8f56043227845b6a49f372169b9023a284611d31
[external/binutils.git] / gold / ChangeLog
1 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
2
3         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
4         Cast current_group_size to unsigned long when reporting error.
5
6 2014-12-10  Jing Yu  <jingyu@google.com>
7
8         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
9         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
10         Update error message.
11         (Target_aarch64::do_relax): Use absolute value of option
12         stub_group_size. Replace local variable with class member
13         stub_group_size_.
14
15 2014-12-04  Alan Modra  <amodra@gmail.com>
16
17         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
18         addend of PLTREL24 reloc when not generating a plt stub.  Make
19         max_branch_offset an "Address".
20         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
21         (Target_powerpc::Relocate::relocate): Likewise.
22
23 2014-12-04  Alan Modra  <amodra@gmail.com>
24
25         PR 17670
26         * symtab.cc (Symbol::set_undefined): Remove assertion.
27         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
28         on symbols defined in discarded sections, instead return false.
29         Rearrange params, update all callers.
30         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
31         branches to syms in discarded sections.
32         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
33         undefined and flag as discarded.
34         (Target_powerpc::Relocate::relocate): Localize variable.
35
36 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
37
38         PR gold/17675
39         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
40         * testsuite/Makefile.in: Regenerated.
41
42 2014-12-03  Alan Modra  <amodra@gmail.com>
43
44         PR 17566
45         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
46         when adding dynamic relocations against section symbols.
47
48 2014-12-01  Dimitry Ivanov <dimitry@google.com>
49
50         * layout.cc (Layout::finish_dynamic_section): When '-z global'
51         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
52         * options.h (General_options): New -z option (global).
53
54 2014-12-01  Cary Coutant  <ccoutant@google.com>
55
56         PR gold/17578
57         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
58         is given.
59         (Layout::create_executable_stack_info): Warn when -z noexecstack is
60         given but some inputs require executable stack.
61
62 2014-11-26  Cary Coutant  <ccoutant@google.com>
63
64         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
65         .debug_str_offsets; strip .debug_gnu_pubnames and
66         .debug_gnu_pubtypes.
67         (lines_only_debug_sections): Strip all four new sections.
68
69 2014-11-26  Jing Yu  <jingyu@google.com>
70
71         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
72         register to be x0 when to relax TLSDESC_LD64_LO12.
73
74 2014-11-26  Alan Modra  <amodra@gmail.com>
75
76         * powerpc.cc (struct Stub_table_owner): New.
77         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
78         unsigned int vector.  Update all references.
79         (powerpc_relobj::set_stub_table): Take an unsigned int param
80         rather than a Stub_table.  Update callers.
81         (Powerpc_relobj::clear_stub_table): New function.
82         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
83         stub_group_size_ vars.
84         (Target_powerpc::new_stub_table): Delete.
85         (max_branch_delta): New function, extracted from..
86         (Target_powerpc::Relocate::relocate): ..here..
87         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
88         status on whether stub created successfully.
89         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
90         default sizing to..
91         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
92         reduce on relax failure.
93         (Target_powerpc::group_sections): Add "no_size_errors" param.
94         Use stub_group_size_.  Set up group info in a temp vector,
95         before building Stub_table vector.  Account for input sections
96         possibly already converted to relaxed sections.
97         (Stub_table::init): Delete.  Merge into..
98         (Stub_table::Stub_table): ..here.
99         (Stub_table::can_reach_stub): New function.
100         (Stub_table::add_plt_call_entry): Add "from" parameter and
101         return true iff stub could be reached.
102         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
103         param too.
104         (Stub_table::clear_stubs): Add "all" param.
105
106 2014-11-26  Alan Modra  <amodra@gmail.com>
107
108         * powerpc.cc (Stub_control::set_output_and_owner): New function.
109         (Target_powerpc::group_sections): Use it.
110
111 2014-11-25  Cary Coutant  <ccoutant@google.com>
112
113         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
114         (Binary_to_elf::write_symbol): Add st_size parameter.
115         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
116
117 2014-11-25  Cary Coutant  <ccoutant@google.com>
118
119         PR gold/17639
120         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
121         (Sized_relobj_file::do_layout): Handle deferred sections properly
122         during GC pass 1. Don't add reloc sections to deferred list twice.
123         * object.h (Sized_relobj_file::is_deferred_layout): New function.
124         (Sized_relobj_file::is_deferred_layout_): New data member.
125
126 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
127
128         PR gold/17619
129         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
130         Check PC-relative offset overflow in PLT entry.
131
132 2014-11-21  Alan Modra  <amodra@gmail.com>
133
134         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
135         for undefined weaks.
136
137 2014-11-20  Alan Modra  <amodra@gmail.com>
138
139         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
140         from --stub-group-size parameter divided by 1024.
141         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
142         template parameter.  Update all uses.
143         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
144         has_stub_value.  Set for long branches.  Don't report overflow for
145         branch to undefined weak symbols.  Print info message on
146         overflowing branch to stub.
147
148 2014-11-20  Alan Modra  <amodra@gmail.com>
149
150         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
151
152 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
153
154         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
155         entry for R_X86_64_GOTPLT64.
156         (Target_x86_64<size>::Relocate::relocate): Update comments for
157         R_X86_64_GOTPLT64.
158
159 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
160
161         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
162         * plugin.h: add lock definition
163
164 2014-10-29  Han Shen  <shenhan@google.com>
165             Jing Yu   <jingyu@google.com>
166
167         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
168         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
169         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
170         Symbol::TLS_REF.
171         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
172         method.
173         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
174         (Target_aarch64::tls_ld_to_le): New method.
175         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
176         for 64bit targets.
177         (Output_data_plt_aarch64::irelative_rel_): New data member.
178         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
179         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
180         (Output_data_plt_aarch64::add_relocation): New method.
181         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
182         offset. Add got_irelative size to got size.
183         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
184         type string with the new typename.
185         (AArch64_relocate_functions::update_adr): Replace parameter x with
186         immed.
187         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
188         (AArch64_relocate_functions::reloc_common): New method.
189         (AArch64_relocate_funcsions::rela_general): Extract common part out
190         into reloc_common method.
191         (AArch64_relocate_functions::rela_general): Likewise.
192         (AArch64_relocate_functions::pcrela_general): Likewise.
193         (AArch64_relocate_functions::adr): New method.
194         (AArch64_relocate_functions::adrp): Calculate immed before calling
195         update_adr.
196         (AArch64_relocate_functions::adrp): Likewise.
197         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
198         comparing x to 0. Calculate immed from ~x when x < 0.
199         (Target_aarch64::optimize_tls_reloc): Add new cases for
200         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
201         TLSLD_MOVW_DTPREL_G0_NC.
202         (Target_aarch64::possible_function_pointer_reloc): Implement this
203         method.
204         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
205         comment.
206         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
207         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
208         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
209         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
210         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
211         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
212         (Target_aarch64::make_plt_entry): Call add_entry with two more
213         parameters.
214         (Target_aarch64::make_local_ifunc_plt_entry): New method.
215         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
216         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
217         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
218         (Target_aarch64::Relocate::relocate_tls): Add cases for
219         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
220         TLSLD_MOVW_DTPREL_G0_NC.
221         * testsuite/icf_safe_so_test.cc: Correct test comment.
222         * testsuite/icf_safe_test.sh: Add AArch64 arch.
223
224 2014-10-22  Alan Modra  <amodra@gmail.com>
225
226         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
227         thread_starter.
228
229 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
230
231         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
232
233 2014-10-17  Cary Coutant  <ccoutant@google.com>
234
235         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
236         Add "typename" keyword.
237
238 2014-10-15  Han Shen  <shenhan@google.com>
239             Jing Yu   <jingyu@google.com>
240
241         Patch for gold aarch64 backend to support relaxation.
242         * aarch64-reloc.def: Change format.
243         * aarch64.cc (class Reloc_stub): New class.
244         (class Stub_table): New class.
245         (class AArch64_relobj): New class.
246         (class AArch64_input_section): New class.
247         (class AArch64_output_section): New class.
248         (Target_aarch64::new_stub_table): New method.
249         (Target_aarch64::new_aarch64_input_section): New method.
250         (Target_aarch64::find_aarch64_input_section): New method.
251         (Target_aarch64::scan_section_for_stubs): New method.
252         (Target_aarch64::scan_reloc_section_for_stubs): New method.
253         (Target_aarch64::relocate_stub): New method.
254         (Target_aarch64::current_target): New method.
255         (Target_aarch64::do_make_elf_object): New method.
256         (Target_aarch64::do_may_relax): New method.
257         (Target_aarch64::do_relax): New method.
258         (Target_aarch64::group_sections): New method.
259         (Target_aarch64::scan_reloc_for_stub): New method.
260         (Target_aarch64::do_make_output_section): New method.
261         (Target_aarch64::stub_tables_): New data member.
262         (Target_aarch64::aarch64_input_section_map_): New data member.
263         (AArch64_relocate_functions::maybe_apply_stub): New method.
264
265 2014-09-30  Cary Coutant  <ccoutant@google.com>
266
267         PR gold/17432
268         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
269
270 2014-09-30  Kito Cheng  <kito@0xlab.org>
271
272         PR gold/13597
273         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
274         hash table before sysv-style hash table.
275
276 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
277
278         * options.h (--pic-executable): Add negative to alias to -no-pie.
279
280 2014-09-26  Cary Coutant  <ccoutant@google.com>
281
282         PR gold/16773
283         * object.cc (Sized_relobj_file): Compute value of section symbols
284         for TLS sections the same as TLS symbols.
285
286 2014-09-25  Cary Coutant  <ccoutant@google.com>
287
288         PR gold/17432
289         * resolve.cc (Symbol_table::resolve): Override common placeholder
290         symbols, but adjust sizes.
291         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
292         symbols to common lists.
293
294 2014-09-24  Alan Modra  <amodra@gmail.com>
295
296         * po/POTFILES.in: Regenerate.
297
298 2014-09-23  Taiju Tsuiki  <tzik@google.com>
299             Cary Coutant  <ccoutant@google.com>
300
301         PR gold/14860
302         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
303         on input_sections_blocker.
304         * layout.cc (Write_sections_task::locks): Unblock
305         input_sections_blocker_.
306         * layout.h (Write_sections_task::Write_sections_task): Add
307         input_sections_blocker.
308         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
309         to DEPENDENCIES.
310         * testsuite/Makefile.in: Regenerate.
311
312 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
313
314         * testsuite/Makefile.am (plugin_test_10): New test.
315         * testsuite/Makefile.in: Regenerate
316         * testsuite/plugin_common_test_2.c (c1): Align to 8.
317         * testsuite/plugin_test_10.sh: New file.
318
319 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
320
321         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
322         * resolve.cc (Symbol_table::resolve): Don't override common symbols
323         during the replacement phase.
324
325 2014-09-17  Han Shen  <shenhan@google.com>
326             Jing Yu  <jingyu@google.com>
327
328         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
329         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
330         * aarch64.cc (Target_aarch64): Add data members
331         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
332         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
333         constructor.
334         (Target_aarch64::do_reloc_symbol_index): New method.
335         (Target_aarch64::do_reloc_addend): New method.
336         (Target_aarch64::add_tlsdesc_info): New method.
337         (Target_aarch64::do_dynsym_value): New method.
338         (Target_aarch64::do_make_data_plt): Add new parameters: got,
339         got_irelative. Pass them to Output_data_plt_aarch64_standard.
340         (Target_aarch64::make_data_plt): Add new parameters: got,
341         got_irelative. Pass them to do_make_data_plt.
342         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
343         (Target_aarch64::Relocate:tls_gd_to_le): New method.
344         (Target_aarch64::Relocate:tls_ie_to_le): New method.
345         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
346         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
347         (Target_aarch64::got_tlsdesc_section): New method.
348         (Target_aarch64::make_local_ifunc_plt_entry): New method.
349         (Target_aarch64::define_tls_base_symbol): New method.
350         (Target_aarch64::reserve_tlsdesc_entries): New method.
351         (Target_aarch64::got_mod_index_entry): New method.
352         (Target_aarch64::rela_tlsdesc_section): New method.
353         (Target_aarch64::rela_irelative_section): New method.
354         (Target_aarch64::Tlsdesc_info): New struct.
355         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
356         relocations and tlsdesc relocations.
357         (Target_aarch64::optimize_tls_reloc): Implement method.
358         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
359         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
360         in constructor.
361         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
362         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
363         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
364         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
365         (Output_data_plt_aarch64::rela_tlsdesc): New method.
366         (Output_data_plt_aarch64::rela_irelative): New method.
367         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
368         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
369         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
370         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
371         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
372         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
373         (Output_data_plt_aarch64_standard): New member variables:
374         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
375         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
376         New parameter: got, got_irelative.
377         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
378         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
379         (Output_data_plt_aarch64::do_write): Replace got_address with
380         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
381         (AArch64_relocate_functions::update_movnz): New method.
382         (AArch64_relocate_functions): Correct format.
383         (AArch64_relocate_functions::movnz): New method.
384         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
385         before the switch. Add new cases to switch.
386         Check ie_to_le relaxation on tlsie relocations. Add code handling
387         tlsgd tlsdesc cases.
388         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
389         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
390         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
391         Call reloc_name_in_error_message to print unsupported reloc.
392         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
393         make_data_plt.
394         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
395         relocs. Fill in some more dynamic tags.
396         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
397         Skip call tls_get_addr when tlsgd is relaxed.
398         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
399         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
400         tlsdesc->ie relaxation.
401
402 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
403
404         * mips.cc (Target_mips_nacl): New class.
405         (Target_selector_mips_nacl): New class.
406         (target_selector_mips32): Rename from target_selector_mips32be and use
407         Target_selector_mips_nacl instead of Target_selector_mips.
408         (target_selector_mips32el): Rename from target_selector_mips32 and use
409         Target_selector_mips_nacl instead of Target_selector_mips.
410         (target_selector_mips64): Rename from target_selector_mips64be and use
411         Target_selector_mips_nacl instead of Target_selector_mips.
412         (target_selector_mips64el): Rename from target_selector_mips64 and use
413         Target_selector_mips_nacl instead of Target_selector_mips.
414         (Target_mips::mips_info): Add const attribute.
415
416 2014-09-02  Cary Coutant  <ccoutant@google.com>
417
418         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
419         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
420         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
421         (Sized_incr_dynobj::do_section_name): Likewise.
422         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
423         (Sized_incr_dynobj::do_section_name): Likewise.
424         * object.h (Object::section_name): Likewise.
425         (Object::do_section_name): Likewise.
426         (Sized_relobj_file::do_section_name): Likewise.
427         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
428         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
429
430 2014-09-02  Cary Coutant  <ccoutant@google.com>
431
432         PR gold/17005
433         * ehframe.cc (Fde::write): Add output_offset parameter.
434         (Cie::write): Likewise.
435         (Eh_frame::set_final_data_size): Account for offset within output
436         section.
437         (Eh_frame::do_sized_write): Likewise.
438         * ehframe.h (Fde::write): Add output_offset parameter.
439         (Cie::write): Likewise.
440         * output.cc (Output_section::Input_section_sort_entry): Remove
441         section_has_name_; add output_section_name parameter. Use
442         output section name for non-input sections.
443         (Output_section::Input_section_sort_entry::section_has_name): Remove.
444         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
445         (Output_section::Input_section_sort_compare): Remove logic for
446         sections without names.
447         (Output_section::Input_section_sort_init_fini_compare): Likewise.
448         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
449         Likewise.
450         (Output_section::Input_section_sort_section_name_compare): Likewise.
451
452 2014-08-29 Han Shen <shenhan@google.com>
453            Jing Yu <jingyu@google.com>
454
455         * aarch64-reloc-property.cc
456         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
457         reference reloc property in the table.
458         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
459         3 other entries.
460         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
461         2 new overloaded methods.
462         (Output_data_got_aarch64::do_write): Add code to write out
463         static relocs.
464         (class Output_data_got_aarch64::Static_reloc): New class to wrap
465         static relocs.
466         (Output_data_got_aarch64::static_relocs): New vector to
467         hold static relocs.
468         (Target_aarch64::TCB_SIZE): New const static memeber.
469         (Target_aarch64::tcb_size): New method.
470         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
471         (Target_aarch64::Relocate::relocate_tls): New method.
472         (Target_aarch64::Scan::local): Add code handling new reloc types.
473         (Target_aarch64::Scan::global): Add code handling new reloc types.
474
475 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
476
477         * options.h (-no-pie): Add option.
478
479 2014-08-08  Jing Yu  <jingyu@google.com>
480             Han Shen  <shenhan@google.com>
481
482         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
483         (DEFFILES): add aarch64-reloc.def.
484         (TARGETSOURCES): Add aarch64-reloc-property.cc.
485         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
486         * Makefile.in: Regenerate.
487         * aarch64-reloc-property.cc: New file.
488         * aarch64-reloc-property.h: New file.
489         * aarch64-reloc.def: New file.
490         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
491         with tab to make the format consistent.
492         (Output_data_got_aarch64::symbol_table_): New method.
493         (Target_aarch64::do_plt_address_for_global): New method.
494         (Target_aarch64::do_plt_address_for_local): New method.
495         (Target_aarch64::do_select_as_default_target): New method.
496         (Target_aarch64::do_make_data_plt): New method.
497         (Target_aarch64::make_data_plt): New method.
498         (Output_data_plt_aarch64::has_irelative_section): New method.
499         (Output_data_plt_aarch64::address_for_global): New method.
500         (Output_data_plt_aarch64::address_for_local): New method.
501         (Output_data_plt_aarch64::irelative_rel_): New parameter.
502         (Output_data_plt_aarch64::add_entry): Implement contents.
503         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
504         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
505         the got_pov entry to plt0.
506         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
507         Implement contents.
508         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
509         (AArch64_howto): New struct.
510         (aarch64_howto[]): New static const array.
511         (AArch64_relocate_functions): New class.
512         (Target_aarch64::Scan::get_reference_flags): Remove method.
513         (Target_aarch64::Scan::local): Implement to support a few relocations.
514         (Target_aarch64::Scan::global): Implement to support a few relocations.
515         (Target_aarch64::make_plt_section): Implement contents.
516         (Target_aarch64::make_plt_entry): Implement contents.
517         (Target_aarch64::do_finalize_sections): Implement contents.
518         (Target_aarch64::Relocate::relocate): Implement a few relocations.
519         (Target_aarch64::relocate_section): Implement contents.
520
521 2014-08-06  Alan Modra  <amodra@gmail.com>
522
523         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
524
525 2014-08-06  Alan Modra  <amodra@gmail.com>
526
527         PR 13227
528         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
529
530 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
531
532         * object.cc (Relobj::is_section_name_included): Add
533         ".rodata.nptl_version" to not garbage collect this section.
534
535 2014-07-08  Cary Coutant  <ccoutant@google.com>
536
537         * expression.cc (struct Expression::Expression_eval_info): Add
538         new fields type_pointer, vis_pointer, and nonvis_pointer.
539         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
540         nonvis_pointer parameters. Adjust all calls.
541         (Symbol_expression::value): Update type, visibility, and nonvis bits
542         in caller.
543         * script.cc (Symbol_assignment::sized_finalize): Update type,
544         visibility, and remaining st_other bits for new symbol.
545         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
546         vis_pointer, and nonvis_pointer parameters.
547         * symtab.h (Symbol::set_type): New method.
548
549         * testsuite/Makefile.am (defsym_test): New test.
550         * testsuite/Makefile.in: Regenerate.
551         * testsuite/defsym_test.c: New file.
552         * testsuite/defsym_test.sh: New file.
553
554 2014-07-08  Cary Coutant  <ccoutant@google.com>
555
556         PR gold/15639
557         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
558         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
559         (Sized_dynobj::base_read_symbols): ...new method.
560         * object.h (Sized_relobj_file::base_read_symbols): New method.
561         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
562         (Sized_relobj_file::base_read_symbols): ...new method.
563         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
564         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
565         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
566
567 2014-07-04  Alan Modra  <amodra@gmail.com>
568
569         * po/POTFILES.in: Regenerate.
570
571 2014-07-02  Jing Yu  <jingyu@google.com>
572
573         * aarch64.cc: New file
574         * Makefile.am (TARGETSOURCES): Add aarch64.cc
575         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
576         * Makefile.in: Regenerate.
577         * configure.tgt: Add entries for aarch64*.
578         * configure.ac:  Likewise.
579         * configure: Likewise.
580
581 2014-06-27  Alan Modra  <amodra@gmail.com>
582
583         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
584
585 2014-06-24  Cary Coutant  <ccoutant@google.com>
586
587         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
588         sections.
589         (Dwo_file::sized_read_unit_index): Likewise.
590
591 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
592
593         * mips.cc: New file.
594         * Makefile.am (TARGETSOURCES): Add mips.cc
595         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
596         * configure.tgt: Add entries for mips*.
597         * configure.ac: Likewise.
598         * Makefile.in: Regenerate.
599         * configure: Likewise.
600
601 2014-06-09  Cary Coutant  <ccoutant@google.com>
602
603         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
604         unit_length is within section bounds.
605
606 2014-06-09  Cary Coutant  <ccoutant@google.com>
607
608         PR gold/16980
609         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
610         map.
611
612 2014-06-07  Alan Modra  <amodra@gmail.com>
613
614         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
615
616 2014-06-06  Cary Coutant  <ccoutant@google.com>
617
618         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
619         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
620         (Dwarf_pubnames_table::read_header): Likewise.
621         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
622         .debug_gnu_pubtypes.
623
624 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
625
626         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
627         * Makefile.in, configure: Regenerate.
628
629 2014-06-03  Alan Modra  <amodra@gmail.com>
630
631         * powerpc.cc (addis_12_2): Define.
632         (Stub_table::do_write): Support fusion on ELFv2 stubs.
633
634 2014-06-03  Alan Modra  <amodra@gmail.com>
635
636         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
637         st_other output.
638
639 2014-06-02  Alan Modra  <amodra@gmail.com>
640
641         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
642         Only ignore relocs on ELFv1.
643         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
644
645 2014-05-30  Cary Coutant  <ccoutant@google.com>
646
647         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
648         * testsuite/Makefile.in: Regenerate.
649         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
650
651 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
652
653         PR gold/16945
654         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
655         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
656
657 2014-05-15  Alan Modra  <amodra@gmail.com>
658
659         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
660         Compare FDE contents with DW_CFA_nop rather than 0.
661
662 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
663
664         * symtab.h (may_need_copy_reloc): Remove check for position independent
665         code.
666         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
667         position independence before pc absolute may_need_copy_reloc call.
668         Add check for executable output befor pc relative may_need_copy_reloc
669         call.
670         * i386.cc: Ditto.
671         * arm.cc: Ditto.
672         * sparc.cc: Ditto.
673         * tilegx.cc: Ditto.
674         * powerpc.cc: Add check for no position independence before
675         may_need_copy_reloc calls.
676         * testsuite/pie_copyrelocs_test.cc: New file.
677         * testsuite/pie_copyrelocs_shared_test.cc: New file.
678         * Makefile.am (pie_copyrelocs_test): New test.
679         * Makefile.in: Regenerate.
680
681 2014-05-08  Martin Liška  <mliska@suse.cz>
682
683         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
684
685 2014-05-06  Cary Coutant  <ccoutant@google.com>
686
687         PR gold/16900
688         * i386.cc (Output_data_got_plt_i386): New class.
689         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
690         parameter. Change all callers.
691         (Output_data_plt_i386::layout_): Remove.
692         (Output_data_plt_i386::got_plt_): Change type.
693         (Target_i386::got_plt_): Change type. Change all references.
694         (Target_i386::got_section): Create instance of new class.
695         (Output_data_got_plt_i386::do_write): New function.
696         * x86_64.cc (Output_data_got_plt_x86_64): New class.
697         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
698         parameter. Change all callers.
699         (Output_data_plt_x86_64::layout_): Remove.
700         (Output_data_plt_x86_64::got_plt_): Change type.
701         (Target_x86_64::got_plt_): Change type. Change all references.
702         (Target_x86_64::got_section): Create instance of new class.
703         (Output_data_got_plt_x86_64::do_write): New function.
704         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
705         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
706         class.
707
708 2014-05-05  Cary Coutant  <ccoutant@google.com>
709
710         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
711         if we have pubnames/pubtypes.
712
713 2014-05-02  Cary Coutant  <ccoutant@google.com>
714
715         * defstd.cc (in_segment): Define __ehdr_start here...
716         * layout.cc (Layout::finalize): ...Instead of here.  Set the
717         output segment when known.
718         * resolve.cc (Symbol::override_base_with_special): Remember
719         the original binding.
720         * symtab.cc (Symbol::set_output_segment): New function.
721         (Symbol::set_undefined): New function.
722         * symtab.h (Symbol::is_weak_undefined): Check original undef
723         binding.
724         (Symbol::is_strong_undefined): New function.
725         (Symbol::set_output_segment): New function.
726         (Symbol::set_undefined): New function.
727         * target-reloc.h (is_strong_undefined): Remove.
728         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
729         Check for hidden undefs.
730         (relocate_section): Call Symbol::is_strong_undefined.
731
732         * testsuite/Makefile.am (ehdr_start_test_1)
733         (ehdr_start_test_2, ehdr_start_test_3)
734         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
735         * testsuite/Makefile.in: Regenerate.
736         * testsuite/ehdr_start_def.cc: New source file.
737         * testsuite/ehdr_start_test.cc: New source file.
738         * testsuite/ehdr_start_test.t: New linker script.
739         * testsuite/ehdr_start_test_4.sh: New shell script.
740
741 2014-04-23  Cary Coutant  <ccoutant@google.com>
742
743         PR gold/16870
744         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
745
746 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
747
748         * layout.cc (Layout::include_section): Allow a target to decide
749         whether to include a section.
750         * target.h (Target::should_include_section): New function.
751         (Target::do_should_include_section): New function.
752
753 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
754
755         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
756         inline into ...
757         (Copy_relocs::emit): ... here.
758         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
759         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
760         (Copy_reloc_entry::entries_): Change from private to protected.
761
762 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
763
764         * icf.cc (get_section_contents): Replace copies of reloc
765         vectors with const references.
766
767 2014-04-02  Cary Coutant  <ccoutant@google.com>
768
769         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
770         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
771         * configure: Regenerate.
772         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
773         -fno-use-linker-plugin.
774         (LINK1, CXXLINK1): Add it to the link command.
775         * testsuite/Makefile.in: Regenerate.
776
777 2014-03-12  Alan Modra  <amodra@gmail.com>
778
779         * Makefile.in: Regenerate.
780
781 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
782
783         * symtab.h (Symbol::set_nonvis): New function.
784
785 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
786
787         * symtab.cc (Sized_symbol<32>::init_output_data):
788         Instantiate the template.
789         (Sized_symbol<64>::init_output_data): Likewise.
790
791 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
792
793         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
794         adjust dynamic symbol value.
795         * target.h (Target::adjust_dyn_symbol): New function.
796         (Target::do_adjust_dyn_symbol): New function.
797
798 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
799
800         * output.cc (Output_data_dynamic::Dynamic_entry::write):
801         Get the value of DYNAMIC_CUSTOM dynamic entry.
802         * output.h (Output_data_dynamic::add_custom): New function.
803         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
804         dynamic entry.
805         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
806         * target.h (Target::dynamic_tag_custom_value): New function.
807         (Target::do_dynamic_tag_custom_value): New function.
808
809 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
810
811         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
812         dynsym indexes.
813         * target.h (Target::has_custom_set_dynsym_indexes): New function.
814         (Target::do_has_custom_set_dynsym_indexes): New function.
815         (Target::set_dynsym_indexes): New function.
816         (Target::do_set_dynsym_indexes): New function.
817
818 2014-03-07  Alan Modra  <amodra@gmail.com>
819
820         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
821         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
822         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
823         (Powerpc_relocate_functions::has_overflow_bitfield,
824         overflowed): Use the above.
825         (Target_powerpc::Relocate::relocate): Correct overflow checking
826         for a number of relocations.  Modify overflow test for 16-bit
827         fields in instructions to signed/unsigned according to whether
828         the field takes a signed or unsigned value.
829
830 2014-03-05  Alan Modra  <amodra@gmail.com>
831
832         Update copyright years.
833
834 2014-03-05  Alan Modra  <amodra@gmail.com>
835
836         * powerpc.cc (Target_powerpc::Scan::local, global): Support
837         R_PPC64_ADDR64_LOCAL.
838         (Target_powerpc::Relocate::relocate): Likewise.
839
840 2014-03-03  Alan Modra  <amodra@gmail.com>
841
842         * dwp.cc (print_version): Update copyright year to current.
843
844 2014-02-10  Alan Modra  <amodra@gmail.com>
845
846         * po/gold.pot: Regenerate.
847
848 2014-02-06  Cary Coutant  <ccoutant@google.com>
849
850         Fix problem where -u is ignored when a weak undef is seen.
851
852         * archive.cc (Library_base::should_include_member): Reorder
853         code to check for -u option if a weak undef has already been seen.
854         * testsuite/Makefile.am (weak_undef_test_2): New test case.
855         * testsuite/Makefile.in: Regenerate.
856         * testsuite/weak_undef_file3.cc: New file.
857         * testsuite/weak_undef_file4.cc: New file.
858         * testsuite/weak_undef_test_2.cc: New file.
859
860 2014-02-05  Cary Coutant  <ccoutant@google.com>
861
862         Fix issues with gold undefined symbol diagnostics.
863
864         PR binutils/15435
865         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
866         check to here.
867         * target-reloc.h (is_strong_undefined): New function.
868         (relocate_section): Move undef vtable symbol check from here.
869         Check for is_strong_undefined.
870
871 2014-02-05  Cary Coutant  <ccoutant@google.com>
872
873         Fix problems with the --dynamic-list option.
874
875         PR gold/13577
876         * options.cc (General_options::parse_dynamic_list):
877         Set have_dynamic_list_.
878         (General_options::General_options): Initialize have_dynamic_list_.
879         (General_options::finalize): Turn off -Bsymbolic and
880         -Bsymbolic-functions if --dynamic-list provided.
881         * options.h (General_options::have_dynamic_list): New function.
882         (General_options::have_dynamic_list_): New data member.
883         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
884         correctly.
885
886         PR gold/16530
887         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
888         in --dynamic-list, mark it.
889
890         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
891         (dynamic_list_2): New test case.
892         * testsuite/Makefile.in: Regenerate.
893         * testsuite/dynamic_list_2.cc: New file.
894         * testsuite/dynamic_list_2.t: New file.
895         * testsuite/dynamic_list_lib1.cc: New file.
896         * testsuite/dynamic_list_lib2.cc: New file.
897         * testsuite/gc_dynamic_list_test.c: New file.
898         * testsuite/gc_dynamic_list_test.sh: New file.
899         * testsuite/gc_dynamic_list_test.t: New file.
900
901 2014-01-28  Cary Coutant  <ccoutant@google.com>
902
903         Add .gdb_index version 7 support.
904
905         * gold/dwarf_reader.cc: include <utility> (for make_pair).
906         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
907         debug sections.
908         (Dwarf_ranges_table::read_ranges_table): Likewise.
909         (Dwarf_pubnames_table::read_section): Check for GNU-style
910         sections, and for compressed debug sections.
911         (Dwarf_pubnames_table::read_header): Compute end address of table.
912         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
913         for end of list by offset, not by offset == 0.
914         (Dwarf_info_reader::do_read_string_table): Check for compressed
915         debug sections.
916         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
917         Initialize new data members.
918         (Dwarf_pubnames_table::next_name): return flag_byte.
919         (Dwarf_pubnames_table::end_of_table_): New data member.
920         (Dwarf_pubnames_table::is_gnu_style_): New data member.
921         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
922         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
923         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
924         read skeleton type unit DIEs.
925         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
926         (Gdb_index::do_write): Write flag_byte.
927         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
928         (Gdb_index::Cu_vector): Store flags along with cu indexes.
929         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
930         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
931
932 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
933
934         * version.cc (print_version): Update copyright year to 2014.
935
936 2013-12-19  Dimitry Andric  <dimitry@andric.com>
937
938         * stringpool.cc (Stringpool_template::reserve): Add
939         HAVE_UNORDERED_MAP case.
940         * stringpool.cc (Stringpool_template::print_stats): Likewise.
941
942 2013-12-18  Cary Coutant  <ccoutant@google.com>
943
944         * configure.ac: Check for <unordered_set> and <unordered_map>.
945         * config.in: Regenerate.
946         * configure: Regenerate.
947         * system.h: Use <unordered_set> and <unordered_map> if available.
948
949 2013-12-10  Roland McGrath  <mcgrathr@google.com>
950
951         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
952         with $(INSTALL_PROGRAM_ENV).
953         * Makefile.in: Regenerate.
954
955 2013-11-22  Cary Coutant  <ccoutant@google.com>
956
957         * configure.ac: Add check for which library is needed for
958         dlopen.
959         * configure: Regenerate.
960
961 2013-11-22  Cary Coutant  <ccoutant@google.com>
962
963         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
964         assembler.
965         * testsuite/Makefile.in: Regenerate.
966
967 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
968
969         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
970         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
971         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
972         (Target_x86_64<size>::Scan::local): Likewise.
973         (Target_x86_64<size>::Scan::global): Likewise.
974         (Target_x86_64<size>::Relocate::relocate): Likewise.
975         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
976         Likewise.
977         (Target_x86_64<size>::Scan::check_non_pic(): Handle
978         R_X86_64_PC32_BND.
979
980         * testsuite/Makefile.am (check_PROGRAMS): Add
981         exception_x86_64_bnd_test.
982         (exception_x86_64_bnd_test_SOURCES): New macro.
983         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
984         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
985         (exception_x86_64_bnd_test_LDADD): Likewise.
986         (exception_x86_64_bnd_1.o): New rule.
987         (exception_x86_64_bnd_2.o): Likewise.
988         * testsuite/Makefile.in: Regenerated.
989
990 2013-11-15  Alan Modra  <amodra@gmail.com>
991
992         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
993         accessor.
994         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
995         Only call ppc64_local_entry_offset for 64-bit.  Restrict
996         symval_for_branch lookup to ELFv1.
997         (Stub_table::add_plt_call_entry): Use unsigned int off.
998         (Output_data_glink::Address, invalid_address): New.
999         (Output_data_glink::add_eh_frame): Move out of line.  Add
1000         support for ELFv2.
1001         (Output_data_glink::add_global_entry, find_global_entry,
1002         global_entry_address): New functions.
1003         (Output_data_glink::global_entry_stubs_, end_branch_table_,
1004         ge_size): New variables.
1005         (Output_data_glink::set_final_data_size): Add global entry
1006         stub sizing.
1007         (Output_data_glink::do_write): Write global entry stubs.
1008         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
1009         parameter.  Return true for ELFv2.  Adjust callers.
1010         (Target_powerpc::Scan::local, global): Restrict opd lookup to
1011         ELFv1.  Similarly for ifunc and dynamic relocation processing
1012         specific to ELFv1.  Recognize that symbols are defined on
1013         their plt entries for ELFv2.
1014         (Target_powerpc::symval_for_branch): Assert if called for
1015         ELFv2 or ppc32.
1016         (Target_powerpc::Relocate::relocate): Use global entry plt
1017         stub for symbol value if such exists on ELFv2.
1018         (Target_powerpc::Relocate::relocate): Don't call
1019         symval_for_branch when ELFv2.  Do adjust for local entry
1020         offset when ELFv2.
1021         (Target_powerpc::do_dynsym_value): Set symbols to global entry
1022         plt stub for ELFv2.
1023         (Target_powerpc::do_plt_address_for_global): Similarly.
1024
1025 2013-11-14  Cary Coutant  <ccoutant@google.com>
1026
1027         Revert patch -- this did not fix the problem, and there is
1028         no race there.
1029
1030         2013-11-14  Cary Coutant  <ccoutant@google.com>
1031
1032             PR gold/14860
1033             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1034             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1035             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1036             updating fde_offsets_.
1037             (Eh_frame_hdr::lock_): New data member.
1038
1039 2013-11-14  Cary Coutant  <ccoutant@google.com>
1040
1041         * dwp.cc (Dwo_file_entry): New type.
1042         (File_list): Use Dwo_file_entry.
1043         (Dwo_file::verify): New function.
1044         (Dwo_file::verify_dwo_list): New function.
1045         (Dwo_file::sized_verify_dwo_list): New function.
1046         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
1047         list.
1048         (Dwp_options): New enum type.
1049         (dwp_options): Add --verify-only.
1050         (usage): Likewise.
1051         (main): Likewise.
1052         * dwp.h (gold_info): Add declaration.
1053
1054 2013-11-14  Cary Coutant  <ccoutant@google.com>
1055
1056         PR gold/14860
1057         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
1058         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
1059         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
1060         updating fde_offsets_.
1061         (Eh_frame_hdr::lock_): New data member.
1062
1063 2013-11-06  Cary Coutant  <ccoutant@google.com>
1064
1065         PR gold/15758
1066         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
1067         before reloc sections.
1068
1069 2013-11-04  Alan Modra  <amodra@gmail.com>
1070
1071         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
1072         (Symbol::needs_dynamic_reloc): Test new flag.
1073         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
1074         (Target_powerpc::Scan::get_reference_flags): Add target param.
1075         Return FUNC_DESC_ABI for 64-bit ELFv1.
1076         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
1077         call.
1078         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
1079         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
1080
1081 2013-10-31  Cary Coutant  <ccoutant@google.com>
1082
1083         Restore support for dwp v2 DWARF package file format.
1084
1085         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1086         tu_length parameter.  Adjust all callers.
1087         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1088         * dwp.cc: Include dwarf.h.
1089         (Section_bounds): New struct type.
1090         (Unit_set): New struct type.
1091         (Dwo_file::Dwo_file): Initialize new data member.
1092         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1093         Combine and rename to...
1094         (Dwo_file::read_unit_index): ...this.
1095         (Dwo_file::sized_read_compunit_index)
1096         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1097         (Dwo_file::sized_read_unit_index): ...this.
1098         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1099         parameters; add section_id parameter.
1100         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1101         (Dwo_file::add_unit_set): ...this.
1102         (Dwo_file::shndx_map_): Remove.
1103         (Dwo_file::sect_offsets_): New data member.
1104         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1105         (Dwp_output_file::add_section): Rename to...
1106         (Dwp_output_file::add_contribution): ...this.
1107         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1108         (Dwp_output_file::add_tu_set): Likewise.
1109         (Dwp_output_file::Contribution): New type.
1110         (Dwp_output_file::Section::contributions): New data member.
1111         (Dwp_output_file::Cu_or_tu_set): Remove.
1112         (Dwp_output_file::Section::Section): New ctor.
1113         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1114         (Dwp_output_file::Dwp_index::Section_table): New type.
1115         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1116         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1117         parameter.
1118         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1119         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1120         (Dwp_output_file::Dwp_index::section_table): New member function.
1121         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1122         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1123         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1124         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1125         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1126         (Dwp_output_file::Dwp_index::section_table_): New data member.
1127         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1128         (Dwp_output_file::add_output_section): New member function.
1129         (Dwp_output_file::write_new_section): New member function.
1130         (Dwp_output_file::write_contributions): New member function.
1131         (Dwp_output_file::section_id_map_): New data member.
1132         (class Dwo_id_info_reader): Remove.
1133         (class Unit_reader): New class.
1134         (get_dwarf_section_name): New function.
1135         (Dwo_file::read_executable): Adjust initializations of class data.
1136         (Dwo_file::read): Add support for v2 package file format.
1137         (Dwo_file::read_unit_index): Likewise.
1138         (Dwo_file::sized_read_unit_index): Likewise.
1139         (Dwo_file::copy_section): Likewise.
1140         (Dwo_file::add_unit_set): Likewise.
1141         (Dwp_output_file::add_output_section): Likewise.
1142         (Dwp_output_file::add_contribution): Likewise.
1143         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1144         for empty slot.
1145         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1146         file format.
1147         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1148         slot.
1149         (Dwp_output_file::initialize): Remove unused function.
1150         (Dwp_output_file::finalize): Add support for v2 package file format.
1151         (Dwp_output_file::write_index): Likewise.
1152         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1153         function prototype.
1154
1155 2013-10-31  Cary Coutant  <ccoutant@google.com>
1156
1157         * configure.ac: Fix check for -fmerge-constants.
1158         * configure.ac: Regenerate.
1159
1160 2013-10-30  Roland McGrath  <mcgrathr@google.com>
1161
1162         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1163         Correct 9-byte nop sequence to match what the assembler generates.
1164
1165 2013-10-30  Alan Modra  <amodra@gmail.com>
1166
1167         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1168         ppc64_local_entry_offset, ppc64_local_entry_offset,
1169         do_read_symbols): New functions.
1170         (Powerpc_relobj::e_flags_, st_other_): New vars.
1171         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1172         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1173         (Powerpc_relobj::e_flags_): New var.
1174         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1175         and adjust for ELFv2.
1176         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1177         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1178         (Powerpc_dynobj::do_find_special_sections): Likewise.
1179         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1180         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1181         to ELFv2 local entry.
1182         (Target_powerpc::do_relax): No thread safe barriers needed for
1183         ELFv2.
1184         (Output_data_plt_powerpc::initial_plt_entry_size_,
1185         plt_entry_size): Delete.  Replace all uses with
1186         first_plt_entry_offset() and plt_entry_size().
1187         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1188         reserved_size parm.  Update callers.
1189         (Output_data_plt_powerpc::entry_count): Update.
1190         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1191         and use Target_powerpc::first_plt_entry_offset().
1192         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1193         rename to plt_entry_size.
1194         (Output_data_plt_powerpc::add_ifunc_entry,
1195         add_local_ifunc_entry): Adjust reloc for ELFv2.
1196         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1197         (glink_eh_frame_fde_64v2): New.
1198         (Stub_table::plt_call_size): Support ELFv2 sizing.
1199         (Output_data_glink::add_eh_frame): Use the new FDE.
1200         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1201         (Stub_table::do_write): Write ELFv2 stubs and glink.
1202         (Target_powerpc::Relocate::relocate): Replaces nop after call
1203         with ld 2,24(1) and adjust local offset destination for ELFv2.
1204
1205 2013-10-30  Alan Modra  <amodra@gmail.com>
1206
1207         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1208         (Target_powerpc::Scan::global, local): Likewise.
1209         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1210         on all ppc64 @h and @ha relocs.
1211
1212 2013-10-14  Alan Modra  <amodra@gmail.com>
1213
1214         * output.h (Output_data_got::add_constant): Tidy.
1215         (Output_data_got::add_constant_pair): New function.
1216         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1217         methods used so as to first call reserve_ent().
1218
1219 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1220
1221         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1222         add_got_entry and add_got_entry_pair.
1223
1224         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1225         (HAVE_PUBNAMES): Likewise.
1226         * configure: Regenerate.
1227
1228         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1229         * testsuite/Makefile.in: Regenerate.
1230
1231         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1232         Remove const from declaration.
1233         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1234         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1235         * output.h (Output_file_header): Remove const from member target_
1236         and corresponding constructor argument.
1237         * output.cc (Output_file_header::Output_file_header): Update prototype.
1238         (Output_file_header::do_sized_write): Use this->target_ in place
1239         of parameters()->target().
1240
1241         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1242
1243         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1244         * configure: Regenerate.
1245         * Makefile.in: Regenerate.
1246         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1247         * testsuite/merge_string_literals_2.c: Likewise.
1248         * testsuite/Makefile.am
1249         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1250         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1251         literal -fmerge-constants.
1252         * testsuite/Makefile.in: Regenerate.
1253
1254         * i386.cc (Target_i386): Remove unused member dynbss_.
1255         * arm.cc (Target_arm): Likewise.
1256         * powerpc.cc (Target_powerpc): Likewise.
1257         * sparc.cc (Target_sparc): Likewise.
1258         * tilegx.cc (Target_tilegx): Likewise.
1259         * x86_64.cc (Target_x86_64): Likewise.
1260         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1261         type_signature_, type_offset_.
1262         * plugin.h (Plugin_hook): Remove unused member layout_.
1263         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1264         mapfile_.
1265         (Read_member): Remove unused members input_objects_, symtab_,
1266         mapfile_, layout_.
1267         (Check_library): Remove unused member symtab_.
1268         * archive.h (Lib_group): Remove unused member lib_.
1269         * archive.cc (Lib_group::Lib_group): Update initializer.
1270         * incremental.h (Incremental_binary): Remove unused member target_.
1271         (Incremental_script_entry): Removed unused member script_.
1272         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1273         * icf.h (Icf): Remove unused member num_tracked_relocs.
1274
1275         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1276         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1277         its only use.
1278         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1279
1280         * archive.h: Use struct rather than class for forward declaration
1281         of Read_symbols_data.
1282
1283 2013-10-07  Cary Coutant  <ccoutant@google.com>
1284
1285         PR gold/16010
1286         * testsuite/Makefile.am (icf_test): Fix dependencies.
1287         (icf_safe_test): Likewise.
1288         (icf_safe_so_test): Likewise.
1289         (large_symbol_alignment): Add empty _LDADD rule.
1290         * testsuite/Makefile.in: Regenerate.
1291
1292 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1293
1294         PR gold/15927
1295         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1296         relocation for R_X86_64_32 on x32.
1297
1298 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1299
1300         * output.cc (Output_segment::set_section_addresses): Take new
1301         Target* argument.  If target->isolate_execinstr() and the segment
1302         is executable and starts at a target->abi_pagesize() boundary,
1303         pad its end out to a target->abi_pagesize() boundary with code fill.
1304         * output.h (Output_segment::set_section_addresses): Update decl.
1305         * layout.h (Layout::check_output_data_for_reset_values): Take new
1306         argument RELAX_OUTPUTS.
1307         (Layout): New member relax_output_list_.
1308         (Layout::add_relax_output): New method.
1309         * layout.cc (Layout::Layout): Update constructor.
1310         (Layout::reset_relax_output): New method.
1311         (Layout::clean_up_after_relaxation): Call it.
1312         (Layout::prepare_for_relaxation): Update caller.
1313         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1314         Call reset_relax_output before re-processing segments for
1315         isolate_execinstr case.
1316         (Layout::write_data): Handle relax_output_list_.
1317         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1318         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1319
1320 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1321
1322         PR binutils/15834
1323         * object.h: Fix typos.
1324
1325 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1326
1327         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1328         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1329
1330 2013-08-07  Cary Coutant  <ccoutant@google.com>
1331
1332         Revert support for v2 DWP files:
1333
1334         2013-03-01  Cary Coutant  <ccoutant@google.com>
1335
1336             Add dwp support for v2 DWARF package file format.
1337             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1338             tu_length parameter.  Adjust all callers.
1339             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1340             * dwp.cc: Include dwarf.h.
1341             (Section_bounds): New struct type.
1342             (Unit_set): New struct type.
1343             (Dwo_file::Dwo_file): Initialize new data member.
1344             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1345             Combine and rename to...
1346             (Dwo_file::read_unit_index): ...this.
1347             (Dwo_file::sized_read_compunit_index)
1348             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1349             (Dwo_file::sized_read_unit_index): ...this.
1350             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1351             parameters; add section_id parameter.
1352             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1353             (Dwo_file::add_unit_set): ...this.
1354             (Dwo_file::shndx_map_): Remove.
1355             (Dwo_file::sect_offsets_): New data member.
1356             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1357             (Dwp_output_file::add_section): Rename to...
1358             (Dwp_output_file::add_contribution): ...this.
1359             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1360             (Dwp_output_file::add_tu_set): Likewise.
1361             (Dwp_output_file::Contribution): New type.
1362             (Dwp_output_file::Section::contributions): New data member.
1363             (Dwp_output_file::Cu_or_tu_set): Remove.
1364             (Dwp_output_file::Section::Section): New ctor.
1365             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1366             (Dwp_output_file::Dwp_index::Section_table): New type.
1367             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1368             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1369             parameter.
1370             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1371             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1372             (Dwp_output_file::Dwp_index::section_table): New member function.
1373             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1374             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1375             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1376             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1377             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1378             (Dwp_output_file::Dwp_index::section_table_): New data member.
1379             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1380             (Dwp_output_file::add_output_section): New member function.
1381             (Dwp_output_file::write_new_section): New member function.
1382             (Dwp_output_file::write_contributions): New member function.
1383             (Dwp_output_file::section_id_map_): New data member.
1384             (class Dwo_id_info_reader): Remove.
1385             (class Unit_reader): New class.
1386             (get_dwarf_section_name): New function.
1387             (Dwo_file::read_executable): Adjust initializations of class data.
1388             (Dwo_file::read): Add support for v2 package file format.
1389             (Dwo_file::read_unit_index): Likewise.
1390             (Dwo_file::sized_read_unit_index): Likewise.
1391             (Dwo_file::copy_section): Likewise.
1392             (Dwo_file::add_unit_set): Likewise.
1393             (Dwp_output_file::add_output_section): Likewise.
1394             (Dwp_output_file::add_contribution): Likewise.
1395             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1396             for empty slot.
1397             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1398             file format.
1399             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1400             slot.
1401             (Dwp_output_file::initialize): Remove unused function.
1402             (Dwp_output_file::finalize): Add support for v2 package file format.
1403             (Dwp_output_file::write_index): Likewise.
1404             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1405             function prototype.
1406
1407 2013-07-31  Cary Coutant  <ccoutant@google.com>
1408
1409         * object.cc (Sized_relobj::do_output_section_address): New function.
1410         (Sized_relobj): Instantiate explicitly.
1411         * object.h (Object::output_section_address): New function.
1412         (Object::do_output_section_address): New function.
1413         (Sized_relobj::do_output_section_address): New function.
1414         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1415
1416 2013-07-30  Cary Coutant  <ccoutant@google.com>
1417             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1418
1419         * parameters.cc (Parameters::entry): Return target-specific entry
1420         symbol name.
1421         * target.h (Target::entry_symbol_name): New function.
1422         (Target_info::entry_symbol_name): New data member.
1423
1424         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1425         * i386.cc (Target_i386::i386_info): Likewise.
1426         (Target_i386_nacl::i386_nacl_info): Likewise.
1427         * sparc.cc (Target_sparc::sparc_info): Likewise.
1428         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1429         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1430         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1431         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1432
1433 2013-07-22  Sterling Augustine  <saugustine@google.com>
1434
1435         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1436         Convert parameter shndx to local variable. Add parameters symtab
1437         and symtab_size.  Scan over section names.  Find relocation
1438         section corresponding to current section.  Create and initialize
1439         reloc_mapper_ and reloc_type_.
1440         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1441         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1442         cu_offset_.
1443         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1444         Initialize new fields unit_length_ and cu_offset_.
1445         (Dwarf_pubnames_table::read_section): Update prototype.
1446         (Dwarf_pubnames_table::cu_offset): New member function.
1447         (Dwarf_pubnames_table::subsection_size): Likewise.
1448         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1449         New fields.
1450         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1451         member functions public.
1452         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1453         Update comment.  Rework logic.  Move repeated parts to...
1454         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1455         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1456         pubtypes_table_, and stmt_list_offset.
1457         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1458         Gdb_index::find_pubtype_offset,
1459         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1460         (Gdb_index::pubnames_read): Update prototype and rework logic.
1461         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1462         Forward declare.
1463         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1464         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1465         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1466         Gdb_index::map_pubtable_to_dies):
1467         Declare functions.
1468         (Gdb_index::pubnames_read): Update declaration.
1469         (Gdb_index::Pubname_offset_map): New type.
1470         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1471         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1472         Gdb_index::stmt_list_offset): Declare.
1473         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1474         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1475         Gdb_index::pubtypes_offset_): Remove.
1476
1477 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1478
1479         * options.h (General_options): Add -Trodata-segment option.
1480         * parameters.cc (Parameters::check_rodata_segment): New function.
1481         (Parameters::set_target_once): Call it.
1482         * parameters.h (Parameters): Declare it (private member function).
1483         * layout.cc (load_seg_unusable_for_headers): New function, broken
1484         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1485         then validate rodata segment rather than text segment.
1486         (relaxation_loop_body): Call that.
1487         (is_text_segment): New function.  Don't admit a non-executable
1488         segment if TARGET->isolate_execinstr().
1489         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1490
1491 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1492
1493         PR gold/15070
1494         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1495         * nacl.h (Sniff_file::View::View): Request aligned view.
1496
1497 2013-07-11  Cary Coutant  <ccoutant@google.com>
1498
1499         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1500         correct BRLT entry size.
1501
1502 2013-07-03  Alan Modra  <amodra@gmail.com>
1503
1504         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1505         comment.
1506
1507 2013-07-01  Cary Coutant  <ccoutant@google.com>
1508
1509         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1510         reloc_type_.
1511         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1512         (Dwarf_ranges_table::lookup_reloc): New function.
1513         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1514         reloc_type_.
1515         (Dwarf_ranges_table::lookup_reloc): New function.
1516         (Dwarf_ranges_table::reloc_type_): New data member.
1517
1518 2013-06-27  Jing Yu  <jingyu@google.com>
1519
1520         PR gold/15662
1521         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1522         function.
1523         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1524         (Target_powerpc::do_relax): Call the above.
1525
1526 2013-06-27  Cary Coutant  <ccoutant@google.com>
1527
1528         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1529         on garbage collected .opd section.
1530
1531 2013-06-27  Alan Modra  <amodra@gmail.com>
1532
1533         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1534         is non-zero.
1535         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1536         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1537
1538 2013-06-14  Cary Coutant  <ccoutant@google.com>
1539
1540         * resolve.cc (Symbol::override_base): Don't override st_type
1541         from plugin placeholder symbols.
1542         (Symbol_table::resolve): Likewise.
1543         (Symbol_table::should_override): Don't complain about TLS mismatch
1544         if the TO symbol is a plugin placeholder.
1545         * testsuite/Makefile.am (plugin_test_tls): New test.
1546         * testsuite/Makefile.in: Regenerate.
1547         * testsuite/plugin_test_tls.sh: New test script.
1548         * testsuite/two_file_test_2_tls.cc: New test source.
1549         * testsuite/two_file_test_tls.cc: New test source.
1550
1551 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1552
1553         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1554         the maximum segment alignment is larger than the page size.
1555         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1556         correctly aligns the symbols with large alignemnt.
1557         * testsuite/Makefile.in: Regenerate.
1558         * testsuite/large_symbol_alignment.cc: New file.
1559
1560 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1561             Sriraman Tallam  <tmsriram@google.com>
1562
1563         * options.h (sort_section): New option.
1564         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1565         Rename from Input_section_sort_section_name_special_ordering_compare.
1566         (Input_section_sort_section_name_compare): New struct.
1567         * output.cc (Output_section::Input_section_sort_section_name_compare::
1568         operator()): New function.
1569         (Output_section::sort_attached_input_sections): Use new sort function
1570         for .text if --sort-section=name is specified.
1571         * layout.cc (Layout::make_output_section):
1572         Add sorting by name when --sort-section=name is specified.
1573         * testsuite/Makefile.am (text_section_grouping): Test option
1574         --sort-section=name.
1575         * testsuite/Makefile.in: Regenerate.
1576         * testsuite/section_sorting_name.cc: New file.
1577         * testsuite/section_sorting_name.sh: New file.
1578
1579 2013-05-21  Cary Coutant  <ccoutant@google.com>
1580
1581         * symtab.h (Symbol::is_cxx_vtable): New function.
1582         * target-reloc.h (relocate_section): Check for vtable symbol.
1583         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1584         * testsuite/Makefile.in: Regenerate.
1585         * testsuite/missing_key_func.cc: New test source.
1586         * testsuite/missing_key_func.sh: New test script.
1587
1588 2013-05-21  Cary Coutant  <ccoutant@google.com>
1589
1590         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1591         type of enclosing symbol.
1592         (Relocate_info::location): Check symbol type when describing symbol.
1593         * object.h (Symbol_location_info): Remove unused line_number;
1594         add enclosing_symbol_type.
1595         * testsuite/debug_msg.sh: Adjust expected output.
1596
1597 2013-05-13  Cary Coutant  <ccoutant@google.com>
1598
1599         * configure.ac: Export DEFAULT_TARGET.
1600         * configure: Regenerate.
1601         * Makefile.in: Regenerate.
1602         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1603         * testsuite/Makefile.in: Regenerate.
1604         * testsuite/debug_msg.sh: Delete duplicate tests.
1605         Don't check undef_int error message match for powerpc where the
1606         source file and line number aren't available.
1607
1608 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1609
1610         * options.h (General_options): Add --rosegment-gap option.
1611         * options.cc (finalize): --rosegment-gap implies --rosegment.
1612         * layout.cc (set_segment_offsets): Let user option override
1613         target->rosegment_gap().
1614
1615 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1616
1617         * options.h (General_options): Remove leading space from help
1618         messages for -nostdlib and --rosegment.
1619
1620 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1621
1622         PR ld/15365
1623         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1624
1625 2013-05-03  Alan Modra  <amodra@gmail.com>
1626
1627         * merge.cc (Output_merge_string::do_add_input_section): Correct
1628         scan for number of strings.  Rename vars to avoid shadowing.
1629         Include missing terminator in input_size_.
1630
1631 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1632
1633         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1634         Restore empty string handling.
1635
1636 2013-05-01  Cary Coutant  <ccoutant@google.com>
1637
1638         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1639         uninitialized warning.
1640
1641 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1642
1643         * output.cc (Output_section::add_merge_input_section): Allow
1644         to merge sections if the alignment is more than character size.
1645         * merge.h (Output_merge_string::Output_merge_string): Remove
1646         assert.
1647         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1648         only not-null strings. Check the alignment of strings.
1649         * stringpool.h
1650         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1651         alignment as the argument.
1652         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1653         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1654         Align non-zero length strings according to the addralign_.
1655         (Stringpool_template<Stringpool_char>::set_string_offsets):
1656         Updating offsets according to the given alignment.
1657         * testsuite/Makefile.am (text_section_grouping): Test if string
1658         literals are getting merged.
1659         * testsuite/Makefile.in: Regenerate.
1660         * testsuite/merge_string_literals_1.c: New file.
1661         * testsuite/merge_string_literals_2.c: Ditto.
1662         * testsuite/merge_string_literals.sh: Ditto.
1663
1664 2013-04-26  Ian Lance Taylor  <iant@google.com>
1665
1666         * target-reloc.h (relocate_section): If the reloc offset is out of
1667         range, pass VIEW as NULL to relocate.relocate.
1668         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1669         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1670         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1671         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1672         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1673         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1674
1675 2013-04-26  Geoff Pike  <gpike@chromium.org>
1676
1677         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1678         * layout.cc (Hash_task): New class.
1679         (Layout::queue_build_id_tasks): New function.
1680         (Layout::write_build_id): Handle single-thread portion of build ID
1681         computation.  (In some cases, all of it is single-threaded.)  Replace
1682         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1683         functionality in fewer lines of code.
1684         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1685         * options.h (General_options): make "--build-id" default to tree
1686         rather than sha1.  Add two new options related to --build-id=tree:
1687         --build-id-chunk-size-for-treehash and
1688         --build-id-min-file-size-for-treehash.
1689         * Makefile.am: add testing of --build-id=tree and related new options
1690         (these tests will be invoked by "make check").
1691         * Makefile.in: Regenerate.
1692
1693 2013-04-25  Alan Modra  <amodra@gmail.com>
1694
1695         * configure.tgt: Add powerpcle and powerpc64le.
1696
1697 2013-04-22  Alan Modra  <amodra@gmail.com>
1698
1699         PR gold/15355
1700         * layout.cc (Layout::segment_precedes): Allow more than one
1701         segment with the same type and flags.
1702
1703 2013-04-15  Cary Coutant  <ccoutant@google.com>
1704
1705         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1706         allocate space in file for BSS sections.
1707
1708 2013-04-15  Cary Coutant  <ccoutant@google.com>
1709
1710         * script-sections.cc (Orphan_output_section): Reset address
1711         to zero after each orphaned section for relocatable links.
1712
1713 2013-04-15  Cary Coutant  <ccoutant@google.com>
1714
1715         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1716         section starting address for relocatable link.
1717         * testsuite/Makefile.am (script_test_11): New test.
1718         * testsuite/Makefile.in: Regenerate.
1719         * testsuite/script_test_11.c: New source file.
1720         * testsuite/script_test_11.t: New linker script.
1721
1722 2013-04-13  Alan Modra  <amodra@gmail.com>
1723
1724         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1725         owner when sections are not adjacent and exceed group size.
1726         (Target_powerpc::group_sections): Handle corner case.
1727         (Target_powerpc::Branch_info::make_stub): Handle case where
1728         stub table doesn't exist due to branches in non-exec sections.
1729         (Target_powerpc::Relocate::relocate): Likewise.
1730
1731 2013-04-11  Alan Modra  <amodra@gmail.com>
1732
1733         PR gold/15354
1734         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1735         .branch_lt to match bfd ld.  Adjust comments throughout file.
1736
1737 2013-04-04  Ian Lance Taylor  <iant@google.com>
1738
1739         GCC PR c++/56840
1740         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1741         sections before checking whether they are included in the link.
1742
1743 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1744
1745         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1746         object before calling the plugin claim_file handler.  Pass the elf
1747         object of the archive to the plugin. Delete the elf object if the
1748         plugin claims the file.
1749
1750 2013-03-21  Alan Modra  <amodra@gmail.com>
1751
1752         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1753         segment when omagic.
1754
1755 2013-03-21  Alan Modra  <amodra@gmail.com>
1756
1757         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1758         comparison warning.
1759         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1760         uninitialized" warning.
1761
1762 2013-03-20  Alan Modra  <amodra@gmail.com>
1763
1764         * symtab.h (Symbol::clear_version): New function.
1765         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1766         is_needed by weak references.  Clear version for symbols defined
1767         in as-needed objects that are not needed.
1768
1769 2013-03-15  Alan Modra  <amodra@gmail.com>
1770
1771         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1772         static and public.  Add report_err param.  Return false for data refs.
1773         (Target_powerpc::rela_dyn_section): New overloaded function.
1774         (Target_powerpc::plt_, iplt_): Elucidate.
1775         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1776         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1777         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1778         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1779         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1780         push_branch and make_plt_entry for ifunc syms when
1781         reloc_needs_plt_for_ifunc.
1782         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1783         for ifunc unless reloc_needs_plt_for_ifunc.
1784
1785 2013-03-15  Alan Modra  <amodra@gmail.com>
1786
1787         * gc.h (gc_process_relocs): Don't look through function descriptors.
1788         * icf.cc (get_section_contents): Do so here instead.
1789
1790 2013-03-13  Alan Modra  <amodra@gmail.com>
1791
1792         * powerpc.cc (is_branch_reloc): Forward declare.
1793         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1794         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1795         false for 64-bit, true for 32-bit non-branch relocs.
1796         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1797         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1798         nm output.
1799         (icf_safe_test): Generate linker map file as well as nm output.
1800         (icf_safe_so_test): Likewise.
1801         * testsuite/Makefile.in: Regenerate.
1802         * testsuite/icf_test.sh: Parse linker map file to determine
1803         section folding.
1804         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1805         * testsuite/icf_safe_so_test.sh: Likewise.
1806         (X86_32_or_ARM_specific_safe_fold): Merge into..
1807         (arch_specific_safe_fold): ..this.
1808         (X86_64_specific_safe_fold): Delete unused function.
1809
1810 2013-03-12  Alan Modra  <amodra@gmail.com>
1811
1812         * gc.h (gc_process_relocs): Look through function descriptors
1813         to determine shndx, symvalue and addend used by ICF.  Tidy
1814         variable duplication.
1815
1816 2013-03-11  Alan Modra  <amodra@gmail.com>
1817
1818         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1819         * layout.cc (Layout_task_runner::run): ..to here.
1820         * symtab.h (struct Symbol_location): Extract from..
1821         (class Symbol_table): ..here.
1822         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1823         * target.h (class Target): Add function_location and
1824         do_function_location functions.
1825         (class Sized_target): Add do_function_location.
1826         * object.h (class Sized_relobj_file): Move find_shdr..
1827         (class Object): ..to here.
1828         * object.cc: Likewise.  Update to suit.  Instantiate.
1829         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1830         * powerpc.cc (class Powerpc_dynobj): New.
1831         (Target_powerpc::do_function_location): New function.
1832         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1833         (Powerpc_dynobj::do_read_symbols): New function.
1834         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1835
1836 2013-03-08  Ian Lance Taylor  <iant@google.com>
1837
1838         * options.cc (General_options::string_to_object_format): Accept
1839         "default".
1840
1841 2013-03-08  Alan Modra  <amodra@gmail.com>
1842
1843         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1844         pointer to Post_fde.
1845         (struct Post_fde): Move definition to here..
1846         * ehframe.cc (struct Post_fde): ..from here.
1847         (Cie::write): Don't alloc Post_fde.
1848         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1849
1850 2013-03-07  Alan Modra  <amodra@gmail.com>
1851
1852         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1853         relocation referencing .LC0.
1854         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1855
1856 2013-03-07  Alan Modra  <amodra@gmail.com>
1857
1858         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1859         always_inline.  Add assembly for powerpc to avoid GOT.
1860
1861 2013-03-07  Alan Modra  <amodra@gmail.com>
1862
1863         * testsuite/script_test_10.sh: Don't test .bss section
1864         header number.
1865
1866 2013-03-06  Alan Modra  <amodra@gmail.com>
1867
1868         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1869         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1870         all callers.  Handle folded sections.
1871         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1872         to Powerpc_relobj.
1873         (Global_symbol_visitor_opd::operator()): Likewise.
1874
1875 2013-03-04  Alan Modra  <amodra@gmail.com>
1876
1877         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1878         * testsuite/Makefile.in: Regenerate.
1879
1880 2013-03-01  Cary Coutant  <ccoutant@google.com>
1881
1882         Add dwp support for v2 DWARF package file format.
1883         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1884         tu_length parameter.  Adjust all callers.
1885         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1886         * dwp.cc: Include dwarf.h.
1887         (Section_bounds): New struct type.
1888         (Unit_set): New struct type.
1889         (Dwo_file::Dwo_file): Initialize new data member.
1890         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1891         Combine and rename to...
1892         (Dwo_file::read_unit_index): ...this.
1893         (Dwo_file::sized_read_compunit_index)
1894         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1895         (Dwo_file::sized_read_unit_index): ...this.
1896         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1897         parameters; add section_id parameter.
1898         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1899         (Dwo_file::add_unit_set): ...this.
1900         (Dwo_file::shndx_map_): Remove.
1901         (Dwo_file::sect_offsets_): New data member.
1902         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1903         (Dwp_output_file::add_section): Rename to...
1904         (Dwp_output_file::add_contribution): ...this.
1905         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1906         (Dwp_output_file::add_tu_set): Likewise.
1907         (Dwp_output_file::Contribution): New type.
1908         (Dwp_output_file::Section::contributions): New data member.
1909         (Dwp_output_file::Cu_or_tu_set): Remove.
1910         (Dwp_output_file::Section::Section): New ctor.
1911         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1912         (Dwp_output_file::Dwp_index::Section_table): New type.
1913         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1914         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1915         parameter.
1916         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1917         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1918         (Dwp_output_file::Dwp_index::section_table): New member function.
1919         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1920         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1921         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1922         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1923         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1924         (Dwp_output_file::Dwp_index::section_table_): New data member.
1925         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1926         (Dwp_output_file::add_output_section): New member function.
1927         (Dwp_output_file::write_new_section): New member function.
1928         (Dwp_output_file::write_contributions): New member function.
1929         (Dwp_output_file::section_id_map_): New data member.
1930         (class Dwo_id_info_reader): Remove.
1931         (class Unit_reader): New class.
1932         (get_dwarf_section_name): New function.
1933         (Dwo_file::read_executable): Adjust initializations of class data.
1934         (Dwo_file::read): Add support for v2 package file format.
1935         (Dwo_file::read_unit_index): Likewise.
1936         (Dwo_file::sized_read_unit_index): Likewise.
1937         (Dwo_file::copy_section): Likewise.
1938         (Dwo_file::add_unit_set): Likewise.
1939         (Dwp_output_file::add_output_section): Likewise.
1940         (Dwp_output_file::add_contribution): Likewise.
1941         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1942         for empty slot.
1943         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1944         file format.
1945         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1946         slot.
1947         (Dwp_output_file::initialize): Remove unused function.
1948         (Dwp_output_file::finalize): Add support for v2 package file format.
1949         (Dwp_output_file::write_index): Likewise.
1950         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1951         function prototype.
1952
1953 2013-03-01  Cary Coutant  <ccoutant@google.com>
1954
1955         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1956         function into class definition in header file.
1957         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1958         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1959         New function.
1960         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1961
1962 2013-02-28  Alan Modra  <amodra@gmail.com>
1963
1964         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1965         * target.cc (Target::do_plt_fde_location): New function.
1966         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1967         accessor function, and constructor param.
1968         (struct Post_fde, Post_fdes): Declare.
1969         (Cie::write): Add post_fdes param.
1970         * ehframe.cc (Fde::write): Use plt_fde_location.
1971         (struct Post_fde): Define.
1972         (Cie::write): Stash FDEs added post merge mapping.
1973         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1974         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1975         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1976         other FDEs.
1977         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1978         (Target_powerpc::has_glink): New function.
1979         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1980         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1981         glink_eh_frame_fde_32, default_fde): New data.
1982         (Stub_table::eh_frame_added_): New var.
1983         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1984         Make const.
1985         (Stub_table::add_eh_frame): New function.
1986         (Output_data_glink::add_eh_frame): New function.
1987         (Target_powerpc::make_glink_section): Call add_eh_frame.
1988
1989 2013-02-15  Ian Lance Taylor  <iant@google.com>
1990
1991         * options.h (DEFINE_uint64_alias): Define.
1992         (class General_options): Add -Ttext-segment as an alias for
1993         -Ttext.
1994
1995 2013-02-15  Alan Modra  <amodra@gmail.com>
1996
1997         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1998         (Stub_table::do_write): ..here, two places.
1999         (Stub_table::plt_call_size): Use it here too.
2000
2001 2013-02-11  Ian Lance Taylor  <iant@google.com>
2002
2003         * descriptors.cc (Descriptors::close_all): New function.
2004         * descriptors.h (class Descriptors): Declare close_all.
2005         (close_all_descriptors): New inline function.
2006         * plugin.cc: Include "descriptors.h".
2007         (Plugin_manager::cleanup): Call close_all_descriptors.
2008
2009 2013-02-06  Alan Modra  <amodra@gmail.com>
2010
2011         * README: Update coding style link.
2012
2013 2013-01-28  Cary Coutant  <ccoutant@google.com>
2014
2015         * dwp.cc (File_list): New typedef.
2016         (Dwo_name_info_reader): New class.
2017         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
2018         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
2019         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
2020         (Dwo_file::read_executable): New function.
2021         (Dwo_file::read): Move common setup code to ...
2022         (Dwo_file::make_object): ... here.
2023         (dwp_options): Add --exec/-e.
2024         (usage): Likewise.
2025         (main): Likewise.
2026
2027 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
2028
2029         * layout.cc (Layout::layout): Check for option text_reorder.
2030         (Layout::make_output_section): Ditto.
2031         * options.h (text_reorder): New option.
2032         * output.cc (Input_section_sort_compare): Remove special ordering
2033         of section names.
2034         (Output_section::
2035          Input_section_sort_section_name_special_ordering_compare::
2036          operator()): New function.
2037         (Output_section::sort_attached_input_sections): Use new sort function
2038         for .text.
2039         * output.h (Input_section_sort_section_name_special_ordering_compare):
2040         New struct.
2041         * testsuite/Makefile.am (text_section_grouping): Test option
2042         --no-text-reorder
2043         * testsuite/Makefile.in: Regenerate.
2044         * testsuite/text_section_grouping.sh: Check order of functions without
2045         default text reordering.
2046
2047 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2048
2049         * options.h (General_options): Change default to true for new_dtags.
2050
2051 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
2052
2053         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
2054         when enable_new_dtags is false.  Only add DT_RUNPATH when
2055         enable_new_dtags is true.
2056
2057 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
2058
2059         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
2060         used in declaration and definition consistent.
2061         (Target_powerpc::symval_for_branch): Ditto.
2062
2063 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2064
2065         * testsuite/plugin_final_layout.cc: Fix comment.
2066
2067 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
2068
2069         * layout.cc (Layout::layout): Do not do default sorting for
2070         text sections when section ordering is specified.
2071         (make_output_section): Ditto.
2072         * testsuite/plugin_final_layout.cc: Name the function sections
2073         to catch reordering issues.
2074
2075 2013-01-15  Alan Modra  <amodra@gmail.com>
2076
2077         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
2078         plt-thread-safe.
2079
2080 2013-01-15  Alan Modra  <amodra@gmail.com>
2081
2082         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
2083         * testsuite/Makefile.in: Regenerate.
2084
2085 2013-01-14  Alan Modra  <amodra@gmail.com>
2086
2087         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
2088         * testsuite/Makefile.in: Regenerate.
2089
2090 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
2091
2092         PR bfd/14430
2093         Fix mingw gold build with plugins enabled
2094         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
2095         * configure.ac: Export DLOPEN_LIBS and add headers check.
2096         * plugin.cc: Handle non-dlfcn case.
2097         * Makefile.in: Regenerate.
2098         * config.in: Regenerate.
2099         * configure: Regenerate.
2100         * testsuite/Makefile.in: Regenerate.
2101
2102 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
2103
2104         * output.h (sort_attached_input_sections): Change to be public.
2105         * script-sections.cc
2106         (Output_section_definition::set_section_addresses): Sort
2107         attached input sections according to section order before linker
2108         script assigns section addresses.
2109         (Orphan_output_section::set_section_addresses): Sort
2110         attached input sections according to section order before linker
2111         script assigns section addresses.
2112         * Makefile.am (final_layout.sh): Use a simple linker script to
2113         check if section ordering still works.
2114         * Makefile.in: Regenerate.
2115
2116 2013-01-09  Ben Cheng  <bccheng@google.com>
2117
2118         * arm.cc (Target_arm::attributes_accept_div): New function.
2119         (Target_arm::attributes_forbid_div): New function.
2120         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
2121         attribute using the same new functions as what bfd/elf32_arm.c
2122         does.
2123
2124 2013-01-07  Cary Coutant  <ccoutant@google.com>
2125
2126         PR gold/14993
2127         * output.cc (Output_section::add_input_section): For incremental
2128         updates, don't track input sections that are allocated from patch
2129         space.
2130
2131 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2132             Ian Lance Taylor  <iant@google.com>
2133
2134         PR gold/14897
2135         * configure.ac (--enable-ld): Removed.
2136         (install_as_default): Set to yes only for --enable-gold=default
2137         or --disable-ld.
2138         * configure: Regenerated.
2139
2140 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
2141
2142         * options.h (General_options): Add -fuse-ld= for GCC linker
2143         option compatibility.
2144
2145 2013-01-04  Cary Coutant  <ccoutant@google.com>
2146
2147         * configure.ac: Fix typo restoring CXXFLAGS.
2148         * configure: Regenerate.
2149
2150 2013-01-04  Cary Coutant  <ccoutant@google.com>
2151
2152         * testsuite/Makefile.am (CXXLINK_S): New macro.
2153         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
2154         * testsuite/Makefile.in: Regenerate.
2155
2156 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
2157
2158         * version.cc (print_version): Update copyright year to 2013.
2159
2160 2012-12-20  Ian Lance Taylor  <iant@google.com>
2161
2162         * layout.cc (Layout::special_ordering_of_input_section): New
2163         function.
2164         (Layout::layout): If input section requires special ordering, must
2165         sort input sections.
2166         (Layout::make_output_section): May sort .text input sections.
2167         (Layout::is_section_name_prefix_grouped): Remove.
2168         * layout.h (class Layout): Declare
2169         special_ordering_of_input_section.  Don't declare
2170         is_section_name_prefix_grouped.
2171         * output.cc (Output_section::add_input_section): Revert last
2172         change.
2173         (Output_section::Input_section_sort::match_file_name): Don't crash
2174         if called on output section data.
2175         (Output_section::Input_section_sort_compare): Sort based on
2176         special ordering.
2177         (Output_section::Input_section_sort_section_order_index_compare):
2178         Revert last patch.
2179         (Output_section::sort_attached_input_sections): Likewise.
2180
2181 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2182
2183         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2184         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2185         * output.cc (Output_section::add_input_section): Check if section
2186         name contains special prefix.  Keep input sections to sort such
2187         sections.
2188         (Output_section::Input_section_sort_section_order_index_compare
2189          ::operator()): Group sections according to prefixes.
2190         (Output_section::sort_attached_input_sections): Add condition to
2191         Input_section_entry constructor call.
2192         * testsuite/Makefile.am (text_section_grouping): New test.
2193         * testsuite/Makefile.in: Regenerate.
2194         * testsuite/text_section_grouping.cc: New file.
2195         * testsuite/text_section_grouping.sh: New file.
2196
2197 2012-12-17  Nick Clifton  <nickc@redhat.com>
2198
2199         * Makefile.am: Add copyright notice.
2200         * NEWS: Likewise.
2201         * README: Likewise.
2202         * configure.ac: Likewise.
2203         * ftruncate.c: Likewise.
2204         * Makefile.in: Regenerate.
2205
2206 2012-12-14  Cary Coutant  <ccoutant@google.com>
2207
2208         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2209         --no-as-needed flag.
2210         (exception_separate_shared_12_test): Likewise.
2211         (incremental_copy_test): Likewise.
2212         * testsuite/Makefile.in: Regenerate.
2213
2214 2012-12-14  Cary Coutant  <ccoutant@google.com>
2215
2216         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2217         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2218
2219 2012-12-12  Alan Modra  <amodra@gmail.com>
2220
2221         * powerpc.cc (class Track_tls): New.
2222         (class Relocate, class Scan): Inherit Track_tls.
2223         (Target_powerpc::Scan::local, global): Track tls optimization
2224         and avoid creating plt entry for __tls_get_addr if all uses
2225         are optimized away.
2226         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2227
2228 2012-12-12  Alan Modra  <amodra@gmail.com>
2229
2230         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2231         Replace no_toc_optimize with toc_optimize.
2232         * output.h (Output_section::input_sections): Provide non-const variant.
2233         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2234         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2235         accessors.
2236         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2237         (class Sort_toc_sections): New.
2238         (Target_powerpc::do_finalize_sections): Sort toc sections.
2239         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2240
2241 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2242
2243         * testsuite/binary_unittest.cc (read_all): New function.
2244         (Sized_binary_test): Use it instead of ::read.
2245         * fileread.cc (do_read): Don't assume pread always reads the whole
2246         amount in a single call.
2247
2248 2012-12-10  Alan Modra  <amodra@gmail.com>
2249
2250         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2251         Set EM_PPC64 or EM_PPC here.
2252         (Target_selector_powerpc::do_recognize): Delete.
2253
2254 2012-12-10  Alan Modra  <amodra@gmail.com>
2255
2256         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2257         stub_table_.
2258         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2259
2260 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2261
2262         * testsuite/binary_unittest.cc (Sized_binary_test):
2263         Use open_descriptor rather than ::open.
2264
2265 2012-12-07  Alan Modra  <amodra@gmail.com>
2266
2267         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2268         typedef and invalid_address constant.
2269         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2270         instantiate constants.
2271
2272 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2273
2274         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2275         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2276         * aclocal.m4: Regenerate.
2277         * configure: Regenerate.
2278         * Makefile.in: Regenerate.
2279         * testsuite/Makefile.in: Regenerate.
2280
2281 2012-12-07  Alan Modra  <amodra@gmail.com>
2282
2283         * options.h (General_options): Add no_toc_optimize.
2284         * powerpc.cc (ok_lo_toc_insn): New function.
2285         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2286
2287 2012-12-06  Alan Modra  <amodra@gmail.com>
2288
2289         * options.h (General_options): Add plt_align, plt_static_chain,
2290         plt_thread_safe.  Update stub_group_size help text.
2291         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2292         for new plt_thread_safe_ var.
2293         (use_plt_offset): Correct comments.
2294         (Target_powerpc::do_relax): Look for thread creation symbols to
2295         determine default plt_thread_safe value.  Clear plt call stubs
2296         as well as branch stubs each iteration.
2297         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2298         insn constants.
2299         (l, hi, ha, write_insn): Move earlier.
2300         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2301         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2302         plt stubs too.
2303         (Stub_table::update_size): Adjust.
2304         (Stub_table::prev_size, set_prev_size): Delete.
2305         (Stub_table::stub_align): Let --plt-align affect result.
2306         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2307         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2308         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2309         (Stub_table::do_write): Support more stub variants.
2310
2311 2012-12-04  Alan Modra  <amodra@gmail.com>
2312
2313         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2314         (Target_powerpc::do_define_standard_symbols): New function.
2315
2316 2012-12-03  Alan Modra  <amodra@gmail.com>
2317
2318         * output.h: Formatting, whitespace.
2319
2320 2012-12-03  Alan Modra  <amodra@gmail.com>
2321
2322         * layout.h (Layout::get_executable_sections): Declare.
2323         * layout.cc (Layout::get_executable_sections): New function.
2324         * arm.cc (Target_arm::group_sections): Use it.
2325         (Arm_output_section::group_sections): Delete now redundant test.
2326         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2327         param to handle relative relocs.
2328         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2329         (Output_data_reloc::add_absolute): Adjust.
2330         (Output_data_reloc::add_relative): New function.
2331         (Output_data::reset_data_size): New function.
2332         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2333         (Output_section::set_addralign): New function.
2334         (Output_section::checkpoint_set_addralign): New function.
2335         (Output_section::clear_section_offsets_need_adjustment): New function.
2336         (Output_section::input_sections): Make public.
2337         * powerpc.cc (class Output_data_brlt_powerpc): New.
2338         (class Stub_table, class Stub_control): New.
2339         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2340         stub_table_, set_stub_table, stub_table): New vectors and accessor
2341         functions.
2342         (Target_powerpc::do_may_relax, do_relax, push_branch,
2343         new_stub_table, stub_tables, brlt_section, group_sections,
2344         add_branch_lookup_table, find_branch_lookup_table,
2345         write_branch_lookup_table, make_brlt_section): New functions.
2346         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2347         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2348         branch_info_): New vars.
2349         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2350         make call stubs here.
2351         (Output_data_glink): Remove all call stub handling from this class.
2352         (Target_powerpc::Scan::local, global): Save interesting branch
2353         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2354         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2355         functions on final link.
2356         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2357         Handle long branch destinations too.
2358         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2359         do_plt_address_for_local): Adjust lookup of plt call stubs.
2360
2361 2012-11-30  Alan Modra  <amodra@gmail.com>
2362
2363         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2364         relocs against protected symbols when building 32-bit shared libs.
2365
2366 2012-11-30  Alan Modra  <amodra@gmail.com>
2367
2368         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2369         param.  Call got_section() to make .got.  Update all callers
2370         and their callers and so on.
2371
2372 2012-11-30  Alan Modra  <amodra@gmail.com>
2373
2374         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2375         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2376         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2377         value if it already exists.
2378
2379 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2380
2381         PR gold/14858
2382         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2383
2384 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2385
2386         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2387         than bfc instruction for data sandboxing.
2388
2389 2012-11-08  Alan Modra  <amodra@gmail.com>
2390
2391         * po/POTFILES.in: Regenerate.
2392
2393 2012-11-05  Alan Modra  <amodra@gmail.com>
2394
2395         * configure.ac: Apply 2012-09-10 change to config.in here.
2396         * configure: Regenerate.
2397
2398 2012-11-05  Alan Modra  <amodra@gmail.com>
2399
2400         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2401         (struct Opd_ent): Use "Address" rather than "Offset".
2402         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2403         (Target_powerpc::got_section): Make public.
2404         (Target_powerpc::scan_relocs): Move code setting symbols..
2405         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2406         Create _SDA_BASE_ only when referenced.
2407
2408 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2409
2410         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2411         from last change.
2412
2413 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2414
2415         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2416         for offset_in_output_section parameter.
2417         (Sized_target::relocate_special_relocatable): Likewise.
2418         * arm.cc (Target_arm::relocate_relocs): Likewise.
2419         (Target_arm::relocate_special_relocatable): Likewise.
2420         * i386.cc (Target_i386::relocate_relocs): Likewise.
2421         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2422         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2423         * target-reloc.h (relocate_relocs): Likewise.
2424         * testsuite/testfile.cc (Target_test): Likewise.
2425         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2426         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2427
2428         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2429         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2430
2431         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2432         parameter, which is unused in the [!F_SETFD] case.
2433
2434         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2435         SYMNDX to off_t before comparing it to this->data_size().
2436         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2437         * incremental.cc (Output_section_incremental_inputs::do_write):
2438         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2439
2440         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2441
2442 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2443
2444         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2445         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2446         in EABI_VER5.
2447
2448 2012-10-29  Cary Coutant  <ccoutant@google.com>
2449
2450         * dwp.cc (usage): Add file and exit status parameters;
2451         add --help and --version options.
2452         (print_version): New function.
2453         (main): Add --help and --version options.
2454
2455 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2456
2457         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2458         final_layout_sequence.txt.
2459         * testsuite/Makefile.in: Regenerated.
2460
2461 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2462
2463         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2464         COMPILE generated by automake.
2465         (LINK1): Likewise.
2466         (CXXCOMPILE1): Likewise.
2467         (CXXLINK1): Likewise.
2468         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2469         (LINK): Likewise.
2470         (CXXCOMPILE): Likewise.
2471         (CXXLINK): Likewise.
2472         * testsuite/Makefile.in: Regenerated.
2473
2474 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2475
2476         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2477         on bad fwrite return.
2478
2479 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2480
2481         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2482         on val.
2483
2484 2012-10-23  Cary Coutant  <ccoutant@google.com>
2485
2486         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2487         * testsuite/Makefile.in: Regenerate.
2488         * testsuite/dwp_test.h: New source file.
2489         * testsuite/dwp_test_1.cc: New source file.
2490         * testsuite/dwp_test_1.s: New source file.
2491         * testsuite/dwp_test_1.sh: New source file.
2492         * testsuite/dwp_test_1b.cc: New source file.
2493         * testsuite/dwp_test_1b.s: New source file.
2494         * testsuite/dwp_test_2.cc: New source file.
2495         * testsuite/dwp_test_2.s: New source file.
2496         * testsuite/dwp_test_2.sh: New source file.
2497         * testsuite/dwp_test_main.cc: New source file.
2498         * testsuite/dwp_test_main.s: New source file.
2499
2500 2012-10-23  Cary Coutant  <ccoutant@google.com>
2501
2502         * dwp.h: New header file.
2503         * dwp.cc: New source file.
2504         * gold.h: Move shared declarations to system.h.
2505         * system.h: New header file.
2506         * Makefile.am: Add dwp.
2507         * Makefile.in: Regenerate.
2508
2509 2012-10-23  Cary Coutant  <ccoutant@google.com>
2510
2511         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2512         Dwarf_info_reader::read_from_pointer.
2513         (Dwarf_pubnames_table::read_header): Likewise.
2514         (Dwarf_pubnames_table::next_name): Likewise.
2515         (Dwarf_die::read_attributes): Likewise.
2516         (Dwarf_die::skip_attributes): Likewise.
2517         (Dwarf_info_reader::read_from_pointer): New function template.
2518         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2519         (Dwarf_pubnames_table): Likewise.
2520         (Dwarf_info_reader::read_from_pointer): New function template.
2521         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2522         Dwarf_pubnames_table ctor.
2523
2524 2012-10-23  Cary Coutant  <ccoutant@google.com>
2525
2526         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2527         abbrev_shndx.
2528         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2529         abbrev_shndx_.
2530         (Dwarf_info_reader::set_abbrev_shndx): New method.
2531         (Dwarf_info_reader::abbrev_shndx_): New data member.
2532
2533 2012-10-23  Cary Coutant  <ccoutant@google.com>
2534
2535         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2536         from object, not parameters.
2537         (Dwarf_info_reader::parse): Likewise.
2538         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2539         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2540         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2541         methods.
2542
2543 2012-10-23  Cary Coutant  <ccoutant@google.com>
2544
2545         * fileread.cc (Input_file::Input_file): New constructor.
2546         * fileread.h (class Input_file): Add new constructor.
2547
2548 2012-10-18  Alan Modra  <amodra@gmail.com>
2549
2550         PR gold/14727
2551         * object.cc (Relobj::is_section_name_included): Also match
2552         .sdata personality section.
2553
2554 2012-10-18  Alan Modra  <amodra@gmail.com>
2555
2556         * target-reloc.h (class Default_comdat_behavior): New, package up..
2557         (get_comdat_behaviour): ..this.
2558         (relocate_section): Add Relocate_comdat_behavior template arg,
2559         adjust code to suit.
2560         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2561         (Target_arm::scan_reloc_section): Likewise.
2562         * i386.cc (Target_i386::relocate_section): Likewise.
2563         * sparc.cc (Target_sparc::relocate_section): Likewise.
2564         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2565         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2566         * powerpc.cc (class Relocate_comdat_behavior): New.
2567         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2568         gold::relocate_section with new template arg.
2569
2570 2012-10-18  Alan Modra  <amodra@gmail.com>
2571
2572         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2573         dynamic relocs for GOT_TPREL got entries, without symbol if
2574         resolving locally.
2575         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2576         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2577         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2578
2579 2012-10-17  Alan Modra  <amodra@gmail.com>
2580
2581         PR gold/14726
2582         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2583
2584 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2585
2586         * layout.cc (Layout::include_section): Keep sections marked
2587         SHF_EXCLUDE when doing relocatable links.
2588
2589 2012-10-16  Alan Modra  <amodra@gmail.com>
2590
2591         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2592         (Target_powerpc::do_finalize_sections): Call it.
2593         (Output_data_save_res): New class and supporting functions.
2594         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2595         normal symbols defined in object files.
2596
2597 2012-10-12  Alan Modra  <amodra@gmail.com>
2598
2599         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2600         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2601         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2602         section if scan_opd_relocs not yet called.
2603         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2604
2605 2012-10-12  Alan Modra  <amodra@gmail.com>
2606
2607         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2608         add_local_ifunc_entry): Revert last change.
2609         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2610
2611 2012-10-05  Alan Modra  <amodra@gmail.com>
2612
2613         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2614         do_plt_address_for_global): New functions.
2615         (Output_data_got_powerpc::do_write): Don't segfault when linking
2616         statically.
2617         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2618         add_local_ifunc_entry): Return true on adding entry..
2619         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2620         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2621         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2622         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2623         set up symbols here.
2624         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2625         syms here.  Do so even when no .iplt.  Don't segfault when linking
2626         statically.
2627         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2628         new variants without reloc param.
2629         (Glink_sym_ent::Glink_sym_ent): Likewise.
2630         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2631         reloc when refs will resolve to plt call stub.
2632         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2633         R_PPC_PLTREL24 to resolve locally.
2634         (Target_powerpc::Scan::global): Correct ifunc handling.
2635         (Target_powerpc::Relocate::relocate): Correct local sym glink
2636         lookup.  Don't destroy "value" when we have a plt call stub,
2637         and when checking plt call validity.
2638         (Target_powerpc::do_dynsym_value): Simplify.
2639
2640 2012-10-05  Alan Modra  <amodra@gmail.com>
2641
2642         * i386.cc (Output_data_plt_i386::address_for_global,
2643         address_for_local): Add plt offset to returned value.  Adjust uses.
2644         * sparc.cc (Output_data_plt_sparc::address_for_global,
2645         address_for_local): Likewise.
2646         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2647         address_for_local): Likewise.
2648         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2649         address_for_local): Likewise.
2650         * target.h (Target::plt_address_for_global, plt_address_for_local):
2651         Update comment.
2652         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2653         (Output_data_got::Got_entry::write): Nor here.
2654         * output.h: Comment fix.
2655
2656 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2657
2658         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2659         global_offset_table_ value for larget got.
2660         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2661
2662 2012-09-29  Alan Modra  <amodra@gmail.com>
2663
2664         * powerpc.cc (Target_powerpc::iplt_): New output section.
2665         (Target_powerpc::iplt_section, make_iplt_section,
2666         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2667         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2668         Target_powerpc::plt_entry_count): Count iplt entries too.
2669         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2670         reloc section in constructor.  New params.
2671         (Target_powerpc::make_plt_section): Create reloc section here instead.
2672         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2673         functions.
2674         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2675         (Output_data_glink::add_entry, find_entry): New functions to
2676         deal with local syms.
2677         (Glink_sym_ent): Add support for local syms.
2678         (Output_data_glink::do_write): Handle ifunc plt entries.
2679         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2680         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2681         (Target_powerpc::Relocate::relocate): Likewise.
2682         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2683
2684 2012-09-25  Alan Modra  <amodra@gmail.com>
2685
2686         * object.h (Sized_relobj_file::adjust_local_symbol,
2687         do_adjust_local_symbol): New functions.
2688         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2689         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2690         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2691         and irregular opd entry spacing.
2692         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2693         (Global_symbol_visitor_opd): New functor.
2694         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2695         on deleted opd entries.
2696
2697 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2698
2699         * tilegx.cc: New file.
2700         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2701         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2702         * configure.tgt: Add entries for tilegx*.
2703         * configure.ac: Likewise.
2704         * Makefile.in: Rebuild.
2705         * configure: Likewise.
2706         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2707         tilegx.
2708
2709 2012-09-13  Alan Modra  <amodra@gmail.com>
2710
2711         * target-reloc.h (scan_relocs): Call scan.local for relocs
2712         against symbols in discarded sections.  Pass is_discarded
2713         param.
2714         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2715         Add is_discarded param.
2716         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2717         is_discarded to flag opd entry as discarded.  Don't emit dyn
2718         relocs on such entries.
2719         (Target_powerpc::Scan::global): Similarly detect and handle
2720         such opd entries.
2721         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2722         opd_ent_.  Update all uses.
2723         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2724         (Target_powerpc::relocate_section): Zero out discarded opd
2725         entry relocs.
2726
2727 2012-09-12  Ian Lance Taylor  <iant@google.com>
2728
2729         PR gold/14570
2730         * output.cc: Rename Output_data_got template parameter from size
2731         to got_size for all functions.  Compile all variants of
2732         Output_data_got.
2733         (Output_data_got::Got_entry::write): Correct use of size for
2734         symbol value.  Use local_is_tls rather than casting to
2735         Sized_relobj_file.
2736         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2737         (class Sized_relobj_file): Add do_local_is_tls.
2738         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2739
2740 2012-09-11  Alan Modra  <amodra@gmail.com>
2741
2742         PR gold/14566
2743         * layout.cc (Layout::set_segment_offsets): When using
2744         common-page-size alignment, ensure we are on a new max-page-size
2745         page.
2746         * output.cc (Output_segment::set_section_addresses): Use
2747         abi_pagesize, not common_pagesize for relro boundary.
2748         (Output_segment::set_offset): Likewise.
2749
2750 2012-09-11  Alan Modra  <amodra@gmail.com>
2751
2752         * output.h (Output_data_got::add_global_tls, add_local_tls,
2753         add_local_tls_pair): New functions.
2754         (Output_data_got::add_local_pair_with_rel): Remove second
2755         reloc param.  Expand comment.
2756         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2757         use_plt_or_tls_offset_, similarly for constructor param.
2758         (Output_data_got::Got_entry::write): Add got_index param.
2759         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2760         add_local_tls_pair): New functions.
2761         (Output_data_got::Got_entry::write): Handle tls symbols
2762         with use_plt_or_tls_offset_ set specially.
2763         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2764         (Output_data_got::do_write): Replace iterator with index, pass
2765         index to entry write function.
2766         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2767         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2768         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2769         call.
2770         * i386.cc (Target_i386::Scan::local): Likewise.
2771         * sparc.cc (Target_sparc::Scan::local): Likewise.
2772         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2773         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2774         do_tls_offset_for_global): New functions.
2775         (Target_powerpc::Scan::local): Correct TLS relocations and got
2776         entry values.
2777         (Target_powerpc::Scan::global): Don't emit unnecessary
2778         dynamic relocations on TLS GOT entries.
2779
2780 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2781
2782         * config.in: Disable sanity check for kfreebsd.
2783
2784 2012-09-10  Sterling Augustine  <saugustine@google.com>
2785
2786         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2787         (Gdb_index::pubtypes_read): New parameter.
2788         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2789         to calls.
2790         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2791         pubtypes_object_.
2792
2793 2012-09-09  Alan Modra  <amodra@gmail.com>
2794
2795         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2796         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2797         * gc.h (gc_process_relocs): Call target gc_add_reference.
2798         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2799         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2800         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2801         unnecessary cast.
2802         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2803         to cater for when we don't need code offset.  Update use.
2804         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2805         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2806         set_opd_valid): New functions.
2807         (Target_powerpc::do_gc_add_reference): New function.
2808         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2809         stashed refs.
2810         (Target_powerpc::do_gc_mark_symbol): New function.
2811
2812 2012-09-06  Cary Coutant  <ccoutant@google.com>
2813
2814         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2815         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2816         (Dwarf_die::skip_attributes): Likewise.
2817         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2818         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2819         (main): Call it.
2820         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2821
2822 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2823
2824         * testsuite/script_test_3.t: Add .got.plt output section
2825         statement.
2826         * testsuite/script_test_4.t: Likewise.
2827
2828 2012-09-05  Alan Modra  <amodra@gmail.com>
2829
2830         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2831         update all uses and lose "enum" when using type.
2832
2833 2012-09-05  Alan Modra  <amodra@gmail.com>
2834
2835         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2836         * configure: Regenerate.
2837         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2838         (plugin_final_layout.stdout): Likewise.
2839         (memory_test): Set page sizes to 0x1000.
2840         * testsuite/Makefile.in: Regenerate.
2841         * testsuite/discard_locals_test.sh: Add FIXME comment.
2842         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2843         * testsuite/pr14265.t: Add .got output section statement.
2844         * testsuite/script_test_2.t: Likewise.
2845         * testsuite/script_test_3.t: Likewise.
2846         * testsuite/script_test_4.t: Likewise.
2847         * testsuite/script_test_5.t: Likewise.
2848         * testsuite/script_test_6.t: Likewise.
2849         * testsuite/script_test_7.t: Likewise.
2850         * testsuite/script_test_9.t: Likewise.
2851
2852 2012-09-05  Alan Modra  <amodra@gmail.com>
2853
2854         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2855         (Powerpc_relocate_functions::Status): New typedef.
2856         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2857         (Target_powerpc::Scan::local): Handle REL64.
2858         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2859         for REL32 and REL64.
2860         (Target_powerpc::symval_for_branch): New function, extracted from..
2861         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2862         checks.  Report overflow errors.
2863
2864 2012-09-05  Alan Modra  <amodra@gmail.com>
2865
2866         * object.h (Sized_relobj_file::emit_relocs): Delete.
2867         (Sized_relobj_file::emit_relocs_reltype): Delete.
2868         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2869         relocate_relocs for --emit-relocs.
2870         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2871         * output.h: Update comment.
2872         (Output_segment::first_section): New function.
2873         (Output_segment::first_section_load_address): Use first_section.
2874         * output.cc (Output_segment::first_section): New function extracted..
2875         (Output_segment::first_section_load_address): ..from here.  Delete.
2876         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2877         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2878         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2879         adjust call to target.h function.
2880         * i386.cc (Target_i386): Likewise.
2881         * sparc.cc (Target_sparc): Likewise.
2882         * x86_64.cc (Target_x86_64): Likewise.
2883         * powerpc.cc (Target_powerpc): Likewise.
2884         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2885         first tls section has section symbol for optimised local dynamic
2886         output relocs.
2887         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2888         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2889         optimised tls code.
2890         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2891         Rename to relocate_relocs.  Update error message.
2892
2893 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2894
2895         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2896         --just-symbols.
2897
2898 2012-08-31  Alan Modra  <amodra@gmail.com>
2899
2900         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2901         (Powerpc_relobj::toc_base_offset): New stub function.
2902         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2903         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2904         (Target_powerpc::Relocate::enum skip_tls): New.
2905         (Target_powerpc::call_tls_get_addr_): New var.
2906         (Target_powerpc::is_branch_reloc): Move to file scope.
2907         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2908         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2909         New functions.
2910         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2911         (powerpc_info): Correct common_pagesize for ppc64.
2912         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2913         (Powerpc_relocate_functions): Add overflow check enums and functions.
2914         Add non-shift version of rela, rela_ua.  Delete all rel public
2915         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2916         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2917         addr16_ha3, addr14 functions.
2918         (Output_data_got_powerpc::add_constant_pair): New function.
2919         (Output_data_got_powerpc::got_base_offset): Likewise.
2920         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2921         (instruction constants): Sort, add some more.
2922         (Output_data_glink::do_write): Add and use Address typedef.  Use
2923         object->toc_base_offset() stub for 64-bit.
2924         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2925         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2926         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2927         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2928         Always treat .opd relocs as against locally defined symbol.
2929         Correct condition for RELATIVE relocs.
2930         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2931         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2932         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2933         calculations.  Handle TLS relocs, and more.  Add overflow
2934         checking and adjust for Powerpc_relocate_functions changes.
2935         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2936         Reinstate --emit-relocs code with FIXME.
2937
2938 2012-08-30  Alan Modra  <amodra@gmail.com>
2939
2940         * layout.cc (Layout::set_segment_offsets): Set p_align to
2941         abi_pagesize, not common_pagesize.
2942         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2943         to determine whether file header can go in segment.
2944
2945 2012-08-30  Alan Modra  <amodra@gmail.com>
2946
2947         * output.h (Output_reloc::Output_reloc <output section>): Add
2948         is_relative param.  Adjust calls.
2949         (Output_reloc::add_output_section_relative): New functions.
2950         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2951         is_relative.
2952         (Output_reloc::symbol_value): Handle SECTION_CODE.
2953
2954 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2955
2956         * gold.cc (queue_middle_tasks): Call layout again when unique
2957         segments for sections is desired.
2958         * layout.cc (Layout::Layout): Initialize new members.
2959         (Layout::get_output_section_flags): New function.
2960         (Layout::choose_output_section): Call get_output_section_flags.
2961         (Layout::layout): Make output section for mapping to a unique segment.
2962         (Layout::insert_section_segment_map): New function.
2963         (Layout::attach_allocated_section_to_segment): Make unique segment for
2964         output sections marked so.
2965         (Layout::segment_precedes): Check for unique segments when sorting.
2966         * layout.h (Layout::Unique_segment_info): New struct.
2967         (Layout::Section_segment_map): New typedef.
2968         (Layout::insert_section_segment_map): New function.
2969         (Layout::get_output_section_flags): New function.
2970         (Layout::is_unique_segment_for_sections_specified): New function.
2971         (Layout::set_unique_segment_for_sections_specified): New function.
2972         (Layout::unique_segment_for_sections_specified_): New member.
2973         (Layout::section_segment_map_): New member.
2974         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2975         Rename is_gc_pass_one to is_pass_one.
2976         Rename is_gc_pass_two to is_pass_two.
2977         Rename is_gc_or_icf to is_two_pass.
2978         Check for which pass based on whether symbols data is present.
2979         Make it two pass when unique segments for sections is desired.
2980         * output.cc (Output_section::Output_section): Initialize new
2981         members.
2982         * output.h (Output_section::is_unique_segment): New function.
2983         (Output_section::set_is_unique_segment): New function.
2984         (Output_section::is_unique_segment_): New member.
2985         (Output_section::extra_segment_flags): New function.
2986         (Output_section::set_extra_segment_flags): New function.
2987         (Output_section::extra_segment_flags_): New member.
2988         (Output_section::segment_alignment): New function.
2989         (Output_section::set_segment_alignment): New function.
2990         (Output_section::segment_alignment_): New member.
2991         (Output_segment::Output_segment): Initialize is_unique_segment_.
2992         (Output_segment::is_unique_segment): New function.
2993         (Output_segment::set_is_unique_segment): New function.
2994         (Output_segment::is_unique_segment_): New member.
2995         * plugin.cc (allow_unique_segment_for_sections): New function.
2996         (unique_segment_for_sections): New function.
2997         (Plugin::load): Add new functions to transfer vector.
2998         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2999         * Makefile.in: Regenerate.
3000         * testsuite/plugin_final_layout.sh: Check if unique segment
3001         functionality works.
3002         * testsuite/plugin_section_order.c (onload): Check if new interfaces
3003         are available.
3004         (allow_unique_segment_for_sections): New global.
3005         (unique_segment_for_sections): New global.
3006         (claim_file_hook): Call allow_unique_segment_for_sections.
3007         (all_symbols_read_hook): Call unique_segment_for_sections.
3008
3009 2012-08-22  Cary Coutant  <ccoutant@google.com>
3010
3011         * layout.cc (Layout::include_section): Don't assert on GROUP
3012         sections with --emit-relocs.
3013
3014 2012-08-21  Cary Coutant  <ccoutant@google.com>
3015
3016         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
3017         if --export-dynamic-symbol names an undef symbol.
3018
3019 2012-08-18  Alan Modra  <amodra@gmail.com>
3020
3021         * powerpc.cc: Formatting and white space.
3022         (Powerpc_relobj): Rename got2_section_ to special_.
3023         Add opd_ent_shndx_ and opd_ent_off_ vectors.
3024         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
3025         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
3026         (Target_powerpc): Add Address typedef and invalid_address.  Use
3027         throughout.
3028         (Target_powerpc::is_branch_reloc): New function.
3029         (Powerpc_relocate_functions): Add Address typedef, use throughout.
3030         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
3031         for dst_mask, value and addend.
3032         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
3033         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
3034         (Output_data_glink::do_write): Correct toc base.  Don't try to use
3035         uint16_t for 24-bit offset.  Use get_output_section_offset and
3036         check return.
3037         (Target_powerpc::Scan::local): Handle more relocs.
3038         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
3039         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
3040         Plug in toc restoring insn after plt calls.  Translate branches
3041         to function descriptor symbols to corresponding entry point.
3042         (Target_powerpc::relocate_for_relocatable): Check return from
3043         get_output_section_offset.
3044         * symtab.h: Comment typo.
3045
3046 2012-08-14  Ian Lance Taylor  <iant@google.com>
3047
3048         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
3049         unsupported_relocal_local to call unsupported_reloc_global.
3050
3051 2012-08-14  Nick Clifton  <nickc@redhat.com>
3052
3053         PR ld/14265
3054         * script-sections.cc (Sections_element::output_section_name): Add
3055         keep return parameter.
3056         (Output_section_element::match_name): Add keep return parameter.
3057         Return the value of the keep_ member.
3058         * script-sections.h (class Output_section): Update
3059         output_section_name prototype.
3060         * layout.cc (Layout::keep_input_section): New public member
3061         function.
3062         (Layout::choose_output_section): Pass keep parameter to
3063         output_section_name.
3064         * layout.h (class Layout): Add keep_input_section.
3065         * object.cc (Sized_relobj_file::do_layout): Check for kept input
3066         sections.
3067         * testsuite/Makefile.am: Add a test.
3068         * testsuite/Makefile.in: Regenerate.
3069         * testsuite/pr14265.c: Source file for the test.
3070         * testsuite/pr14265.t: Linker script for the test.
3071         * testsuite/pr14265.sh: Shell script for the test.
3072
3073 2012-08-14  Alan Modra  <amodra@gmail.com>
3074
3075         * target.h (Target::output_section_name): New function.
3076         (Target::do_output_section_name): New function.
3077         * layout.cc (Layout::choose_output_section): Call the above.
3078         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
3079
3080 2012-08-14  Alan Modra  <amodra@gmail.com>
3081
3082         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
3083         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
3084         for replace_constant call.
3085         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
3086         (Output_data_glink::do_print_to_mapfile): New function.
3087         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
3088         (Target_powerpc::Relocate::relocate): Likewise.
3089
3090 2012-08-14  Alan Modra  <amodra@gmail.com>
3091
3092         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
3093         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
3094         (Output_data_glink::add_entry,find_entry): Remove shndx param.
3095         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
3096         all references to shndx_.  Handle special case for R_PPC_PLTREL24
3097         here.
3098         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
3099         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
3100         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
3101         here.
3102         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
3103         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
3104
3105 2012-08-12  Alan Modra  <amodra@gmail.com>
3106
3107         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
3108         (glink insn constants): Use uint32_t.
3109         (Output_data_glink::add_entry): Use insert, not [] operator.
3110
3111 2012-08-11  Alan Modra  <amodra@gmail.com>
3112
3113         * object.h (Sized_relobj_file::find_shdr): New function.
3114         (Sized_relobj_file::find_special_sections): New function.
3115         * object.cc (Sized_relobj_file::find_shdr): New function.
3116         (Sized_relobj_file::find_eh_frame): Use find_shdr.
3117         (Sized_relobj_file::find_special_sections): New function, split out..
3118         (Sized_relobj_file::do_read_symbols): ..from here.
3119         * output.h (Output_data_got::replace_constant): New function.
3120         (Output_data_got::num_entries): New function.
3121         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
3122         (Output_data_got::got_offset): Protected rather than private.
3123         (Output_data_got::replace_got_entry): New function.
3124         * output.cc (Output_data_got::replace_got_entry): New function.
3125         * powerpc.cc (class Powerpc_relobj): New.
3126         (class Powerpc_relocate_functions): Delete all psymval variants or
3127         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
3128         Implement _ha functions using corresponding _hi function.
3129         (Powerpc_relobj::find_special_sections): New function.
3130         (Target_powerpc::do_make_elf_object): New function.
3131         (class Output_data_got_powerpc): New.
3132         (class Output_data_glink): New.
3133         (class Powerpc_scan_relocatable_reloc): New.
3134         Many more changes througout file.
3135
3136 2012-08-09  Nick Clifton  <nickc@redhat.com>
3137
3138         * po/vi.po: Updated Vietnamese translation.
3139
3140 2012-08-07  Ian Lance Taylor  <iant@google.com>
3141
3142         * layout.cc (Layout::add_target_dynamic_tags): If
3143         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
3144         plt_rel.
3145
3146 2012-07-30  Nick Clifton  <nickc@redhat.com>
3147
3148         * po/gold.pot: Updated template.
3149         * po/es.po: Updated Spanish translation.
3150
3151 2012-07-18  Cary Coutant  <ccoutant@google.com>
3152
3153         PR gold/14344
3154         * configure.ac: Add check for -gpubnames support.
3155         * configure: Regenerate.
3156         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
3157         support; force -gno-pubnames.
3158         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
3159         support.
3160         (gdb_index_test_4): New test.
3161         * testsuite/Makefile.in: Regenerate.
3162         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3163         * testsuite/gdb_index_test_2.sh: Likewise.
3164         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3165         * testsuite/gdb_index_test_4.sh: New script.
3166         * testsuite/gdb_index_test_comm.sh: New script with common code;
3167         don't look for space after colon.
3168
3169 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3170
3171         * gold.cc (queue_middle_tasks): Update function order only after
3172         deferred objects due to plugins are processed.
3173
3174 2012-07-11  Ian Lance Taylor  <iant@google.com>
3175
3176         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3177         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3178         (Target_arm::scan_reloc_for_stub): Likewise.
3179         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3180         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3181         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3182         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3183         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3184
3185 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3186             Ian Lance Taylor  <iant@google.com>
3187
3188         PR gold/14309
3189         * configure.ac: Test whether std::tr1::hash<off_t> works.
3190         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3191         needed.
3192         * output.h (class Output_fill): Add virtual destructor.
3193         * configure, config.in: Rebuild.
3194
3195 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3196
3197         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3198
3199 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3200
3201         * plugin.cc (Plugin::load): Handle position independent executables.
3202
3203 2012-06-06  Cary Coutant  <ccoutant@google.com>
3204
3205         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3206         add .debug_macro.
3207         (lines_only_debug_sections): Likewise.
3208         (gdb_fast_lookup_sections): New static array.
3209         (is_gdb_debug_section): Rename formal parameter.
3210         (is_lines_only_debug_section): Likewise.
3211         (is_gdb_fast_lookup_section): New function.
3212         (Layout::include_section): Check for ".zdebug_" prefix; pass
3213         section name suffix to is_gdb_debug_section, et al.; check for
3214         fast-lookup sections when building .gdb_index.
3215         * options.h (--strip-debug-gdb): Update GDB version number.
3216
3217 2012-06-06  Cary Coutant  <ccoutant@google.com>
3218
3219         * configure.ac: Add check for fallocate.
3220         * configure: Regenerate.
3221         * config.in: Regenerate.
3222
3223         * options.h (class General_options): Add --mmap-output-file and
3224         --posix-fallocate options.
3225         * output.cc: (posix_fallocate): Remove; replace with...
3226         (gold_fallocate): New function.
3227         (Output_file::map_no_anonymous): Call gold_fallocate.
3228         (Output_file::map): Check --mmap-output-file option.
3229
3230 2012-06-05  Jing Yu  <jingyu@google.com>
3231
3232         * gold.h (textdomain): Add do {} to empty while(0).
3233         (bindtextdomain): Likewise.
3234
3235 2012-06-04  Cary Coutant  <ccoutant@google.com>
3236
3237         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3238         has_dynsym_index.
3239
3240 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3241
3242         * symtab.cc (Symbol_table::define_special_symbol):
3243         Initialize *poldsym to prevent uninitialized variable errors.
3244
3245 2012-05-23  Cary Coutant  <ccoutant@google.com>
3246
3247         * layout.cc (Layout::section_name_mapping): Add rules to handle
3248         exact match on .data.rel.ro.local or .data.rel.ro.
3249         (Layout::output_section_name): Check for exact matches.
3250
3251 2012-05-23  Cary Coutant  <ccoutant@google.com>
3252
3253         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3254         more carefully.
3255
3256 2012-05-22  Cary Coutant  <ccoutant@google.com>
3257
3258         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3259         object before exporting symbol.
3260
3261 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3262
3263         * testsuite/tls_test.cc: Include "config.h" first.
3264         * testsuite/tls_test_c.c: Likewise.
3265
3266 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3267             Nick Clifton  <nickc@redhat.com>
3268
3269         PR 14072
3270         * configure.in: Add check that sysdep.h has been included before
3271         any system header files.
3272         * configure: Regenerate.
3273         * config.in: Regenerate.
3274
3275 2012-05-14  Cary Coutant  <ccoutant@google.com>
3276
3277         * layout.cc (Layout::make_output_section): Mark .tdata section
3278         as RELRO.
3279         * testsuite/relro_test.cc: Add a TLS variable.
3280
3281 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3282
3283         PR gold/14091
3284         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3285         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3286         R_X86_64_64.
3287
3288 2012-05-08  Cary Coutant  <ccoutant@google.com>
3289
3290         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3291         (lines_only_debug_sections): Likewise.
3292
3293 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3294
3295         * nacl.cc: New file.
3296         * nacl.h: New file.
3297         * Makefile.am (CCFILES, HFILES): Add them.
3298         * Makefile.in: Regenerate.
3299         * i386.cc (Output_data_plt_i386_nacl): New class.
3300         (Output_data_plt_i386_nacl_exec): New class.
3301         (Output_data_plt_i386_nacl_dyn): New class.
3302         (Target_i386_nacl): New class.
3303         (Target_selector_i386_nacl): New class.
3304         (target_selector_i386): Use it instead of Target_selector_i386.
3305         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3306         (Target_x86_64_nacl): New class.
3307         (Target_selector_x86_64_nacl): New class.
3308         (target_selector_x86_64, target_selector_x32): Use it instead of
3309         Target_selector_x86_64.
3310         * arm.cc (Output_data_plt_arm_nacl): New class.
3311         (Target_arm_nacl): New class.
3312         (Target_selector_arm_nacl): New class.
3313         (target_selector_arm, target_selector_armbe): Use it instead of
3314         Target_selector_arm.
3315
3316         * target-select.cc (select_target): Take new Input_file* and off_t
3317         arguments, pass them on to recognize method of selector.
3318         * object.cc (make_elf_sized_object): Update caller.
3319         * parameters.cc (parameters_force_valid_target): Likewise.
3320         * incremental.cc (make_sized_incremental_binary): Likewise.
3321         * target-select.h: Update decl.
3322         (Target_selector::recognize): Take new Input_file* argument,
3323         pass it on to do_recognize.
3324         (Target_selector::do_recognize): Take new Input_file* argument.
3325         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3326         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3327         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3328         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3329
3330         * target.h (Target::Target_info): New members isolate_execinstr
3331         and rosegment_gap.
3332         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3333         * arm.cc (Target_arm::arm_info): Update initializer.
3334         * i386.cc (Target_i386::i386_info): Likewise.
3335         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3336         * sparc.cc (Target_sparc::sparc_info): Likewise.
3337         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3338         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3339         * layout.cc (Layout::attach_allocated_section_to_segment):
3340         Take new const Target* argument.  If target->isolate_execinstr(), act
3341         like --rosegment.
3342         (Layout::find_first_load_seg): Take new const Target* argument;
3343         if target->isolate_execinstr(), reject PF_X segments.
3344         (Layout::relaxation_loop_body): Update caller.
3345         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3346         reset file offset to zero when we hit LOAD_SEG, and then do a second
3347         loop over the segments before LOAD_SEG to reassign offsets after
3348         addresses have been determined.  Handle target->rosegment_gap().
3349         (Layout::attach_section_to_segment): Take new const Target* argument;
3350         pass it to attach_allocated_section_to_segment.
3351         (Layout::make_output_section): Update caller.
3352         (Layout::attach_sections_to_segments): Take new const Target* argument;
3353         pass it to attach_section_to_segment.
3354         * gold.cc (queue_middle_tasks): Update caller.
3355         * layout.h (Layout): Update method decls with new arguments.
3356
3357         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3358         Target_info pointer to use.
3359         (Target_arm::do_make_data_plt): New virtual method.
3360         (Target_arm::make_data_plt): New method that calls it.
3361         (Target_arm::make_plt_entry): Use it.
3362         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3363         for the section alignment.
3364         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3365         method.
3366         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3367         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3368         method.
3369         (Output_data_plt_arm::get_plt_entry_size): Call it.
3370         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3371         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3372         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3373         method.
3374         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3375         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3376         method instead of sizeof(plt_entry).
3377         (Output_data_plt_arm::add_entry): Likewise.
3378         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3379         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3380         than static method.
3381         (Target_arm::plt_entry_size): Likewise.
3382         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3383         Move to ...
3384         (Output_data_plt_arm_standard): ... here, new class.
3385         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3386         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3387         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3388
3389         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3390         Take additional argument for the PLT entry size.
3391         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3392         Use get_plt_entry_size method rather than plt_entry_size variable.
3393         (Output_data_plt_x86_64::reserve_slot): Likewise.
3394         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3395         (Output_data_plt_x86_64::add_entry): Likewise.
3396         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3397         (Output_data_plt_x86_64::address_for_global): Likewise.
3398         (Output_data_plt_x86_64::address_for_local): Likewise.
3399         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3400         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3401         Make method non-static.
3402         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3403         method.
3404         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3405         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3406         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3407         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3408         virtual method.
3409         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3410         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3411         virtual method.
3412         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3413         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3414         virtual method.
3415         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3416         (Output_data_plt_x86_64::plt_entry_size)
3417         (Output_data_plt_x86_64::first_plt_entry)
3418         (Output_data_plt_x86_64::plt_entry)
3419         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3420         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3421         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3422         (Output_data_plt_x86_64_standard): ... here, new class.
3423         (Target_x86_64::Target_x86_64): Take optional argument for the
3424         Target_info pointer to use.
3425         (Target_x86_64::do_make_data_plt): New virtual method.
3426         (Target_x86_64::make_data_plt): New method to call it.
3427         (Target_x86_64::init_got_plt_for_update): Use that.
3428         Call this->plt_->add_eh_frame method here.
3429         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3430         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3431         rather than static method.
3432         (Target_x86_64::plt_entry_size): Likewise.
3433         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3434         rather than plt_entry_size variable.  Move guts of PLT filling to...
3435         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3436         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3437         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3438
3439         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3440         additional argument for the section alignment.
3441         Don't do add_eh_frame_for_plt here.
3442         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3443         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3444         variable.
3445         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3446         method.
3447         (Output_data_plt_i386::get_plt_entry_size): Call it.
3448         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3449         (Output_data_plt_i386::add_eh_frame): New method to call it.
3450         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3451         method.
3452         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3453         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3454         method.
3455         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3456         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3457         method instead of plt_entry_size.
3458         (Output_data_plt_i386::plt_entry_size)
3459         (Output_data_plt_i386::plt_eh_frame_fde_size)
3460         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3461         (Output_data_plt_i386_standard): ... here, new class.
3462         (Output_data_plt_i386_exec): New class.
3463         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3464         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3465         (Output_data_plt_i386::exec_plt_entry): Move to ...
3466         (Output_data_plt_i386_exec::plt_entry): ... here.
3467         (Output_data_plt_i386_dyn): New class.
3468         (Output_data_plt_i386::first_plt_entry): Move to ...
3469         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3470         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3471         (Output_data_plt_i386_dyn::plt_entry): ... here.
3472         (Target_i386::Target_i386): Take optional argument for the Target_info
3473         pointer to use.
3474         (Target_i386::do_make_data_plt): New virtual method.
3475         (Target_i386::make_data_plt): New method to call it.
3476         (Target_i386::make_plt_section): Use that.
3477         Call this->plt_->add_eh_frame method here.
3478         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3479         rather than plt_entry_size variable.
3480         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3481         (Output_data_plt_i386::address_for_local): Likewise.
3482         (Output_data_plt_i386::do_write): Likewise.
3483         Move guts of PLT filling to...
3484         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3485         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3486         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3487         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3488
3489 2012-05-01  Cary Coutant  <ccoutant@google.com>
3490
3491         * dwarf_reader.cc (Dwarf_die::read_attributes)
3492         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3493         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3494         * reduced_debug_output.cc
3495         (Output_reduced_debug_info_section::get_die_end): Remove
3496         DW_FORM_GNU_ref_index.  Add default case.
3497
3498 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3499
3500         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3501         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3502         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3503         DW_AT_high_pc as offset from DW_AT_low_pc.
3504
3505         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3506         * testsuite/Makefile.in: Regenerate.
3507         * testsuite/gdb_index_test_3.c: New test source file.
3508         * testsuite/gdb_index_test_3.sh: New test source file.
3509
3510 2012-04-25  Ian Lance Taylor  <iant@google.com>
3511
3512         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3513         pointer.
3514         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3515         as a class, not a struct.
3516         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3517         (Target_arm::apply_cortex_a8_workaround): Likewise.
3518         * gc.h: Declare Reloc_types as a struct, not a class.
3519         * object.h: Declare Symbols_data as a struct.
3520         * reloc.h: Declare Read_relocs_data as a struct.
3521         * target.h: Declare Relocate_info as a struct.
3522
3523 2012-04-24  David S. Miller  <davem@davemloft.net>
3524
3525         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3526         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3527         and R_SPARC_WPLT30.
3528
3529 2012-04-24  Cary Coutant  <ccoutant@google.com>
3530
3531         * incremental-dump.cc (find_input_containing_global): Replace
3532         magic number with symbolic constant.
3533         (dump_incremental_inputs): Update version number.
3534         * incremental.cc (Output_section_incremental_inputs): Update version
3535         number; import symbolic constants from Incremental_inputs_reader.
3536         (Incremental_inputs::create_data_sections): Align relocations
3537         section correctly for 64-bit targets.
3538         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3539         constants; add padding.
3540         (Output_section_incremental_inputs::write_header): Add assert for
3541         header_size.
3542         (Output_section_incremental_inputs::write_input_files): Add assert
3543         for input_entry_size.
3544         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3545         add assert for object_info_size, input_section_entry_size,
3546         global_sym_entry_size.
3547         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3548         for data structure sizes; use them.
3549         (Incremental_input_entry_reader): Import symbolic constants from
3550         Incremental_inputs_reader; use them.
3551
3552 2012-04-23  David S. Miller  <davem@davemloft.net>
3553
3554         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3555         and elf_flags_set_.
3556         (Target_sparc::Target_sparc): Initialize new fields.
3557         (Target_sparc::do_make_elf_object): New function.
3558         (Target_sparc::do_adjust_elf_header): New function.
3559
3560 2012-04-23  Cary Coutant  <ccoutant@google.com>
3561
3562         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3563         CU range table of gdb index.
3564
3565 2012-04-20  David S. Miller  <davem@davemloft.net>
3566
3567         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3568         instead of false.
3569
3570 2012-04-16  David S. Miller  <davem@davemloft.net>
3571
3572         * sparc.cc (Target_sparc::got_address): New function.
3573         (Sparc_relocate_functions::gdop_hix22): New function.
3574         (Sparc_relocate_functions::gdop_lox10): New function.
3575         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3576         relocs.
3577         (Target_sparc::Scan::local): Likewise if the global symbol is not
3578         preemptible and is not IFUNC.
3579         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3580         transformations for local and non-preemptible non-IFUNC global
3581         symbols.
3582
3583         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3584         writing out 64-bit part of ranges.
3585
3586         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3587         -fpic and -fpie respectively.
3588         * Makefile.in: Regenerate.
3589
3590         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3591         (Target_sparc::Target_sparc): Initialize new field.
3592         (Target_sparc::do_plt_section_for_global): New function.
3593         (Target_sparc::do_plt_section_for_local): New function.
3594         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3595         (Target_sparc::make_plt_section): New function, broken out of
3596         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3597         (Target_sparc::make_plt_entry): Call make_plt_section.
3598         (Target_sparc::make_local_ifunc_plt_entry): New function.
3599         (Target_sparc::rela_ifunc_section): New function.
3600         (Target_sparc::plt_section): Remove const.
3601         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3602         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3603         and ifunc_count_ fields.
3604         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3605         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3606         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3607         (Output_data_plt_sparc::rela_ifunc): New function.
3608         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3609         (Output_data_plt_sparc::has_ifunc_section): New function.
3610         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3611         (Output_data_plt_sparc::address_for_global): New function.
3612         (Output_data_plt_sparc::address_for_local): New function.
3613         (Output_data_plt_sparc::plt_index_to_offset): New function.
3614         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3615         and entry_count.
3616         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3617         entry_count.
3618         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3619         R_SPARC_JMP_IREL to switch.
3620         (Target_sparc::Scan::check_non_pic): Likewise.
3621         (Target_sparc::Scan::local): Handle IFUNC symbols.
3622         (Target_sparc::Scan::local): Likewise.
3623         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3624         and plt_address_for_local.
3625         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3626         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3627
3628         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3629         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3630         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3631         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3632         global relocs too.
3633         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3634         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3635         calls.
3636         * sparc.cc (Target_sparc::Scan::global): Likewise.
3637         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3638
3639 2012-04-16  Cary Coutant  <ccoutant@google.com>
3640
3641         * archive.cc (Library_base::should_include_member): Check for
3642         --export-dynamic-symbol.
3643         * options.h (class General_options): Add --export-dynamic-symbol.
3644         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3645         --export-dynamic-symbol.
3646         (Symbol_table::gc_mark_undef_symbols): Likewise.
3647         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3648
3649 2012-04-12  David S. Miller  <davem@davemloft.net>
3650
3651         * sparc.cc (Reloc::wdisp10): New relocation method.
3652         (Reloc::h34): Likewise.
3653         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3654         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3655         R_SPARC_WDISP10.
3656         (Target_sparc::Scan::local): Likewise.
3657         (Target_sparc::Scan::global): Likewise.
3658         (Target_sparc::Relocate::relocate): Likewise.
3659
3660 2012-04-09  Cary Coutant  <ccoutant@google.com>
3661
3662         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3663         low_pc == 0.
3664
3665 2012-04-06  Ian Lance Taylor  <iant@google.com>
3666
3667         * timer.cc: #include <unistd.h>.
3668
3669 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3670
3671         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3672         * config.in: Regenerate.
3673         * configure: Regenerate.
3674
3675 2012-04-05  Nick Clifton  <nickc@redhat.com>
3676
3677         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3678         (AM_LC_MESSAGES): Add.
3679         * aclocal.m4: Regenerate.
3680         * config.in: Regenerate.
3681         * configure: Regenerate.
3682
3683 2012-03-21  Cary Coutant  <ccoutant@google.com>
3684
3685         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3686         * Makefile.in: Regenerate.
3687         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3688         (Sized_elf_reloc_mapper::symbol_section): New function.
3689         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3690         (make_elf_reloc_mapper): New function.
3691         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3692         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3693         (Dwarf_abbrev_table::do_get_abbrev): New function.
3694         (Dwarf_ranges_table::read_ranges_table): New function.
3695         (Dwarf_ranges_table::read_range_list): New function.
3696         (Dwarf_pubnames_table::read_section): New function.
3697         (Dwarf_pubnames_table::read_header): New function.
3698         (Dwarf_pubnames_table::next_name): New function.
3699         (Dwarf_die::Dwarf_die): New function.
3700         (Dwarf_die::read_attributes): New function.
3701         (Dwarf_die::skip_attributes): New function.
3702         (Dwarf_die::set_name): New function.
3703         (Dwarf_die::set_linkage_name): New function.
3704         (Dwarf_die::attribute): New function.
3705         (Dwarf_die::string_attribute): New function.
3706         (Dwarf_die::int_attribute): New function.
3707         (Dwarf_die::uint_attribute): New function.
3708         (Dwarf_die::ref_attribute): New function.
3709         (Dwarf_die::child_offset): New function.
3710         (Dwarf_die::sibling_offset): New function.
3711         (Dwarf_info_reader::check_buffer): New function.
3712         (Dwarf_info_reader::parse): New function.
3713         (Dwarf_info_reader::do_parse): New function.
3714         (Dwarf_info_reader::do_read_string_table): New function.
3715         (Dwarf_info_reader::lookup_reloc): New function.
3716         (Dwarf_info_reader::get_string): New function.
3717         (Dwarf_info_reader::visit_compilation_unit): New function.
3718         (Dwarf_info_reader::visit_type_unit): New function.
3719         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3720         Sized_elf_reloc_mapper.
3721         (Sized_dwarf_line_info::symbol_section): Remove function.
3722         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3723         (Sized_dwarf_line_info::read_line_mappings): Remove object
3724         parameter, adjust callers.
3725         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3726         * dwarf_reader.h: Include <sys/types.h>.
3727         (class Track_relocs): Remove forward declaration.
3728         (class Elf_reloc_mapper): New class.
3729         (class Sized_elf_reloc_mapper): New class.
3730         (class Dwarf_abbrev_table): New class.
3731         (class Dwarf_range_list): New class.
3732         (class Dwarf_ranges_table): New class.
3733         (class Dwarf_pubnames_table): New class.
3734         (class Dwarf_die): New class.
3735         (class Dwarf_info_reader): New class.
3736         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3737         (Sized_dwarf_line_info::symbol_section): Remove member function.
3738         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3739         base class.
3740         * gdb-index.cc: New source file.
3741         * gdb-index.h: New source file.
3742         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3743         and .debug_types sections, call Layout::add_to_gdb_index.
3744         (Sized_relobj_incr::do_section_name): Implement.
3745         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3746         return type; Implement.
3747         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3748         return type.
3749         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3750         parameter list and return type.
3751         (Sized_incr_dynobj::do_section_contents): Likewise.
3752         * layout.cc: Include gdb-index.h.
3753         (Layout::Layout): Initialize gdb_index_data_.
3754         (Layout::init_fixed_output_section): Check for .gdb_index section.
3755         (Layout::add_to_gdb_index): New function. Instantiate.
3756         * layout.h: Add forward declaration for class Gdb_index.
3757         (Layout::add_to_gdb_index): New member function.
3758         (Layout::gdb_index_data_): New data member.
3759         * main.cc: Include gdb-index.h.
3760         (main): Print statistics for gdb index.
3761         * object.cc (Object::section_contents): Move code into
3762         do_section_contents.
3763         (need_decompressed_section): Check for sections needed when building
3764         gdb index.
3765         (build_compressed_section_map): Likewise.
3766         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3767         gdb index.
3768         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3769         sections; call Layout::add_to_gdb_index.
3770         (Sized_relobj_file::do_decompressed_section_contents): Call
3771         do_section_contents directly.
3772         * object.h (Object::do_section_contents): Adjust parameter list and
3773         return type.
3774         (Object::do_decompressed_section_contents): Call do_section_contents
3775         directly.
3776         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3777         return type.
3778         * options.h (class General_options): Add --gdb-index option.
3779         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3780         list and return type.
3781         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3782         * reloc.h (Track_relocs::checkpoint): New function.
3783         (Track_relocs::reset): New function.
3784
3785         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3786         New test cases.
3787         * testsuite/Makefile.in: Regenerate.
3788         * testsuite/gdb_index_test.cc: New test source file.
3789         * testsuite/gdb_index_test_1.sh: New test source file.
3790         * testsuite/gdb_index_test_2.sh: New test source file.
3791
3792 2012-03-19  Doug Kwan  <dougkwan@google.com>
3793
3794         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3795         (Target_arm::do_finalize_sections): Remove code which defines
3796         __exidx_start and __exidx_end.  Make symbol table parameter
3797         anonymous as it is not used.
3798         * gold.cc (queue_middle_tasks): Call target hook to define any
3799         target-specific symbols.
3800         * target.h (Target::define_standard_symbols): New method.
3801         (Target::do_define_standard_symbols): Same.
3802         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3803         * testsuite/Makefile.in: Regenerate.
3804         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3805         and __exidx_end.
3806         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3807         relocations are generated for __exidx_start and __exidx_end.
3808
3809 2012-03-16  Doug Kwan  <dougkwan@google.com>
3810
3811         * testsuite/Makefile.am: Disable test initpri3b.
3812         * testsuite/Makefile.in: Regenerate.
3813
3814 2012-03-15  Doug Kwan  <dougkwan@google.com>
3815
3816         * arm.cc (Target_arm::got_section): Make .got section read-only
3817         if -z now is given.
3818
3819 2012-03-15  Ian Lance Taylor  <iant@google.com>
3820
3821         PR gold/13850
3822         * layout.cc (Layout::make_output_section): Correctly mark
3823         SHT_INIT_ARRAY, et. al., as relro.
3824
3825 2012-03-14  Doug Kwan  <dougkwan@google.com>
3826
3827         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3828         dynamic relocations for protected symbols in shared objects.
3829
3830 2012-03-13  Ian Lance Taylor  <iant@google.com>
3831
3832         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3833         keep the larger alignment.
3834
3835 2012-03-12  Cary Coutant  <ccoutant@google.com>
3836
3837         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3838         handling of DW_LNE_define_file.
3839
3840 2012-03-12  Cary Coutant  <ccoutant@google.com>
3841
3842         * reduced_debug_output.cc
3843         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3844         codes to switch.
3845
3846 2012-02-29  Cary Coutant  <ccoutant@google.com>
3847
3848         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3849
3850 2012-02-29  Cary Coutant  <ccoutant@google.com>
3851
3852         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3853         Call Object::decompressed_section_contents.
3854         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3855         New dtor.
3856         (Sized_dwarf_line_info::buffer_start_): New data member.
3857         * merge.cc (Output_merge_data::do_add_input_section): Call
3858         Object::decompressed_section_contents.
3859         (Output_merge_string::do_add_input_section): Likewise.
3860         * object.cc (need_decompressed_section): New function.
3861         (build_compressed_section_map): Decompress sections needed later.
3862         (Sized_relobj_file::do_decompressed_section_contents): New function.
3863         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3864         * object.h (Object::decompressed_section_contents): New function.
3865         (Object::discard_decompressed_sections): New function.
3866         (Object::do_decompressed_section_contents): New function.
3867         (Object::do_discard_decompressed_sections): New function.
3868         (Compressed_section_info): New type.
3869         (Compressed_section_map): Include decompressed section contents.
3870         (Sized_relobj_file::do_decompressed_section_contents): New function.
3871         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3872
3873 2012-02-16  Cary Coutant  <ccoutant@google.com>
3874
3875         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3876         * testsuite/Makefile.in: Regenerate.
3877
3878 2012-02-14  Cary Coutant  <ccoutant@google.com>
3879
3880         * options.cc (General_options::finalize): Disallow -pie and -static.
3881
3882 2012-02-03  Doug Kwan  <dougkwan@google.com>
3883
3884         * arm.cc (Arm_relocate_functions::abs8,
3885         Arm_relocate_functions::abs16): Use
3886         Bits::has_signed_unsigned_overflow32.
3887         (Arm_relocate_functions::thm_abs8): Correct range of
3888         overflow check.
3889         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3890         in assertions.
3891
3892 2012-02-02  Doug Kwan  <dougkwan@google.com>
3893
3894         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3895         position independent outputs, not just shared objects.
3896
3897 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3898
3899         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3900         * configure: Regenerated.
3901
3902 2012-01-27  Ian Lance Taylor  <iant@google.com>
3903
3904         * reloc.h (Bits): New class with static functions, copied from
3905         namespace utils in arm.cc.
3906         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3907         instead.
3908
3909 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3910
3911         * incremental.cc (write_info_blocks): Correct relocation offset.
3912
3913 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3914
3915         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3916         (Relocate::tls_gd_to_le): Likewise.
3917
3918 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3919
3920         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3921
3922 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3923
3924         * configure.ac: Check if -mcmodel=medium works.
3925         * configure: Regenerated.
3926
3927 2012-01-24  Cary Coutant  <ccoutant@google.com>
3928
3929         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3930         definition and ...
3931         (read_unsigned_LEB_128_x): ... this new function.
3932         (read_signed_LEB_128): Replaced with inline definition and ...
3933         (read_signed_LEB_128_x): ... this new function.
3934         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3935         (read_unsigned_LEB_128): Add inline definition.
3936         (read_signed_LEB_128_x): New function.
3937         (read_signed_LEB_128): Add inline definition.
3938         * testsuite/Makefile.am (leb128_unittest): New unit test.
3939         * testsuite/Makefile.in: Regenerate.
3940         * testsuite/leb128_unittest.cc: New unit test.
3941
3942 2012-01-23  Ian Lance Taylor  <iant@google.com>
3943
3944         PR gold/13617
3945         * i386.cc (Target_i386::do_code_fill): When using a jmp
3946         instruction, pad with nop instructions.
3947         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3948
3949 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3950
3951         * x86_64.cc (gc_process_relocs): Add typename on types used in
3952         template.
3953         (scan_relocs): Likewise.
3954         (relocate_section): Likewise.
3955         (apply_relocation): Likewise.
3956
3957 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3958
3959         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3960         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3961         under x32.
3962
3963 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3964
3965         * x86_64.cc: Initial support for x32.
3966
3967 2012-01-03  Cary Coutant  <ccoutant@google.com>
3968
3969         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3970         Use abstract base class for GOT.
3971         * gold/output.h (class Output_data_got_base): New abstract base class.
3972         (class Output_data_got): Derive from new base class, adjust ctors.
3973         (Output_data_got::reserve_slot): Make virtual; rename to
3974         do_reserve_slot; Adjust callers.
3975         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3976         pointer to abstract base class.
3977         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3978
3979 2011-12-18  Ian Lance Taylor  <iant@google.com>
3980
3981         * object.h (Relobj::local_symbol_value): New function.
3982         (Relobj::local_plt_offset): New function.
3983         (Relobj::local_has_got_offset): New function.
3984         (Relobj::local_got_offset): New function.
3985         (Relobj::set_local_got_offset): New function.
3986         (Relobj::do_local_symbol_value): New pure virtual function.
3987         (Relobj::do_local_plt_offset): Likewise.
3988         (Relobj::do_local_has_got_offset): Likewise.
3989         (Relobj::do_local_got_offset): Likewise.
3990         (Relobj::do_set_local_got_offset): Likewise.
3991         (Sized_relobj::do_local_has_got_offset): Rename from
3992         local_has_got_offset.
3993         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3994         (Sized_relobj::do_set_local_got_offset): Rename from
3995         set_local_got_offset.
3996         (Sized_relobj_file::do_local_plt_offset): Rename from
3997         local_plt_offset.
3998         (Sized_relobj_file::do_local_symbol_value): New function.
3999         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
4000         local_plt_offset.
4001         * output.cc (Output_data_got::Got_entry::write): Change object to
4002         Relobj.  Use local_symbol_value.
4003         (Output_data_got::add_global_with_rel): Change rel_dyn to
4004         Output_data_reloc_generic*.  Use add_global_generic.
4005         (Output_data_got::add_global_with_rela): Remove.  Change all
4006         callers to use add_global_with_rel.
4007         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
4008         Output_data_reloc_generic*.  Use add_global_generic.
4009         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
4010         callers to use add_global_pair_with_rel.
4011         (Output_data_got::add_local): Change object to Relobj*.
4012         (Output_data_got::add_local_plt): Likewise.
4013         (Output_data_got::add_local_with_rel): Change object to Relobj*,
4014         change rel_dyn to Output_data_reloc_generic*.  Use
4015         add_local_generic.
4016         (Output_data_got::add_local_with_rela): Remove.  Change all
4017         callers to use all_local_with_rel.
4018         (Output_data_got::add_local_pair_with_rel): Change object to
4019         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
4020         add_output_section_generic.
4021         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
4022         callers to use add_local_pair_with_rel.
4023         (Output_data_got::reserve_local): Change object to Relobj*.
4024         * output.h: (class Output_data_reloc_generic): Add pure virtual
4025         declarations for add_global_generic, add_local_generic,
4026         add_output_section_generic.
4027         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
4028         functions for Output_data_reloc_generic.  Update declarations for
4029         changes listed in output.cc.
4030         (class Output_data_got): Change template parameter to got_size.
4031         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
4032         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
4033         function.
4034         (Sized_relobj_incr::do_local_plt_offset): New function.
4035         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
4036         add_global_generic.
4037
4038 2011-12-17  Cary Coutant  <ccoutant@google.com>
4039
4040         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
4041         * resolve.cc (Symbol_table::resolve): Likewise.
4042         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
4043         arrays.
4044         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
4045
4046 2011-12-16  Ian Lance Taylor  <iant@google.com>
4047
4048         * output.h (Output_data_reloc_generic::add): Only call
4049         add_dynamic_reloc if this is a dynamic reloc section.
4050
4051 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
4052
4053         PR gold/13505
4054         * target-reloc.h (apply_relocation): Replace <64, false> with
4055         <size, big_endian>.
4056
4057 2011-11-25  Nick Clifton  <nickc@redhat.com>
4058
4059         * po/it.po: New Italian translation.
4060
4061 2011-11-17  Sterling Augustine  <saugustine@google.com>
4062
4063         * script.cc (script_include_directive): Implement.
4064         (read_script_file): New local variables name and search_path. Update
4065         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
4066         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
4067         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
4068
4069 2011-11-11  Sterling Augustine  <saugustine@google.com>
4070
4071         * yyscript.y (section_cmd): Add support for INCLUDE directive.
4072         (file_or_sections_cmd): Likewise.
4073
4074 2011-11-11  Doug Kwan  <dougkwan@google.com>
4075
4076         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
4077         if --just-symbols is given.
4078
4079 2011-11-10  Doug Kwan  <dougkwan@google.com>
4080
4081         PR gold/13362
4082         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
4083         when processing data relocs.
4084         * reloc.h (Relocate_functions::rel_unaligned): New method.
4085         (Relocate_functions::pcrel_unaligned): Ditto.
4086         (Relocate_functions::rel32_unaligned): Ditto.
4087         (Relocate_functions::pcrel32_unaligned): Ditto.
4088
4089 2011-11-09  Doug Kwan  <dougkwan@google.com>
4090
4091         PR gold/13362
4092         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
4093         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
4094         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
4095         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4096         (Relocate_functions::rel_unaligned): New.
4097         (Relocate_functions::rel32_unaligned): New.
4098         * target-reloc.h (relocate_for_relocatable): Add code to handle
4099         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
4100         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
4101         arm_unaligned_reloc_r): New targets.
4102         * testsuite/Makefile.in: Regenerate.
4103         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
4104         linking.
4105
4106 2011-11-02  Ian Lance Taylor  <iant@google.com>
4107
4108         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
4109         NATIVE_LINKER.
4110         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
4111         * options.cc (General_options::finalize): Use library search path
4112         from configure script if specified.  If not native and no sysroot,
4113         only search TOOLLIBDIR.
4114         * options.h (Search_directory::Search_directory): Change name to
4115         const std::string&.
4116         (General_options::add_to_library_path_with_sysroot): Change arg to
4117         const std::string&.
4118         * configure, Makefile.in, config.in: Rebuild.
4119
4120 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4121
4122         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
4123         we are working around the ARM1176 Erratum.
4124         * options.h (General_options::fix_arm1176): Add option.
4125         * testsuite/Makefile.am: Add testcases, and keep current ones
4126         working.
4127         * testsuite/Makefile.in: Regenerate.
4128         * testsuite/arm_fix_1176.s: New file.
4129         * testsuite/arm_fix_1176.sh: Likewise.
4130
4131 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
4132
4133         * arm.cc (Target_arm::Target_arm): Remove initialisation of
4134         may_use_blx_.
4135         (Target_arm::may_use_blx): Remove method.
4136         (Target_arm::set_may_use_blx): Likewise.
4137         (Target_arm::may_use_v4t_interworking): New method.
4138         (Target_arm::may_use_v5t_interworking): Likewise.
4139         (Target_arm::may_use_blx_): Remove member variable.
4140         (Arm_relocate_functions::arm_branch_common): Check for v5T
4141         interworking.
4142         (Arm_relocate_functions::thumb_branch_common): Likewise.
4143         (Reloc_stub::stub_type_for_reloc): Likewise.
4144         (Target_arm::do_finalize_sections): Correct interworking checks.
4145         * testsuite/Makefile.am: Add new tests.
4146         * testsuite/Makefile.in: Regenerate.
4147         * testsuite/arm_farcall_arm_arm.s: New test.
4148         * testsuite/arm_farcall_arm_arm.sh: Likewise.
4149         * testsuite/arm_farcall_arm_thumb.s: Likewise.
4150         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
4151         * testsuite/arm_farcall_thumb_arm.s: Likewise.
4152         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
4153         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
4154         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
4155
4156 2011-10-31  Cary Coutant  <ccoutant@google.com>
4157
4158         PR gold/13023
4159         * expression.cc (Expression::eval_with_dot): Add
4160         is_section_dot_assignment parameter.
4161         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
4162         absolute and assigning to dot within a section.
4163         * script-sections.cc
4164         (Output_section_element_assignment::set_section_addresses): Pass
4165         dot_section to set_if_absolute.
4166         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4167         as is_section_dot_assignment flag to eval_with_dot.
4168         (Output_section_element_dot_assignment::set_section_addresses):
4169         Likewise.
4170         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4171         parameter.  Also set value if relative to dot_section; set the
4172         symbol's output_section.
4173         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4174         parameter.  Adjust all callers.
4175         (Expression::eval_maybe_dot): Likewise.
4176         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4177         Adjust all callers.
4178         * testsuite/script_test_2.t: Test assignment of an absolute value
4179         to dot within an output section element.
4180
4181 2011-10-31  Cary Coutant  <ccoutant@google.com>
4182
4183         * options.h (class General_options): Add --[no-]gnu-unique options.
4184         * symtab.cc (Symbol_table::sized_write_globals): Convert
4185         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4186
4187 2011-10-31  Cary Coutant  <ccoutant@google.com>
4188
4189         PR gold/13359
4190         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4191         unnecessary assertion.
4192         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4193
4194 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4195
4196         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4197         gc_mark_symbol.
4198         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4199         gc_mark_symbol.
4200         Change to just keep the section associated with symbol.
4201         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4202         they are externally visible and --export-dynamic is turned on.
4203         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4204
4205 2011-10-19  Ian Lance Taylor  <iant@google.com>
4206
4207         PR gold/13163
4208         * script-sections.cc
4209         (Output_section_element_dot_assignment::needs_output_section): New
4210         function.
4211
4212 2011-10-19  Ian Lance Taylor  <iant@google.com>
4213
4214         PR gold/13204
4215         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4216         --section-start option was seen.
4217         * options.h (General_options::any_section_start): New function.
4218
4219 2011-10-18  David S. Miller  <davem@davemloft.net>
4220
4221         PR binutils/13301
4222         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4223         member to track relocation locations that have moved during TLS
4224         reloc optimizations.
4225         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4226         (Target_sparc::Relocate::relocate): Adjust view down by 4
4227         bytes if it matches reloc_adjust_addr_.
4228         (Target_sparc::Relocate::relocate_tls): Always move the
4229         __tls_get_addr call delay slot instruction forward 4 bytes when
4230         performing relaxation.
4231
4232 2011-10-18  Cary Coutant  <ccoutant@google.com>
4233
4234         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4235         (Output_file::map_no_anonymous): Check for non-zero
4236         return code from posix_fallocate.
4237
4238 2011-10-17  Cary Coutant  <ccoutant@google.com>
4239
4240         PR gold/13245
4241         * plugin.cc (is_visible_from_outside): Check for symbols
4242         referenced from dynamic objects.
4243         * resolve.cc (Symbol_table::resolve): Don't count references
4244         from dynamic objects as references from real ELF files.
4245         * testsuite/plugin_test_2.sh: Adjust expected result.
4246
4247 2011-10-17  Cary Coutant  <ccoutant@google.com>
4248
4249         * gold.cc: Include timer.h.
4250         (queue_middle_tasks): Stamp time.
4251         (queue_final_tasks): Likewise.
4252         * main.cc (main): Store timer in parameters.  Print timers
4253         for each pass.
4254         * parameters.cc (Parameters::Parameters): Initialize timer_.
4255         (Parameters::set_timer): New function.
4256         (set_parameters_timer): New function.
4257         * parameters.h (Parameters::set_timer): New function.
4258         (Parameters::timer): New function.
4259         (Parameters::timer_): New data member.
4260         (set_parameters_timer): New function.
4261         * timer.cc (Timer::stamp): New function.
4262         (Timer::get_pass_time): New function.
4263         * timer.h (Timer::stamp): New function.
4264         (Timer::get_pass_time): New function.
4265         (Timer::pass_times_): New data member.
4266
4267 2011-10-17  Cary Coutant  <ccoutant@google.com>
4268
4269         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4270         task for members of lib groups.
4271
4272 2011-10-17  Cary Coutant  <ccoutant@google.com>
4273
4274         PR gold/13288
4275         * fileread.cc (File_read::find_view): Add assert.
4276         (File_read::make_view): Move bounds check (replace with assert)...
4277         (File_read::find_or_make_view): ... to here.
4278
4279 2011-10-12  Cary Coutant  <ccoutant@google.com>
4280
4281         * output.cc (Output_file::open_base_file): Handle case where
4282         ::read returns less than requested size.
4283
4284 2011-10-10  Cary Coutant  <ccoutant@google.com>
4285
4286         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4287         Initialize defined_count_.
4288         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4289         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4290         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4291         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4292         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4293         * incremental.h (Sized_relobj_incr::defined_count_): New data
4294         member.
4295         (Sized_incr_dynobj::defined_count_): New data member.
4296         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4297         Return zeroes instead of internal error.
4298
4299 2011-10-10  Cary Coutant  <ccoutant@google.com>
4300
4301         PR gold/13249
4302         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4303         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4304         * output.h (class Output_reloc): Add use_plt_offset flag.
4305         (Output_reloc::type_): Adjust size of bit field.
4306         (Output_reloc::use_plt_offset_): New bit field.
4307         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4308         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4309         flag.  Adjust all callers.
4310         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4311         creating RELATIVE relocations.
4312
4313 2011-10-10  Nick Clifton  <nickc@redhat.com>
4314
4315         * po/es.po: Updated Spanish translation.
4316         * po/fi.po: Updated Finnish translation.
4317
4318 2011-10-03   Diego Novillo  <dnovillo@google.com>
4319
4320         * options.cc (parse_uint): Fix dereference of RETVAL.
4321
4322 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4323
4324         * layout.h (section_order_map_): New member.
4325         (get_section_order_map): New member function.
4326         * output.cc (Output_section::add_input_section): Check for patterns
4327         only when --section-ordering-file is specified.
4328         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4329         output_sections have been formed.
4330         * layout.cc (Layout_Layout): Initialize section_order_map_.
4331         * plugin.cc (update_section_order): Store order in order_map. Do not
4332         update the order.
4333         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4334         * testsuite/Makefile.in: Regenerate.
4335         * testsuite/plugin_section_order.c: New file.
4336         * testsuite/plugin_final_layout.cc: New file.
4337         * testsuite/plugin_final_layout.sh: New file.
4338
4339 2011-09-29  Cary Coutant  <ccoutant@google.com>
4340
4341         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4342         Check for NULL.
4343         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4344         symbols during incremental update.
4345         (Symbol_table::add_from_dynobj): Likewise.
4346
4347 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4348             Ian Lance Taylor  <iant@google.com>
4349
4350         * symtab.cc (Symbol_table::define_special_symbol): Always
4351         canonicalize version string.
4352
4353 2011-09-26  Cary Coutant  <ccoutant@google.com>
4354
4355         * gold.cc (queue_initial_tasks): Move option checks ...
4356         * options.cc (General_options::finalize): ... to here. Disable
4357         some options; make others fatal.
4358
4359 2011-09-26  Cary Coutant  <ccoutant@google.com>
4360
4361         gcc PR lto/47247
4362         * plugin.cc (get_symbols_v2): New function.
4363         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4364         (is_referenced_from_outside): New function.
4365         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4366         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4367         (get_symbols): Pass version parameter.
4368         (get_symbols_v2): New function.
4369         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4370         parameter.
4371         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4372         (onload): Add LDPT_GET_SYMBOLS_V2.
4373         (all_symbols_read_hook): Use get_symbols_v2; check for
4374         LDPR_PREVAILING_DEF_IRONLY_EXP.
4375         * testsuite/plugin_test_3.sh: Update expected results.
4376
4377 2011-09-23  Simon Baldwin  <simonb@google.com>
4378
4379         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4380         configuration options.
4381         * configure: Regenerate.
4382         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4383         * Makefile.in: Regenerate.
4384         * testsuite/Makefile.in: Regenerate.
4385
4386 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4387
4388         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4389
4390 2011-09-19  Cary Coutant  <ccoutant@google.com>
4391
4392         * incremental.cc (can_incremental_update): Fix typo in comment.
4393         * incremental.h (can_incremental_update): Likewise.
4394
4395 2011-09-18  Cary Coutant  <ccoutant@google.com>
4396
4397         * incremental.cc (can_incremental_update): New function.
4398         * incremental.h (can_incremental_update): New function.
4399         * layout.cc (Layout::init_fixed_output_section): Call it.
4400         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4401         * object.cc (Sized_relobj_file::do_layout): Call
4402         can_incremental_update.
4403
4404 2011-09-13  Cary Coutant  <ccoutant@google.com>
4405
4406         * configure.ac: Check for glibc support for gnu_indirect_function
4407         support with static linking, setting automake conditional
4408         IFUNC_STATIC.
4409         * Makefile.in: Regenerate.
4410         * configure: Regenerate.
4411
4412         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4413         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4414         for IFUNC_STATIC.
4415         * testsuite/Makefile.in: Regenerate.
4416
4417 2011-09-13  Cary Coutant  <ccoutant@google.com>
4418
4419         * incremental.cc (Sized_relobj_incr::do_layout): Call
4420         report_comdat_group for kept comdat sections.
4421         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4422         * testsuite/Makefile.in: Regenerate.
4423         * testsuite/incr_comdat_test_1.cc: New source file.
4424         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4425         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4426         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4427
4428 2011-09-13  Ian Lance Taylor  <iant@google.com>
4429
4430         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4431         variable external_symbols_offset.
4432
4433 2011-09-12  Ian Lance Taylor  <iant@google.com>
4434
4435         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4436         triggered if object has no symbols.
4437
4438 2011-09-09  David S. Miller  <davem@davemloft.net>
4439
4440         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4441         (Output_fill_debug_line::do_write): Likewise.
4442
4443 2011-08-29  Cary Coutant  <ccoutant@google.com>
4444
4445         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4446         casts to match formatting specs.
4447         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4448
4449 2011-08-26  Cary Coutant  <ccoutant@google.com>
4450
4451         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4452         remaining hole size when allocating.
4453         (Layout::make_output_section): Set fill methods for debug sections.
4454         * layout.h (Free_list::Free_list_node): Move from private to
4455         public.
4456         (Free_list::set_min_hole_size): New function.
4457         (Free_list::begin, Free_list::end): New functions.
4458         (Free_list::min_hole_): New data member.
4459         * output.cc: Include dwarf.h.
4460         (Output_fill_debug_info::do_minimum_hole_size): New function.
4461         (Output_fill_debug_info::do_write): New function.
4462         (Output_fill_debug_line::do_minimum_hole_size): New function.
4463         (Output_fill_debug_line::do_write): New function.
4464         (Output_section::Output_section): Initialize new data member.
4465         (Output_section::set_final_data_size): Ensure patch space is larger
4466         than minimum hole size.
4467         (Output_section::do_write): Fill holes in debug sections.
4468         * output.h (Output_fill): New class.
4469         (Output_fill_debug_info): New class.
4470         (Output_fill_debug_line): New class.
4471         (Output_section::set_free_space_fill): New function.
4472         (Output_section::free_space_fill_): New data member.
4473         * testsuite/Makefile.am (incremental_test_3): Add
4474         --incremental-patch option.
4475         (incremental_test_4): Likewise.
4476         (incremental_test_5): Likewise.
4477         (incremental_test_6): Likewise.
4478         (incremental_copy_test): Likewise.
4479         (incremental_common_test_1): Likewise.
4480         * testsuite/Makefile.in: Regenerate.
4481
4482 2011-08-26  Nick Clifton  <nickc@redhat.com>
4483
4484         * po/es.po: Updated Spanish translation.
4485
4486 2011-08-01  Cary Coutant  <ccoutant@google.com>
4487
4488         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4489         * gold/testsuite/Makefile.in: Regenerate.
4490         * gold/testsuite/justsyms_exec.c: New source file.
4491         * gold/testsuite/justsyms_lib.c: New source file.
4492
4493 2011-08-01  Cary Coutant  <ccoutant@google.com>
4494
4495         * layout.cc (Layout::set_segment_offsets): Don't realign text
4496         segment if -Ttext was specified.
4497         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4498         file type.
4499         * object.h (Sized_relobj_file::e_type): New function.
4500         (Sized_relobj_file::e_type_): New data member.
4501         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4502         base address for ET_EXEC files.
4503         * target.cc (Target::do_make_elf_object_implementation): Allow
4504         ET_EXEC files with --just-symbols option.
4505
4506 2011-07-28  Cary Coutant  <ccoutant@google.com>
4507
4508         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4509         Add thread_number parameter.
4510         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4511         * workqueue-threads.cc
4512         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4513         current thread if its thread number is greater than desired thread
4514         count.
4515         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4516         Add thread_number parameter.
4517         (Workqueue::should_cancel_thread): Likewise.
4518         (Workqueue::find_runnable_or_wait): Pass thread_number to
4519         should_cancel_thread.
4520         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4521         parameter.
4522
4523 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4524
4525         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4526         only after checking if it cannot be forced local.
4527         * symtab.h (is_externally_visible): Check if the symbol is not forced
4528         local.
4529
4530 2011-07-15  Ian Lance Taylor  <iant@google.com>
4531
4532         * options.h (class General_options): Add --print-output-format.
4533         Move -EL next to -EB, for  better --help output.
4534         * target-select.cc: Include <cstdio>, "options.h", and
4535         "parameters.h".
4536         (Target_selector::do_target_bfd_name): New function.
4537         (print_output_format): New function.
4538         * target-select.h (class Target_selector): Update declarations.
4539         (Target_selector::target_bfd_name): New function.
4540         (print_output_format): Declare.
4541         * main.cc: Include "target-select.h".
4542         (main): Handle --print-output-format.
4543         * gold.cc: Include "target-select.h".
4544         (queue_initial_tasks): Handle --print-output-format when there are
4545         no input files.
4546         * parameters.cc (parameters_force_valid_target): Give a better
4547         error message if -EB/-EL does not match target.
4548         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4549         function.
4550
4551 2011-07-15  Ian Lance Taylor  <iant@google.com>
4552
4553         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4554         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4555         (Output_data_plt_i386::do_write): Write address of .dynamic
4556         section to first entry in .got.plt section.
4557         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4558         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4559         Initialize layout_.
4560         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4561         section to first entry in .got.plt section.
4562         * layout.h (Layout::dynamic_section): New function.
4563
4564 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4565
4566         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4567         to claim_file call.
4568         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4569         input_section_position_, and input_section_glob_.
4570         (read_layout_from_file): Call function section_ordering_specified.
4571         * layout.h (is_section_ordering_specified): New function.
4572         (section_ordering_specified): New function.
4573         (section_ordering_specified_): New boolean member.
4574         * main.cc(main): Call load_plugins after layout object is defined.
4575         * output.cc (Output_section::add_input_section): Use
4576         function section_ordering_specified to check if section ordering is
4577         needed.
4578         * output.cc (Output_section::add_relaxed_input_section): Use
4579         function section_ordering_specified to check if section ordering is
4580         needed.
4581         (Output_section::update_section_layout): New function.
4582         (Output_section::sort_attached_input_sections): Check if input section
4583         must be reordered.
4584         * output.h (Output_section::update_section_layout): New function.
4585         * plugin.cc (get_section_count): New function.
4586         (get_section_type): New function.
4587         (get_section_name): New function.
4588         (get_section_contents): New function.
4589         (update_section_order): New function.
4590         (allow_section_ordering): New function.
4591         (Plugin::load): Add the new interfaces to the transfer vector.
4592         (Plugin_manager::load_plugins): New parameter.
4593         (Plugin_manager::all_symbols_read): New parameter.
4594         (Plugin_manager::claim_file): New parameter. Save the elf object for
4595         unclaimed objects.
4596         (Plugin_manager::get_elf_object): New function.
4597         (Plugin_manager::get_view): Change to directly use the bool to check
4598         if get_view is called from claim_file_hook.
4599         * plugin.h (input_objects): New function
4600         (Plugin__manager::load_plugins): New parameter.
4601         (Plugin_manager::claim_file): New parameter.
4602         (Plugin_manager::get_elf_object): New function.
4603         (Plugin_manager::in_claim_file_handler): New function.
4604         (Plugin_manager::in_claim_file_handler_): New member.
4605         (layout): New function.
4606         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4607         handler with an extra parameter. Make the elf object before calling
4608         claim_file handler.
4609         * testsuite/plugin_test.c (get_section_count): New function pointer.
4610         (get_section_type): New function pointer.
4611         (get_section_name): New function pointer.
4612         (get_section_contents): New function pointer.
4613         (update_section_order): New function pointer.
4614         (allow_section_ordering): New function pointer.
4615         (onload): Check if the new interfaces exist.
4616
4617 2011-07-13  Ian Lance Taylor  <iant@google.com>
4618
4619         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4620         relro section.
4621         * x86_64.cc (Target_x86_64::got_section): Likewise.
4622         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4623         (relro_now_test_SOURCES): New variable.
4624         (relro_now_test_DEPENDENCIES): New variable.
4625         (relro_now_test_LDFLAGS): New variable.
4626         (relro_now_test_LDADD): New variable.
4627         (relro_now_test.so): New target.
4628         * testsuite/Makefile.in: Rebuild.
4629
4630 2011-07-12  Ian Lance Taylor  <iant@google.com>
4631
4632         PR gold/12980
4633         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4634         GLOB_DAT relocation rather than a RELATIVE relocation for a
4635         protected symbol when creating a shared library.
4636         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4637         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4638         * testsuite/protected_main_1.cc (main): Test that protected
4639         function has same address.
4640
4641 2011-07-11  Ian Lance Taylor  <iant@google.com>
4642
4643         PR gold/12979
4644         * options.h (class General_options): Add -Bgroup.
4645         * options.cc (General_options::finalize): If -Bgroup is set,
4646         default to --unresolved-symbols=report-all.
4647         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4648         * target-reloc.h (issue_undefined_symbol_error): Handle
4649         --unresolved-symbols=report-all.
4650
4651 2011-07-08  Ian Lance Taylor  <iant@google.com>
4652
4653         PR gold/11985
4654         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4655         if linker script discards key sections.
4656         (Layout::create_dynamic_symtab): Likewise.
4657         (Layout::assign_local_dynsym_offsets): Likewise.
4658         (Layout::sized_create_version_sections): Likewise.
4659         (Layout::create_interp): Likewise.
4660         (Layout::finish_dynamic_section): Likewise.
4661         (Layout::set_dynamic_symbol_size): Likewise.
4662
4663 2011-07-08  Ian Lance Taylor  <iant@google.com>
4664
4665         PR gold/12386
4666         * options.h (class General_options): Add --unresolved-symbols.
4667         * target-reloc.h (issue_undefined_symbol_error): Check
4668         --unresolved-symbols.  Add comments.
4669
4670 2011-07-08  Ian Lance Taylor  <iant@google.com>
4671
4672         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4673         expression more complex.
4674
4675 2011-07-08  Ian Lance Taylor  <iant@google.com>
4676
4677         PR gold/11317
4678         * target-reloc.h (issue_undefined_symbol_error): New inline
4679         function, broken out of relocate_section.
4680         (relocate_section): Call issue_undefined_symbol_error.
4681         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4682         there is no TLS segment if we are about to issue an undefined
4683         symbol error.
4684         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4685
4686 2011-07-08  Ian Lance Taylor  <iant@google.com>
4687
4688         PR gold/12279
4689         * resolve.cc (Symbol_table::should_override): Add fromtype
4690         parameter.  Change all callers.  Give error when linking together
4691         TLS and non-TLS symbol.
4692         (Symbol_table::should_override_with_special): Add fromtype
4693         parameter.  Change all callers.
4694         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4695         there is no TLS segment if we have reported some errors.
4696         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4697
4698 2011-07-08  Ian Lance Taylor  <iant@google.com>
4699
4700         PR gold/12372
4701         * target.h (Target::plt_address_for_global): New function.
4702         (Target::plt_address_for_local): New function.
4703         (Target::plt_section_for_global): Remove.
4704         (Target::plt_section_for_local): Remove.
4705         (Target::do_plt_address_for_global): New virtual function.
4706         (Target::do_plt_address_for_local): New virtual function.
4707         (Target::do_plt_section_for_global): Remove.
4708         (Target::do_plt_section_for_local): Remove.
4709         (Target::register_global_plt_entry): Add Symbol_table and Layout
4710         parameters.
4711         * output.cc (Output_data_got::Got_entry::write): Use
4712         plt_address_for_global and plt_address_for_local.
4713         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4714         address of output section.
4715         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4716         got_irelative_, and irelative_count_ fields.  Update
4717         declarations.
4718         (Output_data_plt_i386::has_irelative_section): New function.
4719         (Output_data_plt_i386::entry_count): Add irelative_count_.
4720         (Output_data_plt_i386::set_final_data_size): Likewise.
4721         (class Target_i386): Add got_irelative_ and rel_irelative_
4722         fields.  Update declarations.
4723         (Target_i386::Target_i386): Initialize new fields.
4724         (Target_i386::do_plt_address_for_global): New function replacing
4725         do_plt_section_for_global.
4726         (Target_i386::do_plt_address_for_local): New function replacing
4727         do_plt_section_for_local.
4728         (Target_i386::got_section): Create got_irelative_.
4729         (Target_i386::rel_irelative_section): New function.
4730         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4731         fields.  Don't define __rel_iplt_{start,end}.
4732         (Output_data_plt_i386::add_entry): Add symtab and layout
4733         parameters.  Change all callers.  Use different PLT and GOT for
4734         IFUNC symbols.
4735         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4736         layout parameters.  Change all callers.  Use different PLT and
4737         GOT.
4738         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4739         (Output_data_plt_i386::rel_irelative): New function.
4740         (Output_data_plt_i386::address_for_global): New function.
4741         (Output_data_plt_i386::address_for_local): New function.
4742         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4743         IRELATIVE GOT when changing IFUNC GOT entries.
4744         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4745         reloc.
4746         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4747         if we didn't create an IRELATIVE GOT.
4748         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4749         plt_address_for_local.
4750         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4751         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4752         got_irelative_, and irelative_count_ fields.  Update
4753         declarations.
4754         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4755         Initialize new fields.  Remove symtab parameter.  Change all
4756         callers.
4757         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4758         irelative_count_.
4759         (Output_data_plt_x86_64::has_irelative_section): New function.
4760         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4761         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4762         fields.  Update declarations.
4763         (Target_x86_64::Target_x86_64): Initialize new fields.
4764         (Target_x86_64::do_plt_address_for_global): New function replacing
4765         do_plt_section_for_global.
4766         (Target_x86_64::do_plt_address_for_local): New function replacing
4767         do_plt_section_for_local.
4768         (Target_x86_64::got_section): Create got_irelative_.
4769         (Target_x86_64::rela_irelative_section): New function.
4770         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4771         all callers.  Don't create __rel_iplt_{start,end}.
4772         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4773         parameters.  Change all callers.  Use different PLT and GOT for
4774         IFUNC symbols.
4775         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4776         layout parameters.  Change all callers.  Use different PLT and
4777         GOT.
4778         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4779         parameters.  Change all callers.  Use different PLT and GOT for
4780         IFUNC symbols.
4781         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4782         (Output_data_plt_x86_64::rela_irelative): New function.
4783         (Output_data_plt_x86_64::address_for_global): New function.
4784         (Output_data_plt_x86_64::address_for_local): New function.
4785         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4786         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4787         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4788         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4789         parameters.
4790         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4791         reloc.
4792         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4793         symbols if we didn't create an IRELATIVE GOT.
4794         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4795         plt_address_for_local.
4796         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4797         * testsuite/ifuncvar1.c: New test file.
4798         * testsuite/ifuncvar2.c: New test file.
4799         * testsuite/ifuncvar3.c: New test file.
4800         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4801         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4802         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4803         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4804         * testsuite/Makefile.in: Rebuild.
4805
4806 2011-07-07  Cary Coutant  <ccoutant@google.com>
4807
4808         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4809         (two_file_test_1_ndebug.o): Likewise.
4810         (two_file_test_1b_ndebug.o): Likewise.
4811         (two_file_test_2_ndebug.o): Likewise.
4812         (two_file_test_main_ndebug.o): Likewise.
4813         (incremental_test_2): Link with no-debug versions.
4814
4815 2011-07-06  Cary Coutant  <ccoutant@google.com>
4816
4817         * gold/incremental.cc
4818         (Output_section_incremental_inputs::write_info_blocks): Check for
4819         hidden and internal symbols.
4820
4821 2011-07-06  Cary Coutant  <ccoutant@google.com>
4822
4823         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4824         Check disposition for startup file.
4825         (Incremental_inputs::report_command_line): Ignore
4826         --incremental-startup-unchanged option.
4827         * options.cc (General_options::parse_incremental_startup_unchanged):
4828         New function.
4829         (General_options::General_options): Initialize new data member.
4830         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4831         (General_options): Add --incremental-startup-unchanged option.
4832         (General_options::incremental_startup_disposition): New function.
4833         (General_options::incremental_startup_disposition_): New data member.
4834
4835 2011-07-06  Cary Coutant  <ccoutant@google.com>
4836
4837         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4838         input file index to Script_info ctor.
4839         (Sized_incremental_binary::do_file_has_changed): Find the
4840         command-line argument for files named in scripts.
4841         * incremental.h (Script_info::Script_info): New ctor
4842         with input file index.
4843         (Script_info::input_file_index): New function.
4844         (Script_info::input_file_index_): New data member.
4845         (Incremental_binary::get_library): Add const.
4846         (Incremental_binary::get_script_info): Add const.
4847         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4848         * testsuite/Makefile.am (incremental_test_5): New test case.
4849         (incremental_test_6): New test case.
4850         * testsuite/Makefile.in: Regenerate.
4851
4852 2011-07-06  Cary Coutant  <ccoutant@google.com>
4853
4854         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4855         debug output when command lines differ.
4856
4857 2011-07-06  Cary Coutant  <ccoutant@google.com>
4858
4859         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4860         --incremental-patch option.
4861         * layout.cc (Free_list::allocate): Extend allocation beyond original
4862         end if enabled.
4863         (Layout::make_output_section): Mark sections that should get
4864         patch space.
4865         * options.cc (parse_percent): New function.
4866         * options.h (parse_percent): New function.
4867         (DEFINE_percent): New macro.
4868         (General_options): Add --incremental-patch option.
4869         * output.cc (Output_section::Output_section): Initialize new data
4870         members.
4871         (Output_section::add_input_section): Print section name when out
4872         of patch space.
4873         (Output_section::add_output_section_data): Likewise.
4874         (Output_section::set_final_data_size): Add patch space when
4875         doing --incremental-full.
4876         (Output_section::do_reset_address_and_file_offset): Remove patch
4877         space.
4878         (Output_segment::set_section_list_addresses): Print debug output
4879         only if --incremental-update.
4880         * output.h (Output_section::set_is_patch_space_allowed): New function.
4881         (Output_section::is_patch_space_allowed_): New data member.
4882         (Output_section::patch_space_): New data member.
4883         * parameters.cc (Parameters::incremental_full): New function.
4884         * parameters.h (Parameters::incremental_full): New function
4885         * testsuite/Makefile.am (incremental_test_2): Add test for
4886         --incremental-patch option.
4887         * testsuite/Makefile.in: Regenerate.
4888         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4889         (t18): Remove function body.
4890
4891 2011-07-05  Doug Kwan  <dougkwan@google.com>
4892
4893         PR gold/12771
4894         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4895         Arm_Address type for relocation result.
4896         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4897         overflow check.
4898         (Arm_relocate_functions::abs32): Use unaligned access.
4899         (Arm_relocate_functions::rel32): Ditto.
4900         (Arm_relocate_functions::prel31): Ditto.
4901         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4902         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4903         static data relocations.
4904         * testsuite/Makefile.in: Regnerate.
4905         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4906
4907 2011-07-05  Ian Lance Taylor  <iant@google.com>
4908
4909         PR gold/12392
4910         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4911         symbols if necessary.
4912         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4913
4914 2011-07-05  Ian Lance Taylor  <iant@google.com>
4915
4916         PR gold/12952
4917         * resolve.cc (Symbol::override_base_with_special): Simply override
4918         version with special symbol version, ignoring previous version.
4919
4920 2011-07-05  Ian Lance Taylor  <iant@google.com>
4921
4922         * object.cc (Sized_relobj_file::include_section_group): Add
4923         information to comment about signature location.
4924
4925 2011-07-02  Ian Lance Taylor  <iant@google.com>
4926
4927         PR gold/12957
4928         * options.h (class General_options): Add -f and -F.
4929         * options.cc (General_options::finalize): Fatal error if -f/-F
4930         are used without -shared.
4931         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4932
4933 2011-07-02  Ian Lance Taylor  <iant@google.com>
4934
4935         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4936
4937 2011-07-01  Ian Lance Taylor  <iant@google.com>
4938
4939         PR gold/12525
4940         PR gold/12952
4941         * resolve.cc (Symbol::override_base_with_special): Don't override
4942         the version if the overriding symbol has a different name.
4943         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4944         all callers.  If we give an error about an undefined version,
4945         define the base version if necessary.
4946         * dynobj.h (class Versions): Update declaration.
4947         * testsuite/weak_alias_test_5.cc: New file.
4948         * testsuite/weak_alias_test.script: New file.
4949         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4950         and versioned_alias have the right value, and call t2.
4951         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4952         weak_alias_test_5.so.
4953         (weak_alias_test_LDADD): Likewise.
4954         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4955         * testsuite/Makefile.in: Rebuild.
4956
4957 2011-07-01  Ian Lance Taylor  <iant@google.com>
4958
4959         PR gold/12525
4960         * options.h (class General_options): Support -z notext.
4961         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4962         -Wl,-z,notext.
4963         (two_file_shared_nonpic.so): Likewise.
4964         (two_file_shared_mixed.so): Likewise.
4965         (two_file_shared_mixed_1.so): Likewise.
4966         (weak_undef_lib_nonpic.so): Likewise.
4967         (alt/weak_undef_lib_nonpic.so): Likewise.
4968         (tls_test_shared_nonpic.so): Likewise.
4969         * testsuite/Makefile.in: Rebuild.
4970
4971 2011-07-01  Ian Lance Taylor  <iant@google.com>
4972
4973         PR gold/12525
4974         * configure.ac: Test whether static linking works, setting
4975         the automake conditional HAVE_STATIC.
4976         * testsuite/Makefile.am: Disable tests using -static if
4977         HAVE_STATIC is not true.
4978         * configure, testsuite/Makefile.in: Rebuild.
4979
4980 2011-07-01  Ian Lance Taylor  <iant@google.com>
4981
4982         PR gold/12525
4983         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4984         Assert if we see DW_EH_PE_indirect.
4985         * target.h (Target::ehframe_datarel_base): New function.
4986         (Target::do_ehframe_datarel_base): New target function.
4987         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4988         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4989         function.
4990
4991 2011-07-01  Ian Lance Taylor  <iant@google.com>
4992
4993         PR gold/12571
4994         * options.h (class General_options): Add
4995         --ld-generated-unwind-info.
4996         * ehframe.cc (Fde::write): Add address parameter.  Change all
4997         callers.  If associated with PLT, fill in address and size.
4998         (Cie::set_output_offset): Only add merge mapping if there is an
4999         object.
5000         (Cie::write): Add address parameter.  Change all callers.
5001         (Eh_frame::add_ehframe_for_plt): New function.
5002         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
5003         input_offset_ fields into union u_, with new plt field.
5004         (Fde::Fde): Adjust for new union field.
5005         (Fde::Fde) [Output_data version]: New constructor.
5006         (Fde::add_mapping): Only add merge mapping if there is an object.
5007         (class Cie): Update declarations.
5008         (class Eh_frame): Declare add_ehframe_for_plt.
5009         * layout.cc (Layout::layout_eh_frame): Break out code into
5010         make_eh_frame_section, and call it.
5011         (Layout::make_eh_frame_section): New function.
5012         (Layout::add_eh_frame_for_plt): New function.
5013         * layout.h (class Layout): Update declarations.
5014         * merge.cc (Merge_map::add_mapping): Add assertion.
5015         * i386.cc: Include "dwarf.h".
5016         (class Output_data_plt_i386): Make first_plt_entry,
5017         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
5018         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5019         and plt_eh_frame_fde.
5020         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
5021         boundary.  Call add_eh_frame_for_plt if appropriate.
5022         * x86_64.cc: Include "dwarf.h".
5023         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
5024         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
5025         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
5026         and plt_eh_frame_fde.
5027         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
5028         appropriate.
5029
5030 2011-06-29  Ian Lance Taylor  <iant@google.com>
5031
5032         PR gold/12629
5033         * object.cc (Sized_relobj_file::layout_section): Change shdr
5034         parameter to be const.
5035         (Sized_relobj_file::layout_eh_frame_section): New function, broken
5036         out of do_layout.
5037         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
5038         appropriate.  Call layout_eh_frame_section.
5039         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
5040         sections.
5041         * object.h (class Sized_relobj_file): Update declarations.
5042
5043 2011-06-29  Ian Lance Taylor  <iant@google.com>
5044
5045         PR gold/12652
5046         * script.cc (Token::integer_value): Accept trailing M/m/K/k
5047         modifier.
5048         (Lex::gather_token): Accept trailing M/m/K/k for integers.
5049
5050 2011-06-29  Ian Lance Taylor  <iant@google.com>
5051
5052         PR gold/12675
5053         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
5054         SHT_X86_64_UNWIND.
5055         * layout.cc (Layout::layout_eh_frame): Likewise.
5056
5057 2011-06-29  Ian Lance Taylor  <iant@google.com>
5058
5059         PR gold/12695
5060         * layout.cc (Layout::symtab_section_shndx): New function.
5061         * layout.h (class Layout): Declare symtab_section_shndx.
5062         * output.cc (Output_section::write_header): Call it.
5063
5064 2011-06-29  Ian Lance Taylor  <iant@google.com>
5065
5066         PR gold/12818
5067         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
5068         symbols which are not used in a relocation.
5069
5070 2011-06-28  Ian Lance Taylor  <iant@google.com>
5071
5072         PR gold/12898
5073         * layout.cc (Layout::segment_precedes): Don't crash if a linker
5074         script create indistinguishable segments.
5075         (Layout::set_segment_offsets): Use stable_sort when sorting
5076         segments.  Pass this to Compare_segments constructor.
5077         * layout.h (class Layout): Make segment_precedes non-static.
5078         (class Compare_segments): Change from struct to class.  Add
5079         layout_ field.  Add constructor.
5080         * script-sections.cc
5081         (Script_sections::attach_sections_using_phdrs_clause): Rename
5082         local orphan to is_orphan.  Don't report failure to put empty
5083         section in segment.  On attachment failure, report name of
5084         section, and attach to first PT_LOAD segment.
5085
5086 2011-06-28  Ian Lance Taylor  <iant@google.com>
5087
5088         PR gold/12934
5089         * target-select.cc (Target_selector::Target_selector): Add
5090         emulation parameter.  Change all callers.
5091         (select_target_by_bfd_name): Rename from select_target_by_name.
5092         Change all callers.
5093         (select_target_by_emulation): New function.
5094         (supported_emulation_names): New function.
5095         * target-select.h (class Target_selector): Add emulation_ field.
5096         Update declarations.
5097         (Target_selector::recognize_by_bfd_name): Rename from
5098         recognize_by_name.  Change all callers.
5099         (Target_selector::supported_bfd_names): Rename from
5100         supported_names.  Change all callers.
5101         (Target_selector::recognize_by_emulation): New function.
5102         (Target_selector::supported_emulations): New function.
5103         (Target_selector::emulation): New function.
5104         (Target_selector::do_recognize_by_bfd_name): Rename from
5105         do_recognize_by_name.  Change all callers.
5106         (Target_selector::do_supported_bfd_names): Rename from
5107         do_supported_names.  Change all callers.
5108         (Target_selector::do_recognize_by_emulation): New function.
5109         (Target_selector::do_supported_emulations): New function.
5110         (select_target_by_bfd_name): Change name in declaration.
5111         (select_target_by_emulation): Declare.
5112         (supported_emulation_names): Declare.
5113         * parameters.cc (parameters_force_valid_target): Try to find
5114         target based on emulation from -m option.
5115         * options.h (class General_options): Change doc string for -m.
5116         * options.cc (help): Print emulations.
5117         (General_options::parse_V): Likewise.
5118         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
5119         Add emulation parameter.  Change all callers.
5120
5121 2011-06-28  Ian Lance Taylor  <iant@google.com>
5122
5123         * target.h (class Target): Add osabi_ field.
5124         (Target::osabi): New function.
5125         (Target::set_osabi): New function.
5126         (Target::Target): Initialize osabi_.
5127         (Target::do_adjust_elf_header): Make pure virtual.
5128         (Sized_target::do_adjust_elf_header): Declare.
5129         * target.cc (Sized_target::do_adjust_elf_header): New function.
5130         (class Sized_target): Instantiate all versions.
5131         * freebsd.h (class Target_freebsd): Remove.
5132         (Target_selector_freebsd::do_recognize): Call set_osabi on
5133         Target.
5134         (Target_selector_freebsd::do_recognize_by_name): Likewise.
5135         (Target_selector_freebsd::set_osabi): Remove.
5136         * i386.cc (class Target_i386): Inherit from Sized_target rather
5137         than Target_freebsd.
5138         * x86_64.cc (class Target_x86_64): Likewise.
5139
5140 2011-06-28  Ian Lance Taylor  <iant@google.com>
5141
5142         * target.h (Target::can_check_for_function_pointers): Rewrite.
5143         Make non-virtual.
5144         (Target::can_icf_inline_merge_sections): Likewise.
5145         (Target::section_may_have_icf_unsafe_poineters): Likewise.
5146         (Target::Target_info): Add can_icf_inline_merge_sections field.
5147         (Target::do_can_check_for_function_pointers): New virtual
5148         function.
5149         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
5150         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
5151         from can_check_for_function_pointers, move in file.
5152         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
5153         section_may_have_icf_unsafe_poineters, move in file.
5154         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
5155         * i386.cc (Target_i386::do_can_check_for_function_pointers):
5156         Rename from can_check_for_function_pointers, move in file.
5157         (Target_i386::can_icf_inline_merge_sections): Remove.
5158         (Target_i386::i386_info): Initialize
5159         can_icf_inline_merge_sections.
5160         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
5161         Initialize can_icf_inline_merge_sections.
5162         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5163         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5164         Rename from can_check_for_function_pointers, move in file.
5165         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5166         (Target_x86_64::x86_64_info): Initialize
5167         can_icf_inline_merge_sections.
5168         * testsuite/testfile.cc (Target_test::test_target_info):
5169         Likewise.
5170         * icf.cc (get_section_contents): Correct formatting.
5171
5172 2011-06-27  Ian Lance Taylor  <iant@google.com>
5173
5174         * symtab.cc (Symbol::versioned_name): New function.
5175         (Symbol_table::add_to_final_symtab): Use versioned_name when
5176         appropriate.
5177         (Symbol_table::sized_write_symbol): Likewise.
5178         * symtab.h (class Symbol): Declare versioned_name.
5179         * stringpool.h (class Stringpool_template): Add variant of add
5180         which takes a std::basic_string.
5181         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5182         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5183         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5184         (ver_test_12.o): New target.
5185         * testsuite/Makefile.in: Rebuild.
5186
5187 2011-06-27  Doug Kwan  <dougkwan@google.com>
5188
5189         * arm.cc (Arm_relocate_functions::thm_jump8,
5190         Arm_relocate_functions::thm_jump11): Use a wider signed
5191         type to compute offset.
5192         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5193         arm_thm_jump8.
5194         * testsuite/Makefile.in: Regenerate.
5195         * testsuite/arm_branch_in_range.sh: Check test results of
5196         arm_thm_jump11 and arm_thm_jump8.
5197         * testsuite/arm_thm_jump11.s: New test source file.
5198         * testsuite/arm_thm_jump11.t: New linker script.
5199         * testsuite/arm_thm_jump8.s: New test source file.
5200         * testsuite/arm_thm_jump8.t: New linker script.
5201
5202 2011-06-24  Ian Lance Taylor  <iant@google.com>
5203
5204         * layout.cc: Include "object.h".
5205         (ctors_sections_in_init_array): New static variable.
5206         (Layout::is_ctors_in_init_array): New function.
5207         (Layout::layout): Add entry to ctors_sections_in_init_array if
5208         appropriate.
5209         * layout.h (class Layout): Declare is_ctors_in_init_array.
5210         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5211         is_ctors_reverse_view is set.
5212         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5213         all callers.  Set is_ctors_reverse_view field of View_size.
5214         (Sized_relobj_file::reverse_words): New function.
5215         * object.h (Sized_relobj_file::View_size): Add
5216         is_ctors_reverse_view field.
5217         (class Sized_relobj_file): Update declarations.
5218         * testsuite/initpri3.c: New test.
5219         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5220         initpri3b.
5221         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5222         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5223         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5224         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5225         * testsuite/Makefile.in: Rebuild.
5226
5227 2011-06-24  Cary Coutant  <ccoutant@google.com>
5228
5229         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5230         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5231         (debug_msg_cdebug.err): New targets.
5232         * testsuite/Makefile.in: Regenerate.
5233         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5234         Fix checks for link with shared library.
5235
5236 2011-06-24  Doug Kwan  <dougkwan@google.com>
5237
5238         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5239         skip empty text sections.
5240         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5241
5242 2011-06-22  Ian Lance Taylor  <iant@google.com>
5243
5244         PR gold/12910
5245         * options.h (class General_options): Add --ctors-in-init-array.
5246         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5247         friends as SHT_PROGBITS for merging sections.
5248         (Layout::layout): Remove special handling of .init_array and
5249         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5250         and .dtors if ctors_in_init_array.
5251         (Layout::make_output_section): Force correct section types for
5252         .init_array and friends.  Don't sort if doing relocatable link,
5253         Don't sort .ctors and .dtors if ctors_in_init_array.
5254         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5255         (Layout::output_section_name): Add relobj parameter.  Change all
5256         callers.  Handle .ctors. and .dtors. in code rather than table.
5257         Handle .ctors and .dtors if ctors_in_init_array.
5258         (Layout::match_file_name): New function, moved from output.cc.
5259         * layout.h (class Layout): Update declarations.
5260         * output.cc: Include "layout.h".
5261         (Input_section_sort_entry::get_priority): New function.
5262         (Input_section_sort_entry::match_file_name): Just call
5263         Layout::match_file_name.
5264         (Output_section::Input_section_sort_init_fini_compare::operator()):
5265         Handle .ctors and .dtors.  Sort by explicit priority rather than
5266         by name.
5267         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5268         * testsuite/initpri2.c: New test.
5269         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5270         (check_PROGRAMS): Add initpri2.
5271         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5272         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5273         * configure, testsuite/Makefile.in: Rebuild.
5274
5275 2011-06-19  Ian Lance Taylor  <iant@google.com>
5276
5277         PR gold/12880
5278         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5279         .interp section to a PT_INTERP segment even if we have seen a
5280         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5281         clause in a linker script.
5282         (Layout::finalize): Don't create a .interp section if we've
5283         already create a PT_INTERP segment.
5284         (Layout::create_interp): Always call choose_output_section (revert
5285         patch of 2011-06-17).  Don't create PT_INTERP segment.
5286         * script-sections.cc
5287         (Script_sections::create_note_and_tls_segments): Add a .interp
5288         section to a PT_INTERP segment even if we have seen a
5289         --dynamic-linker option.
5290
5291 2011-06-18  Ian Lance Taylor  <iant@google.com>
5292
5293         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5294         merely because a non-PT_LOAD segment has a dynamic reloc.
5295
5296 2011-06-18  Ian Lance Taylor  <iant@google.com>
5297
5298         * layout.cc (Layout::finish_dynamic_section): Don't create
5299         DT_FLAGS entry if not needed.
5300
5301 2011-06-18  Ian Lance Taylor  <iant@google.com>
5302
5303         PR gold/12745
5304         * layout.cc (Layout::layout_eh_frame): Correct handling of
5305         writable .eh_frame section.
5306
5307 2011-06-17  Ian Lance Taylor  <iant@google.com>
5308
5309         PR gold/12893
5310         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5311         symbol is redefined with the exact same object and value.
5312
5313 2011-06-17  Ian Lance Taylor  <iant@google.com>
5314
5315         PR gold/12880
5316         * layout.h (class Layout): Add interp_segment_ field.
5317         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5318         (Layout::attach_allocated_section_to_segment): If making shared
5319         library, put .interp section in PT_INTERP segment.
5320         (Layout::finalize): Also call create_interp if -dynamic-linker
5321         option was used.
5322         (Layout::create_interp): Assert that there is no PT_INTERP
5323         segment.  If not using a SECTIONS clause, use make_output_section.
5324         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5325         * script-sections.cc
5326         (Script_sections::create_note_and_tls_segments): If making shared
5327         library, put .interp section in PT_INTERP segment.
5328
5329 2011-06-17  Ian Lance Taylor  <iant@google.com>
5330
5331         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5332         when making a shared library.
5333
5334 2011-06-17  Ian Lance Taylor  <iant@google.com>
5335
5336         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5337         parameter.  Change all callers.  Don't issue warning about PC32
5338         against locally defined symbol.
5339
5340 2011-06-16  Ian Lance Taylor  <iant@google.com>
5341
5342         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5343         occurs in same object.
5344
5345 2011-06-14  Alan Modra  <amodra@gmail.com>
5346
5347         * po/POTFILES.in: Regenerate.
5348
5349 2011-06-09  Ian Lance Taylor  <iant@google.com>
5350
5351         * script-sections.cc
5352         (Orphan_output_section::set_section_addresses): For a relocatable
5353         link set address to 0.
5354
5355 2011-06-09  Cary Coutant  <ccoutant@google.com>
5356
5357         PR gold/12804
5358         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5359         used with --compress-debug-sections.
5360         * gold/object.cc (Sized_relobj_file::do_layout): Report
5361         uncompressed size of compressed input sections.
5362
5363 2011-06-08  Cary Coutant  <ccoutant@google.com>
5364
5365         PR gold/12804
5366         * testsuite/two_file_test_2_v1.cc: Change initialization of
5367         v2 to keep it in .data.
5368
5369 2011-06-07  Cary Coutant  <ccoutant@google.com>
5370
5371         * common.cc (Symbol_table::do_allocate_commons_list): Call
5372         gold_fallback.
5373         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5374         (Errors::fallback): New function.
5375         (gold_fallback): New function.
5376         * errors.h (Errors::fallback): New function.
5377         * gold.cc (gold_exit): Change status parameter to enum; adjust
5378         all callers.
5379         (queue_initial_tasks): Call gold_fallback.
5380         * gold.h: Include cstdlib.
5381         (Exit_status): New enum type.
5382         (gold_exit): Change status parameter to enum.
5383         (gold_fallback): New function.
5384         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5385         (Layout::create_symtab_sections): Likewise.
5386         (Layout::create_shdrs): Likewise.
5387         * main.cc (main): Adjust call to gold_exit.
5388         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5389         (Output_data_got::add_got_entry_pair): Likewise.
5390         (Output_section::add_input_section): Likewise.
5391         (Output_section::add_output_section_data): Likewise.
5392         (Output_segment::set_section_list_addresses): Likewise.
5393         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5394
5395 2011-06-07  Cary Coutant  <ccoutant@google.com>
5396
5397         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5398         for incremental links.
5399         * output.cc (Output_segment::set_section_list_addresses): Remove
5400         FIXME and test for TLS or BSS.
5401
5402 2011-06-07  Cary Coutant  <ccoutant@google.com>
5403
5404         * testsuite/Makefile.am: Add incremental_copy_test,
5405         incremental_common_test_1.
5406         * testsuite/Makefile.in: Regenerate.
5407         * testsuite/common_test_1_v1.c: New source file.
5408         * testsuite/common_test_1_v2.c: New source file.
5409         * testsuite/copy_test_v1.cc: New source file.
5410
5411 2011-06-07  Cary Coutant  <ccoutant@google.com>
5412
5413         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5414         update, allocate common from bss section's free list.
5415         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5416         linker-defined symbols.
5417         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5418         Skip GOT and PLT entries that are no longer referenced.
5419         (Output_section_incremental_inputs::write_info_blocks): Mark
5420         linker-defined symbols.
5421         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5422         * output.cc (Output_section::allocate): New function.
5423         * output.h (Output_section::allocate): New function.
5424         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5425         linker-defined symbols.
5426         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5427         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5428         (Symbol::init_base_output_data): Likewise.
5429         (Symbol::init_base_output_segment): Likewise.
5430         (Symbol::init_base_constant): Likewise.
5431         (Sized_symbol::init_output_data): Likewise.
5432         (Sized_symbol::init_output_segment): Likewise.
5433         (Sized_symbol::init_constant): Likewise.
5434         (Symbol_table::do_define_in_output_data): Likewise.
5435         (Symbol_table::do_define_in_output_segment): Likewise.
5436         (Symbol_table::do_define_as_constant): Likewise.
5437         * symtab.h (Symbol::is_predefined): New function.
5438         (Symbol::init_base_output_data): Add is_predefined parameter.
5439         (Symbol::init_base_output_segment): Likewise.
5440         (Symbol::init_base_constant): Likewise.
5441         (Symbol::is_predefined_): New data member.
5442         (Sized_symbol::init_output_data): Add is_predefined parameter.
5443         (Sized_symbol::init_output_segment): Likewise.
5444         (Sized_symbol::init_constant): Likewise.
5445         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5446
5447 2011-06-07  Cary Coutant  <ccoutant@google.com>
5448
5449         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5450         instead of emit_copy_reloc.
5451         (Copy_relocs::emit_copy_reloc): Refactor.
5452         (Copy_relocs::make_copy_reloc): New function.
5453         (Copy_relocs::add_copy_reloc): Remove.
5454         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5455         section.
5456         (Copy_relocs::make_copy_reloc): New function.
5457         (Copy_relocs::add_copy_reloc): Remove.
5458         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5459         unchanged input files.
5460         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5461         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5462         Reserve BSS space for COPY relocations.
5463         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5464         (Output_section_incremental_inputs::write_info_blocks): Record
5465         whether a symbol is copied from a shared object.
5466         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5467         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5468         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5469         (Incremental_input_entry_reader::get_output_symbol_index): Add
5470         is_copy parameter.
5471         (Incremental_binary::emit_copy_relocs): New function.
5472         (Incremental_binary::do_emit_copy_relocs): New function.
5473         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5474         new data member.
5475         (Sized_incremental_binary::add_copy_reloc): New function.
5476         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5477         (Sized_incremental_binary::Copy_reloc): New struct.
5478         (Sized_incremental_binary::Copy_relocs): New typedef.
5479         (Sized_incremental_binary::copy_relocs_): New data member.
5480         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5481         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5482         * target.h (Sized_target::emit_copy_reloc): New function.
5483         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5484
5485 2011-06-02  Cary Coutant  <ccoutant@google.com>
5486
5487         PR gold/12163
5488         * gold/archive.cc (Archive::Archive): Initialize new data member.
5489         (Archive::include_all_members): Return if archive has already been
5490         included.
5491         * gold/archive.h (Archive::include_all_members_): New data member.
5492
5493 2011-06-02  Nick Clifton  <nickc@redhat.com>
5494
5495         * dynobj.h: Fix spelling mistake in comment.
5496         * output.cc: Likewise.
5497
5498 2011-05-31  Doug Kwan  <dougkwan@google.com>
5499             Asier Llano
5500
5501         PR gold/12826
5502         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5503         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5504         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5505         redundant arm_exidx_test.so.
5506         * testsuite/Makefile.in: Regenerate.
5507         (check_SCRIPTS): Add pr12826.sh
5508         (check_DATA): Add pr12826.stdout
5509         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5510         * testsuite/pr12826.sh: New file.
5511         * testsuite/pr12826_1.s: Ditto.
5512         * testsuite/pr12826_1.s: Ditto.
5513
5514 2011-05-30  Ian Lance Taylor  <iant@google.com>
5515
5516         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5517         sections.
5518
5519 2011-05-29  Ian Lance Taylor  <iant@google.com>
5520
5521         PR gold/12804
5522         * testsuite/Makefile.am: Use different file name for two_file_test
5523         temporary file for each incremental test.
5524         * testsuite/Makefile.in: Rebuild.
5525
5526 2011-05-29  Ian Lance Taylor  <iant@google.com>
5527
5528         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5529         binary input file is empty.
5530
5531 2011-05-27  Ian Lance Taylor  <iant@google.com>
5532
5533         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5534         (ver_test_9.so): Likewise.
5535         * testsuite/Makefile.in: Rebuild.
5536
5537 2011-05-26 Cary Coutant  <ccoutant@google.com>
5538
5539         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5540         * incremental.cc (Incremental_inputs::report_input_section): Fix
5541         comment, indentation.
5542         (Incremental_inputs::report_comdat_group): New function.
5543         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5544         of data for incremental input file entry.
5545         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5546         group count, COMDAT group signatures.
5547         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5548         an unchanged input file.
5549         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5550         Initialize new data member.
5551         (Incremental_object_entry::add_comdat_group): New function.
5552         (Incremental_object_entry::get_comdat_group_count): New function.
5553         (Incremental_object_entry::get_comdat_signature_key): New function.
5554         (Incremental_object_entry::groups_): New data member.
5555         (Incremental_inputs::report_comdat_group): New function.
5556         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5557         data for incremental input file entry.
5558         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5559         (Incremental_input_entry_reader::get_input_section): Adjust size of
5560         data for incremental input file entry.
5561         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5562         (Incremental_input_entry_reader::get_comdat_group_signature): New
5563         function.
5564         * object.cc (Sized_relobj::include_section_group): Report kept
5565         COMDAT groups for incremental links.
5566
5567 2011-05-24  David Meyer  <pdox@google.com>
5568
5569         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5570         with name parameter.  Add found_name parameter.
5571         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5572         * dirsearch.h (class Dirsearch): Update declaration.
5573
5574 2011-05-24  Ian Lance Taylor  <iant@google.com>
5575
5576         * archive.cc (Library_base::should_include_member): Pull in object
5577         from archive if it defines the entry symbol.
5578         * parameters.cc (Parameters::entry): New function.
5579         * parameters.h (class Parameters): Declare entry.
5580         * output.h (class Output_file_header): Remove entry_ field.
5581         * output.cc (Output_file_header::Output_file_header): Remove entry
5582         parameter.  Change all callers.
5583         (Output_file_header::entry): Use parameters->entry.
5584         * gold.cc (queue_middle_tasks): Likewise.
5585         * plugin.cc (Plugin_hook::run): Likewise.
5586
5587 2011-05-24 Cary Coutant  <ccoutant@google.com>
5588
5589         * gold.cc (queue_initial_tasks): Pass incremental base filename
5590         to Output_file::open_base_file; don't print error message.
5591         * incremental-dump.cc (main): Adjust call to
5592         Output_file::open_for_modification.
5593         * incremental-dump.cc (main): Likewise.
5594         * incremental.cc (Incremental_inputs::report_command_line):
5595         Ignore --incremental-base option when comparing command lines.
5596         Ignore parameter when given as separate argument.
5597         * options.h (class General_options): Add --incremental-base.
5598         * output.cc (Output_file::Output_file):
5599         (Output_file::open_base_file): Add base_name and writable parameters;
5600         read base file into new file; print error message here.
5601         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5602         callers.
5603         * output.h (Output_file::open_for_modification): Rename to...
5604         (Output_file::open_base_file): ...this; add base_name and
5605         writable parameters; adjust all callers.
5606         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5607         callers.
5608         * testsuite/Makefile.am (incremental_test_4): Test
5609         --incremental-base.
5610         * testsuite/Makefile.in: Regenerate.
5611
5612 2011-05-24 Cary Coutant  <ccoutant@google.com>
5613
5614         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5615         incremental_test_4.
5616         * testsuite/Makefile.in: Regenerate.
5617         * testsuite/two_file_test_1_v1.cc: New test source file.
5618         * testsuite/two_file_test_1b_v1.cc: New test source file.
5619         * testsuite/two_file_test_2_v1.cc: New test source file.
5620
5621 2011-05-24 Cary Coutant  <ccoutant@google.com>
5622
5623         * dynobj.h (Dynobj::do_dynobj): New function.
5624         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5625         flag and soname for shared objects.
5626         * incremental.cc (Incremental_inputs::report_object): Make
5627         either Incremental_object_entry or Incremental_dynobj_entry; add
5628         soname to string table.
5629         (Incremental_inputs::report_input_section): Add assertion.
5630         (Output_section_incremental_inputs::set_final_data_size): Adjust
5631         type of input file entry for shared libraries; adjust size of
5632         shared library info entry.
5633         (Output_section_incremental_inputs::write_input_files): Write
5634         as_needed flag for shared libraries.
5635         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5636         of input file entry for shared libraries; write soname.
5637         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5638         soname from incremental info.
5639         * incremental.h (enum Incremental_input_flags): Add
5640         INCREMENTAL_INPUT_AS_NEEDED.
5641         (Incremental_input_entry::Incremental_input_entry): Initialize new
5642         data member.
5643         (Incremental_input_entry::set_as_needed): New function.
5644         (Incremental_input_entry::as_needed): New function.
5645         (Incremental_input_entry::do_dynobj_entry): New function.
5646         (Incremental_input_entry::as_needed_): New data member.
5647         (Incremental_object_entry::Incremental_object_entry): Don't check
5648         for shared library.
5649         (Incremental_object_entry::do_type): Likewise.
5650         (class Incremental_dynobj_entry): New class.
5651         (Incremental_input_entry_reader::as_needed): New function.
5652         (Incremental_input_entry_reader::get_soname): New function.
5653         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5654         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5655         size of shared library info entry.
5656         * layout.cc (Layout::finish_dynamic_section): Don't test for
5657         incremental link when adding DT_NEEDED entries.
5658         * object.h (Object::Object): Initialize new data member.
5659         (Object::dynobj): New function.
5660         (Object::set_as_needed): New function.
5661         (Object::as_needed): New function.
5662         (Object::do_dynobj): New function.
5663         (Object::as_needed_): New data member.
5664
5665 2011-05-24 Cary Coutant  <ccoutant@google.com>
5666
5667         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5668         info; adjust display of GOT entries.
5669         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5670         vector of input objects; remove file_status_.
5671         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5672         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5673         got_plt reader; call target hooks to reserve GOT entries.
5674         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5675         of input file info header and GOT info entry.
5676         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5677         relocation info.
5678         (Got_plt_view_info::got_descriptor): Remove.
5679         (Got_plt_view_info::sym_index): New data member.
5680         (Got_plt_view_info::input_index): New data member.
5681         (Local_got_offset_visitor::visit): Write input file index.
5682         (Global_got_offset_visitor::visit): Write 0 for input file index.
5683         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5684         with sym_index and input_index.
5685         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5686         incremental info GOT entry; replace got_descriptor with input_index.
5687         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5688         map from input file index to object.
5689         (Sized_relobj_incr::do_layout): Replace direct data member reference
5690         with accessor function.
5691         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5692         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5693         Adjust size of input file info header.
5694         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5695         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5696         (Incremental_input_entry_reader::get_input_section): Adjust size of
5697         input file info header.
5698         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5699         of incremental info GOT entry.
5700         (Incremental_got_plt_reader::get_got_desc): Remove.
5701         (Incremental_got_plt_reader::get_got_symndx): New function.
5702         (Incremental_got_plt_reader::get_got_input_index): New function.
5703         (Sized_incremental_binary::Sized_incremental_binary): Remove
5704         file_status_; add input_objects_.
5705         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5706         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5707         (Sized_incremental_binary::file_is_unchanged): Remove.
5708         (Sized_incremental_binary::set_input_object): New function.
5709         (Sized_incremental_binary::input_object): New function.
5710         (Sized_incremental_binary::file_status_): Remove.
5711         (Sized_incremental_binary::input_objects_): New data member.
5712         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5713         references.
5714         (Sized_relobj_incr::invalid_address): Move to base class.
5715         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5716         class.
5717         (Sized_relobj_incr::do_output_section_offset): Likewise.
5718         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5719         (Sized_relobj_incr::section_offsets_): Likewise.
5720         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5721         function.
5722         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5723         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5724         with accessor function.
5725         (Sized_relobj_file::do_layout): Likewise.
5726         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5727         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5728         (Sized_relobj_file::compute_final_local_value): Replace refs to
5729         section_offsets_ with accessor function.
5730         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5731         * object.h (Relobj::Relobj): Initialize new data members.
5732         (Relobj::add_dyn_reloc): New function.
5733         (Relobj::first_dyn_reloc): New function.
5734         (Relobj::dyn_reloc_count): New function.
5735         (Relobj::first_dyn_reloc_): New data member.
5736         (Relobj::dyn_reloc_count_): New data member.
5737         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5738         references.
5739         (Sized_relobj::Address): New typedef.
5740         (Sized_relobj::invalid_address): Move here from child class.
5741         (Sized_relobj::Sized_relobj): Initialize new data members.
5742         (Sized_relobj::sized_relobj): New function.
5743         (Sized_relobj::is_output_section_offset_invalid): Move here from
5744         child class.
5745         (Sized_relobj::get_output_section_offset): Likewise.
5746         (Sized_relobj::local_has_got_offset): Likewise.
5747         (Sized_relobj::local_got_offset): Likewise.
5748         (Sized_relobj::set_local_got_offset): Likewise.
5749         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5750         (Sized_relobj::clear_got_offsets): New function.
5751         (Sized_relobj::section_offsets): Move here from child class.
5752         (Sized_relobj::do_output_section_offset): Likewise.
5753         (Sized_relobj::do_set_section_offset): Likewise.
5754         (Sized_relobj::Local_got_offsets): Likewise.
5755         (Sized_relobj::local_got_offsets_): Likewise.
5756         (Sized_relobj::section_offsets_): Likewise.
5757         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5758         references.
5759         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5760         class.
5761         (Sized_relobj_file::sized_relobj): New function
5762         (Sized_relobj_file::local_has_got_offset): Move to base class.
5763         (Sized_relobj_file::local_got_offset): Likewise.
5764         (Sized_relobj_file::set_local_got_offset): Likewise.
5765         (Sized_relobj_file::get_output_section_offset): Likewise.
5766         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5767         (Sized_relobj_file::do_output_section_offset): Likewise.
5768         (Sized_relobj_file::do_set_section_offset): Likewise.
5769         (Sized_relobj_file::Local_got_offsets): Likewise.
5770         (Sized_relobj_file::local_got_offsets_): Likewise.
5771         (Sized_relobj_file::section_offsets_): Likewise.
5772         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5773         (all constructors).
5774         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5775         (Output_reloc::get_symbol_index): Likewise.
5776         (Output_reloc::local_section_offset): Likewise.
5777         (Output_reloc::get_address): Likewise.
5778         (Output_reloc::symbol_value): Likewise.
5779         (Output_data_got::reserve_slot): Move to class definition.
5780         (Output_data_got::reserve_local): New function.
5781         (Output_data_got::reserve_slot_for_global): Remove.
5782         (Output_data_got::reserve_global): New function.
5783         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5784         (all constructors, two instantiations).
5785         (Output_reloc::get_relobj): New function (two instantiations).
5786         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5787         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5788         (Output_data_reloc::add_global): Adjust type of relobj.
5789         (Output_data_reloc::add_global_relative): Likewise.
5790         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5791         (Output_data_reloc::add_local): Likewise.
5792         (Output_data_reloc::add_local_relative): Likewise.
5793         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5794         (Output_data_reloc::add_local_section): Likewise.
5795         (Output_data_reloc::add_output_section): Likewise.
5796         (Output_data_reloc::add_absolute): Likewise.
5797         (Output_data_reloc::add_target_specific): Likewise.
5798         (Output_data_got::reserve_slot): Move definition here.
5799         (Output_data_got::reserve_local): New function.
5800         (Output_data_got::reserve_global): New function.
5801         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5802         section_offsets_ with accessor function.
5803         (Sized_relobj_file::write_sections): Likewise.
5804         (Sized_relobj_file::do_relocate_sections): Likewise.
5805         * target.h (Sized_target::reserve_local_got_entry): New function.
5806         (Sized_target::reserve_global_got_entry): New function.
5807         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5808         (Target_x86_64::reserve_global_got_entry): New function.
5809         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5810
5811 2011-05-23 Cary Coutant  <ccoutant@google.com>
5812
5813         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5814         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5815         bit when checking got_type.
5816         * incremental.cc (Sized_incremental_binary::setup_readers):
5817         Store symbol table and string table locations; initialize bit vector
5818         of file status flags.
5819         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5820         unchanged files.
5821         (Sized_incremental_binary::do_process_got_plt): New function.
5822         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5823         (Output_section_incremental_inputs::set_final_data_size): Record
5824         file index for each input file.
5825         (Output_section_incremental_inputs::write_got_plt): Store file index
5826         instead of input entry offset for each GOT entry.
5827         * incremental.h
5828         (Incremental_input_entry::Incremental_input_entry): Initialize new
5829         data member.
5830         (Incremental_input_entry::set_offset): Store file index.
5831         (Incremental_input_entry::get_file_index): New function.
5832         (Incremental_input_entry::file_index_): New data member.
5833         (Incremental_binary::process_got_plt): New function.
5834         (Incremental_binary::do_process_got_plt): New function.
5835         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5836         data members.
5837         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5838         (Sized_incremental_binary::set_file_is_unchanged): New function.
5839         (Sized_incremental_binary::file_is_unchanged): New function.
5840         (Sized_incremental_binary::do_process_got_plt): New function.
5841         (Sized_incremental_binary::file_status_): New data member.
5842         (Sized_incremental_binary::main_symtab_loc_): New data member.
5843         (Sized_incremental_binary::main_strtab_loc_): New data member.
5844         * output.cc (Output_data_got::Got_entry::write): Add case
5845         RESERVED_CODE.
5846         (Output_data_got::add_global): Call add_got_entry.
5847         (Output_data_got::add_global_plt): Likewise.
5848         (Output_data_got::add_global_with_rel): Likewise.
5849         (Output_data_got::add_global_with_rela): Likewise.
5850         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5851         (Output_data_got::add_global_pair_with_rela): Likewise.
5852         (Output_data_got::add_local): Call add_got_entry.
5853         (Output_data_got::add_local_plt): Likewise.
5854         (Output_data_got::add_local_with_rel): Likewise.
5855         (Output_data_got::add_local_with_rela): Likewise.
5856         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5857         (Output_data_got::add_local_pair_with_rela): Likewise.
5858         (Output_data_got::reserve_slot): New function.
5859         (Output_data_got::reserve_slot_for_global): New function.
5860         (Output_data_got::add_got_entry): New function.
5861         (Output_data_got::add_got_entry_pair): New function.
5862         (Output_section::add_output_section_data): Edit FIXME.
5863         * output.h
5864         (Output_section_data_build::Output_section_data_build): New
5865         constructor with size parameter.
5866         (Output_data_space::Output_data_space): Likewise.
5867         (Output_data_got::Output_data_got): Initialize new data member; new
5868         constructor with size parameter.
5869         (Output_data_got::add_constant): Call add_got_entry.
5870         (Output_data_got::reserve_slot): New function.
5871         (Output_data_got::reserve_slot_for_global): New function.
5872         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5873         (Output_data_got::add_got_entry): New function.
5874         (Output_data_got::add_got_entry_pair): New function.
5875         (Output_data_got::free_list_): New data member.
5876         * target.h (Sized_target::init_got_plt_for_update): New function.
5877         (Sized_target::register_global_plt_entry): New function.
5878         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5879         Initialize new data member; call init; add constructor with PLT count.
5880         (Output_data_plt_x86_64::init): New function.
5881         (Output_data_plt_x86_64::add_relocation): New function.
5882         (Output_data_plt_x86_64::reserve_slot): New function.
5883         (Output_data_plt_x86_64::free_list_): New data member.
5884         (Target_x86_64::init_got_plt_for_update): New function.
5885         (Target_x86_64::register_global_plt_entry): New function.
5886         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5887         incremental updates.
5888         (Output_data_plt_x86_64::add_relocation): New function.
5889         * testsuite/object_unittest.cc (Object_test): Set default options.
5890
5891 2011-05-16  Ian Lance Taylor  <iant@google.com>
5892
5893         * options.h (class General_options): Make -i a synonym for -r.
5894
5895 2011-05-16  Ian Lance Taylor  <iant@google.com>
5896
5897         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5898
5899 2011-05-10 Cary Coutant  <ccoutant@google.com>
5900
5901         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5902         strip_all (-s).
5903
5904 2011-05-06  Ian Lance Taylor  <iant@google.com>
5905
5906         * layout.cc (Layout::layout): If the output section flags change,
5907         update the ordering.
5908
5909 2011-04-25 Cary Coutant  <ccoutant@google.com>
5910
5911         * incremental-dump.cc (dump_incremental_inputs): Print local
5912         symbol info for each input file.
5913         * incremental.cc
5914         (Output_section_incremental_inputs::set_final_data_size): Add local
5915         symbol info to input file entries in incremental info.
5916         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5917         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5918         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5919         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5920         implementation.
5921         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5922         (Sized_incr_relobj::do_relocate): Write the local symbols.
5923         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5924         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5925         Adjust size of input file header.
5926         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5927         (Incremental_inputs_reader::get_local_symbol_count): New function.
5928         (Incremental_inputs_reader::get_input_section): Adjust size of input
5929         file header.
5930         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5931         (Sized_incr_relobj::This): New typedef.
5932         (Sized_incr_relobj::sym_size): New const data member.
5933         (Sized_incr_relobj::Local_symbol): New struct.
5934         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5935         (Sized_incr_relobj::do_local_symbol_offset): New function.
5936         (Sized_incr_relobj::local_symbol_count_): New data member.
5937         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5938         (Sized_incr_relobj::local_symbol_index_): New data member.
5939         (Sized_incr_relobj::local_symbol_offset_): New data member.
5940         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5941         (Sized_incr_relobj::local_symbols_): New data member.
5942         * object.h (Relobj::output_local_symbol_count): New function.
5943         (Relobj::local_symbol_offset): New function.
5944         (Relobj::do_output_local_symbol_count): New function.
5945         (Relobj::do_local_symbol_offset): New function.
5946         (Sized_relobj::do_output_local_symbol_count): New function.
5947         (Sized_relobj::do_local_symbol_offset): New function.
5948
5949 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5950
5951         * descriptors.cc (set_close_on_exec): New function.
5952         (Descriptors::open): Use set_close_on_exec.
5953         * output.cc (S_ISLNK): Define if not defined.
5954
5955 2011-04-22 Cary Coutant  <ccoutant@google.com>
5956
5957         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5958         global symbol map.
5959         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5960         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5961         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5962         relocations.
5963         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5964         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5965         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5966         * incremental.h
5967         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5968         function.
5969         (Incremental_binary::apply_incremental_relocs): New function.
5970         (Incremental_binary::do_apply_incremental_relocs): New function.
5971         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5972         data member.
5973         (Sized_incremental_binary::add_global_symbol): New function.
5974         (Sized_incremental_binary::global_symbol): New function.
5975         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5976         (Sized_incremental_binary::symbol_map_): New data member.
5977         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5978         * target.h (Sized_target::apply_relocation): New function.
5979         * target-reloc.h (apply_relocation): New function.
5980         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5981
5982 2011-04-22  Doug Kwan  <dougkwan@google.com>
5983
5984         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5985         flag of a SHT_ARM_EXIDX section.
5986         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5987         * testsuite/Makefile.in: Regenerate.
5988         * testsuite/arm_exidx_test.s: New file.
5989         * testsuite/arm_exidx_test.sh: Same.
5990
5991 2011-04-20 Cary Coutant  <ccoutant@google.com>
5992
5993         PR gold/12689
5994         * archive.h (Incremental_archive_entry::Archive_member):
5995         Initialize arg_serial_ (second constructor).
5996
5997 2011-04-17  Ian Lance Taylor  <iant@google.com>
5998
5999         * object.cc (Relocate_info::location): Simplify location string.
6000         * errors.cc (Errors::error_at_location): Don't print program
6001         name.
6002         (Errors::warning_at_location): Likewise.
6003         (Errors::undefined_symbol): Likewise.
6004         * testsuite/debug_msg.sh: Update accordingly.
6005
6006 2011-04-14 Cary Coutant  <ccoutant@google.com>
6007
6008         * gold/layout.cc (Layout::symtab_section_offset): New function.
6009         * gold/layout.h (Layout::symtab_section_offset): New function.
6010         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
6011
6012 2011-04-12  Ian Lance Taylor  <iant@google.com>
6013
6014         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
6015         with MREMAP_MAYMOVE.
6016         * output.h (class Output_file): Add map_is_allocated_ field.
6017         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
6018         not available, provide stubs.  If mremap is not available, #define
6019         it to gold_mremap.
6020         (MREMAP_MAYMOVE): Define if not defined.
6021         (Output_file::Output_file): Initialize map_is_allocated_.
6022         (Output_file::resize): Check map_is_allocated_.
6023         (Output_file::map_anonymous): If mmap fails, use malloc.
6024         (Output_file::unmap): Don't do anything for an anonymous map.
6025         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
6026         is not available, provide stubs.
6027         (File_read::View::~View): Use free rather than delete[].
6028         (File_read::make_view): Use malloc rather than new[].  If mmap
6029         fails, use malloc.
6030         (File_read::find_or_make_view): Use malloc rather than new[].
6031         * gold.h: Remove HAVE_REMAP code.
6032         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
6033         exists.  Rename mremap to gold_mremap.  If mmap is not available
6034         don't do anything.
6035         * configure, config.in: Rebuild.
6036
6037 2011-04-11  Ian Lance Taylor  <iant@google.com>
6038
6039         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
6040         initialize local variable v.
6041
6042 2011-04-11  Cary Coutant  <ccoutant@google.com>
6043
6044         * archive.cc (Archive::include_member): Adjust call to
6045         report_object.
6046         (Add_archive_symbols::run): Track argument serial numbers.
6047         (Lib_group::include_member): Likewise.
6048         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
6049         * archive.h (Incremental_archive_entry::Archive_member):
6050         Initialize arg_serial_.
6051         (Archive_member::arg_serial_): New data member.
6052         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
6053         (Sized_dynobj::do_add_symbols): Track symbols when doing an
6054         incremental link.
6055         (Sized_dynobj::do_for_all_local_got_entries): New function.
6056         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
6057         function.
6058         * fileread.cc (get_mtime): New function.
6059         * fileread.h (get_mtime): New function.
6060         * gold.cc (queue_initial_tasks): Check for incremental update.
6061         (process_incremental_input): New function.
6062         (queue_middle_tasks): Don't force valid target for incremental
6063         update.
6064         * incremental-dump.cc (find_input_containing_global): Adjust
6065         size of symbol info entry.
6066         (dump_incremental_inputs): Dump argument serial number and
6067         in_system_directory flag; bias shndx by 1; print symbol names
6068         when dumping per-file symbol lists; use new symbol info readers.
6069         * incremental.cc
6070         (Output_section_incremental_inputs:update_data_size): New function.
6071         (Sized_incremental_binary::setup_readers): Setup input readers
6072         for each input file; build maps for files added from libraries
6073         and scripts.
6074         (Sized_incremental_binary::check_input_args): New function.
6075         (Sized_incremental_binary::do_check_inputs): Build map of argument
6076         serial numbers to input arguments.
6077         (Sized_incremental_binary::do_file_has_changed): Rename
6078         do_file_is_unchanged to this; compare file modification times.
6079         (Sized_incremental_binary::do_init_layout): New function.
6080         (Sized_incremental_binary::do_reserve_layout): New function.
6081         (Sized_incremental_binary::do_get_input_reader): Remove.
6082         (Sized_incremental_binary::get_symtab_view): New function.
6083         (Incremental_checker::can_incrementally_link_output_file): Remove.
6084         (Incremental_inputs::report_command_line): Exclude --debug options.
6085         (Incremental_inputs::report_archive_begin): Add parameter; track
6086         argument serial numbers; don't put input file entry for archive
6087         before archive members.
6088         (Incremental_inputs::report_archive_end): Put input file entry
6089         for archive after archive members.
6090         (Incremental_inputs::report_object): Add parameter; track argument
6091         serial numbers and in_system_directory flag.
6092         (Incremental_inputs::report_script): Add parameter; track argument
6093         serial numbers.
6094         (Output_section_incremental_inputs::set_final_data_size): Adjust
6095         size of symbol info entry; check for forwarding symbols.
6096         (Output_section_incremental_inputs::write_input_files): Write
6097         in_system_directory flag and argument serial number.
6098         (Output_section_incremental_inputs::write_info_blocks): Map section
6099         indices between incremental info and original input file; store
6100         input section index for each symbol.
6101         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
6102         change operator() to visit().
6103         (class Global_got_offset_visitor): Likewise.
6104         (class Global_symbol_visitor_got_plt):
6105         (Output_section_incremental_inputs::write_got_plt): Use new visitor
6106         classes.
6107         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
6108         (Sized_incr_relobj::do_read_symbols): New function.
6109         (Sized_incr_relobj::do_layout): New function.
6110         (Sized_incr_relobj::do_layout_deferred_sections): New function.
6111         (Sized_incr_relobj::do_add_symbols): New function.
6112         (Sized_incr_relobj::do_should_include_member): New function.
6113         (Sized_incr_relobj::do_for_all_global_symbols): New function.
6114         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
6115         (Sized_incr_relobj::do_section_size): New function.
6116         (Sized_incr_relobj::do_section_name): New function.
6117         (Sized_incr_relobj::do_section_contents): New function.
6118         (Sized_incr_relobj::do_section_flags): New function.
6119         (Sized_incr_relobj::do_section_entsize): New function.
6120         (Sized_incr_relobj::do_section_address): New function.
6121         (Sized_incr_relobj::do_section_type): New function.
6122         (Sized_incr_relobj::do_section_link): New function.
6123         (Sized_incr_relobj::do_section_info): New function.
6124         (Sized_incr_relobj::do_section_addralign): New function.
6125         (Sized_incr_relobj::do_initialize_xindex): New function.
6126         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
6127         (Sized_incr_relobj::do_read_relocs): New function.
6128         (Sized_incr_relobj::do_gc_process_relocs): New function.
6129         (Sized_incr_relobj::do_scan_relocs): New function.
6130         (Sized_incr_relobj::do_count_local_symbols): New function.
6131         (Sized_incr_relobj::do_finalize_local_symbols): New function.
6132         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
6133         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
6134         (Sized_incr_relobj::do_relocate): New function.
6135         (Sized_incr_relobj::do_set_section_offset): New function.
6136         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
6137         (Sized_incr_dynobj::do_read_symbols): New function.
6138         (Sized_incr_dynobj::do_layout): New function.
6139         (Sized_incr_dynobj::do_add_symbols): New function.
6140         (Sized_incr_dynobj::do_should_include_member): New function.
6141         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
6142         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
6143         (Sized_incr_dynobj::do_section_size): New function.
6144         (Sized_incr_dynobj::do_section_name): New function.
6145         (Sized_incr_dynobj::do_section_contents): New function.
6146         (Sized_incr_dynobj::do_section_flags): New function.
6147         (Sized_incr_dynobj::do_section_entsize): New function.
6148         (Sized_incr_dynobj::do_section_address): New function.
6149         (Sized_incr_dynobj::do_section_type): New function.
6150         (Sized_incr_dynobj::do_section_link): New function.
6151         (Sized_incr_dynobj::do_section_info): New function.
6152         (Sized_incr_dynobj::do_section_addralign): New function.
6153         (Sized_incr_dynobj::do_initialize_xindex): New function.
6154         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
6155         (make_sized_incremental_object): New function.
6156         (Incremental_library::copy_unused_symbols): New function.
6157         (Incremental_library::do_for_all_unused_symbols): New function.
6158         * incremental.h (enum Incremental_input_flags): New type.
6159         (class Incremental_checker): Remove.
6160         (Incremental_input_entry::Incremental_input_entry): Add argument
6161         serial number.
6162         (Incremental_input_entry::arg_serial): New function.
6163         (Incremental_input_entry::set_is_in_system_directory): New function.
6164         (Incremental_input_entry::is_in_system_directory): New function.
6165         (Incremental_input_entry::arg_serial_): New data member.
6166         (Incremental_input_entry::is_in_system_directory_): New data member.
6167         (class Script_info): Move here from script.h.
6168         (Script_info::Script_info): Add filename parameter.
6169         (Script_info::filename): New function.
6170         (Script_info::filename_): New data member.
6171         (Incremental_script_entry::Incremental_script_entry): Add argument
6172         serial number.
6173         (Incremental_object_entry::Incremental_object_entry): Likewise.
6174         (Incremental_object_entry::add_input_section): Build list of input
6175         sections with map to original shndx.
6176         (Incremental_object_entry::get_input_section_index): New function.
6177         (Incremental_object_entry::shndx_): New data member.
6178         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6179         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6180         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6181         serial number.
6182         (Incremental_inputs::report_archive_begin): Likewise.
6183         (Incremental_inputs::report_object): Likewise.
6184         (Incremental_inputs::report_script): Likewise.
6185         (class Incremental_global_symbol_reader): New class.
6186         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6187         and store flags and input file type.
6188         (Incremental_input_entry_reader::arg_serial): New function.
6189         (Incremental_input_entry_reader::type): Extract type from flags.
6190         (Incremental_input_entry_reader::is_in_system_directory): New function.
6191         (Incremental_input_entry_reader::get_input_section_count): Call
6192         accessor function for type.
6193         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6194         function for type; adjust size of global symbol entry.
6195         (Incremental_input_entry_reader::get_global_symbol_count): Call
6196         accessor function for type.
6197         (Incremental_input_entry_reader::get_object_count): Likewise.
6198         (Incremental_input_entry_reader::get_object_offset): Likewise.
6199         (Incremental_input_entry_reader::get_member_count): Likewise.
6200         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6201         (Incremental_input_entry_reader::get_member_offset): Likewise.
6202         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6203         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6204         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6205         (Incremental_input_entry_reader::get_global_symbol_reader): New
6206         function.
6207         (Incremental_input_entry_reader::get_output_symbol_index): New
6208         function.
6209         (Incremental_input_entry_reader::type_): Remove.
6210         (Incremental_input_entry_reader::flags_): New data member.
6211         (Incremental_inputs_reader::input_file_offset): New function.
6212         (Incremental_inputs_reader::input_file_index): New function.
6213         (Incremental_inputs_reader::input_file): Call input_file_offset.
6214         (Incremental_inputs_reader::input_file_at_offset): New function.
6215         (Incremental_relocs_reader::get_r_type): Reformat.
6216         (Incremental_relocs_reader::get_r_shndx): Reformat.
6217         (Incremental_relocs_reader::get_r_offset): Reformat.
6218         (Incremental_relocs_reader::data): New function.
6219         (Incremental_binary::Incremental_binary): Initialize new data members.
6220         (Incremental_binary::check_inputs): Add cmdline parameter.
6221         (Incremental_binary::file_is_unchanged): Remove.
6222         (Input_reader::arg_serial): New function.
6223         (Input_reader::get_unused_symbol_count): New function.
6224         (Input_reader::get_unused_symbol): New function.
6225         (Input_reader::do_arg_serial): New function.
6226         (Input_reader::do_get_unused_symbol_count): New function.
6227         (Input_reader::do_get_unused_symbol): New function.
6228         (Incremental_binary::input_file_count): New function.
6229         (Incremental_binary::get_input_reader): Change signature to use
6230         index instead of filename.
6231         (Incremental_binary::file_has_changed): New function.
6232         (Incremental_binary::get_input_argument): New function.
6233         (Incremental_binary::get_library): New function.
6234         (Incremental_binary::get_script_info): New function.
6235         (Incremental_binary::init_layout): New function.
6236         (Incremental_binary::reserve_layout): New function.
6237         (Incremental_binary::output_file): New function.
6238         (Incremental_binary::do_check_inputs): New function.
6239         (Incremental_binary::do_file_is_unchanged): Remove.
6240         (Incremental_binary::do_file_has_changed): New function.
6241         (Incremental_binary::do_init_layout): New function.
6242         (Incremental_binary::do_reserve_layout): New function.
6243         (Incremental_binary::do_input_file_count): New function.
6244         (Incremental_binary::do_get_input_reader): Change signature.
6245         (Incremental_binary::input_args_map_): New data member.
6246         (Incremental_binary::library_map_): New data member.
6247         (Incremental_binary::script_map_): New data member.
6248         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6249         new data members.
6250         (Sized_incremental_binary::output_section): New function.
6251         (Sized_incremental_binary::inputs_reader): Add const.
6252         (Sized_incremental_binary::symtab_reader): Add const.
6253         (Sized_incremental_binary::relocs_reader): Add const.
6254         (Sized_incremental_binary::got_plt_reader): Add const.
6255         (Sized_incremental_binary::get_symtab_view): New function.
6256         (Sized_incremental_binary::Inputs_reader): New typedef.
6257         (Sized_incremental_binary::Input_entry_reader): New typedef.
6258         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6259         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6260         (Sized_incremental_binary::do_file_has_changed): New function.
6261         (Sized_incremental_binary::do_init_layout): New function.
6262         (Sized_incremental_binary::do_reserve_layout): New function.
6263         (Sized_input_reader::Inputs_reader): Remove.
6264         (Sized_input_reader::Input_entry_reader): Remove.
6265         (Sized_input_reader::do_arg_serial): New function.
6266         (Sized_input_reader::do_get_unused_symbol_count): New function.
6267         (Sized_input_reader::do_get_unused_symbol): New function.
6268         (Sized_incremental_binary::do_input_file_count): New function.
6269         (Sized_incremental_binary::do_get_input_reader): Change signature;
6270         use index instead of filename.
6271         (Sized_incremental_binary::section_map_): New data member.
6272         (Sized_incremental_binary::input_entry_readers_): New data member.
6273         (class Sized_incr_relobj): New class.
6274         (class Sized_incr_dynobj): New class.
6275         (make_sized_incremental_object): New function.
6276         (class Incremental_library): New class.
6277         * layout.cc (Free_list::num_lists): New static data member.
6278         (Free_list::num_nodes): New static data member.
6279         (Free_list::num_removes): New static data member.
6280         (Free_list::num_remove_visits): New static data member.
6281         (Free_list::num_allocates): New static data member.
6282         (Free_list::num_allocate_visits): New static data member.
6283         (Free_list::init): New function.
6284         (Free_list::remove): New function.
6285         (Free_list::allocate): New function.
6286         (Free_list::dump): New function.
6287         (Free_list::print_stats): New function.
6288         (Layout_task_runner::run): Resize output file for incremental updates.
6289         (Layout::Layout): Initialize new data members.
6290         (Layout::set_incremental_base): New function.
6291         (Layout::init_fixed_output_section): New function.
6292         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6293         incremental updates.
6294         (Layout::create_gold_note): Do not create gold note section for
6295         incremental updates.
6296         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6297         for incremental updates.
6298         (Layout::set_section_offsets): For incremental updates, allocate space
6299         from free list.
6300         (Layout::create_symtab_sections): Layout with offsets relative to
6301         start of section; for incremental updates, allocate space from free
6302         list.
6303         (Layout::create_shdrs): For incremental updates, allocate space from
6304         free list.
6305         (Layout::finish_dynamic_section): For incremental updates, do not
6306         check --as-needed (fixed in subsequent patch).
6307         * layout.h (class Free_list): New class.
6308         (Layout::set_incremental_base): New function.
6309         (Layout::incremental_base): New function.
6310         (Layout::init_fixed_output_section): New function.
6311         (Layout::allocate): New function.
6312         (Layout::incremental_base_): New data member.
6313         (Layout::free_list_): New data member.
6314         * main.cc (main): Print Free_list statistics.
6315         * object.cc (Relobj::finalize_incremental_relocs): Add
6316         clear_counts parameter; clear counts only when clear_counts is set.
6317         (Sized_relobj::Sized_relobj): Initialize new base class.
6318         (Sized_relobj::do_layout): Don't report special sections.
6319         (Sized_relobj::do_for_all_local_got_entries): New function.
6320         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6321         symtab_off to all symbol table offsets.
6322         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6323         * object.h (class Got_offset_list): Move to top of file.
6324         (Object::Object): Allow case where input_file == NULL.
6325         (Object::~Object): Likewise.
6326         (Object::input_file): Assert that input_file != NULL.
6327         (Object::lock): Allow case where input_file == NULL.
6328         (Object::unlock): Likewise.
6329         (Object::is_locked): Likewise.
6330         (Object::token): Likewise.
6331         (Object::release): Likewise.
6332         (Object::is_incremental): New function.
6333         (Object::get_mtime): New function.
6334         (Object::for_all_local_got_entries): New function.
6335         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6336         (Object::set_is_in_system_directory): New function.
6337         (Object::is_in_system_directory): New function.
6338         (Object::do_is_incremental): New function.
6339         (Object::do_get_mtime): New function.
6340         (Object::do_for_all_local_got_entries): New function.
6341         (Object::is_in_system_directory_): New data member.
6342         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6343         (class Sized_relobj_base): New class.
6344         (class Sized_relobj): Derive from Sized_relobj_base.
6345         (class Sized_relobj::Symbols): Redeclare from base class.
6346         (class Sized_relobj::local_got_offset_list): Remove.
6347         (class Sized_relobj::Output_sections): Redeclare from base class.
6348         (class Sized_relobj::do_for_all_local_got_entries): New function.
6349         (class Sized_relobj::write_local_symbols): Add offset parameter.
6350         (class Sized_relobj::local_symbol_offset_): Update comment.
6351         (class Sized_relobj::local_dynsym_offset_): Update comment.
6352         * options.cc (Input_arguments::add_file): Remove const.
6353         * options.h (Input_file_argument::Input_file_argument):
6354         Initialize arg_serial_ (all constructors).
6355         (Input_file_argument::set_arg_serial): New function.
6356         (Input_file_argument::arg_serial): New function.
6357         (Input_file_argument::arg_serial_): New data member.
6358         (Input_arguments::Input_arguments): Initialize file_count_.
6359         (Input_arguments::add_file): Remove const.
6360         (Input_arguments::number_of_input_files): New function.
6361         (Input_arguments::file_count_): New data member.
6362         (Command_line::number_of_input_files): Call
6363         Input_arguments::number_of_input_files.
6364         * output.cc (Output_segment_headers::Output_segment_headers):
6365         Set current size.
6366         (Output_section::Input_section::current_data_size): New function.
6367         (Output_section::Output_section): Initialize new data members.
6368         (Output_section::add_input_section): Don't do merge sections for
6369         an incremental link; allocate space from free list for an
6370         incremental update.
6371         (Output_section::add_output_section_data): Allocate space from
6372         free list for an incremental update.
6373         (Output_section::update_data_size): New function.
6374         (Output_section::set_fixed_layout): New function.
6375         (Output_section::reserve): New function.
6376         (Output_segment::set_section_addresses): Remove const.
6377         (Output_segment::set_section_list_addresses): Remove const; allocate
6378         space from free list for an incremental update.
6379         (Output_segment::set_offset): Adjust size of RELRO segment for an
6380         incremental update.
6381         * output.h (Output_data::current_data_size): Move here from
6382         child classes.
6383         (Output_data::pre_finalize_data_size): New function.
6384         (Output_data::update_data_size): New function.
6385         (Output_section_headers::update_data_size): new function.
6386         (Output_section_data_build::current_data_size): Move to Output_data.
6387         (Output_data_strtab::update_data_size): New function.
6388         (Output_section::current_data_size): Move to Output_data.
6389         (Output_section::set_fixed_layout): New function.
6390         (Output_section::has_fixed_layout): New function.
6391         (Output_section::reserve): New function.
6392         (Output_section::update_data_size): New function.
6393         (Output_section::has_fixed_layout_): New data member.
6394         (Output_section::free_list_): New data member.
6395         (Output_segment::set_section_addresses): Remove const.
6396         (Output_segment::set_section_list_addresses): Remove const.
6397         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6398         New function.
6399         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6400         New function.
6401         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6402         parameter when calling Add_symbols constructor; store argument
6403         serial number for members of a lib group.
6404         (Add_symbols::locks): Allow case where token == NULL.
6405         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6406         (Read_member::~Read_member): New function.
6407         (Read_member::is_runnable): New function.
6408         (Read_member::locks): New function.
6409         (Read_member::run): New function.
6410         (Check_script::~Check_script): New function.
6411         (Check_script::is_runnable): New function.
6412         (Check_script::locks): New function.
6413         (Check_script::run): New function.
6414         (Check_library::~Check_library): New function.
6415         (Check_library::is_runnable): New function.
6416         (Check_library::locks): New function.
6417         (Check_library::run): New function.
6418         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6419         (Add_symbols::library_): New data member.
6420         (class Read_member): New class.
6421         (class Check_script): New class.
6422         (class Check_library): New class.
6423         * reloc.cc (Read_relocs::is_runnable): Allow case where
6424         token == NULL.
6425         (Read_relocs::locks): Likewise.
6426         (Scan_relocs::locks): Likewise.
6427         (Relocate_task::locks): Likewise.
6428         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6429         to clear counters.
6430         (Sized_relobj::incremental_relocs_scan): Fix comment.
6431         (Sized_relobj::do_relocate): Pass output file offset to
6432         write_local_symbols.
6433         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6434         from class declaration.
6435         * script.cc (read_input_script): Allocate Script_info; pass
6436         argument serial number to report_script.
6437         * script.h (class Script_info): Move to incremental.h.
6438         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6439         * symtab.h (Symbol_table::add_from_incrobj): New function.
6440         (Symbol_table::set_file_offset): New function.
6441
6442 2011-04-05  Cary Coutant  <ccoutant@google.com>
6443
6444         * incremental-dump.cc (dump_incremental_inputs): Change signature
6445         to take a Sized_incremental_binary; change caller.  Use readers
6446         in Sized_incremental_binary.
6447         * incremental.cc
6448         (Sized_incremental_binary::find_incremental_inputs_sections):
6449         Rename do_find_incremental_inputs_sections to this.
6450         (Sized_incremental_binary::setup_readers): New function.
6451         (Sized_incremental_binary::do_check_inputs): Check
6452         has_incremental_info_ flag; move setup code to setup_readers;
6453         use input readers.
6454         (Sized_incremental_binary::do_file_is_unchanged): New function.
6455         (Sized_incremental_binary::do_get_input_reader): New function.
6456         * incremental.h (class Incremental_binary): Move to end of file.
6457         (Incremental_binary::file_is_unchanged): New function.
6458         (Incremental_binary::do_file_is_unchanged): New function.
6459         (Incremental_binary::Input_reader): New class.
6460         (Incremental_binary::get_input_reader): New function.
6461         (class Sized_incremental_binary): Move to end of file.
6462         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6463         input section reader classes.
6464         (Sized_incremental_binary::has_incremental_info): New function.
6465         (Sized_incremental_binary::inputs_reader): New function.
6466         (Sized_incremental_binary::symtab_reader): New function.
6467         (Sized_incremental_binary::relocs_reader): New function.
6468         (Sized_incremental_binary::got_plt_reader): New function.
6469         (Sized_incremental_binary::do_file_is_unchanged): New function.
6470         (Sized_incremental_binary::Sized_input_reader): New class.
6471         (Sized_incremental_binary::get_input_reader): New function.
6472         (Sized_incremental_binary::find_incremental_inputs_sections):
6473         Rename do_find_incremental_inputs_sections to this.
6474         (Sized_incremental_binary::setup_readers): New function.
6475         (Sized_incremental_binary::has_incremental_info_): New data member.
6476         (Sized_incremental_binary::inputs_reader_): New data member.
6477         (Sized_incremental_binary::symtab_reader_): New data member.
6478         (Sized_incremental_binary::relocs_reader_): New data member.
6479         (Sized_incremental_binary::got_plt_reader_): New data member.
6480         (Sized_incremental_binary::current_input_file_): New data member.
6481
6482 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6483
6484         PR gold/12640
6485         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6486         violation.
6487
6488 2011-03-30  Cary Coutant  <ccoutant@google.com>
6489
6490         * archive.cc (Archive::include_member): Adjust call to report_object.
6491         (Add_archive_symbols::run): Add script_info to call to
6492         report_archive_begin.
6493         (Lib_group::include_member): Adjust call to report_object.
6494         (Add_lib_group_symbols::run): Adjust call to report_object.
6495         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6496         blocks.  Add object count for script input files.
6497         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6498         script_info parameter; change all callers.
6499         (Incremental_inputs::report_object): Add script_info parameter;
6500         change all callers.
6501         (Incremental_inputs::report_script): Store backpointer to
6502         incremental info entry.
6503         (Output_section_incremental_inputs::set_final_data_size): Record
6504         additional information for scripts.
6505         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6506         * incremental.h (Incremental_script_entry::add_object): New function.
6507         (Incremental_script_entry::get_object_count): New function.
6508         (Incremental_script_entry::get_object): New function.
6509         (Incremental_script_entry::objects_): New data member; adjust
6510         constructor.
6511         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6512         (Incremental_inputs::report_object): Add script_info parameter.
6513         (Incremental_inputs_reader::get_object_count): New function.
6514         (Incremental_inputs_reader::get_object_offset): New function.
6515         * options.cc (Input_arguments::add_file): Return reference to
6516         new input argument.
6517         * options.h (Input_argument::set_script_info): New function.
6518         (Input_argument::script_info): New function.
6519         (Input_argument::script_info_): New data member; adjust all
6520         constructors.
6521         (Input_file_group::add_file): Return reference to new input argument.
6522         (Input_file_lib::add_file): Likewise.
6523         (Input_arguments::add_file): Likewise.
6524         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6525         * script.cc (Parser_closure::Parser_closure): Add script_info
6526         parameter; adjust all callers.
6527         (Parser_closure::script_info): New function.
6528         (Parser_closure::script_info_): New data member.
6529         (read_input_script): Report scripts earlier to incremental info.
6530         (script_add_file): Set script_info in Input_argument.
6531         (script_add_library): Likewise.
6532         * script.h (Script_options::Script_info): Rewrite class.
6533
6534 2011-03-29  Cary Coutant  <ccoutant@google.com>
6535
6536         * archive.cc (Library_base::should_include_member): Move
6537         method here from class Archive.
6538         (Archive::Archive): Initialize base class.
6539         (Archive::should_include_member): Move to base class.
6540         (Archive::do_for_all_unused_symbols): New function.
6541         (Add_archive_symbols::run): Remove redundant access to
6542         incremental_inputs.
6543         (Lib_group::Lib_group): Initialize base class.
6544         (Lib_group::do_filename): New function.
6545         (Lib_group::include_member): Pass pointer to Lib_group to
6546         report_object.
6547         (Lib_group::do_for_all_unused_symbols): New function.
6548         (Add_lib_group_symbols::run): Report archive information for
6549         incremental links.
6550         * archive.h (class Library_base): New base class.
6551         (class Archive): Derive from Library_base.
6552         (Archive::filename): Move to base class.
6553         (Archive::set_incremental_info): Likewise.
6554         (Archive::incremental_info): Likewise.
6555         (Archive::Should_include): Likewise.
6556         (Archive::should_include_member): Likewise.
6557         (Archive::Armap_entry): Remove.
6558         (Archive::Unused_symbol_iterator): Remove.
6559         (Archive::unused_symbols_begin): Remove.
6560         (Archive::unused_symbols_end): Remove.
6561         (Archive::do_filename): New function.
6562         (Archive::do_get_mtime): New function.
6563         (Archive::do_for_all_unused_symbols): New function.
6564         (Archive::task_): Move to base class.
6565         (Archive::incremental_info_): Likewise.
6566         (class Lib_group): Derive from Library_base.
6567         (Lib_group::do_filename): New function.
6568         (Lib_group::do_get_mtime): New function.
6569         (Lib_group::do_for_all_unused_symbols): New function.
6570         (Lib_group::task_): Move to base class.
6571         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6572         function.
6573         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6574         function.
6575         * incremental.cc (Incremental_inputs::report_archive_begin):
6576         Use Library_base; call library's get_mtime; add incremental inputs
6577         entry before members.
6578         (class Unused_symbol_visitor): New class.
6579         (Incremental_inputs::report_archive_end): Use Library_base; use
6580         visitor class to record unused symbols; don't add incremental inputs
6581         entry after members.
6582         (Incremental_inputs::report_object): Use Library_base.
6583         * incremental.h
6584         (Incremental_archive_entry::Incremental_archive_entry): Remove
6585         unused Archive parameter.
6586         (Incremental_inputs::report_archive_begin): Use Library_base.
6587         (Incremental_inputs::report_archive_end): Likewise.
6588         (Incremental_inputs::report_object): Likewise.
6589         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6590         function.
6591         * object.h (Object::for_all_global_symbols): New function.
6592         (Object::do_for_all_global_symbols): New function.
6593         (Sized_relobj::do_for_all_global_symbols): New function.
6594         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6595         function.
6596         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6597         function.
6598
6599 2011-03-27  Ian Lance Taylor  <iant@google.com>
6600
6601         * archive.cc (Archive::interpret_header): Return -1 if something
6602         goes wrong.  Change callers accordingly.
6603
6604 2011-03-25  Cary Coutant  <ccoutant@google.com>
6605
6606         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6607         * testsuite/Makefile.in: Regenerate.
6608
6609 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6610
6611         * plugin.cc (get_view): New.
6612         (Plugin::load): Pass get_view to the plugin.
6613         (Plugin_manager::get_view): New.
6614
6615 2011-03-21  Ian Lance Taylor  <iant@google.com>
6616
6617         * testsuite/final_layout.sh: Rewrite to not use dc.
6618         * testsuite/relro_test.sh: Fail if dc is not present.
6619
6620 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6621
6622         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6623         Change == to -eq.
6624         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6625         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6626         Change == to -eq.
6627         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6628         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6629
6630 2011-03-14  Ian Lance Taylor  <iant@google.com>
6631
6632         * script-sections.cc (Sort_output_sections::script_compare):
6633         Rename from is_before, change return type.
6634         (Sort_output_sections::operator()): Adjust accordingly.
6635
6636 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6637
6638         PR gold/12572
6639         * testsuite/odr_violation2.cc: Add comment to make all error line
6640         numbers double digits.
6641         * testsuite/debug_msg.sh: Adjust expected errors.
6642
6643 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6644
6645         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6646         but mark earlier ones as non-canonical
6647         (offset_to_iterator): Update search target and example
6648         (do_addr2line): Return extra lines in a vector*
6649         (format_file_lineno): Extract from do_addr2line
6650         (one_addr2line): Add vector* out-param
6651         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6652         when a lineno entry appeared last for its instruction
6653         (Dwarf_line_info): Add vector* out-param
6654         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6655         * symtab.cc (Odr_violation_compare): Include the lineno in the
6656         comparison again.
6657         (linenos_from_loc): New. Combine the canonical line for an
6658         address with its other lines.
6659         (True_if_intersect): New. Helper functor to make
6660         std::set_intersection a query.
6661         (detect_odr_violations): Compare sets of lines instead of just
6662         one line for each function. This became less deterministic, but
6663         has fewer false positives.
6664         * symtab.h: Declarations.
6665         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6666         mix an optimized and non-optimized object in the same binary
6667         (odr_violation2.so): Same.
6668         * testsuite/Makefile.in: Regenerate from Makefile.am.
6669         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6670         * testsuite/debug_msg.sh: Update line numbers and add
6671         assertions.
6672         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6673         non-optimized context.
6674         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6675         isn't inlined, and use OdrDerived in an optimized context.
6676         * testsuite/odr_header1.h: Defines OdrDerived, where
6677         optimization will change the
6678         first-instruction-in-the-destructor's file and line number.
6679         * testsuite/odr_header2.h: Defines OdrBase.
6680
6681 2011-03-09  Ian Lance Taylor  <iant@google.com>
6682
6683         * fileread.cc (File_read::clear_views): Don't delete the whole
6684         file view.
6685
6686 2011-03-08  Ian Lance Taylor  <iant@google.com>
6687
6688         PR gold/12525
6689         * fileread.cc: #include <climits>.
6690         (GOLD_IOV_MAX): Define.
6691         (File_read::read_multiple): Limit number of entries by iov_max.
6692         * fileread.h (class File_read): Always set max_readv_entries to
6693         128.
6694
6695 2011-03-07  Ian Lance Taylor  <iant@google.com>
6696
6697         PR gold/12525
6698         * options.h (class General_options): Add -dy and -dn.
6699
6700 2011-03-02  Cary Coutant  <ccoutant@google.com>
6701
6702         * testsuite/script_test_9.t: Add TLS segment.
6703
6704 2011-03-02  Simon Baldwin  <simonb@google.com>
6705
6706         * configure.ac: Add check for gnu_indirect_function support in
6707         the toolchain building binutils.
6708         * configure: Rebuild.
6709
6710 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6711
6712         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6713         plugin only symbols.
6714         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6715         in plugin files as not needed in the symbol table.
6716
6717 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6718
6719         * output.cc (Output_section::add_input_section): Delay fill
6720         generation for section ordering.
6721
6722 2011-02-09  Ian Lance Taylor  <iant@google.com>
6723
6724         PR gold/12316
6725         * object.h (class Sized_relobj): Remove clear_local_symbols.
6726         * reloc.cc (Sized_relobj::do_relocate): Don't call
6727         clear_local_symbols.
6728
6729 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6730
6731         * plugin.cc (is_visible_from_outside): Return true for symbols
6732         in the -u option.
6733
6734 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6735
6736         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6737         filename.
6738
6739 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6740
6741         * icf.h (is_section_foldable_candidate): Change type of parameter
6742         to std::string.
6743         * icf.cc (Icf::find_identical_sections): Change type of local variable
6744         section_name to be std::string.
6745         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6746
6747 2011-01-25  Ian Lance Taylor  <iant@google.com>
6748
6749         * script.cc (script_add_extern): Rewrite to use
6750         add_symbol_reference.
6751
6752 2011-01-25  Doug Kwan  <dougkwan@google.com>
6753
6754         * icf.cc (get_section_contents): Always lock section's object.
6755
6756 2011-01-24  Ian Lance Taylor  <iant@google.com>
6757
6758         * options.h (class General_options): Accept
6759         --no-detect-odr-violations.
6760
6761 2011-01-24  Ian Lance Taylor  <iant@google.com>
6762
6763         * version.cc (version_string): Bump to 1.11.
6764
6765 2011-01-24  Ian Lance Taylor  <iant@google.com>
6766
6767         * plugin.cc (class Plugin_rescan): Define new class.
6768         (Plugin_manager::claim_file): Set any_claimed_.
6769         (Plugin_manager::save_archive): New function.
6770         (Plugin_manager::save_input_group): New function.
6771         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6772         necessary.
6773         (Plugin_manager::new_undefined_symbol): New function.
6774         (Plugin_manager::rescan): New function.
6775         (Plugin_manager::rescannable_defines): New function.
6776         (Plugin_manager::add_input_file): Set any_added_.
6777         * plugin.h (class Plugin_manager): define new fields rescannable_,
6778         undefined_symbols_, any_claimed_, and any_added_.  Declare
6779         Plugin_rescan as friend.  Declare new functions.
6780         (Plugin_manager::Rescannable): Define type.
6781         (Plugin_manager::Rescannable_list): Define type.
6782         (Plugin_manager::Undefined_symbol_list): Define type.
6783         (Plugin_manager::Plugin_manager): Initialize new fields.
6784         * archive.cc (Archive::defines_symbol): New function.
6785         (Add_archive_symbols::run): Pass archive to plugins if any.
6786         * archive.h (class Archive): Declare defines_symbol.
6787         * readsyms.cc (Input_group::~Input_group): New function.
6788         (Finish_group::run): Pass input_group to plugins if any.
6789         * readsyms.h (class Input_group): Declare destructor.
6790         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6791         any.
6792
6793 2011-01-10  Ian Lance Taylor  <iant@google.com>
6794
6795         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6796         section as relro.
6797         (Layout::set_segment_offsets): Reset increase_relro before calling
6798         set_section_addresses a second time.
6799
6800 2011-01-04  Cary Coutant  <ccoutant@google.com>
6801
6802         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6803         sections before NOBITS sections.
6804
6805 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6806
6807         * version.cc (print_version): Update copyright to 2011.
6808
6809 2010-12-23  Cary Coutant  <ccoutant@google.com>
6810
6811         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6812         of OS to this->add.  Add OD parameter to second form of the function.
6813
6814 2010-12-20  Ian Lance Taylor  <iant@google.com>
6815
6816         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6817         second of two consecutive entries with same offset.
6818
6819 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6820
6821         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6822         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6823         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6824         to avoid unneeded links against $(LDADD).
6825         * testsuite/Makefile.in: Regenerate.
6826
6827 2010-12-15  Ian Lance Taylor  <iant@google.com>
6828
6829         PR gold/12324
6830         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6831         for R_X86_64_32 and R_X86_64_PC32.
6832         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6833         ver_matching_def_pic.o.
6834         (ver_matching_def_pic.o): New target.
6835
6836 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6837
6838         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6839         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6840         Move definition before File_read::View member definitions.
6841         (File_read::View::~View): Initialize and hold lock before
6842         updating current_mapped_bytes.
6843
6844 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6845
6846         * dwarf_reader.cc: Remove outdated comment.
6847         * gold-threads.cc: Fix typo in error message.
6848         * archive.cc: Fix typos in comments.
6849         * archive.h: Likewise.
6850         * arm-reloc-property.cc: Likewise.
6851         * arm-reloc-property.h: Likewise.
6852         * arm-reloc.def: Likewise.
6853         * arm.cc: Likewise.
6854         * attributes.h: Likewise.
6855         * cref.cc: Likewise.
6856         * ehframe.cc: Likewise.
6857         * fileread.h: Likewise.
6858         * gold.h: Likewise.
6859         * i386.cc: Likewise.
6860         * icf.cc: Likewise.
6861         * incremental.h: Likewise.
6862         * int_encoding.cc: Likewise.
6863         * layout.h: Likewise.
6864         * main.cc: Likewise.
6865         * merge.h: Likewise.
6866         * object.cc: Likewise.
6867         * object.h: Likewise.
6868         * options.cc: Likewise.
6869         * readsyms.cc: Likewise.
6870         * reduced_debug_output.cc: Likewise.
6871         * reloc.cc: Likewise.
6872         * script-sections.cc: Likewise.
6873         * sparc.cc: Likewise.
6874         * symtab.h: Likewise.
6875         * target-reloc.h: Likewise.
6876         * target.cc: Likewise.
6877         * target.h: Likewise.
6878         * timer.cc: Likewise.
6879         * timer.h: Likewise.
6880         * x86_64.cc: Likewise.
6881
6882 2010-12-09  Cary Coutant  <ccoutant@google.com>
6883
6884         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6885         stack.
6886         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6887         parameter; change all callers.
6888         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6889         * options.h (warn_execstack): New option.
6890
6891 2010-12-07  Doug Kwan  <dougkwan@google.com>
6892
6893         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6894         like function call relocations.
6895
6896 2010-12-07  Ian Lance Taylor  <iant@google.com>
6897
6898         * archive.cc (Archive::get_elf_object_for_member): Permit
6899         punconfigured to be NULL.
6900         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6901         (Archive::include_member): Pass NULL to get_elf_object_for_member
6902         if we searched for the archive and this is the first included
6903         object.
6904
6905 2010-12-01  Ian Lance Taylor  <iant@google.com>
6906
6907         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6908         track_relocs_type_ field.
6909         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6910         Set track_relocs_type_.
6911         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6912         contents when using RELA relocs.
6913         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6914         reloc_map_.
6915         * reloc.cc (Track_relocs::next_addend): New function.
6916         * reloc.h (class Track_relocs): Declare next_addend.
6917
6918 2010-12-01  Ian Lance Taylor  <iant@google.com>
6919
6920         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6921         virtual destructor.
6922
6923 2010-12-01  Ian Lance Taylor  <iant@google.com>
6924
6925         * README: Update compilers known to work and fail.
6926
6927 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6928
6929         * configure.in: For --enable-gold, handle value `default' instead of
6930         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6931         not the default.
6932         * configure: Regenerate.
6933
6934 2010-11-18  Doug Kwan  <dougkwan@google.com>
6935
6936         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6937         and right_alignment to be zero.  Store result alignment only if it is
6938         greater than existing alignment.
6939
6940 2010-11-16  Cary Coutant  <ccoutant@google.com>
6941
6942         PR gold/12220
6943         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6944         Check for ".zdebug_line".
6945
6946 2010-11-16  Doug Kwan  <dougkwan@google.com>
6947             Cary Coutant  <ccoutant@google.com>
6948
6949         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6950         by reference; adjust all callers.
6951         * output.cc (Output_segment::set_section_addresses): Adjust references
6952         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6953         list is empty.
6954         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6955         end at page boundary.
6956
6957 2010-11-16  Cary Coutant  <ccoutant@google.com>
6958
6959         PR gold/12220
6960         * layout.cc (Layout::choose_output_section): Transform names of
6961         compressed sections even when using a script with a SECTIONS clause.
6962         (Layout::output_section_name): Remove code to transform
6963         compressed debug section names.
6964         * output.cc (Output_section::add_input_section): Use uncompressed
6965         section size when tracking input sections.
6966
6967 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6968
6969         * symtab.h (Symbol::NON_PIC_REF): Remove.
6970         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6971         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6972         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6973         (Symbol::use_plt_offset): Take a flags argument and pass it
6974         directly to needs_dynamic_reloc.  Restrict check for undefined
6975         weak symbols to function calls.
6976         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6977         (Target_arm::Scan::global): Use it.
6978         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6979         (Target_arm::Relocate::relocate): Likewise.
6980         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6981         parameter with an r_type parameter.  Use get_reference_flags
6982         to get the flags.
6983         (Target_arm::Relocate::relocate): Update accordingly.
6984         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6985         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6986         (Target_i386::Scan::global): Likewise.
6987         (Target_i386::Relocate::relocate): Likewise.
6988         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6989         parameter with an r_type parameter.  Use get_reference_flags
6990         to get the flags.
6991         (Target_i386::Relocate::relocate): Update accordingly.
6992         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6993         (Target_powerpc::Scan::global): Use it.
6994         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6995         (Target_powerpc::Relocate::relocate): Likewise.
6996         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6997         (Target_sparc::Scan::global): Use it.
6998         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6999         (Target_sparc::Relocate::relocate): Likewise.
7000         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
7001         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
7002         (Target_x86_64::Scan::global): Likewise.
7003         (Target_x86_64::Relocate::relocate): Likewise.
7004
7005 2010-11-08  Doug Kwan  <dougkwan@google.com>
7006             Cary Coutant  <ccoutant@google.com>
7007
7008         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
7009         (Arm_exidx_merge_section::section_contents_): New data member.
7010         (Arm_input_section::Arm_input_section): Initialize original_contents_.
7011         (Arm_input_section::~Arm_input_section): De-allocate memory.
7012         (Arm_input_section::original_contents_): New data member.
7013         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
7014         in parameters instead of calling Object::section_contents without
7015         locking.
7016         (Arm_output_section::group_section): New parameter TASK.  Pass it
7017         to callees that need locking objects.
7018         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
7019         to lock EXIDX input sections.  Fix a formatting issue.  Call
7020         Arm_exidx_merged_section::build_contents to create merged section
7021         contents.
7022         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
7023         to lock object of stub table owner.
7024         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
7025         TEXT_SIZE to initialize data member TEXT_SIZE_.
7026         (Arm_exidx_input_section::addralign): Fix typo in comment.
7027         (Arm_exidx_input_section::text_size): New method.
7028         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
7029         that require locking objects.  Lock objects before scanning for stubs
7030         and updating local symbols.
7031         (Arm_input_section<big_endian>::init): Copy contents of original
7032         input section.
7033         (Arm_input_section<big_endian>::do_write): Use saved contents of
7034         original input section instead of calling Object::section_contents
7035         without locking.
7036         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
7037         size without calling Object::section_size().
7038         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
7039         for size.  Allocate a buffer for merged EXIDX entries.
7040         (Arm_exidx_merged_section::build_contents): New method.
7041         (Arm_exidx_merged_section::do_write): Move merge section contents
7042         building code to Arm_exidx_merged_section::build_contetns.  Write
7043         out contetns in buffer instead of building it on the fly.
7044         (Arm_relobj::make_exidx_input_section): Also pass text section size
7045         to Arm_exidx_input_section constructor.
7046         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
7047         (Arm_dynobj::do_read_symbols): Fix memory leak.
7048         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
7049         * target.h: (class Task): Add forward declaration.
7050         (Target::relax): Add new parameter TASK and pass it to
7051         Target::do_relax().
7052         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
7053
7054 2010-11-05  Cary Coutant  <ccoutant@google.com>
7055
7056         PR gold/10708
7057         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
7058         object when reading from the file.
7059         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
7060         second layout pass.
7061         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
7062         when reading section contents.
7063         (get_section_contents): Likewise.
7064         (icf::find_identical_sections): Likewise.
7065         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
7066         object when reading from the file.
7067         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
7068         the object when doing deferred section layout.
7069
7070 2010-11-03  Nick Clifton  <nickc@redhat.com>
7071
7072         PR gold/12001
7073         * script.h (class Symbol_assignment: name): New member.  Returns
7074         the name of the symbol.
7075         * scrfipt.cc (Script_options::is_pending_assignment): New member.
7076         Returns true if the given symbol name is on the list of
7077         assignments wating to be processed.
7078         * archive.cc (should_incldue_member): If the symbol is undefined,
7079         check to see if it is on the list of symbols pending assignment.
7080
7081 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
7082
7083         * script-sections.cc (Script_sections::find_memory_region): Check
7084         for a NULL output section pointer.
7085
7086 2010-10-29  Doug Kwan  <dougkwan@google.com>
7087
7088         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
7089         Output_section::add_relaxed_input_section.
7090         * output.cc (Output_section::add_relaxed_input_section): Add new
7091         arguments LAYOUT and NAME.  Set section order index.
7092         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
7093         Copy section order index.
7094         * output.h (Output_section::add_relaxed_input_section): Add new
7095         arguments LAYOUT and NAME.
7096
7097 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7098
7099         * testsuite/Makefile.am: Move gcctestdir/ld rule to
7100         NATIVE_OR_CROSS_LINKER.
7101         * testsuite/Makefile.in: Regenerate.
7102
7103 2010-10-20  Doug Kwan  <dougkwan@google.com>
7104
7105         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
7106         without SHF_LINK_ORDER flags.
7107         * layout.cc (Layout::choose_output_section): Do not filter
7108         SHF_LINK_ORDER flag in a relocatable link.
7109
7110 2010-10-17  Cary Coutant  <ccoutant@google.com>
7111
7112         * output.h (Output_segment::set_section_addresses): Change function
7113         signature.  Update all callers.
7114         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
7115         sections.
7116         (Output_segment::set_section_addresses): Align after last TLS
7117         section.  Add padding before last relro section instead of after.
7118
7119 2010-10-17  Doug Kwan  <dougkwan@google.com>
7120
7121         * gold/arm.cc (Target_arm::got_section): Use correct order and set
7122         GOT output section to be writable.
7123
7124 2010-10-14  Cary Coutant  <ccoutant@google.com>
7125
7126         * debug.h (DEBUG_INCREMENTAL): New flag.
7127         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
7128         * gold.cc (queue_initial_tasks): Check parameters for incremental link
7129         mode.
7130         * incremental.cc (report_command_line): Ignore all forms of
7131         --incremental.
7132         * layout.cc (Layout::Layout): Check parameters for incremental link
7133         mode.
7134         * options.cc (General_options::parse_incremental): New function.
7135         (General_options::parse_no_incremental): New function.
7136         (General_options::parse_incremental_full): New function.
7137         (General_options::parse_incremental_update): New function.
7138         (General_options::incremental_mode_): New data member.
7139         (General_options::finalize): Check incremental_mode_.
7140         * options.h (General_options): Update help text for --incremental.
7141         Add --no-incremental, --incremental-full, --incremental-update.
7142         (General_options::Incremental_mode): New enum type.
7143         (General_options::incremental_mode): New function.
7144         (General_options::incremental_mode_): New data member.
7145         * parameters.cc (Parameters::incremental_mode_): New data member.
7146         (Parameters::set_options): Set incremental_mode_.
7147         (Parameters::set_incremental_full): New function.
7148         (Parameters::incremental): New function.
7149         (Parameters::incremental_update): New function.
7150         (set_parameters_incremental_full): New function.
7151         * parameters.h (Parameters::set_incremental_full): New function.
7152         (Parameters::incremental): New function.
7153         (Parameters::incremental_update): New function.
7154         (Parameters::incremental_mode_): New data member.
7155         (set_parameters_incremental_full): New function.
7156         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
7157         incremental link mode.
7158         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
7159         (Sized_relobj::do_relocate_sections): Likewise.
7160         * testsuite/Makefile.am (incremental_test): Use --incremental-full
7161         option.
7162         * testsuite/Makefile.in: Regenerate.
7163         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7164
7165 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7166
7167         * script-sections.h (class Script_sections): Make
7168         Sections_elements typedef public.
7169         * script-sections.cc (class Sort_output_sections): Add elements_
7170         field.  Add constructor which sets it; change all callers.
7171         (Sort_output_sections::is_before): New function.
7172         (Sort_output_sections::operator()): Call is_before.
7173         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7174         conditional.
7175         * testsuite/script_test_10.sh: New test. Test script section
7176         order.
7177         * testsuite/script_test_10.t: Likewise.
7178         * testsuite/script_test_10.s: Likewise.
7179         * testsuite/Makefile.am: Wrap the cross linker tests and the
7180         common tests into NATIVE_OR_CROSS_LINKER.
7181         (check_SCRIPTS): Add script_test_10.sh.
7182         (check_DATA): Add script_test_10.stdout.
7183         (script_test_10.o, script_test_10): New targets.
7184         (script_test_10.stdout): New target.
7185         * configure, testsuite/Makefile.in: Regenerate.
7186
7187 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7188
7189         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7190         error for the deprecated relocations.
7191         (Target_arm::Scan::global): Likewise.
7192         (Target_arm::Relocate::relocate): Likewise.
7193
7194 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7195
7196         * fileread.cc (Input_file::find_file): Initialize *found_name
7197         and *namep when using the fallback search for case 4.
7198
7199 2010-10-11  Cary Coutant  <ccoutant@google.com>
7200
7201         * options.h (class General_options): Redefine -z lazy as an alias for
7202         the negation of -z now.
7203
7204 2010-10-11  Ian Lance Taylor  <iant@google.com>
7205
7206         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7207         binding.
7208
7209 2010-10-06  Nick Clifton  <nickc@redhat.com>
7210
7211         * script-sections.cc(class Memory_region): Remove
7212         current_lma_offset_ field.  Rename current_vma_offset_ to
7213         current_offset_.  Add last_section_ field.
7214         (Memory_region::get_current_vma_address): Rename to
7215         get_current_address.
7216         (Memory_region::get_current_lma_address): Delete.
7217         (Memory_region::increment_vma_offset): Rename to
7218         increment_offset.
7219         (Memory_region::increment_lma_offset): Delete.
7220         (Memory_region::attributes_compatible): New method.  Returns
7221         true if the provided section is compatible with the region.
7222         (Memory_region::get_last_section): New method.  Returns the last
7223         section to use the region.
7224         (Memory_region::set_last_section): New method.  Stores the last
7225         section to use the region.
7226         (Script_sections::block_in_region): New method.  Returns true if
7227         a block of memory is contained within a region.
7228         (Script_sections::find_memory_region): New method.  Locates a
7229         memory region to be used to set a VMA or LMA address.
7230         (Output_section_definition::set_section_addresses): Add code to
7231         check for addresses set by memory regions.
7232         (Output_segment::set_section_addresses): Remove memory region
7233         walking code.
7234         (Script_sections::create_segment): Add a warning if a header
7235         segment is created outside of any region.
7236         * script-sections.h (class Script_sections): Add prototypes for
7237         find_memory_region and block_in_region methods.
7238         * testsuite/memory_test.s: Use .long instead of .word.
7239         * testsuite/memory_test.t: Add some more output sections.
7240         * testsuite/memory_test.sh: Update expected output.
7241
7242 2010-10-02  Doug Kwan  <dougkwan@google.com>
7243
7244         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7245         defintion to symtab.h
7246         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7247         declaration to defintion.
7248
7249 2010-10-01  Nick Clifton  <nickc@redhat.com>
7250
7251         * expression.cc (eval): Replace dummy argument with NULL.
7252         (eval_maybe_dot): Check for a NULL result section pointer.
7253         (Symbol_expression::value): Likewise.
7254         (Dot_expression::value): Likewise.
7255         (BINARY_EXPRESSION): Likewise.
7256         (Max_expression::value): Likewise.
7257         (Min_expression::value): Likewise.
7258         (Absolute_expression::value): Likewise.
7259         (Addr_expression::value_from_output_section): Likewise.
7260         (Loaddddr_expression::value_from_output_section): Likewise.
7261         (Segment_start_expression::value): Likewise.
7262         * script-sections.cc
7263         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7264         argument with NULL.
7265         (Sections_elememt_dot_assignment::set_section_addresses):
7266         Likewise.
7267         (Output_data_expression::do_write_to_buffer): Likewise.
7268         (Output_section_definition::finalize_symbols): Likewise.
7269         (Output_section_definition::set_section_addresses): Likewise.
7270
7271 2010-09-30  Doug Kwan  <dougkwan@google.com>
7272
7273         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7274
7275 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7276
7277         * target.h (Target::can_icf_inline_merge_sections): New virtual
7278         function.
7279         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7280         virtual function.
7281         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7282         virtual function.
7283         * icf.cc (get_section_contents): Inline merge sections only when
7284         target allows it.
7285
7286 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7287
7288         * configure: Regenerate.
7289
7290 2010-09-17  Ian Lance Taylor  <iant@google.com>
7291
7292         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7293         * testsuite/Makefile.am (memory_test.o): New target.
7294         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7295         memory_test.t.
7296         * testsuite/Makefile.in: Rebuild.
7297
7298 2010-09-17  Doug Kwan  <dougkwan@google.com>
7299
7300         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7301         defintion if relocation uses GOT entries of the symbol.
7302         * testsuite/icf_safe_test.sh: Fix test.
7303         * testsuite/icf_safe_so_test.sh: Fix test.
7304
7305 2010-09-16  Cary Coutant  <ccoutant@google.com>
7306
7307         * script_sections.cc (class Memory_region): Remove "NULL" from
7308         vector initializations.
7309
7310 2010-09-15  Cary Coutant  <ccoutant@google.com>
7311
7312         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7313         Resolve forwarding symbols.
7314
7315 2010-09-15  Doug Kwan  <dougkwan@google.com>
7316
7317         * gold/testsuite/script_test_3.t: Add ARM special sections.
7318         * gold/testsuite/script_test_4.t: Same.
7319         * gold/testsuite/script_test_5.t: Same.
7320         * gold/testsuite/script_test_6.t: Same.
7321         * gold/testsuite/script_test_7.t: Same.
7322         * gold/testsuite/script_test_7.t: Same.
7323         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7324
7325 2010-09-14  Cary Coutant  <ccoutant@google.com>
7326
7327         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7328         (Target_x86_64::Relocate::relocate_tls): Replace check for
7329         saw_tls_block_reloc_ with test for executable section.
7330
7331 2010-09-12  Cary Coutant  <ccoutant@google.com>
7332
7333         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7334         position-independent executables to shared libraries need dynamic
7335         relocations.
7336         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7337         position-independent executables.
7338         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7339         * testsuite/Makefile.in: Regenerate.
7340
7341 2010-09-10  Nick Clifton  <nickc@redhat.com>
7342
7343         PR gold/11997
7344         * testsuite/memory_test.t: Discard any sections that are not
7345         needed.
7346
7347 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7348
7349         PR gold/11996
7350         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7351         "This::" to work around a bug in gcc 4.2.
7352
7353         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7354
7355 2010-09-09  Rafael Espindola  <espindola@google.com>
7356
7357         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7358         sections with different PF_X flags in the same segment.
7359         (Layout::find_first_load_seg): Search all segments to find the first
7360         one.
7361         * options.h (rosegment): New.
7362
7363 2010-09-08  Rafael Espindola  <espindola@google.com>
7364
7365         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7366
7367 2010-09-08  Doug Kwan  <dougkwan@google.com>
7368
7369         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7370         (Arm_relobj::do_relocate_sections): Add new parameter for output
7371         file to match the parent.
7372         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7373         of local symbols instead of input values.  Update code to track
7374         changes in gold::relocate_section.
7375         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7376         (Sized_relobj::compute_final_local_value_internal): New methods.
7377         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7378         body into private version of Sized_relobj::compute_final_local_value.
7379         Call the inline method.
7380         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7381         merged symbol value if there is one.
7382         (Symbol_value::has_output_value): New method defintiion.
7383         (Sized_relobj::Compute_final_local_value_status): New enum type.
7384         (Sized_relobj::compute_final_local_value): New methods.
7385         (Sized_relobj::compute_final_local_value_internal): New methods.
7386         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7387         and arm_cortex_a8.sh.
7388         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7389         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7390         New tests.
7391         * Makefile.in: Regenerate.
7392         * testsuite/arm_bl_out_of_range.s: Update test.
7393         * testsuite/thumb_bl_out_of_range.s: Ditto.
7394         * testsuite/thumb_blx_out_of_range.s: Ditto.
7395         * testsuite/arm_branch_out_of_range.sh: New file.
7396         * testsuite/arm_cortex_a8.sh: Ditto.
7397         * testsuite/arm_cortex_a8_b.s: Ditto.
7398         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7399         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7400         * testsuite/arm_cortex_a8_bl.s: Ditto.
7401         * testsuite/arm_cortex_a8_blx.s: Ditto.
7402         * testsuite/arm_cortex_a8_local.s: Ditto.
7403         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7404         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7405
7406 2010-09-08  Rafael Espindola  <espindola@google.com>
7407
7408         * Makefile.am (memory_test.stdout): Run readelf with -W.
7409         * Makefile.in: Regenerate.
7410         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7411         64 bit output.
7412
7413 2010-09-08  Rafael Espindola  <espindola@google.com>
7414
7415         * script-sections.cc (Script_sections::add_memory_region): Convert
7416         field precision to int.
7417         * script.cc (script_set_section_region, script_set_section_region):
7418         Convert field precision to int.
7419
7420 2010-09-08  Rafael Espindola  <espindola@google.com>
7421
7422         * arm.cc (do_finalize_sections): Create the __exidx_start and
7423         __exdix_end symbols even when the section is missing.
7424
7425 2010-09-08  Nick Clifton  <nickc@redhat.com>
7426
7427         * README: Remove claim that MEMORY is not supported.
7428         * expression.cc (script_exp_function_origin)
7429         (script_exp_function_length): Move from here to ...
7430         * script.cc: ... here.
7431         (script_set_section_region, script_add_memory)
7432         (script_parse_memory_attr, script_include_directive): New
7433         functions.
7434         * script-sections.cc
7435         (class Memory_region): New class.
7436         (class Output_section_definition): Add set_memory_region,
7437         set_section_vma, set_section_lma and get_section_name methods.
7438         (class Script_Sections): Add add_memory_region,
7439         find_memory_region, find_memory_region_origin,
7440         find_memory_region_length and set_memory_region methods.
7441         Have set_section_addresses method walk the list of set memory
7442         regions.
7443         Extend the print methos to display memory regions.
7444         * script-sections.h: Add prototypes for new methods.
7445         Add enum for MEMORY region attributes.
7446         * yyscript.y: Add support for parsing MEMORY regions.
7447         * script-c.h: Add prototypes for new functions.
7448         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7449         * testsuite/Makefile.in: Regenerate.
7450         * testsuite/memory_test.sh: New script.
7451         * testsuite/memory_test.s: New assembler source file.
7452         * testsuite/memory_test.t: New linker script.
7453
7454 2010-08-27  Doug Kwan  <dougkwan@google.com>
7455
7456         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7457         reference override an existing dynamic weak reference.
7458         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7459         * testsuite/Makefile.in: Regenerate.
7460         * testsuite/dyn_weak_ref.sh: New file.
7461         * testsuite/dyn_weak_ref_1.c: Ditto.
7462         * testsuite/dyn_weak_ref_2.c: Ditto.
7463
7464 2010-08-27  Ian Lance Taylor  <iant@google.com>
7465
7466         * incremental.h (class Incremental_input_entry): Add virtual
7467         destructor.
7468
7469 2010-08-27  Ian Lance Taylor  <iant@google.com>
7470
7471         * testsuite/start_lib_test_3.c: Mark t3 as used.
7472
7473 2010-08-27  Nick Clifton  <nickc@redhat.com>
7474
7475         * options.cc (version_script): Fix small typo in previous
7476         whitespace tidyup.
7477
7478 2010-08-25  Nick Clifton  <nickc@redhat.com>
7479
7480         * archive.cc: Formatting fixes: Remove whitespace between
7481         typename and following asterisk.  Remove whitespace between
7482         function name and opening parenthesis.
7483         * archive.h: Likewise.
7484         * arm.cc: Likewise.
7485         * attributes.cc: Likewise.
7486         * attributes.h: Likewise.
7487         * common.cc: Likewise.
7488         * copy-relocs.cc: Likewise.
7489         * dirsearch.h: Likewise.
7490         * dynobj.cc: Likewise.
7491         * ehframe.cc: Likewise.
7492         * ehframe.h: Likewise.
7493         * expression.cc: Likewise.
7494         * fileread.cc: Likewise.
7495         * fileread.h: Likewise.
7496         * gc.h: Likewise.
7497         * gold-threads.cc: Likewise.
7498         * gold.cc: Likewise.
7499         * i386.cc: Likewise.
7500         * icf.h: Likewise.
7501         * incremental-dump.cc: Likewise.
7502         * incremental.cc: Likewise.
7503         * layout.cc: Likewise.
7504         * layout.h: Likewise.
7505         * main.cc: Likewise.
7506         * merge.cc: Likewise.
7507         * merge.h: Likewise.
7508         * object.cc: Likewise.
7509         * object.h: Likewise.
7510         * options.cc: Likewise.
7511         * options.h: Likewise.
7512         * output.cc: Likewise.
7513         * output.h: Likewise.
7514         * plugin.cc: Likewise.
7515         * plugin.h: Likewise.
7516         * powerpc.cc: Likewise.
7517         * reloc.cc: Likewise.
7518         * script-c.h: Likewise.
7519         * script-sections.cc: Likewise.
7520         * script.cc: Likewise.
7521         * stringpool.cc: Likewise.
7522         * symtab.cc: Likewise.
7523         * symtab.h: Likewise.
7524         * target.cc: Likewise.
7525         * timer.cc: Likewise.
7526         * timer.h: Likewise.
7527         * version.cc: Likewise.
7528         * x86_64.cc: Likewise.
7529
7530 2010-08-24  Nick Clifton  <nickc@redhat.com>
7531
7532         PR 11899
7533         * layout.cc (segment_precedes): Sort segments by their physical
7534         addresses, if they have been set.
7535
7536 2010-08-23  Cary Coutant  <ccoutant@google.com>
7537
7538         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7539         symbols data.
7540         (Lib_group::include_member): Unlock object after deleting its
7541         symbols data.
7542         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7543         the bug fixed here.
7544
7545 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7546             Cary Coutant  <ccoutant@google.com>
7547
7548         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7549         constructor, and set_blocker.
7550         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7551         readsyms_blocker_.
7552         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7553         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7554         * testsuite/Makefile.am (start_lib_test): New test case.
7555         * testsuite/Makefile.in: Regenerate.
7556         * testsuite/start_lib_test_main.c: New file.
7557         * testsuite/start_lib_test_1.c: New file.
7558         * testsuite/start_lib_test_2.c: New file.
7559         * testsuite/start_lib_test_3.c: New file.
7560
7561 2010-08-19  Ian Lance Taylor  <iant@google.com>
7562
7563         * Makefile.in: Rebuild with automake 1.11.1.
7564         * aclocal.m4: Likewise.
7565         * testsuite/Makefile.in: Likewise.
7566
7567 2010-08-19  Ian Lance Taylor  <iant@google.com>
7568
7569         PR 10893
7570         * i386.cc (class Output_data_plt_i386): Update declarations.
7571         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7572         local_ifuncs_ fields.
7573         (Target_i386::do_plt_section_for_global): New function.
7574         (Target_i386::do_plt_section_for_local): New function.
7575         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7576         parameter; change all callers.  Initialize global_ifuncs_ and
7577         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7578         __rel_iplt_end.
7579         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7580         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7581         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7582         symbols.
7583         (Target_i386::make_plt_section): New function, broken out of
7584         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7585         (Target_i386::make_plt_entry): Call make_plt_section.
7586         (Target_i386::make_local_ifunc_plt_entry): New function.
7587         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7588         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7589         R_386_IRELATIVE to switch.
7590         (Target_i386::Scan::global): Likewise.
7591         (Target_i386::Relocate::relocate): Likewise.
7592         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7593         switch.
7594         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7595         (Target_x86_64::do_plt_section_for_global): New function.
7596         (Target_x86_64::do_plt_section_for_local): New function.
7597         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7598         parameter; change all callers.  If doing a static link define
7599         __rela_iplt_start and __rela_iplt_end.
7600         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7601         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7602         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7603         to point to .plt.
7604         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7605         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7606         switch.
7607         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7608         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7609         R_X86_64_IRELATIVE to switch.
7610         (Target_x86_64::Scan::global): Likewise.
7611         (Target_x86_64::Relocate::relocate): Likewise.
7612         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7613         switch.
7614         * target.h (class Target): Add plt_section_for_global and
7615         plt_section_for_local functions.  Add do_plt_section_for_global
7616         and do_plt_section_for_local virtual functions.
7617         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7618         clarifying comments.
7619         (Symbol::use_plt_offset): Handle IFUNC symbol.
7620         * object.cc (Sized_relobj::Sized_relobj): Initialize
7621         local_plt_offsets_.
7622         (Sized_relobj::local_has_plt_offset): New function.
7623         (Sized_relobj::local_plt_offset): New function.
7624         (Sized_relobj::set_local_plt_offset): New function.
7625         (Sized_relobj::do_count): Handle IFUNC symbol.
7626         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7627         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7628         is_ifunc_symbol functions.
7629         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7630         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7631         local_plt_offsets_ field.
7632         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7633         * output.h (class Output_section_data): Add non-const
7634         output_section function.
7635         (class Output_data_got): Update declarations.
7636         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7637         Add use_plt_offset parameter to global and local constructors.
7638         Change all callers.  Change local_sym_index_ field to 31 bits.
7639         Change GSYM_CODE and CONSTANT_CODE accordingly.
7640         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7641         doing a static link don't set sh_link field.
7642         (Output_data_got::Got_entry::write): Use PLT offset if
7643         appropriate.
7644         (Output_data_got::add_global_plt): New function.
7645         (Output_data_got::add_local_plt): New function.
7646         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7647         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7648         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7649         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7650         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7651         IFUNC conditional.
7652         * testsuite/ifunc-sel.h: New file.
7653         * testsuite/ifuncmain1.c: New file.
7654         * testsuite/ifuncmain1vis.c: New file.
7655         * testsuite/ifuncmod1.c: New file.
7656         * testsuite/ifuncdep2.c: New file.
7657         * testsuite/ifuncmain2.c: New file.
7658         * testsuite/ifuncmain3.c: New file.
7659         * testsuite/ifuncmod3.c: New file.
7660         * testsuite/ifuncmain4.c: New file.
7661         * testsuite/ifuncmain5.c: New file.
7662         * testsuite/ifuncmod5.c: New file.
7663         * testsuite/ifuncmain6pie.c: New file.
7664         * testsuite/ifuncmod6.c: New file.
7665         * testsuite/ifuncmain7.c: New file.
7666         * configure, testsuite/Makefile.in: Rebuild.
7667
7668 2010-08-18  Ian Lance Taylor  <iant@google.com>
7669
7670         * incremental.cc
7671         (Output_section_incremental_inputs::write_input_files): Add cast
7672         to avoid signed/unsigned comparison warning.
7673         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7674
7675 2010-08-12  Cary Coutant  <ccoutant@google.com>
7676
7677         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7678
7679 2010-08-13  Ian Lance Taylor  <iant@google.com>
7680
7681         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7682
7683 2010-08-12  Cary Coutant  <ccoutant@google.com>
7684             Doug Kwan  <dougkwan@google.com>
7685
7686         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7687         defintion overrides non-weak undef, remember that the original undef
7688         is not weak.
7689         * symtab.cc (Symbol_table::sized_write_global): For undef without
7690         an original weak binding, set binding to global in output.
7691         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7692         * testsuite/Makefile.in: Regenerate.
7693         * testsuite/strong_ref_weak_def.sh: New file.
7694         * testsuite/strong_ref_weak_def_1.c: Ditto.
7695         * testsuite/strong_ref_weak_def_2.c: Ditto.
7696
7697 2010-08-12  Cary Coutant  <ccoutant@google.com>
7698
7699         * testsuite/incremental_test.sh: Rewrite.
7700         * testsuite/incremental_test_1.c: Rewrite.
7701         * testsuite/incremental_test_2.c: Rewrite.
7702
7703 2010-08-12  Cary Coutant  <ccoutant@google.com>
7704
7705         * arm.cc (Target_arm::got_size): Add const.
7706         (Target_arm::got_entry_count): New function.
7707         (Target_arm::plt_entry_count): New function.
7708         (Target_arm::first_plt_entry_offset): New function.
7709         (Target_arm::plt_entry_size): New function.
7710         (Output_data_plt_arm::entry_count): New function.
7711         (Output_data_plt_arm::first_plt_entry_offset): New function.
7712         (Output_data_plt_arm::get_plt_entry_size): New function.
7713         * i386.cc (Target_i386::got_size): Add const.
7714         (Target_i386::got_entry_count): New function.
7715         (Target_i386::plt_entry_count): New function.
7716         (Target_i386::first_plt_entry_offset): New function.
7717         (Target_i386::plt_entry_size): New function.
7718         (Output_data_plt_i386::entry_count): New function.
7719         (Output_data_plt_i386::first_plt_entry_offset): New function.
7720         (Output_data_plt_i386::get_plt_entry_size): New function.
7721         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7722         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7723         * incremental.cc: Include target.h.
7724         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7725         parameter.  Adjust all callers.  Find incremental_got_plt section.
7726         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7727         section.
7728         (Output_section_incremental_inputs::set_final_data_size): Calculate
7729         size of incremental_got_plt section.
7730         (Output_section_incremental_inputs::do_write): Write the
7731         incremental_got_plt section.
7732         (Got_plt_view_info): New struct.
7733         (Local_got_offset_visitor): New class.
7734         (Global_got_offset_visitor): New class.
7735         (Global_symbol_visitor_got_plt): New class.
7736         (Output_section_incremental_inputs::write_got_plt): New function.
7737         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7738         Add parameter.  Adjust all callers.
7739         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7740         (Incremental_inputs::got_plt_section): New function.
7741         (Incremental_inputs::got_plt_section_): New data member.
7742         (Incremental_got_plt_reader): New class.
7743         * layout.cc (Layout::create_incremental_info_sections): Add the
7744         incremental_got_plt section.
7745         * object.h (Got_offset_list::get_list): New function.
7746         (Got offset_list::for_all_got_offsets): New function.
7747         (Sized_relobj::local_got_offset_list): New function.
7748         * powerpc.cc (Target_powerpc::got_size): Add const.
7749         (Target_powerpc::got_entry_count): New function.
7750         (Target_powerpc::plt_entry_count): New function.
7751         (Target_powerpc::first_plt_entry_offset): New function.
7752         (Target_powerpc::plt_entry_size): New function.
7753         (Output_data_plt_powerpc::entry_count): New function.
7754         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7755         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7756         * sparc.cc (Target_sparc::got_size): Add const.
7757         (Target_sparc::got_entry_count): New function.
7758         (Target_sparc::plt_entry_count): New function.
7759         (Target_sparc::first_plt_entry_offset): New function.
7760         (Target_sparc::plt_entry_size): New function.
7761         (Output_data_plt_sparc::entry_count): New function.
7762         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7763         (Output_data_plt_sparc::get_plt_entry_size): New function.
7764         * symtab.h (Symbol::got_offset_list): New function.
7765         (Symbol_table::for_all_symbols): New function.
7766         * target.h (Sized_target::got_entry_count): New function.
7767         (Sized_target::plt_entry_count): New function.
7768         (Sized_target::plt_entry_size): New function.
7769         * x86_64.cc (Target_x86_64::got_size): Add const.
7770         (Target_x86_64::got_entry_count): New function.
7771         (Target_x86_64::plt_entry_count): New function.
7772         (Target_x86_64::first_plt_entry_offset): New function.
7773         (Target_x86_64::plt_entry_size): New function.
7774         (Output_data_plt_x86_64::entry_count): New function.
7775         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7776         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7777
7778 2010-08-12  Cary Coutant  <ccoutant@google.com>
7779
7780         * archive.cc: Include incremental.h.
7781         (Archive::Archive): Initialize incremental_info_.
7782         (Archive::include_member): Record archive members in incremental info.
7783         (Add_archive_symbols::run): Record begin and end of an archive in
7784         incremental info.
7785         (Lib_group::include_member): Record objects in incremental info.
7786         * archive.h (Incremental_archive_entry): Forward declaration.
7787         (Archive::set_incremental_info): New member function.
7788         (Archive::incremental_info): New member function.
7789         (Archive::Unused_symbol_iterator): New class.
7790         (Archive::unused_symbols_begin): New member function.
7791         (Archive::unused_symbols_end): New member function.
7792         (Archive::incremental_info_): New data member.
7793         * incremental-dump.cc (find_input_containing_global): New function.
7794         (dump_incremental_inputs): Dump new incremental info sections.
7795         * incremental.cc: Include symtab.h.
7796         (Output_section_incremental_inputs): New class.
7797         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7798         new incremental info sections.
7799         (Sized_incremental_binary::do_check_inputs): Likewise.
7800         (Incremental_inputs::report_archive): Remove.
7801         (Incremental_inputs::report_archive_begin): New function.
7802         (Incremental_inputs::report_archive_end): New function.
7803         (Incremental_inputs::report_object): New function.
7804         (Incremental_inputs::finalize_inputs): Remove.
7805         (Incremental_inputs::report_input_section): New function.
7806         (Incremental_inputs::report_script): Rewrite.
7807         (Incremental_inputs::finalize): Do nothing but finalize string table.
7808         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7809         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7810         (Incremental_inputs::create_data_sections): New function.
7811         (Incremental_inputs::relocs_entsize): New function.
7812         (Output_section_incremental_inputs::set_final_data_size): New function.
7813         (Output_section_incremental_inputs::do_write): New function.
7814         (Output_section_incremental_inputs::write_header): New function.
7815         (Output_section_incremental_inputs::write_input_files): New function.
7816         (Output_section_incremental_inputs::write_info_blocks): New function.
7817         (Output_section_incremental_inputs::write_symtab): New function.
7818         * incremental.h (Incremental_script_entry): Forward declaration.
7819         (Incremental_object_entry): Forward declaration.
7820         (Incremental_archive_entry): Forward declaration.
7821         (Incremental_inputs): Forward declaration.
7822         (Incremental_inputs_header_data): Remove.
7823         (Incremental_inputs_header): Remove.
7824         (Incremental_inputs_header_write): Remove.
7825         (Incremental_inputs_entry_data): Remove.
7826         (Incremental_inputs_entry): Remove.
7827         (Incremental_inputs_entry_write): Remove.
7828         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7829         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7830         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7831         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7832         Likewise.
7833         (Incremental_input_entry): New class.
7834         (Incremental_script_entry): New class.
7835         (Incremental_object_entry): New class.
7836         (Incremental_archive_entry): New class.
7837         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7838         (Incremental_inputs::report_inputs): Remove.
7839         (Incremental_inputs::report_archive): Remove.
7840         (Incremental_inputs::report_archive_begin): New function.
7841         (Incremental_inputs::report_archive_end): New function.
7842         (Incremental_inputs::report_object): Change prototype.
7843         (Incremental_inputs::report_input_section): New function.
7844         (Incremental_inputs::report_script): Change prototype.
7845         (Incremental_inputs::get_reloc_count): New function.
7846         (Incremental_inputs::set_reloc_count): New function.
7847         (Incremental_inputs::create_data_sections): New function.
7848         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7849         (Incremental_inputs::inputs_section): New function.
7850         (Incremental_inputs::symtab_section): New function.
7851         (Incremental_inputs::relocs_section): New function.
7852         (Incremental_inputs::get_stringpool): Add const.
7853         (Incremental_inputs::command_line): Add const.
7854         (Incremental_inputs::inputs): Remove.
7855         (Incremental_inputs::command_line_key): New function.
7856         (Incremental_inputs::input_file_count): New function.
7857         (Incremental_inputs::input_files): New function.
7858         (Incremental_inputs::relocs_entsize): New function.
7859         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7860         (Incremental_inputs::finalize_inputs): Remove.
7861         (Incremental_inputs::Input_info): Remove.
7862         (Incremental_inputs::lock_): Remove.
7863         (Incremental_inputs::inputs_): Change type.
7864         (Incremental_inputs::inputs_map_): Remove.
7865         (Incremental_inputs::current_object_entry_): New data member.
7866         (Incremental_inputs::inputs_section_): New data member.
7867         (Incremental_inputs::symtab_section_): New data member.
7868         (Incremental_inputs::relocs_section_): New data member.
7869         (Incremental_inputs::reloc_count_): New data member.
7870         (Incremental_inputs_reader): New class.
7871         (Incremental_symtab_reader): New class.
7872         (Incremental_relocs_reader): New class.
7873         * layout.cc (Layout::finalize): Move finalization of incremental info
7874         and creation of incremental info sections to follow finalization of
7875         symbol table.  Set offsets for postprocessing sections.
7876         (Layout::create_incremental_info_sections): Call
7877         Incremental_inputs::create_data_sections.  Add incremental symtab
7878         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7879         sections to layout after input sections.
7880         * layout.h (struct Timespec): Forward declaration.
7881         (Layout::incremental_inputs): Add const.
7882         (Layout::create_incremental_info_sections): Add parameter.
7883         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7884         * object.cc: Include incremental.h.
7885         (Relobj::finalize_incremental_relocs): New function.
7886         (Sized_relobj::do_layout): Record input sections in incremental info.
7887         * object.h (Object::output_section): New function.
7888         (Object::output_section_offset): Moved from Relobj.
7889         (Object::get_incremental_reloc_base): New function.
7890         (Object::get_incremental_reloc_count): New function.
7891         (Object::do_output_section): New function.
7892         (Object::do_output_section_offset): Moved from Relobj.
7893         (Object::do_get_incremental_reloc_base): New function.
7894         (Object::do_get_incremental_reloc_count): New function.
7895         (Object::Object): Initialize new data members.
7896         (Relobj::output_section): Renamed do_output_section and moved to
7897         protected.
7898         (Relobj::output_section_offset): Moved to Object.
7899         (Relobj::do_get_incremental_reloc_base): New function.
7900         (Relobj::do_get_incremental_reloc_count): New function.
7901         (Relobj::allocate_incremental_reloc_counts): New function.
7902         (Relobj::count_incremental_reloc): New function.
7903         (Relobj::finalize_incremental_relocs): New function.
7904         (Relobj::next_incremental_reloc_index): New function.
7905         (Relobj::reloc_counts_): New data member.
7906         (Relobj::reloc_bases_): New data member.
7907         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7908         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7909         (Sized_relobj::incremental_relocs_scan): New function.
7910         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7911         (Sized_relobj::incremental_relocs_write): New function.
7912         (Sized_relobj::incremental_relocs_write_reltype): New function.
7913         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7914         incremental link.
7915         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7916         archives and object files elsewhere.
7917         (Add_symbols::run): Report object files here.
7918         (Finish_group::run): Report end of archive at end of group.
7919         * reloc.cc: Include layout.h, incremental.h.
7920         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7921         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7922         (Sized_relobj::incremental_relocs_scan): New function.
7923         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7924         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7925         (Sized_relobj::incremental_relocs_write): New function.
7926         (Sized_relobj::incremental_relocs_write_reltype): New function.
7927         * script.cc (read_input_script): Rewrite test for incremental link.
7928         Change call to Incremental_inputs::report_script.
7929         * symtab.h (Symbol_table::first_global_index): New function.
7930         (Symbol_table::output_count): New function.
7931
7932 2010-08-12  Doug Kwan  <dougkwan@google.com>
7933
7934         * arm.cc (Target_arm::merge_object_attributes): Check command line
7935         options --no-wchar-size-warning and --no-enum-size-warning.
7936         * options.h (General_options): Add ld-compatible options
7937         --no-enum-size-warning and --no-wchar-size-warning.
7938
7939 2010-08-04  Ian Lance Taylor  <iant@google.com>
7940
7941         * x86_64.cc (Target_x86_64::Scan::local): Use
7942         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7943         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7944         (Target_x86_64::Scan::global): Likewise.
7945         (Target_x86_64::Relocate::relocate): Likewise.
7946         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7947         Likewise.
7948
7949 2010-08-03  Cary Coutant  <ccoutant@google.com>
7950
7951         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7952         to reserve space in merged_strings vector. Keep total input size
7953         for stats.
7954         (Output_merge_string::do_print_merge_stats): Print total input size.
7955         * merge.h (Output_merge_string): Add input_size_ field.
7956         * stringpool.cc (Stringpool_template::string_length): Move
7957         implementations out of Stringpool_template class and place in
7958         stringpool.h.
7959         * stringpool.h (string_length): Move out of Stringpool_template.
7960
7961 2010-08-03  Ian Lance Taylor  <iant@google.com>
7962
7963         PR 11712
7964         * layout.cc (relaxation_loop_body): If address of load segment is
7965         set, adjust address to include headers if possible.
7966
7967 2010-08-03  Ian Lance Taylor  <iant@google.com>
7968
7969         * version.cc (version_string): Bump to 1.10.
7970
7971 2010-08-03  Ian Lance Taylor  <iant@google.com>
7972
7973         PR 11805
7974         * layout.h (enum Output_section_order): Define.
7975         (class Layout): Update declarations.
7976         * layout.cc (Layout::get_output_section): Add order parameter.
7977         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7978         is_first_non_relro parameters.  Change all callers.
7979         (Layout::choose_output_section): Likewise.
7980         (Layout::add_output_section_data): Likewise.
7981         (Layout::make_output_section): Likewise.  Set order.
7982         (Layout::default_section_order): New function.
7983         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7984         * output.cc (Output_section::Output_section): Initialize order_.
7985         Don't initialize deleted fields.
7986         (Output_segment::Output_segment): Don't initialize deleted
7987         fields.
7988         (Output_segment::add_output_section_to_load): New function
7989         replacing add_output_section.  Change all callers to call this or
7990         add_output_section_to_nonload.
7991         (Output_segment::add_output_section_to_nonload): New function.
7992         (Output_segment::remove_output_section): Rewrite.
7993         (Output_segment::add_initial_output_data): Likewise.
7994         (Output_segment::has_any_data_sections): Likewise.
7995         (Output_segment::is_first_section_relro): Likewise.
7996         (Output_segment::maximum_alignment): Likewise.
7997         (Output_segment::has_dynamic_reloc): New function replacing
7998         dynamic_reloc_count.  Change all callers.
7999         (Output_segment::has_dynamic_reloc_list): New function replacing
8000         dynamic_reloc_count_list.  Change all callers.
8001         (Output_segment::set_section_addresses): Rewrite.
8002         (Output_segment::set_offset): Rewrite.
8003         (Output_segment::find_first_and_last_list): Remove.
8004         (Output_segment::set_tls_offsets): Rewrite.
8005         (Output_segment::first_section_load_address): Likewise.
8006         (Output_segment::output_section_count): Likewise.
8007         (Output_segment::section_with_lowest_load_address): Likewise.
8008         (Output_segment::write_section_headers): Likewise.
8009         (Output_segment::print_sections_to_map): Likewise.
8010         * output.h (class Output_data): Remove dynamic_reloc_count_
8011         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
8012         (Output_data::add_dynamic_reloc): Rewrite.
8013         (Output_data::has_dynamic_reloc): New function.
8014         (Output_data::dynamic_reloc_count): Remove.
8015         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
8016         is_last_relro_, is_first_non_relro_, is_interp_,
8017         is_dynamic_linker_section_ fields.  Add order and set_order
8018         functions.  Remove is_relro_local, set_is_relro_local,
8019         is_last_relro, set_is_last_relro, is_first_non_relro,
8020         set_is_first_non_relro functions, is_interp, set_is_interp,
8021         is_dynamic_linker_section, and set_is_dynamic_linker_section
8022         functions.
8023         (class Output_segment): Change Output_data_list from std::list to
8024         std:;vector.  Add output_lists_ field.  Remove output_data_ and
8025         output_bss_ fields.  Update declarations.
8026
8027 2010-08-02  Ian Lance Taylor  <iant@google.com>
8028
8029         * arm.cc (Target_arm::gc_process_relocs): Use typename.
8030         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
8031         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
8032
8033 2010-08-02  Ian Lance Taylor  <iant@google.com>
8034
8035         PR 11855
8036         * script.cc (Script_options::Script_options): Initialize
8037         symbol_definitions_ and symbol_references_.
8038         (Script_options::add_symbol_assignment): Update
8039         symbol_definitions_ and symbol_references_.
8040         (Script_options::add_symbol_reference): New function.
8041         (script_symbol): New function.
8042         * script.h (class Script_options): Add symbol_definitions_ and
8043         symbol_references_ fields.
8044         (Script_options::referenced_const_iterator): New type.
8045         (Script_options::referenced_begin): New function.
8046         (Script_options::referenced_end): New function.
8047         (Script_options::is_referenced): New function.
8048         (Script_options::any_unreferenced): New function.
8049         * script-c.h (script_symbol): Declare.
8050         * yyscript.y (exp): Call script_symbol.
8051         * symtab.cc: Include "script.h".
8052         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
8053         Change all callers.  Check symbols referenced by scripts.
8054         (Symbol_table::add_undefined_symbols_from_command_line): Add
8055         layout parameter.  Change all callers.
8056         (Symbol_table::do_add_undefined_symbols_from_command_line):
8057         Likewise.  Break out loop body.  Check symbols referenced by
8058         scripts.
8059         (Symbol_table::add_undefined_symbol_from_command_line): New
8060         function broken out of
8061         do_add_undefined_symbols_from_command_line.
8062         * symtab.h (class Symbol_table): Update declarations.
8063         * archive.cc: Include "layout.h".
8064         (Archive::should_include_member): Add layout parameter.  Change
8065         all callers.  Check for symbol mentioned in expression.
8066         * archive.h (class Archive): Update declaration.
8067         * object.cc (Sized_relobj::do_should_include_member): Add layout
8068         parameter.
8069         * object.h (Object::should_include_member): Add layout parameter.
8070         Change all callers.
8071         (Object::do_should_include_member): Add layout parameter.
8072         (class Sized_relobj): Update declaration.
8073         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
8074         parameter.
8075         * dynobj.h (class Sized_dynobj): Update declaration.
8076         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
8077         layout parameter.
8078         * plugin.h (class Sized_pluginobj): Update declaration.
8079
8080 2010-08-02  Ian Lance Taylor  <iant@google.com>
8081
8082         PR 11866
8083         * output.cc (Output_segment::set_offset): Search for the first and
8084         last sections rather than assuming that the list is in order.
8085         (Output_segment::find_first_and_last_list): New function.
8086         * output.h (class Output_segment): Update declarations.
8087         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
8088         (relro_strip_test_SOURCES): New variable.
8089         (relro_strip_test_DEPENDENCIES): New variable.
8090         (relro_strip_test_LDFLAGS): New variable.
8091         (relro_strip_test_LDADD): New variable.
8092         (relro_strip_test.so): New target.
8093
8094 2010-08-02  Ian Lance Taylor  <iant@google.com>
8095
8096         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
8097         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
8098         (Target_i386::got_tlsdesc_section): New function.
8099         (Target_i386::got_section): Create space for GOT entries for
8100         TLSDESC relocations.
8101         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
8102         R_386_TLS_GOTDESC.
8103         (Target_i386::Scan::global): Likewise.
8104         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
8105         using TLSDESC GOT.
8106         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
8107         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
8108         (Target_x86_64::got_tlsdesc_section): New function.
8109         (Target_x86_64::got_section): Create space for GOT entries for
8110         TLSDESC relocations.
8111         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
8112         R_386_TLS_GOTDESC.
8113         (Target_x86_64::Scan::global): Likewise.
8114         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
8115         using TLSDESC GOT.
8116
8117 2010-08-02  Ian Lance Taylor  <iant@google.com>
8118
8119         * testsuite/final_layout.sh: Use dc to convert from hex to
8120         decimal.
8121
8122 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
8123
8124         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
8125         paramter to the call to gold::gc_process_relocs.
8126         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
8127         paramter to the call to gold::gc_process_relocs.
8128         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
8129         parameter to the call to gold::gc_process_relocs.
8130         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
8131         template parameter to the call to gold::gc_process_relocs.
8132         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
8133         paramter to the call to gold::gc_process_relocs.
8134         * gc.h (get_embedded_addend_size): New function.
8135         (gc_process_relocs): Save the size of the reloc for use by ICF.
8136         * icf.cc (get_section_contents): Get the addend from the text section
8137         for SHT_REL relocation sections.
8138         * icf.h (Icf::Reloc_addend_size_info): New typedef.
8139         (Icf::Reloc_info): Add new member reloc_addend_size_info.
8140         * int_encoding.h (read_from_pointer): New overloaded function.
8141         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
8142         * testsuite/icf_sht_rel_addend_test.sh: New file.
8143         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
8144         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
8145
8146 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8147
8148         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
8149         * Makefile.in: Regenerate.
8150         * testsuite/Makefile.in: Regenerate.
8151
8152 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
8153
8154         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
8155         * gold/testsuite/debug_msg.cc: Likewise.
8156         * gold/testsuite/odr_violation1.cc
8157         * gold/testsuite/odr_violation2.cc
8158
8159 2010-07-21  Cary Coutant  <ccoutant@google.com>
8160
8161         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
8162         string, and length fields.
8163         (Output_merge_string::Merged_strings_list): New type.
8164         (Output_merge_string::Merged_strings_lists): New typedef.
8165         (Output_merge_string): Replace merged_strings_ with
8166         merged_strings_lists_.
8167         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8168         Merged_strings_list per input object and section.  Don't store pointer
8169         to the string.  Don't store length with each merged string entry.
8170         (Output_merge_string::finalize_merged_data): Loop over list of merged
8171         strings lists.  Recompute length of each merged string.
8172
8173 2010-07-15  Cary Coutant  <ccoutant@google.com>
8174
8175         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8176         here.
8177
8178 2010-07-14  Ian Lance Taylor  <iant@google.com>
8179
8180         * descriptors.cc (Descriptors::open): Report correct name in error
8181         message.
8182
8183 2010-07-13  Doug Kwan  <dougkwan@google.com>
8184
8185         * arm.cc (Arm_input_section::Arm_input_section): For a
8186         SHT_ARM_EXIDX section, always keeps the input sections.
8187         (Arm_input_section::set_exidx_section_link): New method.
8188         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8189         has_errors_ to false.
8190         (Arm_exidx_input_section::has_errors,
8191         Arm_exidx_input_section::set_has_errors): New methods.
8192         (Arm_exidx_input_section::has_errors_): New data member.
8193         (Arm_relobj::get_exidx_shndx_list): New method.
8194         (Arm_output_section::append_text_sections_to_list): Do not skip
8195         section without SHF_EXECINSTR.
8196         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8197         errors.
8198         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8199         section header.  Make error messages more verbose.  Check for
8200         a non-executable section linked to an EXIDX section.
8201         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8202         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8203         check that there is no deferred EXIDX section if we exit early.
8204         Instead of not making an EXIDX section in case of an error, make one
8205         and set the has_errors flag of it.
8206         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8207         in a relocatable link.
8208         (Target_arm::do_relax): Look for the EXIDX output section instead of
8209         assuming that it is called .ARM.exidx.
8210         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8211         section list.  Do not check for SHF_EXECINSTR section flags but
8212         skip any input section with errors.
8213         * output.cc (Output_section::Output_section): Initialize
8214         always_keeps_input_sections_ to false.
8215         (Output_section::add_input_section): Check for
8216         always_keeps_input_sections_.
8217         *  output.h (Output_section::always_keeps_input_sections,
8218         Output_section::set_always_keeps_input_sections): New methods.
8219         (Output_section::always_keeps_input_sections): New data member.
8220
8221 2010-07-13  Rafael Espindola  <espindola@google.com>
8222
8223         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8224         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8225
8226 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8227             Ian Lance Taylor  <iant@google.com>
8228
8229         * output.h (Output_section_lookup_maps::add_merge_section):
8230         Correct check of whether value was inserted.
8231         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8232         (Output_section_lookup_maps::add_relaxed_input_section):
8233         Likewise.
8234         * arm.cc (Target_arm::got_section): Remove used local os.
8235         * i386.cc (Target_i386::got_section): Likewise.
8236         * x86_64.cc (Target_x86_64::got_section): Likewise.
8237         * sparc.cc (Target_sparc::got_section): Likewise.
8238         (Target_sparc::relocate): Remove unused local have_got_offset.
8239         * powerpc.cc (Target_powerpc::relocate): Likewise.
8240
8241 2010-07-13  Ian Lance Taylor  <iant@google.com>
8242
8243         * compressed_output.cc (zlib_decompress): Fix signature in
8244         !HAVE_ZLIB_H case.
8245
8246         * archive.cc (Archive::include_member): Unlock an external member
8247         of a thin archive.  Don't bother to delete an object we know is
8248         NULL.
8249
8250 2010-07-12  Cary Coutant  <ccoutant@google.com>
8251
8252         * compressed_output.cc (zlib_decompress): New function.
8253         (get_uncompressed_size): New function.
8254         (decompress_input_section): New function.
8255         * compressed_output.h (get_uncompressed_size): New function.
8256         (decompress_input_section): New function.
8257         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8258         Handle compressed debug sections.
8259         * layout.cc (is_compressed_debug_section): New function.
8260         (Layout::output_section_name): Map compressed section names to
8261         canonical names.
8262         * layout.h (is_compressed_debug_section): New function.
8263         (is_debug_info_section): Recognize compressed debug sections.
8264         * merge.cc: Include compressed_output.h.
8265         (Output_merge_data::do_add_input_section): Handle compressed
8266         debug sections.
8267         (Output_merge_string::do_add_input_section): Handle compressed
8268         debug sections.
8269         * object.cc: Include compressed_output.h.
8270         (Sized_relobj::Sized_relobj): Initialize new data members.
8271         (build_compressed_section_map): New function.
8272         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8273         * object.h (Object::section_is_compressed): New method.
8274         (Object::do_section_is_compressed): New method.
8275         (Sized_relobj::Compressed_section_map): New type.
8276         (Sized_relobj::do_section_is_compressed): New method.
8277         (Sized_relobj::compressed_sections_): New data member.
8278         * output.cc (Output_section::add_input_section): Handle compressed
8279         debug sections.
8280         * reloc.cc: Include compressed_output.h.
8281         (Sized_relobj::write_sections): Handle compressed debug sections.
8282
8283 2010-07-08  Cary Coutant  <ccoutant@google.com>
8284
8285         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8286         weak when resolving to a dynamic def.
8287         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8288         for weak undef/dynamic def cases. Adjust callers.
8289         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8290         undef_binding_weak_.
8291         (Symbol_table::sized_write_globals): Adjust symbol binding.
8292         (Symbol_table::sized_write_symbol): Add binding parameter.
8293         * symtab.h (Symbol::set_undef_binding): New method.
8294         (Symbol::is_undef_binding_weak): New method.
8295         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8296         (Symbol_table::should_override): Add new parameter.
8297         (Symbol_table::sized_write_symbol): Add new parameter.
8298
8299         * testsuite/weak_undef_file1.cc: Add new test case.
8300         * testsuite/weak_undef_file2.cc: Fix header comment.
8301         * testsuite/weak_undef_test.cc: Add new test case.
8302
8303 2010-06-29  Doug Kwan  <dougkwan@google.com>
8304
8305         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8306         Initialize USE_SYMBOL_.
8307         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8308         definition.
8309         (Arm_reloc_property::uses_symbol_): New data member declaration.
8310         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8311         uses symbol value and symbol is undefined but not weakly undefined.
8312
8313 2010-06-28  Rafael Espindola  <espindola@google.com>
8314
8315         * plugin.cc (Plugin::load): Use dlerror.
8316
8317 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8318
8319         * symtab.cc (detect_odr_violations): When reporting an ODR
8320         violation, report an object where the symbol is defined.
8321
8322 2010-06-25  Doug Kwan  <dougkwan@google.com>
8323
8324         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8325         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8326         definition.
8327         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8328         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8329         target hook to detect function points.
8330         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8331         * icf.h (Icf::check_section_for_function_pointers): Change type of
8332         parameter SECTION_NAME to const reference to std::string.  Use
8333         target hook to determine if section may have unsafe pointers.
8334         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8335         method definition.
8336
8337 2010-06-21  Rafael Espindola  <espindola@google.com>
8338
8339         * fileread.cc (Input_file::find_fie): New
8340         (Input_file::open): Use Input_file::find_fie.
8341         * fileread.h (Input_file::find_fie): New
8342         * plugin.cc (set_extra_library_path): New.
8343         (Plugin::load): Add set_extra_library_path to the transfer vector.
8344         (Plugin_manager::set_extra_library_path): New.
8345         (Plugin_manager::add_input_file): Use the extra search path if set.
8346         (set_extra_library_path(): New.
8347         * plugin.h (Plugin_manager): Add set_extra_library_path and
8348         extra_search_path_.
8349
8350 2010-06-19  Cary Coutant  <ccoutant@google.com>
8351
8352         * layout.cc (gdb_sections): Add .debug_types.
8353         (lines_only_debug_sections): Likewise.
8354
8355 2010-06-18  Rafael Espindola  <espindola@google.com>
8356
8357         * plugin.cc (add_input_file,add_input_library)
8358         (Plugin_manager::add_input_file): Make filename arguments const.
8359         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8360         const.
8361
8362 2010-06-16  Doug Kwan  <dougkwan@google.com>
8363
8364         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8365         .ARM.attributes section if we have not merged any input
8366         attributes sections.
8367
8368 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8369
8370         * arm.cc: Allow combining objects with no EABI version
8371         information.
8372
8373 2010-06-15  Rafael Espindola  <espindola@google.com>
8374
8375         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8376
8377 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8378
8379         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8380         (struct iovec): Correct !HAVE_READV definition.
8381
8382 2010-06-10  Cary Coutant  <ccoutant@google.com>
8383
8384         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8385         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8386         reloc sections.
8387         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8388
8389         PR 11683
8390         * symtab.h (Symbol::is_placeholder): New member function.
8391         * target-reloc.h (relocate_section): Check for placeholder symbols.
8392
8393         * testsuite/Makefile.am (plugin_test_8): New test.
8394         (plugin_test_9): New test.
8395         * testsuite/Makefile.in: Regenerate.
8396
8397 2010-06-09  Nick Clifton  <nickc@redhat.com>
8398
8399         * yyscript.y (input_list_element): Allow strings prefixed with
8400         the '-' character.  Treat these as libraries.
8401         * script.cc (script_add_library): New function.  Adds a library
8402         specified by "-l<name>" found in an input script.
8403         * script-c.h: Add prototype for script_add_library.
8404
8405 2010-06-07  Doug Kwan  <dougkwan@google.com>
8406
8407         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8408         Restrict stub-group size to be within long conditional branch
8409         range when working around cortex-A8 erratum.
8410
8411 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8412
8413         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8414         #ifdef typo.
8415
8416 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8417
8418         PR gold/11658
8419         * output.cc
8420         (Output_section::Input_section_sort_entry::compare_section_ordering):
8421         Change to return non-zero correctly.
8422         (Output_section::Input_section_sort_section_order_index_compare
8423         ::operator()): Change to fix ambiguity in comparisons.
8424
8425 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8426
8427         * gold.h (is_wildcard_string): New function.
8428         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8429         (Layout::layout_eh_frame): Ditto.
8430         (Layout::find_section_order_index): New method.
8431         (Layout::read_layout_from_file): New method.
8432         * layout.h (Layout::find_section_order_index): New method.
8433         (Layout::read_layout_from_file): New method.
8434         (Layout::input_section_position_): New private member.
8435         (Layout::input_section_glob_): New private member.
8436         * main.cc (main): Call read_layout_from_file here.
8437         * options.h (--section-ordering-file): New option.
8438         * output.cc (Output_section::input_section_order_specified_): New
8439         member.
8440         (Output_section::Output_section): Initialize new member.
8441         (Output_section::add_input_section): Add new parameter.
8442         Keep input sections when --section-ordering-file is used.
8443         (Output_section::set_final_data_size): Sort input sections when
8444         section ordering file is specified.
8445         (Output_section::Input_section_sort_entry): Add new parameter.
8446         Check sorting type.
8447         (Output_section::Input_section_sort_entry::compare_section_ordering):
8448         New method.
8449         (Output_section::Input_section_sort_compare::operator()): Change to
8450         consider section_order_index.
8451         (Output_section::Input_section_sort_init_fini_compare::operator()):
8452         Change to consider section_order_index.
8453         (Output_section::Input_section_sort_section_order_index_compare
8454         ::operator()): New method.
8455         (Output_section::sort_attached_input_sections): Change to sort
8456         according to section order when specified.
8457         (Output_section::add_input_section<32, true>): Add new parameter.
8458         (Output_section::add_input_section<64, true>): Add new parameter.
8459         (Output_section::add_input_section<32, false>): Add new parameter.
8460         (Output_section::add_input_section<64, false>): Add new parameter.
8461         * output.h (Output_section::add_input_section): Add new parameter.
8462         (Output_section::input_section_order_specified): New
8463         method.
8464         (Output_section::set_input_section_order_specified): New method.
8465         (Input_section::Input_section): Initialize section_order_index_.
8466         (Input_section::section_order_index): New method.
8467         (Input_section::set_section_order_index): New method.
8468         (Input_section::section_order_index_): New member.
8469         (Input_section::Input_section_sort_section_order_index_compare): New
8470         struct.
8471         (Output_section::input_section_order_specified_): New member.
8472         * script-sections.cc (is_wildcard_string): Delete and move modified
8473         method to gold.h.
8474         (Output_section_element_input::Output_section_element_input): Modify
8475         call to is_wildcard_string.
8476         (Output_section_element_input::Input_section_pattern
8477         ::Input_section_pattern): Ditto.
8478         (Output_section_element_input::Output_section_element_input): Ditto.
8479         * testsuite/Makefile.am (final_layout): New test case.
8480         * testsuite/Makefile.in: Regenerate.
8481         * testsuite/final_layout.cc: New file.
8482         * testsuite/final_layout.sh: New file.
8483
8484 2010-06-01  Rafael Espindola  <espindola@google.com>
8485
8486         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8487
8488 2010-06-01  Rafael Espindola  <espindola@google.com>
8489
8490         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8491         visibility of symbols.
8492
8493 2010-05-27  Doug Kwan  <dougkwan@google.com>
8494
8495         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8496         from start of output section instead of address for a local symbol
8497         in a merged or relaxed section when doing a relocatable link.
8498
8499 2010-05-26  Rafael Espindola  <espindola@google.com>
8500
8501         PR 11604
8502         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8503         adding sections the garbage collector removed.
8504         * gold/testsuite/Makefile.am: Add test.
8505         * gold/testsuite/Makefile.in: Regenerate.
8506         * gold/testsuite/plugin_test_7.sh: New.
8507         * gold/testsuite/plugin_test_7_1.c: New.
8508         * gold/testsuite/plugin_test_7_2.c: New.
8509
8510 2010-05-26  Rafael Espindola  <espindola@google.com>
8511
8512         * script-sections.cc (Output_section_definition::set_section_addresses):
8513         Check for --section-start.
8514
8515 2010-05-26  Doug Kwan  <dougkwan@google.com>
8516
8517         * arm.cc (Arm_scan_relocatable_relocs): New class.
8518         (Target_arm::relocate_special_relocatable): New method.
8519         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8520         (Arm_relocate_functions::thumb_branch_common): Same.
8521         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8522         instead of Default_scan_relocatable_relocs.
8523         * target-reloc.h (relocate_for_relocatable): Let target handle
8524         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8525         * target.h (Sized_target::relocate_special_relocatable): New method.
8526
8527 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8528
8529         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8530
8531 2010-05-23  Doug Kwan  <dougkwan@google.com>
8532
8533         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8534         instead of a cast.
8535         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8536         with a direct branch, not a conditional branch, to a stub.
8537         * merge.cc (Output_merge_base::record_input_section): New method
8538         defintion.
8539         (Output_merge_data::do_add_input_section): Record input section if
8540         keeps-input-sections flag is set.
8541         (Output_merge_string::do_add_input_section): Ditto.
8542         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8543         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8544         INPUT_SECTIONS_.
8545         (Output_merge_base::keeps_input_sections,
8546         Output_merge_base::set_keeps_input_sections,
8547         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8548         method definitions.
8549         (Output_merge_base::Input_sections): New type declaration.
8550         (Output_merge_base::input_sections_begin,
8551         Output_merge_base::input_sections_end,
8552         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8553         (Output_merge_base::bool keeps_input_sections_,
8554         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8555         Output_merge_base::input_sections_): New data members.
8556         (Output_merge_data::do_set_keeps_input_sections): New method
8557         defintion.
8558         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8559         * output.cc (Output_section::Input_section::relobj): Move method
8560         defintion from class declaration to here and handle merge sections.
8561         (Output_section::Input_section::shndx): Ditto.
8562         (Output_section::Output_section): Remove initializations of removed
8563         data members and initialize new data member LOOKUP_MAPS_.
8564         (Output_section::add_input_section): Set keeps-input-sections flag
8565         for a newly created merge output section as appropriate.  Adjust code
8566         to use Output_section_lookup_maps class.
8567         (Output_section::add_relaxed_input_section): Adjst code for lookup
8568         maps code refactoring.
8569         (Output_section::add_merge_input_section): Add a new parameter
8570         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8571         class.  If adding input section to a newly created merge output
8572         section fails, remove the new merge section.
8573         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8574         Adjust code for use of the Output_section_lookup_maps class.
8575         (Output_section::find_merge_section): Ditto.
8576         (Output_section::build_lookup_maps): New method defintion.
8577         (Output_section::find_relaxed_input_section): Adjust code to use
8578         Output_section_lookup_maps class.
8579         (Output_section::get_input_sections): Export merge sections.  Adjust
8580         code to use Output_section_lookup_maps class.
8581         (Output_section:::add_script_input_section): Adjust code to use
8582         Output_section_lookup_maps class.  Update lookup maps for merge
8583         sections also.
8584         (Output_section::discard_states): Use Output_section_lookup_maps.
8585         (Output_section::restore_states): Same.
8586         * output.h (Merge_section_properties): Move class defintion out of
8587         Output_section.
8588         (Output_section_lookup_maps): New class.
8589         (Output_section::Input_section::is_merge_section): New method
8590         defintion.
8591         (Output_section::Input_section::relobj): Move defintion out of class
8592         defintion.  Declare method only.
8593         (Output_section::Input_section::shndx): Ditto.
8594         (Output_section::Input_section::output_merge_base): New method defintion.
8595         (Output_section::Input_section::u2_.pomb): New union field.
8596         (Output_section::Merge_section_by_properties_map,
8597         Output_section::Output_section_data_by_input_section_map,
8598         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8599         Remove types.
8600         (Output_section::add_merge_input_section): Add new parameter
8601         KEEPS_INPUT_SECTIONS.
8602         (Output_section::build_lookup_maps): New method declaration.
8603         (Output_section::merge_section_map_,
8604         Output_section::merge_section_by_properties_map_,
8605         Output_section::relaxed_input_section_map_,
8606         Output_section::is_relaxed_input_section_map_valid_): Remove data
8607         members.
8608         (Output_section::lookup_maps_): New data member.
8609
8610 2010-05-21  Doug Kwan  <dougkwan@google.com>
8611
8612         PR gold/11619
8613         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8614         avoid a compilation error.
8615
8616 2010-05-19  Rafael Espindola  <espindola@google.com>
8617
8618         * script-sections.cc (Output_section_definition::allocate_to_segment):
8619         Update the phdrs_list even when the output section is NULL.
8620         * testsuite/Makefile.am: Add test.
8621         * testsuite/Makefile.in: Regenerate.
8622         * testsuite/script_test_9.cc: New.
8623         * testsuite/script_test_9.sh: New.
8624         * testsuite/script_test_9.t: New.
8625
8626 2010-05-19  Doug Kwan  <dougkwan@google.com>
8627
8628         * arm.cc (Arm_input_section::original_size): New method.
8629         (Arm_input_section::do_addralign): Add a cast.
8630         (Arm_input_section::do_output_offset): Remove static cast.
8631         (Arm_input_section::original_addralign,
8632          Arm_input_section::original_size_): Change type to uint32_t.
8633         (Arm_input_section::init): Add safe casts for section alignment
8634         and size.
8635         (Arm_input_section::set_final_data_size): Do not set address and
8636         offset of stub table.
8637         (Arm_output_section::fix_exidx_coverage): Change use of of
8638         Output_section::Simple_input_section to that of
8639         Output_section::Input_section.
8640         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8641         except for the first pass.
8642         * output.cc (Output_section::get_input_sections): Change type of
8643         input_sections to std::list<Input_section>.
8644         (Output_section::add_script_input_section): Rename from
8645         Output_section::add_simple_input_section.  Change type of SIS
8646         parameter from Simple_input_section to Input_section.
8647         * output.h (Output_section::Simple_input_section): Remove class.
8648         (Output_section::Input_section): Change class visibility to public.
8649         (Output_section::Input_section::addralign): Use stored alignments
8650         for special input sections if set.
8651         (Output_section::Input_section::set_addralign): New method.
8652         (Output_section::get_input_sections): Change parameter type from
8653         list of Simple_input_section to list of Input_section.
8654         (Output_section::add_script_input_section): Rename from
8655         Output_section::add_simple_input_section. Change first parameter's
8656         type from Simple_input_section to Input_section and remove the
8657         second and third parameters.
8658         * script-sections.cc (Input_section::Input_section_list): Change
8659         type to list of Output_section::Input_section/
8660         (Input_section_info::Input_section_info): Change parameter type of
8661         INPUT_SECTION to Output_section::Input_section.
8662         (Input_section_info::input_section): Change return type.
8663         (Input_section_info::input_section_): Change type to
8664         Output_section::Input_section.
8665         (Output_section_element_input::set_section_addresses): Adjust code
8666         to use Output_section::Input_section instead of
8667         Output_section::Simple_input_section.  Adjust code for renaming
8668         of Output_section::add_simple_input_section.
8669         (Orphan_output_section::set_section_addresses): Ditto.
8670
8671 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8672
8673         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8674         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8675
8676 2010-05-18  Rafael Espindola  <espindola@google.com>
8677
8678         * options.cc (General_options::finalize): Handle -nostdlib.
8679         * options.h (nostdlib): New option.
8680         * script.cc (script_add_search_dir): Handle -nostdlib.
8681
8682 2010-05-12  Doug Kwan  <dougkwan@google.com>
8683
8684         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8685         attributes section only if there no attributes section after merging.
8686         (Target_arm::merge_object_attributes): Move value of
8687         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8688         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8689         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8690         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8691         and arm_attr_merge_7.stdout.
8692         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8693         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8694         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8695         arm_attr_merge_7b.o): New rules.
8696         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8697         arm_attr_merge_7
8698         * testsuite/Makefile.in: Regenerate.
8699         * testsuite/arm_attr_merge.sh: New file.
8700         * testsuite/arm_attr_merge_[67][ab].s: Same.
8701
8702 2010-05-05  Nick Clifton  <nickc@redhat.com>
8703
8704         * po/es.po: Updated Spanish translation.
8705
8706 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8707
8708         * Makefile.am (install-exec-local): Properly install gold as
8709         default cross linker.
8710         * Makefile.in: Regenerated.
8711
8712 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8713             Nick Clifton  <nickc@redhat.com>
8714
8715         * configure.ac (install_as_default): Define and set to false
8716         unless --enable-gold or --enable-gold=both/gold has been
8717         specified.
8718         * configure: Regenerate.
8719
8720         * Makefile.am (install-exec-local): Install the executable as
8721         'ld.gold'.  If install_as_default is true then also install it as
8722         'ld'.
8723         * Makefile.in: Regenerated.
8724
8725 2010-04-24  Ian Lance Taylor  <iant@google.com>
8726
8727         * layout.cc (Layout::layout_reloc): In relocatable link don't
8728         combine reloc sections for grouped sections.
8729
8730 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8731
8732         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8733         sections that are not ordinary to icf.
8734         * icf.cc (get_section_contents): Handle relocation pointing to section
8735         with no object or shndx information.
8736         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8737         * testsuite/Makefile.in: Regenerate.
8738         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8739         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8740
8741 2010-04-22  Ian Lance Taylor  <iant@google.com>
8742
8743         * expression.cc (Expression::Expression_eval_info): Add
8744         result_alignment_pointer field.
8745         (Expression::eval_with_dot): Add result_alignment_pointer
8746         parameter.  Change all callers.
8747         (Expression::eval_maybe_dot): Likewise.
8748         (class Binary_expression): Add alignment_pointer parameter to
8749         left_value and right_value.  Change all callers.
8750         (BINARY_EXPRESSION): Set result alignment.
8751         (class Trinary_expression): Add alignment_pointer parameter to
8752         arg2_value and arg3_value.  Change all callers.
8753         (Trinary_cond::value): Set result alignment.
8754         (Max_expression::value, Min_expression::value): Likewise.
8755         (Align_expression::value): Likewise.
8756         * script-sections.cc (class Sections_element): Add dot_alignment
8757         parameter to set_section_addresses virtual function.  Update
8758         instantiations.
8759         (class Output_section_element): Likewise.
8760         (Script_sections::create_segments): Add dot_alignment parameter.
8761         Change all callers.
8762         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8763         (Script_sections::set_phdrs_clause_addresses): Likewise.
8764         * script-sections.h: Update declarations.
8765         * script.h: Update declarations.
8766         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8767         min_p_align.
8768         * testsuite/script_test_3.t: Set large alignment.
8769         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8770         segment has expected alignment.
8771
8772 2010-04-22  Nick Clifton  <nickc@redhat.com>
8773
8774         * po/gold.pot: Updated by the Translation project.
8775         * po/vi.po: Updated Vietnamese translation.
8776
8777 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8778
8779         * testsuite/Makefile.am (check_PROGRAMS): Add
8780         icf_virtual_function_folding_test.
8781         * testsuite/Makefile.in: Regenerated.
8782
8783 2010-04-15  Andrew Haley  <aph@redhat.com>
8784
8785         * options.h (merge_exidx_entries): New option.
8786         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8787         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8788         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8789         (Target_arm::merge_exidx_entries): New function.
8790         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8791         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8792         to Arm_exidx_fixup constructor.
8793         Add new arg, merge_exidx_entries.
8794         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8795         Arm_output_section::fix_exidx_coverage.
8796
8797 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8798
8799         * icf.cc (get_section_contents): Check for preemptible functions.
8800         Ignore addend when appropriate.
8801         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8802         section folded.
8803         (add_from_relobj): Check for section folded.
8804         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8805         * symtab.h (should_add_dynsym_entry): Add new parameter.
8806         * target-reloc.h (scan_relocs): Check for section folded.
8807         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8808         Check reloc types for function pointers in shared objects.
8809         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8810         case.
8811         (icf_preemptible_functions_test): New test case.
8812         (icf_string_merge_test): New test case.
8813         * testsuite.Makefile.in: Regenerate.
8814         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8815         bar_glob.  Refactor code.
8816         * testsuite/icf_preemptible_functions_test.cc: New file.
8817         * testsuite/icf_preemptible_functions_test.sh: New file.
8818         * testsuite/icf_string_merge_test.cc: New file.
8819         * testsuite/icf_string_merge_test.sh: New file.
8820         * testsuite/icf_virtual_function_folding_test.cc: New file.
8821         * testsuite/icf_virtual_function_folding_test.sh: New file.
8822
8823 2010-04-14  Doug Kwan  <dougkwan@google.com>
8824
8825         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8826         for local symbol recounting if we remove a section due to ICF.
8827         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8828         there are no regular objects in input.
8829
8830 2010-04-13  Doug Kwan  <dougkwan@google.com>
8831
8832         * arm.cc (Arm_input_section::set_final_data_size): Compute
8833         accurate final data size instead of using current data size.
8834
8835 2010-04-09  Doug Kwan  <dougkwan@google.com>
8836
8837         * layout.cc (Layout::choose_output_section): Handle script section
8838         types.
8839         (Layout::make_output_section_for_script): Add section type parameter.
8840         Handle script section types.
8841         * layout.h (Layout::make_output_section_for_script): Add section
8842         type parameter.
8843         * output.cc (Output_section::Output_section): Initialize data member
8844         is_noload_.
8845         (Output_section::do_reset_address_and_file_offset): Do not set address
8846         to 0 if section is a NOLOAD section.
8847         * output.h (Output_section::is_noload): New method.
8848         (Output_section::set_is_noload): Ditto.
8849         (Output_section::is_noload_): New data member.
8850         * script-c.h (Script_section_type): New enum type.
8851         (struct Parser_output_section_header): Add new file section_type.
8852         * script-sections.cc (Sections_element::output_section_name): Add
8853         parameter for returning script section type.
8854         (Output_section_definition::output_section_name): Ditto.
8855         (Output_section_definition::section_type)P; New method.
8856         (Output_section_definiton::script_section_type_name): Ditto.
8857         (Output_section_definition::script_section_type_): New data member.
8858         (Output_section_definition::Output_section_definition): Initialize
8859         data member Output_section_definition::script_section_type_.
8860         (Output_section_definition::create_sections): Pass script section type
8861         to Layout::make_output_section_for_script.
8862         (Output_section_definition::output_section_name): Return script
8863         section type to caller.
8864         (Output_section_definition::set_section_address): Do not advance
8865         dot value and load address if section type is NOLOAD.  Set address
8866         of NOLOAD sections regardless of section flags.
8867         (Output_section_definition::print): Print section type if it is
8868         not SCRIPT_SECTION_TYPE_NONE.
8869         (Output_section_definition::section_type): New method.
8870         (Output_section_definition::script_section_type_name): Ditto.
8871         (Script_sections::output_section_name): Add new parameter
8872         PSECTION_TYPE for returning script section type.  Pass it to
8873         section elements.  Handle discard sections.
8874         (Sort_output_sections::operator()): Handle NOLOAD sections.
8875         * script-sections.h (Script_sections::Section_type): New enum type.
8876         (Script_sections::output_section_name): Add a new parameter for
8877         returning script section type.
8878         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8879         INFO and NOLOAD.
8880         * yyscript.y (union): Add new field SECTION_TYPE.
8881         (COPY, DSECT, INFO, NOLOAD): New tokens.
8882         (opt_address_and_section_type): Change type to output_section_header.
8883         (section_type): New non-terminal
8884         (section_header): Handle section type.
8885         (opt_address_and_section_type): Return section type value.
8886
8887 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8888
8889         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8890         * testsuite/plugin_common_test_2.c (foo): Likewise.
8891
8892 2010-04-08  Doug Kwan  <dougkwan@google.com>
8893
8894         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8895         Output_merge_data.
8896         * output.cc (Output_section::add_merge_input_section): Simplify
8897         code and return status of Output_merge_base::add_input_section.
8898         Update merge section map only if Output_merge_base::add_input_section
8899         returns true.
8900
8901 2010-04-07  Doug Kwan  <dougkwan@google.com>
8902
8903         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8904         if section is marked as containing instructions but has no mapping
8905         symbols.
8906         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8907         correct section index.
8908         (Arm_relobj::find_linked_text_section): Ditto.
8909
8910 2010-04-07  Cary Coutant  <ccoutant@google.com>
8911
8912         * archive.cc (include_member): Destroy Read_symbols_data object before
8913         releasing file.
8914         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8915         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8916         (Read_symbols_data::~Read_symbols_data) New destructor.
8917         (Section_relocs::Section_relocs) New constructor.
8918         (Section_relocs::~Section_relocs) New destructor.
8919         (Read_relocs_data::Read_relocs_data) New constructor.
8920         (Read_relocs_data::~Read_relocs_data) New destructor.
8921         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8922         pointers to NULL after deleting.
8923
8924 2010-04-07  Doug Kwan  <dougkwan@google.com>
8925
8926         * arm.cc: Replace "endianity" with "endianness" in comments.
8927         (Arm_exidx_cantunwind): Ditto.
8928         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8929         (Arm_relobj::merge_flags_and_attributes): New method.
8930         (Arm_relobj::merge_flags_and_attributes_): New data member.
8931         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8932         (Arm_relobj::scan_sections_for_stubs): Ditto.
8933         (Arm_relobj::do_read_symbols): Check to see if we really want to
8934         merge processor-specific flags and attributes.  Exit early if
8935         an object is empty except for section names and the undefined symbol.
8936         (Target_arm::do_finalize_sections): Move check for ELF format to
8937         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8938         attributes from a regular object only when we have determined that
8939         it is aapropriate.  Do not create an .ARM.attributes section in
8940         output if there is no regular input object.
8941         (Target_arm::merge_processor_specific_flags): Check
8942         --warn-mismatch before printing any error.
8943         (Target_arm::merge_object_attributes): Ditto.
8944         * gold.cc (queue_middle_tasks): Handle the case in which there is
8945         no regular object in input.
8946         * options.cc (General_options::parse_EB): New method.
8947         (General_options::parse_EL): Same.
8948         (General_options::General_options): Initialize endianness_.
8949         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8950         New options.
8951         (General_options::Endianness): New enum.
8952         (General_options::endianness): New method.
8953         (General_options::endianness_): New data member.
8954         * parameters.cc (Parameters::set_options): Check target endianness.
8955         (Parameters::set_target_once): Ditto.
8956         (Parameters::check_target_endianness): New method.
8957         (parameters_force_valid_target): If either -EL or -EB is specified,
8958         use it to define endianness of default target.
8959         * parameters.h (Parameters::check_target_endianness): New method
8960         declaration.
8961         * target.h (class Target): Change "endianity" to "endianness"
8962         in comments.
8963
8964 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8965
8966         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8967         * configure: Regenerate.
8968         * Makefile.in: Regenerate.
8969         * testsuite/Makefile.in: Regenerate.
8970
8971 2010-04-06  Cary Coutant  <ccoutant@google.com>
8972
8973         gcc PR lto/42757
8974         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8975         prevailing definitions of common symbols.
8976         * testsuite/plugin_test_6.sh: New test case.
8977         * testsuite/plugin_common_test_1.c: New test case.
8978         * testsuite/plugin_common_test_2.c: New test case.
8979         * testsuite/Makefile.am (plugin_test_6): New test case.
8980         * testsuite/Makefile.in: Regenerate.
8981
8982 2010-04-06  Nick Clifton  <nickc@redhat.com>
8983
8984         * po/vi.po: New Vietnamese translation.
8985
8986 2010-03-30  Doug Kwan  <dougkwan@google.com>
8987
8988         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8989
8990 2010-03-25  Doug Kwan  <dougkwan@google.com>
8991
8992         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8993         to avoid a conversion warning on a 32-bit host.
8994
8995 2010-03-24  Ian Lance Taylor  <iant@google.com>
8996
8997         * testsuite/script_test_3.t: Add a TLS segment.
8998         * testsuite/Makefile.am (check_PROGRAMS): Add
8999         tls_phdrs_script_test.
9000         (tls_phdrs_script_test_SOURCES): Define.
9001         (tls_phdrs_script_test_DEPENDENCIES): Define.
9002         (tls_phdrs_script_test_LDFLAGS): Define.
9003         (tls_phdrs_script_test_LDADD): Define.
9004         * testsuite/Makefile.in: Rebuild.
9005
9006 2010-03-23  Cary Coutant  <ccoutant@google.com>
9007
9008         * fileread.cc (find_or_make_view): Fix comment.
9009
9010 2010-03-23  Ian Lance Taylor  <iant@google.com>
9011
9012         * script-sections.cc (class Orphan_section_placement): Define
9013         PLACE_TLS and PLACE_TLS_BSS.
9014         (Orphan_section_placement::Orphan_section_placement): Initialize
9015         new places.
9016         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
9017         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
9018         (tls_script_test_SOURCES): Define.
9019         (tls_script_test_DEPENDENCIES): Define.
9020         (tls_script_test_LDFLAGS): Define.
9021         (tls_script_test_LDADD): Define.
9022         * testsuite/Makefile.in: Rebuild.
9023
9024 2010-03-22  Doug Kwan  <dougkwan@google.com>
9025
9026         * arm.cc (Arm_relocate_functions::abs8,
9027         Arm_relocate_functions::abs16): Use correct check for overflow
9028         specified in the ARM ELF specs.
9029         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
9030         target of a BLX instruction specially.
9031         (Reloc_stub::stub_type_for_reloc): Ditto.
9032         (Relocate::relocate): Use symbolic names instead of numeric relocation
9033         codes to report error.
9034         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
9035         workaround.
9036         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
9037         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
9038         thumb2_blx_out_of_range.stdout
9039         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
9040         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
9041         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
9042         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
9043         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
9044         thumb2_blx_in_range, thumb2_blx_in_range.o,
9045         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
9046         thumb2_blx_out_of_range.o): New rules.
9047         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
9048         thumb2_blx_in_range and thumb2_blx_out_of_range.
9049         * testsuite/Makefile.in: Regenerate.
9050         * arm_branch_in_range.sh: Add tests for THUMB BLX.
9051         * testsuite/thumb_blx_in_range.s: New file.
9052         * testsuite/thumb_blx_out_of_range.s: New file.
9053
9054 2010-03-22  Rafael Espindola  <espindola@google.com>
9055
9056         * archive.cc (Should_include): Move to archive.h.
9057         (should_include_member): Make it a member of Archive.
9058         (Lib_group): New.
9059         (Add_lib_group_symbols): New.
9060         * archive.h: Include options.h.
9061         (Archive_member): Moved from Archive.
9062         (Should_include): Moved from archive.cc.
9063         (Lib_group): New.
9064         (Add_lib_group_symbols): New.
9065         * dynobj.cc (do_should_include_member): New.
9066         * dynobj.h (do_should_include_member): New.
9067         * gold.cc (queue_initial_tasks): Update call to queue.
9068         * main.cc (main): Print lib group stats.
9069         * object.cc (do_should_include_member): New.
9070         * object.h: Include archive.h.
9071         (Object::should_include_member): New.
9072         (Object::do_should_include_member): New.
9073         (Sized_relobj::do_should_include_member): New.
9074         * options.cc (General_options::parse_start_lib): New.
9075         (General_options::parse_end_lib): New.
9076         (Input_arguments::add_file): Handle lib groups.
9077         (Input_arguments::start_group): Check we are not in a lib.
9078         (Input_arguments::start_lib): New.
9079         (Input_arguments::end_lib): New.
9080         * options.h (General_options): Add start_lib and end_lib.
9081         (Input_argument::lib_): New.
9082         (Input_argument::lib): New.
9083         (Input_argument::is_lib): New.
9084         (Input_file_lib): New.
9085         (Input_arguments::in_lib_): New.
9086         (Input_arguments::in_lib): New.
9087         (Input_arguments::start_lib): New.
9088         (Input_arguments::end_lib_): New.
9089         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
9090         in unused members as preempted.
9091         (Sized_pluginobj::do_should_include_member): New.
9092         * plugin.h (Sized_pluginobj::do_should_include_member): New.
9093         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
9094         return the blocker.
9095         (Read_symbols::do_whole_lib_group): New.
9096         (Read_symbols::do_lib_group): New.
9097         (Read_symbols::do_read_symbols): Handle lib groups.
9098         (Read_symbols::get_name): Handle lib groups.
9099         * readsyms.h (Read_symbols): Add an archive member pointer.
9100         (Read_symbols::do_whole_lib_group): New.
9101         (Read_symbols::do_lib_group): New.
9102         (Read_symbols::member_): New.
9103         * script.cc (read_input_script): Update call to queue_soon.
9104
9105 2010-03-19  Doug Kwan  <dougkwan@google.com>
9106
9107         * arm.cc (Stub_table::Stub_table): Initialize new data members
9108         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9109         (Stub_table::add_reloc_stub): Assign stub offset and update
9110         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
9111         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
9112         New data members.
9113         (Stub_table::update_data_size_and_addralign): Use
9114         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
9115         instead of going over all reloc stubs.
9116         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
9117         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9118         Stringpool_template::offset_ to size of Stringpool_char.
9119         (Stringpool_template::new_key_offset): Remove code to initialize
9120         Stringpool_template::offset_.
9121         * stringpool.h (Stringpool_template::set_no_zero_null): Set
9122         Stringpool_template::offset_ to zero.
9123
9124 2010-03-15  Doug Kwan  <dougkwan@google.com>
9125
9126         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
9127         offset_.
9128         (Stringpool_template::new_key_offset): New method.
9129         (Stringpool_template::add_string): Assign offsets when adding new
9130         strings.
9131         (Stringpool_template::set_string_offsets): Do not set string offsets
9132         when not optimizing.
9133         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
9134         member size_.
9135         (Chunked_vector::clear): Clear size_.
9136         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
9137         (Chunked_vector::size): Return size_.
9138         (Chunked_vector::push_back): Use size_ to find insert position.
9139         (Chunked_vector::size_): New data member.
9140         (Stringpool_template::set_no_zero_null): Assert string set is empty.
9141         (Stringpool_template::new_key_offset): New method declaration.
9142         (Stringpool_template::offset_): New data member.
9143
9144 2010-03-15   Rafael Espindola  <espindola@google.com>
9145
9146         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
9147         Add_symbols' constructor.
9148         * readsyms.h (Add_symbols): Remove the input_group member.
9149
9150 2010-03-10  Ian Lance Taylor  <iant@google.com>
9151
9152         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
9153         target to ask whether a reference to a symbol requires a stack
9154         split.
9155         * target.h (Target::is_call_to_non_split): New function.
9156         (Target::do_is_call_to_non_split): Declare virtual function.
9157         * target.cc: Include "symtab.h".
9158         (Target::do_is_call_to_non_split): New function.
9159         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
9160
9161 2010-03-10  Cary Coutant  <ccoutant@google.com>
9162
9163         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9164         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9165         (File_read::open[2]): Add whole_file_view_ to list of views.
9166         (File_read::make_view): Remove test of whole_file_view_.
9167         (File_read::find_or_make_view): Create whole_file_view_ if
9168         necessary.
9169         (File_read::clear_views): Replace bool parameter with enum;
9170         adjust all callers.  Don't delete views with permanent data;
9171         do delete cached views and views from archives if
9172         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9173         if clearing the corresponding view.
9174         * fileread.h (File_read::Clear_views_mode): New enum.
9175         (File_read::View::is_permanent_view): New method.
9176         (File_read::clear_views): Replace bool parameter
9177         with enum; adjust all callers.
9178         * options.h (General_options): Change keep_files_mapped option;
9179         add map_whole_files.
9180         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9181         releasing the file.
9182         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9183         the file.
9184
9185 2010-03-10  David S. Miller  <davem@davemloft.net>
9186
9187         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9188
9189 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9190
9191         * icf.cc (get_section_contents): Add '@' marker after processing the
9192         merge reloc.
9193
9194 2010-03-08  Doug Kwan  <dougkwan@google.com>
9195
9196         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9197         due to a conversion warning.
9198         (Arm_relobj::update_output_local_symbol_count): Check for local
9199         symbol with unset output index.
9200
9201 2010-03-05  Ian Lance Taylor  <iant@google.com>
9202
9203         * options.h (class General_options): Add --spare-dynamic-tags.
9204         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9205         --spare-dynamic-tags.
9206
9207 2010-03-05  Ian Lance Taylor  <iant@google.com>
9208
9209         * incremental.cc: Include "libiberty.h".
9210
9211 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9212
9213         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9214         function, is_info_ member.
9215         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9216         (Versions::Versions): Update caller.
9217         (Versions::define_base_version): Likewise.
9218         (Versions::add_def): Likewise.
9219
9220 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9221
9222         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9223         (Scan::possible_function_pointer_reloc): New function.
9224         (Scan::local_reloc_may_be_function_pointer): Change to call
9225         possible_function_pointer_reloc.
9226         (Scan::global_reloc_may_be_function_pointer): Ditto.
9227         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9228         relocations in ".data.rel.ro._ZTV" section.
9229         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9230         * testsuite/icf_safe_so_test.cc: Ditto.
9231         * testsuite/icf_safe_test.cc: Ditto.
9232         * testsuite/icf_safe_test.sh: Ditto.
9233
9234 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9235             Ian Lance Taylor  <iant@google.com>
9236
9237         * target-reloc.h (relocate_section): Check the symbol table index
9238         for -1U before setting the local symbol index.
9239         (scan_relocatable_relocs): If copying the relocation, record that
9240         the local symbol is required.
9241         * object.h (Symbol_value::is_output_symtab_index_set): New
9242         function.
9243         (Symbol_value::may_be_discarded_from_output_symtab): New
9244         function.
9245         (Symbol_value::has_output_symtab_entry): New function.
9246         (Symbol_value::needs_output_symtab_entry): Remove.
9247         (Symbol_value::output_symtab_index): Make sure the symbol index is
9248         set.
9249         (Symbol_value::set_output_symtab_index): Make sure the symbol
9250         index is not set.  Make sure the new index is valid.
9251         (Symbol_value::set_must_have_output_symtab_entry): New function.
9252         (Symbol_value::has_output_dynsym_entry): New function.
9253         (Symbol_value::set_output_dynsym_index): Make sure the new index
9254         is valid.
9255         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9256         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9257         local symbol if permitted.
9258         (Sized_relobj::do_finalize_local_symbols): Call
9259         is_output_symtab_index_set rather than needs_output_symtab_entry.
9260         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9261         rather than needs_output_symtab_entry.  Call
9262         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9263         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9264         is_output_symtab_index_set rather than needs_output_symtab_entry.
9265         * testsuite/discard_locals_relocatable_test.c: New file.
9266         * testsuite/discard_locals_test.sh: Test -r.
9267         * testsuite/Makefile.am (check_DATA): Add
9268         discard_locals_relocatable_test1.syms,
9269         discard_local_relocatable_test2.syms.
9270         (MOSTLYCLEANFILES): Likewise.  Also add
9271         discard_locals_relocatable_test1.lout and
9272         discard_locals_relocatable_test2.out.
9273         (discard_locals_relocatable_test1.syms): New target.
9274         (discard_locals_relocatable_test.o): New target.
9275         (discard_locals_relocatable_test1.out): New target.
9276         (discard_locals_relocatable_test2.syms): New target.
9277         (discard_locals_relocatable_test2.out): New target.
9278         (various): Add missing ../ld-new dependencies.
9279         * testsuite/Makefile.in: Rebuild.
9280
9281 2010-03-03  Nick Clifton  <nickc@redhat.com>
9282
9283         * po/fi.po: New Finnish translation.
9284
9285 2010-03-01  Doug Kwan  <dougkwan@google.com>
9286
9287         * layout.cc (Layout::Layout): Force section types of .init_array*,
9288         .preinit_array* and .fini_array* sections.
9289         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9290         Fix check of return value of std::string::find.().
9291         (Output_section::Input_section_sort_compare::operator()): Remove
9292         comment about .init_array.
9293         (Output_section::Input_section_sort_init_fini_compare::operator()):
9294         New method.
9295         (Output_section::sort_attached_input_sections): Handle .init_array
9296         and .fini_array specially.
9297         * output.h (Output_section::Inut_section_sort_compare): Update
9298         comment.
9299         (Output_section::Input_section_sort_init_fini_compare): New struct.
9300
9301 2010-02-26  Doug Kwan  <dougkwan@google.com>
9302
9303         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9304         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9305         * testsuite/debug_msg.sh: Avoid matching source line number for
9306         use of global variable undef_int.
9307
9308 2010-02-26  Doug Kwan  <dougkwan@google.com>
9309
9310         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9311         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9312         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9313         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9314         * options.cc (General_options::General_options): Initialize member
9315         fix_v4bx_.
9316         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9317         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9318         and rm_no_fix_v4bx.stdout
9319         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9320         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9321         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9322         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9323         and arm_no_fix_v4bx.
9324         * Makefile.in: Regenerate.
9325         * testsuite/arm_fix_v4bx.s: New file.
9326         * testsuite/arm_fix_v4bx.sh: Ditto.
9327
9328 2010-02-24  Doug Kwan  <dougkwan@google.com>
9329
9330         * arm.cc (Target_arm::got_section): Make the .got section the first
9331         non RELRO section in the data segment.
9332         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9333         suffixes of section names.
9334
9335 2010-02-24  Doug Kwan  <dougkwan@google.com>
9336
9337         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9338         flags and attributes merging if an input file is a binary file.
9339         * fileread.cc (Input_file::open): Record format of original file.
9340         * fileread.h (Input_file::Format): New enum type.
9341         (Input_file::Input_file): Initialize data member format_.
9342         (Input_file::format): New method definition.
9343         (Input_file::format_):: New data member.
9344
9345 2010-02-24  Doug Kwan  <dougkwan@google.com>
9346
9347         * arm.cc (Arm_output_data_got): New class.
9348         (ARM_TCB_SIZE): New constant
9349         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9350         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9351         If user uses a script with a SECTIONS clause, issue only a warning
9352         for a misplaced EXIDX input section.  Otherwise, issue an error.
9353         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9354         garbage collection.
9355         (Target_arm::got_mode_index_entry): Handle static linking.
9356         (Target_arm::Scan::local): Ditto.
9357         (Target_arm::Scan::global): Ditto.
9358         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9359         all incorrectly implemented relocations.
9360         (Target_arm::fix_exidx_coverage): Pass layout to
9361         Arm_output_section::fix_exidx_coverage.
9362         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9363         from ".ARM.exidx." and ".ARM.extab.".
9364
9365 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9366
9367         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9368         section if it does not already exist.
9369         * attributes.cc (Attributes_section_data::Attributes_section_data):
9370         Don't crash if size is zero.
9371
9372 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9373             Ian Lance Taylor  <iant@google.com>
9374
9375         * gold.cc (queue_middle_tasks): If no input files were opened,
9376         exit.
9377         * workqueue.h (Task_function::Task_function): Assert that there is
9378         a blocker.
9379
9380 2010-02-22  Doug Kwan  <dougkwan@google.com>
9381
9382         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9383         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9384         types to avoid warnings due to different uint64_t implementations
9385         on different hosts.
9386
9387 2010-02-21  Doug Kwan  <dougkwan@google.com>
9388
9389         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9390         handling of the maximum backward branch offset.
9391         (Arm_relocate_functions::thumb_branch_common): Ditto.
9392         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9393         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9394         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9395         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9396         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9397         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9398         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9399         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9400         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9401         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9402         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9403         thumb2_bl_out_of_range.o): New rules.
9404         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9405         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9406         thumb2_bl_out_of_range
9407         * testsuite/Makefile.in: Regenerate.
9408         * testsuite/arm_bl_in_range.s: New file.
9409         * testsuite/arm_bl_out_of_range.s: Ditto.
9410         * testsuite/arm_branch_in_range.sh: Ditto.
9411         * testsuite/arm_branch_range.t: Ditto.
9412         * testsuite/thumb2_branch_range.t: Ditto.
9413         * testsuite/thumb_bl_in_range.s: Ditto.
9414         * testsuite/thumb_bl_out_of_range.s: Ditto.
9415         * testsuite/thumb_branch_range.t: Ditto.
9416
9417 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9418
9419         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9420         Add reloc offset information.
9421         * icf.cc (get_section_contents): Change iterators to point to the new
9422         vectors. Add reloc offset information to the contents.
9423         * icf.h (Icf::Sections_reachable_info): New typedef.
9424         (Icf::Sections_reachable_list): New typedef.
9425         (Icf::Offset_info): New typedef.
9426         (Icf::Reloc_info): New struct typedef.
9427         (Icf::Reloc_info_list): New typedef.
9428         (Icf::symbol_reloc_list): Delete method.
9429         (Icf::addend_reloc_list): Delete method.
9430         (Icf::section_reloc_list): Delete method.
9431         (Icf::reloc_info_list): New method.
9432         (Icf::reloc_info_list_): New member.
9433
9434 2010-02-19  Doug Kwan  <dougkwan@google.com>
9435
9436         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9437         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9438         * arm.cc (Arm_relocation_functions): New forward declaration.
9439         (Target_arm::Target_arm): Initialize new data members
9440         got_mod_index_offset_ and tls_base_symbol_defined_.
9441         (Target_arm::Relocate::relocate_tls): New method.
9442         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9443          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9444         New methods.
9445         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9446         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9447         (Target_arm::got_mod_index_offset_,
9448         Target_arm::tls_base_symbol_defined_): New data members.
9449         (Target_arm::Scan::local, Target::Scan::global,
9450         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9451         relocations.
9452
9453 2010-02-18  Doug Kwan  <dougkwan@google.com>
9454
9455         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9456         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9457         text section as a parameter becuase some broken tools may not set
9458         the link in section header.
9459         (Target_arm::has_got_section): New method.
9460         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9461         without any mapping symbol as data only.  Remove warning.
9462         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9463         link in its section header, try to discover the link by inspecting the
9464         REL31 relocation at the beginning of the section.
9465         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9466         in error message.
9467         (Target_arm::Scan::global): Treat any reference to the symbol
9468         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9469
9470 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9471
9472         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9473         (Scan::global_reloc_may_be_function_pointer): New function.
9474         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9475         (Scan::global_reloc_may_be_function_pointer): New function.
9476         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9477         (Scan::global_reloc_may_be_function_pointer): New function.
9478         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9479         (Scan::global_reloc_may_be_function_pointer): New function.
9480         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9481         (Scan::global_reloc_may_be_function_pointer): New function.
9482         (Scan::possible_function_pointer_reloc): New function.
9483         (Target_x86_64::can_check_for_function_pointers): New function.
9484         * gc.h (gc_process_relocs): Scan relocation types to determine if
9485         function pointers were taken for targets that support it.
9486         * icf.cc (Icf::find_identical_sections): Include functions for
9487         folding in safe ICF whose pointer is not taken.
9488         * icf.h (Secn_fptr_taken_set): New typedef.
9489         (fptr_section_id_): New member.
9490         (section_has_function_pointers): New function.
9491         (set_section_has_function_pointers): New function.
9492         (check_section_for_function_pointers): New function.
9493         * options.h: Fix comment for safe ICF option.
9494         * target.h (can_check_for_function_pointers): New function.
9495         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9496         Modify icf_safe_test for X86-64.
9497         * testsuite/Makefile.in: Regenerate.
9498         * testsuite/icf_safe_so_test.cc: New file.
9499         * testsuite/icf_safe_so_test.sh: New file.
9500         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9501         (main): Change to take pointer to function kept_func_3.
9502         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9503         folding is done correctly for X86-64.
9504
9505 2010-02-12  David S. Miller  <davem@davemloft.net>
9506
9507         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9508         is_symbolless parameter.
9509         (Output_reloc<SHT_REL>::is_symbolless): New.
9510         (Output_reloc<SHT_REL>::is_symbolless_): New.
9511         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9512         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9513         (Output_reloc<SHT_RELA>::is_symbolless): New.
9514         (Output_data_reloc::add_global): Handle is_symbolless.
9515         (Output_data_reloc::add_global_relative): Likewise.
9516         (Output_data_reloc::add_local): Likewise.
9517         (Output_data_reloc::add_local_relative): Likewise.
9518         (Output_data_reloc::add_symbolless_global_addend): New.
9519         (Output_data_reloc::add_symbolless_local_addend): New.
9520         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9521         is_symbolless.
9522         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9523         instead of ->is_relative_
9524         (Output_reloc::write): Likewise.
9525         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9526         (Output_reloc::write_rel): Simplify.
9527
9528         * sparc.cc (Target_sparc::Scan::local): Use
9529         ->add_symbolless_local_addend as needed.
9530         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9531         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9532         based upon relocation offset.
9533
9534 2010-02-11  Doug Kwan  <dougkwan@google.com>
9535
9536         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9537         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9538         beginning of function.
9539         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9540         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9541         parameter is_32bit in calls to should_apply_static_reloc.
9542         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9543         (check_DATA): Add arm_abs_global.stdout.
9544         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9545         arm_abs_global.stdout): New rules.
9546         (MOSTLLYCLEANFILES): Add arm_abs_global
9547         * Makefile.in: Regenerate.
9548         * testsuite/arm_abs_global.s: New file.
9549         * testsuite/arm_abs_global.sh: Ditto.
9550         * testsuite/arm_abs_lib.s: Ditto.
9551
9552 2010-02-11  Ian Lance Taylor  <iant@google.com>
9553
9554         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9555         Read_relocs task.
9556         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9557         Allocate_commons_task first.
9558         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9559         task, rather than symtab_lock_.
9560         (Gc_process_relocs::~Gc_process_relocs): New function.
9561         (Gc_process_relocs::is_runnable): Check this_blocker_.
9562         (Gc_process_relocs::locks): Use next_blocker_ rather than
9563         blocker_.
9564         (Scan_relocs::~Scan_relocs): New function.
9565         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9566         symtab_lock_.
9567         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9568         next_blocker_.
9569         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9570         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9571         constructor accordingly.
9572         (class Gc_process_relocs): Likewise.
9573         (class Scan_relocs): Likewise.
9574         * common.h (class Allocate_commons_task): Remove symtab_lock_
9575         field, and corresponding constructor parameter.
9576         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9577         symtab_lock_.
9578         (Allocate_commons_task::locks): Likewise.
9579
9580 2010-02-11  Ian Lance Taylor  <iant@google.com>
9581
9582         * gold-threads.h (class Once): Define.
9583         (class Initialize_lock): Rewrite as child of Once.
9584         * gold-threads.cc (class Once_initialize): Define.
9585         (once_pointer_control): New static variable.
9586         (once_pointer, once_arg): New static variables.
9587         (c_run_once): New static function.
9588         (Once::Once, Once::run_once, Once::internal_run): New functions.
9589         (class Initialize_lock_once): Remove.
9590         (initialize_lock_control): Remove.
9591         (initialize_lock_pointer): Remove.
9592         (initialize_lock_once): Remove.
9593         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9594         (Initialize_lock::initialize): Rewrite.
9595         (Initialize_lock::do_run_once): New function.
9596         * archive.cc (Archive::interpret_header): Only clear name if it is
9597         not already empty.
9598         * fileread.cc: Include "gold-threads.h"
9599         (file_counts_lock): New static variable.
9600         (file_counts_initialize_lock): Likewise.
9601         (File_read::release): Only increment counts when using --stats.
9602         Use a lock around the increment.
9603         * parameters.cc (class Set_parameters_target_once): Define.
9604         (set_parameters_target_once): New static variable.
9605         (Parameters::Parameters): Move here from parameters.h.
9606         (Parameters::set_target): Rewrite.
9607         (Parameters::set_target_once): New function.
9608         (Parameters::clear_target): Move here and rewrite.
9609         * parameters.h (class Parameters): Update declarations.  Add
9610         set_parameters_target_once_ field.
9611         (Parameters::Parameters): Move to parameters.cc.
9612         (Parameters::clear_target): Likewise.
9613         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9614         task.
9615         (Start_group::~Start_group): New function.
9616         (Start_group::is_runnable): New function.
9617         (Start_group::locks, Start_group::run): New functions.
9618         (Finish_group::run): Change saw_undefined to size_t.
9619         * readsyms.h (class Start_group): Define.
9620         (class Finish_group): Change saw_undefined_ field to size_t.
9621         (Finish_group::Finish_group): Remove saw_undefined and
9622         this_blocker parameters.  Change all callers.
9623         (Finish_group::set_saw_undefined): New function.
9624         (Finish_group::set_blocker): New function.
9625         * symtab.h (class Symbol_table): Change saw_undefined to return
9626         size_t.  Change saw_undefined_ field to size_t.
9627         * target-select.cc (Set_target_once::do_run_once): New function.
9628         (Target_selector::Target_selector): Initialize set_target_once_
9629         field.  Don't initialize lock_ and initialize_lock_ fields.
9630         (Target_selector::instantiate_target): Rewrite.
9631         (Target_selector::set_target): New function.
9632         * target-select.h (class Set_target_once): Define.
9633         (class Target_selector): Update declarations.  Make
9634         Set_target_once a friend.  Remove lock_ and initialize_lock_
9635         fields.  Add set_target_once_ field.
9636
9637 2010-02-10  Ian Lance Taylor  <iant@google.com>
9638
9639         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9640         queueing any tasks.
9641         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9642         (queue_middle_tasks): Add all blockers before queueing any tasks.
9643         (queue_final_tasks): Likewise.
9644         * token.h (Task_token::add_blockers): New function.
9645         * object.h (Input_objects::number_of_relobjs): New function.
9646
9647 2010-02-10  Ian Lance Taylor  <iant@google.com>
9648
9649         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9650         shared, not if not position independent.
9651         * x86_64.cc (Relocate::relocate_tls): Likewise.
9652         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9653         (tls_pie_pic_test): New target.
9654         * testsuite/Makefile.in: Rebuild.
9655
9656         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9657         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9658         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9659         * testsuite/Makefile.in: Rebuild.
9660
9661 2010-02-09  David S. Miller  <davem@davemloft.net>
9662
9663         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9664         R_SPARC_RELATIVE using ->add_local_relative().
9665         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9666
9667         * output.h (Output_data_dynamic::add_section_size): New method
9668         that takes two Output_data objects.
9669         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9670         entry param.  Handle it in initializers.
9671         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9672         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9673         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9674         arg.
9675         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9676         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9677         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9678         for dynrel_includes_plt.
9679         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9680         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9681         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9682         before .rela.plt
9683         (Target_sparc::do_finalize_sections): Update to pass true for
9684         dynrel_includes_plt.
9685         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9686         output before .rela.plt
9687         (Target_powerpc::do_finalize_sections): Update to pass true for
9688         dynrel_includes_plt when 32-bit.
9689
9690 2010-02-08  Doug Kwan  <dougkwan@google.com>
9691
9692         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9693         method.
9694         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9695         Arm_relobj::scan_section_for_cortex_a8_stubs,
9696         Arm_relobj::do_relocation_section): Instead of calling
9697         Output_section::output_address, use faster
9698         Arm_relobj::simple_input_section_output_address.
9699
9700 2010-02-08  David S. Miller  <davem@davemloft.net>
9701
9702         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9703         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9704         relocation helper function.
9705
9706         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9707         just like R_SPARC_GOT{10,13,22}.
9708         (Target_sparc::Scan::local): Likewise.
9709         (Target_sparc::Relocate:relocate): Likewise.
9710
9711 2010-02-06  Ian Lance Taylor  <iant@google.com>
9712
9713         * configure.ac: Rewrite targetobjs duplicate removal code to use
9714         only shell constructs.
9715         * configure: Rebuild.
9716
9717 2010-02-05  Doug Kwan  <dougkwan@google.com>
9718
9719         PR 11247
9720         * arm.cc (Arm_relobj::section_is_scannable): New method.
9721         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9722         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9723
9724 2010-02-04  Doug Kwan  <dougkwan@google.com>
9725
9726         PR 11247
9727         * arm-reloc-property.cc (cstdio): Include.
9728         * configure.ac (targetobjs): Remove duplicates.
9729         * configure: Regenerate.
9730         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9731         big and little endian version for a given address size.
9732
9733 2010-02-03  Doug Kwan  <dougkwan@google.com>
9734
9735         * arm-reloc-property.cc
9736         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9737         definition.
9738         * arm-reloc-property.h
9739         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9740         New method definition.
9741         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9742         declaration.
9743         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9744         overflow to N.
9745         (GOT_PREL): Change implemented to Y.
9746         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9747         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9748         (Arm_relocate_functions::movw_abs_nc): Remove method.
9749         (Arm_relocate_functions::movt_abs): Ditto.
9750         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9751         (Arm_relocate_functions::thm_movt_abs): Ditto.
9752         (Arm_relocate_functions::movw_rel_nc): Ditto.
9753         (Arm_relocate_functions::movw_rel): Ditto.
9754         (Arm_relocate_functions::movt_rel): Ditto.
9755         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9756         (Arm_relocate_functions:thm_movw_rel): Ditto.
9757         (Arm_relocate_functions:thm_movt_rel): Ditto.
9758         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9759         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9760         New method definitions.
9761         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9762         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9763         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9764         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9765         (Target_arm::Relocate::relocate): Check for non-static or
9766         unimplemented relocation code and exit early.  Change calls to
9767         Target_arm::reloc_uses_thumb_bit and
9768         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9769         instead.  Refactor code to handle similar relocations to increase
9770         code sharing.  Remove check for unsupported relocation code in switch
9771         statement.
9772         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9773         relocation property table to find out size.  Change error message to
9774         print out the name of a relocation code instead of the numeric value.
9775         (Target_arm::scan_reloc_for_stub): Use relocation property table
9776         instead of calling Target_arm::reloc_uses_thumb_bit().
9777
9778 2010-02-02  Doug Kwan  <dougkwan@google.com>
9779
9780         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9781         types of relaxed input section.
9782
9783 2010-02-02  Doug Kwan  <dougkwan@google.com>
9784
9785         * Makefile.am (HFILES): Add arm-reloc-property.h.
9786         (DEFFILES): New.
9787         (TARGETSOURCES): Add arm-reloc-property.cc
9788         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9789         (libgold_a_SOURCES): $(DEFFILES)
9790         * Makefile.in: Regenerate.
9791         * arm-reloc-property.cc: New file.
9792         * arm-reloc-property.h: New file.
9793         * arm-reloc.def: New file.
9794         * arm.cc: Update comments.
9795         (arm-reloc-property.h): New included header.
9796         (arm_reloc_property_table): New global variable.
9797         (Target_arm::do_select_as_default_target): New method definition.
9798         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9799         arm-reloc-property to targ_extra_obj.
9800         * parameters.cc (set_parameters_target): Call
9801         Target::select_as_default_target().
9802         * target.h (Target::select_as_default_target): New method definition.
9803         (Target::do_select_as_default_target): Same.
9804
9805 2010-02-01  Doug Kwan  <dougkwan@google.com>
9806
9807         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9808         first_output_text_section_.
9809         (Arm_exidx_fixup::first_output_text_section): New method definition.
9810         (Arm_exidx_fixup::first_output_text_section_): New data member.
9811         (Arm_exidx_fixup::process_exidx_section): Record the first text
9812         output section seen.
9813         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9814         and entsize in output section header.
9815
9816 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9817
9818         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9819         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9820         (Arm_relocate_functions::thm_alu11): New Method.
9821         (Arm_relocate_functions::thm_pc8): New Method.
9822         (Arm_relocate_functions::thm_pc12): New Method.
9823         (Target_arm::Scan::local): Handle the relocations.
9824         (Target_arm::Scan::global): Likewise.
9825         (Target_arm::Relocate::relocate): Likewise.
9826         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9827
9828 2010-01-29  Doug Kwan  <dougkwan@google.com>
9829
9830         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9831         of relocation types as ld.
9832
9833 2010-01-29  Doug Kwan  <dougkwan@google.com>
9834
9835         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9836         to public.
9837         (Arm_relocate_functions::thumb_branch_common): Ditto.
9838         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9839         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9840         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9841         Arm_relocate_functions::jump24): Remove.
9842         (Target_arm::Relocate::relocate): Adjust code to call
9843         Arm_relocation_functions::arm_branch_common and
9844         Arm_relocation_functions::thumb_branch_common instead of their removed
9845         wrappers.  Merge switch-cases together to reduce source code size.
9846
9847 2010-01-29  Doug Kwan  <dougkwan@google.com>
9848
9849         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9850         output_local_symbol_count_needs_update_.
9851         (Arm_relobj::output_local_symbol_count_needs_update,
9852          Arm_relobj::set_output_local_symbol_count_needs_update,
9853          Arm_relobj::update_output_local_symbol_count): New methods.
9854         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9855         member.
9856         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9857         of pointed function as in a R_ARM_PREL31 relocation.
9858         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9859         for output local symbol count updating.
9860         (Target_arm::do_relax): Update output local symbol counts in objects
9861         if necessary.
9862         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9863
9864 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9865
9866         * arm.cc: Added support for the ARM relocations:
9867         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9868         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9869         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9870         movw_prel_nc).
9871         (Arm_relocate_functions::movw_rel): New method.
9872         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9873         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9874         thm_movw_prel_nc).
9875         (Arm_relocate_functions::thm_movw_rel): New method.
9876         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9877         thm_movt_prel).
9878         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9879         relocations.
9880         (Target_arm::Scan::global): Likewise.
9881         (Target_arm::Relocate::relocate): Likewise.
9882         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9883         Likewise.
9884
9885 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9886
9887         * arm.cc: Added support for ARM group relocations.
9888         (Target_arm::reloc_needs_sym_origin): New method.
9889         (Arm_relocate_functions::calc_grp_kn): New method.
9890         (Arm_relocate_functions::calc_grp_residual): New method.
9891         (Arm_relocate_functions::calc_grp_gn): New method.
9892         (Arm_relocate_functions::arm_grp_alu): New Method.
9893         (Arm_relocate_functions::arm_grp_ldr): New Method.
9894         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9895         (Arm_relocate_functions::arm_grp_ldc): New Method.
9896         (Target_arm::Scan::local): Handle the ARM group relocations.
9897         (Target_arm::Scan::global): Likewise.
9898         (Target_arm::Relocate::relocate): Likewise.
9899         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9900         Likewise.
9901
9902 2010-01-26  Doug Kwan  <dougkwan@google.com>
9903
9904         * arm.cc (set): Include.
9905         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9906         pointer type.
9907         (Arm_output_section::Text_section_list): New type.
9908         (Arm_output_section::append_text_sections_to_list): New method.
9909         (Arm_output_section::fix_exidx_coverage): Ditto.
9910         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9911         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9912         Relobj::set_section_offset() instead of
9913         Sized_relobj::invalidate_section_offset().
9914         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9915         parameter for section headers. Ignore relocation sections for
9916         unallocated sections and EXIDX sections.
9917         (Target_arm::fix_exidx_coverage): New method.
9918         (Target_arm::output_section_address_less_than): New type.
9919         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9920         linked text section instead of the EXIDX section.
9921         (Arm_output_section::create_stub_group): Add an assertion to check
9922         that this is not an EXIDX output section.
9923         (Arm_output_section::append_text_sections_to_list): New method.
9924         (Arm_output_section::fix_exidx_coverage): Ditto.
9925         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9926         Arm_relobj::section_needs_reloc_stub_scanning.
9927         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9928         first pass.
9929         (Target_arm::fix_exidx_coverage): New method.
9930         * object.h (Relobj::set_output_section): New method.
9931         (Sized_relobj::invalidate_section_offset): Remove method.
9932         (Sized_relobj::do_invalidate_section_offset): Remove method.
9933         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9934
9935 2010-01-25  Doug Kwan  <dougkwan@google.com>
9936
9937         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9938         Fix warning due to signed and unsigned comparison on a 32-bit host.
9939
9940 2010-01-22  Doug Kwan  <dougkwan@google.com>
9941
9942         * arm.cc (Target_arm::do_relax): Record an output section for section
9943         offset adjustment it contains any stub table that has changed.
9944         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9945         offsets in an output section if necessary.
9946         * output.cc (Output_section::Output_section): Initialize
9947         section_offsets_need_adjustments_.
9948         (Output_section::add_input_section_for_script): Renamed to
9949         Output_section::add_simple_input_section.
9950         (Output_section::save_states): Add a comment.
9951         (Output_section::discard_states): New method defintion.
9952         (Output_section::adjust_section_offsets): Same.
9953         * output.h (Output_section::add_input_section_for_script): Renamed to
9954         Output_section::add_simple_input_section.
9955         (Output_section::discard_states): New method declaration.
9956         (Output_section::adjust_section_offsets): Same.
9957         (Output_section::section_offsets_need_adjustment,
9958         Output_section::set_section_offsets_need_adjustment): New method
9959         definitions.
9960         (Output_section::section_offsets_need_adjustment_): New data member.
9961         * script-sections.cc
9962         (Output_section_element_input::set_section_address): Adjust code for
9963         renaming of Output_section::add_input_section_for_script.
9964         (Orphan_output_section::set_section_address): Same.
9965
9966 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9967
9968         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9969         Fix_v4bx enum values .
9970         * gold/options.h (General_options): New option definitions.
9971         (General_options::fix_v4bx): New method.
9972         (General_options::Fix_v4bx): New enum.
9973         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9974         (General_options::parse_fix_v4bx_interworking): New method.
9975
9976 2010-01-22  Doug Kwan  <dougkwan@google.com>
9977
9978         * arm.cc (Arm_exidx_fixup): New class.
9979
9980 2010-01-21  Doug Kwan  <dougkwan@google.com>
9981
9982         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9983         classes.
9984         (Arm_exidx_section_offset_map): New type.
9985
9986 2010-01-21  Doug Kwan  <dougkwan@google.com>
9987
9988         * arm.cc (Arm_exidx_input_section): New class.
9989         (Arm_relobj::exidx_input_section_by_link,
9990         Arm_relobj::exidx_input_section_by_shndx,
9991         Arm_relobj::make_exidx_input_section): New methods.
9992         (read_arm_attributes_section): Remove.
9993         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9994         information about them.
9995         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9996         to here.
9997
9998 2010-01-20  Doug Kwan  <dougkwan@google.com>
9999
10000         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
10001         Input_section_specifier to Section_id.
10002         (Target_arm::new_arm_input_section: Adjust code for change of key
10003         type.
10004         (Target_arm::find_arm_input_section): Ditto.
10005         * gc.h (object.h): Include for Section_id nand Section_id_hash.
10006         (Section_id): Remove.
10007         (Garbage_collection::Section_id_hash): Remove.
10008         * icf.h (object.h): Include for Section_id nand Section_id_hash.
10009         (Section_id): Remove.
10010         (Icf::Section_id_hash): Remove.
10011         * object.h (Section_id, Const_section_id, Section_id_hash,
10012         Const_section_id_hash): New type definitions.
10013         * output.cc (Output_section::add_relaxed_input_section): Change to
10014         use Const_section_id instead of Input_section_specifier as key type.
10015         (Output_section::add_merge_input_section): Ditto.
10016         (Output_section::build_relaxation_map): Change to use Section_id
10017         instead of Input_section_specifier as key type.
10018         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10019         Ditto.
10020         (Output_section::convert_input_sections_to_relaxed_sections): Change
10021         to use Const_section_id instead of Input_section_specifier as key type.
10022         (Output_section::find_merge_section): Ditto.
10023         (Output_section::find_relaxed_input_section): Ditto.
10024         * output.h (Input_section_specifier): Remove class.
10025         (Output_section::Output_section_data_by_input_section_map): Change
10026         key type to Const_section_id.
10027         (Output_section::Output_relaxed_input_section_by_input_section_map):
10028         Ditto.
10029         (Output_section::Relaxation_map): Change key type to Section_id.
10030
10031 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10032
10033         * gold/arm.cc: Added support for R_ARM_V4BX relocation
10034         (class Arm_v4bx_stub): New class.
10035         (DEF_STUBS): Updated definition to support v4_veneer_bx.
10036         (Stub_factory::make_arm_v4bx_stub): New method.
10037         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
10038         (Stub_table::empty): Handle v4bx stubs.
10039         (Stub_table::add_arm_v4bx_stub): New method.
10040         (Stub_table::find_arm_v4bx_stub): New method.
10041         (Arm_relocate_functions::v4bx): New method.
10042         (Target_arm::fix_v4bx): New method.
10043         (Target_arm::Target_arm): Handle R_ARM_V4BX.
10044         (Stub_table::relocate_stubs): Likewise.
10045         (Stub_table::do_write): Likewise.
10046         (Stub_table::update_data_size_and_addralign): Likewise.
10047         (Stub_table::finalize_stubs):  Likewise.
10048         (Target_arm::Scan::local): Likewise.
10049         (Target_arm::Scan::global): Likewise.
10050         (Target_arm::do_finalize_sections): Likewise.
10051         (Target_arm::Relocate::relocate): Likewise.
10052         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10053         Likewise.
10054         (Target_arm::scan_reloc_for_stub): Likewise.
10055         (Target_arm::scan_reloc_section_for_stubs): Likewise.
10056
10057 2010-01-19  Ian Lance Taylor  <iant@google.com>
10058
10059         * output.cc (Output_section_headers::do_sized_write): Write large
10060         segment count to sh_info field.
10061         (Output_file_header::do_sized_write): For large segment count,
10062         write PN_XNUM to e_phnum field.
10063
10064 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10065
10066         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
10067         (Arm_relocate_functions::thm_jump8): New function.
10068         (Arm_relocate_functions::thm_jump11): New function.
10069         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
10070         R_ARM_THM_JUMP11.
10071         (Target_arm::Scan::global): Likewise.
10072         (Target_arm::Relocate::relocate): Likewise.
10073         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10074         Likewise.
10075
10076 2010-01-14  Doug Kwan  <dougkwan@google.com>
10077
10078         * arm.cc (map, utility): Include headers.
10079         (Target_arm::apply_cortex_a8_workaround): New method.
10080         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
10081         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
10082         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
10083         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
10084         the --[no-]fix-cortex-a8 command line options.
10085         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
10086         (Target_arm::relocate_stub): Use addend in instruction template.
10087         * options.h (DEFINE_bool): Set the user-set flag.
10088         (General_options): Add --[no-]-fix-cortex options.
10089         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
10090         : Update fast look-up map after conversion.
10091
10092 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
10093
10094         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
10095         in the first pass of do_layout.
10096
10097 2010-01-13  Doug Kwan  <dougkwan@google.com>
10098
10099         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10100         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
10101         apparent compiler problem of not folding static constant integral
10102         data members of elfcpp::Elf_sizes<32>.
10103
10104 2010-01-13  Doug Kwan  <dougkwan@google.com>
10105
10106         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
10107         Arm_relobj::section_needs_cortex_a8_stub_scanning,
10108         Arm_relobj::scan_section_for_cortex_a8_erratum,
10109         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
10110         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
10111         sections to scan for relocation stubs into a new method
10112         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
10113         relocation and Cortex-A8 stub scanning.
10114         (Target_arm::do_relax): Force stubs to be after stubbed sections
10115         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
10116         the beginning of a new relaxation pass.  Update a comment.
10117         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
10118
10119 2010-01-12  Ian Lance Taylor  <iant@google.com>
10120
10121         * target-reloc.h (visibility_error): New inline function.
10122         (relocate_section): Call visibility_error.
10123         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
10124         (MOSTLYCLEANFILES): Likewise.
10125         (protected_4_pic.o, protected_3.err): New targets.
10126         * testsuite/protected_4.cc: New file.
10127
10128 2010-01-12  Doug Kwan  <dougkwan@google.com>
10129
10130         * arm.cc (Cortex_a8_reloc): New class.
10131         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
10132         and cortex_a8_relocs_info_.
10133         (Target_arm::fix_cortex_a8): New method definition.
10134         (Target_arm::Cortex_a8_relocs_info): New type.
10135         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
10136         New data member declarations.
10137         (Target_arm::scan_reloc_for_stub): Record information about
10138         relocations for THUMB branches that might be exempted from the
10139         Cortex-A8 workaround.
10140         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
10141         at the beginning of a relaxation pass.
10142
10143 2010-01-12  Doug Kwan  <dougkwan@google.com>
10144
10145         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
10146         (Arm_relobj::Mapping_symbol_position,
10147          Arm_reloj::Mapping_symbol_position_less,
10148          Arm_relobj::Mapping_symbols_info): New types.
10149         (Target_arm::is_mapping_symbol_name): New method definition.
10150         (Arm_relobj::do_count_local_symbols): Save information about mapping
10151         symbols.
10152
10153 2010-01-11  Doug Kwan  <dougkwan@google.com>
10154
10155         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
10156         Arm_relocate_functions::thumb32_branch_upper,
10157         Arm_relocate_functions::thumb32_branch_lower,
10158         Arm_relocate_functions::thumb32_cond_branch_offset,
10159         Arm_relocate_functions::thumb32_cond_branch_upper,
10160         Arm_relocate_functions::thumb32_cond_branch_lower,
10161         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
10162         branch offset encoding.
10163         (Arm_relocate_functions::thumb_branch_common): Use new branch
10164         offset encoding methods to avoid code duplication.
10165         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10166         (Stub_addend_reader::operator()): Use new branch encoding method
10167         to avoid code duplication.
10168
10169 2010-01-11  Doug Kwan  <dougkwan@google.com>
10170
10171         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10172         (Target_arm::do_finalize_sections): Define special EXIDX section
10173         symbols only if referenced.
10174         * gc.h (Garbage_collection::add_reference): New method.
10175         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10176         code duplication.
10177
10178 2010-01-11  Ian Lance Taylor  <iant@google.com>
10179
10180         * script.cc (Version_script_info::build_expression_list_lookup):
10181         Change complaing about duplicate wildcard match from error to
10182         warning.
10183
10184         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10185         of 2009-12-30.
10186         (Version_script_info::Version_script_info): Initialize globs_,
10187         default_version_, default_is_global_, and exact_.  Don't
10188         initialize globals_ or locals_.
10189         (Version_script_info::build_lookup_tables): Build local symbols
10190         first.
10191         (Version_script_info::unquote): New function.
10192         (Version_script_info::add_exact_match): New function.
10193         (Version_script_info::build_expression_list_lookup): Remove lookup
10194         parameter.  Add is_global parameter.  Change all callers.  Handle
10195         wildcard pattern specially.  Unquote pattern.  Call
10196         add_exact_match.
10197         (Version_script_info::get_name_to_match): New function.
10198         (Version_script_info::get_symbol_version): New function.
10199         (Version_script_info::get_symbol_version_helper): Remove.
10200         (Version_script_info::check_unmatched_names): Call unquote.
10201         * script.h (class Version_script_info): Change get_symbol_version
10202         to be non-inline and add is_global parameter; change all callers.
10203         Rewrite symbol_is_local.  Update declarations.  Define struct
10204         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10205         Remove globals_ and locals_ members.  Add exact_, globs_,
10206         default_version_, is_global_.
10207         (Version_script_info::Glob): Remove pattern, add expression and
10208         is_global.  Update constructor.  Change all callers.
10209         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10210         default version.
10211         (Versions::symbol_section_contents): If a symbol is undefined, or
10212         defined in a dynamic object, set the version index to
10213         VER_NDX_LOCAL.
10214         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10215         symbol_is_local.
10216         (Symbol_table::add_from_pluginobj): Likewise.
10217         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10218
10219 2010-01-11  Doug Kwan  <dougkwan@google.com>
10220
10221         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10222         (incremental_dump_LDADD): Add linking option for libintl.
10223         * Makefile.in: Regenerate.
10224
10225 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10226
10227         PR gold/11144
10228         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10229         instead of -Ds.
10230         * testsuite/Makefile.in: Regenerated.
10231
10232 2010-01-10  Doug Kwan  <dougkwan@google.com>
10233
10234         * options.h (DEFINE_var): Use parentheses around argument varname__
10235         in macro body to avoid any unintended subsequent substitutions.
10236
10237 2010-01-10  Ian Lance Taylor  <iant@google.com>
10238
10239         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10240         candidates before doing symbol resolution.
10241
10242         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10243         ODR candidates if only one is weak.
10244
10245 2010-01-08  Ian Lance Taylor  <iant@google.com>
10246
10247         * script.cc (Version_script_info::build_expression_list_lookup):
10248         Don't warn about ambiguous version, just record the ambiguity.
10249         (Version_script_info::get_symbol_version_helper): Give error if
10250         version is ambiguous.
10251
10252 2010-01-08  Doug Kwan  <dougkwan@google.com>
10253
10254         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10255         prev_data_size_ and prev_addralign_.  Remove initializer for
10256         deleted data member has_been_changed_.
10257         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10258         to determine if the table is empty.
10259         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10260         Remove.
10261         (Stub_table::add_reloc_stub): Define method in class definition
10262         instead of just declaring it there.
10263         (Stub_table::add_cortex_a8_stub): New method definition.
10264         (Stub_table::update_data_size_and_addralign): Ditto.
10265         (Stub_table::finalize_stubs): Ditto.
10266         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10267         (Stub_table::do_addralign_): Return address alignment in the
10268         (Stub_table::do_reset_address_and_file_offset): Define method in
10269         class definition instead of declaring it there.  Set current data
10270         size to be the data size of the previous pass.
10271         (Stub_table::set_final_data_size): Use current data size as the
10272         final data size.
10273         (Stub_table::relocate_stub): Change parameter type of stub from
10274         Reloc_stub pointer to Stub pointer.
10275         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10276         (Stub_table::Cortex_a8_stub_list): New typedef.
10277         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10278          Stub_table::prev_addralign_): New data member.
10279         (Arm_relobj::Arm_relobj): Initialize data member
10280         section_has_cortex_a8_workaround_.
10281         (Arm_relobj::section_has_cortex_a8_workaround,
10282          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10283          definitions.
10284         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10285         declarations.
10286         (Target_arm::relocate_stub): Change parameter type of stub from
10287         Reloc_stub pointer to Stub pointer.
10288         (Insn_template::size, Insn_template::alignment): Handle
10289         THUMB16_SPECIAL_TYPE.
10290         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10291          Stub_table::update_data_size_and_addralign,
10292          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10293         definitions.
10294         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10295         (Stub_table::do_write): Ditto.
10296         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10297
10298 2010-01-08  Ian Lance Taylor  <iant@google.com>
10299
10300         PR 11108
10301         * symtab.h (class Symbol): Remove fields is_target_special_ and
10302         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10303         (Symbol::is_defined_in_discarded_section): New function.
10304         (Symbol::set_is_defined_in_discarded_section): New function.
10305         (Symbol::has_plt_offset): Rewrite.
10306         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10307         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10308         Don't initialize is_target_special_ or has_plt_offset_.
10309         Initialize is_defined_in_discarded_section_.
10310         (Symbol_table::add_from_relobj): If appropriate, set
10311         is_defined_in_discarded_section.
10312         * resolve.cc (Symbol::override_base_with_special): Don't test
10313         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10314         * target-reloc.h (relocate_section): Do special handling for
10315         symbols defined in discarded sections for global symbols as well
10316         as local symbols.
10317
10318 2010-01-08  Ian Lance Taylor  <iant@google.com>
10319
10320         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10321         the SHT_SYMTAB case.
10322
10323 2010-01-08  Ian Lance Taylor  <iant@google.com>
10324
10325         * object.cc (Sized_relobj::do_layout): Don't get confused if
10326         layout_eh_frame returns NULL.
10327
10328 2010-01-08  Ian Lance Taylor  <iant@google.com>
10329
10330         PR 11084
10331         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10332         dynamic symbol table, use the normal symbol table.
10333         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10334         symbol table.
10335
10336 2010-01-08  Ian Lance Taylor  <iant@google.com>
10337
10338         PR 11072
10339         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10340         sections.
10341
10342 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10343
10344         * version.cc (print_version): Change to "Copyright 2010".
10345
10346 2010-01-08  Ian Lance Taylor  <iant@google.com>
10347
10348         PR 10287
10349         PR 11063
10350         * i386.cc (class Target_i386): Change return type of plt_section
10351         to be non-const.
10352         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10353         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10354         tls_desc_rel_ field.
10355         (Output_data_plt_i386::rel_tls_desc): New function.
10356         (Target_i386::rel_tls_desc_section): New function.
10357         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10358         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10359         R_386_TLS_DESC reloc in rel_tls_desc_section.
10360         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10361         Define struct Tlsdesc_info.
10362         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10363         (Target_x86_64::do_reloc_symbol_index): New function.
10364         (Target_x86_64::add_tlsdesc_info): New function.
10365         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10366         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10367         tlsdesc_rel_ field.
10368         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10369         all callers.
10370         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10371         (Target_x86_64::rela_tlsdesc_section): New function.
10372         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10373         handling.
10374         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10375         (Target_x86_64::do_reloc_addend): New function.
10376         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10377         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10378         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10379         (Output_reloc::type): New function.
10380         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10381         (Output_reloc::is_target_specific): New function.
10382         (Output_reloc::target_arg): New function.
10383         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10384         absolute relocs and target specific relocs.
10385         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10386         add_target_specific.
10387         (class Output_data_reloc) [SHT_RELA]: Likewise.
10388         * output.cc (Output_reloc::Output_reloc): Add four new versions
10389         for absolute relocs and target specific relocs.
10390         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10391         (Output_reloc::get_symbol_index): Likewise.
10392         (Output_reloc::local_section_offset): Check that local_sym_index_
10393         is not TARGET_CODE or 0.
10394         (Output_reloc::symbol_value): Likewise.
10395         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10396         reloc.
10397         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10398         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10399         functions.
10400         * layout.cc (add_target_dynamic_tags): Use output section for
10401         DT_PLTRELSZ and DT_JMPREL.
10402
10403 2010-01-07  Ian Lance Taylor  <iant@google.com>
10404
10405         PR 11061
10406         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10407         function.
10408         (class Output_data_reloc_generic): Define.
10409         (class Output_data_reloc_base): Change base class to
10410         Output_data_reloc_generic.  Change add() method to call
10411         bump_relative_reloc_count for a relative reloc.  Remove
10412         sort_relocs_ field.
10413         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10414         to sort_relocs().
10415         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10416         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10417         appropriate.
10418         * layout.h (class Layout): Update declaration.
10419
10420 2010-01-07  Ian Lance Taylor  <iant@google.com>
10421
10422         * output.h (class Output_data): Add const version of
10423         output_section and do_output_section.
10424         (class Output_section_data): Add const version of
10425         do_output_section.
10426         (class Output_section): Likewise.
10427         * layout.cc (Layout::add_target_dynamic_tags): New function.
10428         * layout.h (class Layout): Update declarations.
10429         * arm.cc (Target_arm::do_finalize_sections): Use
10430         add_target_dynamic_tags.
10431         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10432         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10433         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10434         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10435
10436 2010-01-07  Ian Lance Taylor  <iant@google.com>
10437
10438         PR 11042
10439         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10440         object as needed.
10441
10442 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10443             Ian Lance Taylor  <iant@google.com>
10444
10445         PR 11019
10446         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10447         Xindex::read_symtab_xindex.
10448
10449 2010-01-07  Doug Kwan  <dougkwan@google.com>
10450
10451         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10452         (Insn_template::thumb16_bcond_insn): New method declaration.
10453         (Insn_template): Fix spelling.
10454         (Stub::thumb16_special): New method declaration.
10455         (Stub::do_write): Define virtual method which was previously pure
10456         virtual.
10457         (Stub::do_thumb16_special): New method declaration.
10458         (Stub::do_fixed_endian_write): New template member.
10459         (Reloc_stub::do_write): Remove.
10460         (Reloc_stub::do_fixed_endian_write): Remove.
10461         (Cortex_a8_stub): New class definition.
10462         (Stub_factory::make_cortex_a8_stub): New method definition.
10463         (Stub_factory::Stub_factory): Add missing static storage class
10464         qualifier for elf32_arm_stub_a8_veneer_blx.
10465
10466 2010-01-07  Ian Lance Taylor  <iant@google.com>
10467
10468         PR 10980
10469         * options.h (class General_options): Add --warn-unresolved-symbols
10470         and --error-unresolved-symbols.
10471         * errors.cc (Errors::undefined_symbol): Implement
10472         --warn-unresolved-symbols.
10473
10474         * options.h (class General_options): Add -z text and -z textoff.
10475         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10476
10477 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10478
10479         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10480         (Garbage_collection::cident_sections): New function.
10481         (Garbage_collection::add_cident_section): New function.
10482         (Garbage_collection::cident_sections_): New member.
10483         (gc_process_relocs): Add references to sections whose names are C
10484         identifiers.
10485         * gold.h (cident_section_start_prefix): New constant.
10486         (cident_section_stop_prefix): New constant.
10487         (is_cident): New function.
10488         * layout.cc (Layout::define_section_symbols): Replace string constants
10489         with the newly defined constants.
10490         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10491         C identifiers.
10492         * testsuite/Makefile.am: Add gc_orphan_section_test.
10493         * testsuite/Makefile.in: Regenerate.
10494         * testsuite/gc_orphan_section_test.cc: New file.
10495         * testsuite/gc_orphan_section_test.sh: New file.
10496
10497 2010-01-06  Ian Lance Taylor  <iant@google.com>
10498
10499         PR 10980
10500         * options.h (class General_options): Add --warn-shared-textrel.
10501         * layout.cc (Layout::finish_dynamic_section): Implement
10502         --warn-shared-textrel.
10503
10504         PR 10980
10505         * options.h (class General_options): Add --warn-multiple-gp.
10506
10507 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10508
10509         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10510         $(THREADSLIB) and $(LIBDL).
10511         * Makefile.in: Rebuild.
10512
10513 2010-01-06  Ian Lance Taylor  <iant@google.com>
10514
10515         PR 10980
10516         * options.cc (General_options::parse_section_start): New function.
10517         (General_options::section_start): New function.
10518         (General_options::General_options): Initialize all members.
10519         * options.h: Include <map>
10520         (class General_options): Add --section-start.  Add section_starts_
10521         member.
10522         * layout.cc (Layout::attach_allocated_section_to_segment): If
10523         --section-start was used, set the address of the segment.  Remove
10524         local sort_sections.
10525         (Layout::relaxation_loop_body): If the address of the load segment
10526         has been set by --section-start, don't use it.
10527         * output.h (Output_segment::update_flags_for_output_section): New
10528         function.
10529         * output.cc (Output_segment::add_output_section): Call
10530         update_flags_for_output_section.
10531
10532 2010-01-05  Ian Lance Taylor  <iant@google.com>
10533
10534         PR 10980
10535         * options.h (class General_options): Add --undefined-version.
10536         * script.cc (struct Version_expression): Add was_matched_by_symbol
10537         field.
10538         (Version_script_info::matched_symbol): New function.
10539         (Version_script_info::get_symbol_version_helper): Call
10540         matched_symbol.
10541         (Version_script_info::check_unmatched_names): New function.
10542         * script.h (class Version_script_info): Update declarations.
10543         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10544
10545         * options.h (class General_options): Use DEFINE_bool_alias for
10546         allow_multiple_definition.
10547         * resolve.cc (Symbol_table::should_override): Don't test
10548         allow_multiple_definition.
10549
10550         PR 10980
10551         * options.h (class General_options): Add --cref.
10552         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10553         until after printing cref table.
10554         * cref.cc: Include "symtab.h".
10555         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10556         (Cref_table_compare::operator()): New function.
10557         (Cref_inputs::gather_cref): New function.
10558         (filecol): New static const.
10559         (Cref_inputs::print_cref): New function.
10560         (Cref::print_cref): New function.
10561         * cref.h: Include <cstdio>.
10562         (class Cref): Update declarations.
10563         * mapfile.h (Mapfile::file): New function.
10564         * object.h (class Object): Define Symbols.  Declare virtual
10565         do_get_global_symbols.
10566         (Object::get_global_symbols): New function.
10567         * object.cc (Input_objects::add_object): Pass object to cref_ if
10568         --cref.
10569         (Input_objects::archive_start): Likewise.
10570         (Input_objects::archive_stop): Likewise.
10571         (Input_objects::print_cref): New function.
10572         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10573         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10574         --cref.
10575         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10576         function.
10577         * plugin.h (class Sized_pluginobj): Update declarations.
10578
10579 2010-01-05  Ian Lance Taylor  <iant@google.com>
10580
10581         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10582         to is_default_version.  Rename insdef to insdefault.
10583         (Symbol_table::add_from_relobj): Rename def to is_default_version
10584         and local to is_forced_local.
10585         (Symbol_table::add_from_pluginobj): Likewise.
10586         (Symbol_table::add_from_dynobj): Likewise.
10587         (Symbol_table::define_special_symbol): Rename insdef to
10588         insdefault.
10589
10590 2010-01-04  Ian Lance Taylor  <iant@google.com>
10591
10592         PR 10980
10593         * options.h (class General_options): Add
10594         --allow-multiple-definition and -z muldefs.
10595         * resolve.cc (Symbol_table::should_override): Don't warn about a
10596         multiple symbol definition if --allow-multiple-definition or -z
10597         muldefs.
10598
10599         PR 10980
10600         * options.h (class General_options): Add --add-needed and
10601         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10602         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10603         error if --copy-dt-needed-entries aka --add-needed is used and
10604         would cause a change in behaviour.
10605
10606         PR 10980
10607         * options.h (class General_options): Add -G as a short version of
10608         --shared.  Add no-op options -assert, -g, and -i.
10609
10610 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10611
10612         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10613         check for .text or .gnu.linkonce.t sections.
10614         * icf.cc (Icf::find_identical_sections): Ditto.
10615         Change the detection for mangled function name within the section
10616         name.
10617         * icf.h (is_section_foldable_candidate): New function.
10618
10619 2009-12-30  Ian Lance Taylor  <iant@google.com>
10620
10621         PR 10980
10622         * options.h (class General_options): Permit two dashes with
10623         --retain-symbols-file.
10624
10625 2009-12-30  Ian Lance Taylor  <iant@google.com>
10626
10627         PR 10979
10628         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10629         don't put the file header and segment headers in the text
10630         segment.
10631
10632         PR 10979
10633         * common.cc (Sort_commons::operator()): Stabilize sort when both
10634         entries are NULL.
10635         (Symbol_table::do_allocate_commons_list): When allocating common
10636         symbols, skip a symbol which is no longer common.
10637         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10638         an object before checking its type.
10639         * testsuite/common_test_2.c: New file.
10640         * testsuite/common_test_3.c: New file.
10641         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10642         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10643         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10644         (common_test_2_pic.o, common_test_2.so): New targets.
10645         (common_test_3_pic.o, common_test_3.so): New targets.
10646         * testsuite/Makefile.in: Rebuild.
10647
10648         PR 10979
10649         * script.cc (read_input_script): If we see a new SECTIONS clause,
10650         and we have added an input section, give an error.
10651         * layout.h (class Layout): Add have_added_input_section function.
10652         Add have_added_input_section_ field.
10653         * layout.cc (Layout::Layout): Initialize
10654         have_added_input_section_.
10655         (Layout::layout): Set have_added_input_section_.
10656         (Layout::layout_eh_frame): Likewise.
10657
10658 2009-12-30  Ian Lance Taylor  <iant@google.com>
10659
10660         PR 10931
10661         * options.h (class General_options): Add --sort-common option.
10662         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10663         * common.cc (Sort_common): Add sort_order parameter to
10664         constructor.  Add sort_order_ field.
10665         (Sort_commons::operator): Check sort_order_.
10666         (Symbol_table::allocate_commons): Determine the sort order.
10667         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10668         Change all callers.
10669         (Symbol_table::do_allocate_commons_list): Likewise.
10670
10671 2009-12-30  Ian Lance Taylor  <iant@google.com>
10672
10673         PR 10916
10674         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10675         symbols from this object, don't change the visibility of an
10676         undefined symbol.
10677         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10678
10679 2009-12-30  Ian Lance Taylor  <iant@google.com>
10680
10681         PR 10861
10682         * script.h (class Version_script_info): Define Language enum.
10683         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10684         new fields globals_, locals_, and is_finalized_.
10685         * script.cc: Various formatting fixes.
10686         (class Parser_closure): Change language_stack_ from a vector of
10687         std::string to one of Version_script_info::Language.  Adjust all
10688         uses accordingly.
10689         (class Lazy_demangler): Remove.
10690         (struct Version_expression): Change language from std::string to
10691         Version_script_info::Language.
10692         (Version_script_info::Version_script_info): New function.
10693         (Version_script_info::~Version_script_info): Don't call clear.
10694         (Version_script_info::finalize): New function.
10695         (Version_script_info::build_lookup_tables): New function.
10696         (Version_script_info::build_expression_list_lookup): New
10697         function.
10698         (Version_script_info::get_symbol_version_helper): Rewrite to use
10699         lookup tables.
10700         (Version_script_info::print_expression_list): Adjust to use
10701         Version_script_info::Language.
10702         (script_push_lex_into_version_mode): Check that the version script
10703         has not been finalized.
10704         (version_script_push_lang): Change language string to
10705         Version_script_info::Language.
10706         * options.cc (Command_line::version_script): New function.
10707         * options.h (class General_options): Add finalize_dynamic_list
10708         function.  Change version_script from declaration to definition.
10709         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10710         * testsuite/version_script.map: Remove duplicate def of foo.
10711         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10712         version_script.map.
10713         * testsuite/Makefile.in: Rebuild.
10714
10715 2009-12-30  Ian Lance Taylor  <iant@google.com>
10716
10717         PR 10843
10718         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10719         if the input symbol index is 0, make the output symbol index 0.
10720
10721 2009-12-30  Ian Lance Taylor  <iant@google.com>
10722
10723         PR 10670
10724         * options.h (class General_options): Add -x/--discard-all.
10725         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10726         --discard-all.  If the local symbol needs a dynamic entry, check
10727         that before handling --discard-locals.
10728
10729 2009-12-30  Ian Lance Taylor  <iant@google.com>
10730
10731         PR 10450
10732         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10733         flags to PF_R.
10734         (Output_segment::add_output_section): Don't change the flags if
10735         the type is PT_TLS.
10736
10737         PR 10450
10738         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10739         GNU hash table if they need a dynamic value.  Otherwise, don't add
10740         them if they are defined in a dynamic object or are forced local.
10741
10742 2009-12-29  Ian Lance Taylor  <iant@google.com>
10743
10744         PR 10450
10745         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10746         .gnu.hash table for a 32-bit target.
10747
10748         PR 10450
10749         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10750         regular and a dynamic object only needs a dynamic symbol table
10751         entry if it is externally visible.
10752
10753         PR 10450
10754         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10755         constructor.  Add global_offset_table_ field.
10756         (Target_i386::got_section): Set global_offset_table_.
10757         (Target_i386::do_finalize_sections): Set global_offset_table_
10758         size.
10759         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10760         in constructor.  Add global_offset_table_ field.
10761         (Target_x86_64::got_section): Set global_offset_table_.
10762         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10763         size.
10764
10765         * layout.cc (Layout::Layout): Initialize increase_relro_.
10766         (Layout::get_output_section): Add is_relro, is_last_relro, and
10767         is_first_non_relro parameters.  Change all callers.
10768         (Layout::choose_output_section): Likewise.
10769         (Layout::add_output_section_data): Likewise.
10770         (Layout::make_output_section): Likewise.
10771         (Layout::set_segment_offsets): Clear increase_relro when using a
10772         linker script.
10773         * layout.h (class Layout): Add increase_relro method.  Add
10774         increase_relro_ field.  Update declarations.
10775         * output.cc (Output_section::Output_section): Initialize
10776         is_last_relro_ and is_first_non_relro_.
10777         (Output_segment::add_output_section): Group relro sections is
10778         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10779         (Output_segment::maximum_alignment): Remove relro handling.
10780         (Output_segment::set_section_addresses): Add increase_relro
10781         parameter.  Change all callers.  Add initial alignment to align
10782         relro sections on separate page.  Remove old relro handling.
10783         (Output_segment::set_section_list_addresses): Remove in_relro
10784         parameter.  Change all callers.
10785         (Output_segment::set_offset): Add increase parameter.  Change all
10786         callers.  Remove old relro handling.
10787         * output.h (class Output_section): Add new methods: is_last_relro,
10788         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10789         Add is_last_relro_ and is_first_non_relro_ fields.
10790         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10791         Create separate .got.plt section.  Call increase_relro.
10792         * x86_64.cc (Target_x86_64::got_section): Likewise.
10793         * testsuite/relro_script_test.t: Add .got.plt.
10794
10795         PR 10450
10796         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10797         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10798         (Layout::finalize): Call set_dynamic_symbol_size.
10799         (Layout::set_dynamic_symbol_size): New function.
10800         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10801         set_dynamic_symbol_size.
10802
10803         PR 10450
10804         * output.h (class Output_section): Add is_entsize_zero_ field.
10805         * output.cc (Output_section::Output_section): Initialize
10806         is_entsize_zero_.
10807         (Output_section::set_entsize): If two different entsizes are
10808         requested, force it to zero.
10809         (Output_section::add_input_section): Set flags for .debug_str
10810         before updating section flags.  Set entsize.
10811         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10812         and SHF_STRING if all input sections have those flags.
10813
10814 2009-12-29   Rafael Espindola  <espindola@google.com>
10815
10816         * main.cc (main): Fix the sys time reporting.
10817         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10818         reporting.
10819
10820 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10821
10822         * options.cc (General_options::parse_version): Allow -v to exit
10823         without an error if there is nothing to link.
10824
10825 2009-12-29  Ian Lance Taylor  <iant@google.com>
10826
10827         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10828         using a version of gcc before 4.1.
10829         * configure: Rebuild.
10830
10831 2009-12-28  Chris Demetriou  <cgd@google.com>
10832
10833         * attributes.cc (Output_attributes_section_data::do_write): Use
10834         std::vector::front rather than std::vector::data.
10835
10836 2009-12-28  Ian Lance Taylor  <iant@google.com>
10837
10838         * symtab.h (class Symbol_table): Add enum Defined.
10839         * resolve.cc (Symbol_table::should_override): Add defined
10840         parameter.  Change all callers.  Test whether object is NULL
10841         before calling a method on it.
10842         (Symbol_table::report_resolve_problem): Add defined parameter.
10843         Change all callers.
10844         (Symbol_table::should_override_with_special): Likewise.
10845         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10846         parameter.  Change all callers.
10847         (Symbol_table::do_define_in_output_data): Likewise.
10848         (Symbol_table::define_in_output_segment): Likewise.
10849         (Symbol_table::do_define_in_output_segment): Likewise.
10850         (Symbol_table::define_as_constant): Likewise.
10851         (Symbol_table::do_define_as_constant): Likewise.
10852         * script.h (class Symbol_assignment): Add is_defsym parameter to
10853         constructor; change all callers.
10854         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10855         parameter.  Change all callers.  Add is_defsym_ field.
10856         (class Parser_closure): Add parsing_defsym parameter to
10857         constructor; change all callers.  Add parsing_defsym accessor
10858         function.  Add parsing_defsym_ field.
10859
10860 2009-12-28  Ian Lance Taylor  <iant@google.com>
10861
10862         * gold.cc (queue_middle_tasks): Fix formatting.
10863         * object.cc (Relobj::is_section_name_included): Likewise.
10864
10865 2009-12-23  Ian Lance Taylor  <iant@google.com>
10866
10867         * i386.cc (Target_i386::do_calls_non_split): Recognize
10868         -fsplit-stack prologue for a function with a static chain.
10869         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10870         -fsplit-stack prologue when using %r11.
10871
10872 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10873
10874         * options.cc (General_options::parse_version): Make -v continue and do
10875         the link like GNU ld does.
10876
10877 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10878
10879         * Makefile.am (CCFILES): Add timer.cc.
10880         (HFILES): Add timer.h.
10881         * configure.ac: Check for sysconf and times.
10882         * main.cc: include timer.h.
10883         (main): Use Timer instead of get_run_time.
10884         * timer.cc: New.
10885         * timer.h: New.
10886         * workqueue.cc: include timer.h.
10887         (Workqueue::find_and_run_task):
10888         Report user, sys and wall time.
10889         * Makefile.in: Regenerate.
10890         * config.in: Regenerate.
10891         * configure: Regenerate.
10892
10893 2009-12-16  Doug Kwan  <dougkwan@google.com>
10894
10895         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10896         sections.
10897         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10898         relaxed input sections.
10899         * output.cc (Output_section::find_relaxed_input_section): Change
10900         return type to Output_relaxed_input_section pointer.  Adjust code
10901         for new type of relaxed_input_section_map_.
10902         * output.h (Output_section::find_relaxed_input_section): Change
10903         return type to Output_relaxed_input_section pointer.
10904         (Output_section::Output_relaxed_input_section_by_input_section_map):
10905         New type.
10906         (Output_section::relaxed_input_section_map_): Change type to
10907         Output_section::Output_relaxed_input_section_by_input_section_map.
10908         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10909         input section.
10910
10911 2009-12-15  Ian Lance Taylor  <iant@google.com>
10912
10913         * layout.cc (Layout::create_shstrtab): Only write out after input
10914         sections if we are compressing debug sections.
10915
10916 2009-12-15  Ian Lance Taylor  <iant@google.com>
10917
10918         * archive.cc (Archive::add_symbols): Only look up a symbol without
10919         a version if there is, in fact, a version.
10920
10921 2009-12-14  Ian Lance Taylor  <iant@google.com>
10922
10923         Revert -Wshadow changes, all changes from:
10924         2009-12-11  Doug Kwan  <dougkwan@google.com>
10925         2009-12-11  Nick Clifton  <nickc@redhat.com>
10926         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10927
10928 2009-12-11  Doug Kwan  <dougkwan@google.com>
10929
10930         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10931         due to -Wshadow.
10932         * attributes.cc (Object_attribute::size): Ditto.
10933         (Attributes_section_data::size): Ditto.
10934         (Attributes_section_data::Attributes_section_data): Ditto.
10935         (Output_attributes_section_data::do_write): Ditto.
10936         * attributes.h (Object_attribute::set_type): Ditto.
10937         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10938
10939 2009-12-11  Nick Clifton  <nickc@redhat.com>
10940
10941         * archive.cc: Fix shadowed variable warnings.
10942         * arm.cc: Likewise.
10943         * compressed_output.cc: Likewise.
10944         * compressed_output.h: Likewise.
10945         * configure: Likewise.
10946         * dwarf_reader.cc: Likewise.
10947         * dynobj.cc: Likewise.
10948         * dynobj.h: Likewise.
10949         * ehframe.cc: Likewise.
10950         * ehframe.h: Likewise.
10951         * errors.cc: Likewise.
10952         * expression.cc: Likewise.
10953         * fileread.cc: Likewise.
10954         * fileread.h: Likewise.
10955         * freebsd.h: Likewise.
10956         * i386.cc: Likewise.
10957         * icf.cc: Likewise.
10958         * incremental.h: Likewise.
10959         * layout.cc: Likewise.
10960         * layout.h: Likewise.
10961         * mapfile.cc: Likewise.
10962         * merge.cc: Likewise.
10963         * merge.h: Likewise.
10964         * object.cc: Likewise.
10965         * object.h: Likewise.
10966         * options.h: Likewise.
10967         * output.cc: Likewise.
10968         * output.h: Likewise.
10969         * parameters.cc: Likewise.
10970         * plugin.cc: Likewise.
10971         * powerpc.cc: Likewise.
10972         * reduced_debug_output.cc: Likewise.
10973         * reduced_debug_output.h: Likewise.
10974         * reloc.cc: Likewise.
10975         * reloc.h: Likewise.
10976         * resolve.cc: Likewise.
10977         * script-sections.cc: Likewise.
10978         * script.cc: Likewise.
10979         * script.h: Likewise.
10980         * sparc.cc: Likewise.
10981         * symtab.cc: Likewise.
10982         * symtab.h: Likewise.
10983         * target-select.cc: Likewise.
10984         * target-select.h: Likewise.
10985         * token.h: Likewise.
10986         * workqueue.cc: Likewise.
10987         * workqueue.h: Likewise.
10988         * x86_64.cc: Likewise.
10989
10990 2009-12-10  Doug Kwan  <dougkwan@google.com>
10991
10992         * arm.cc (attributes.h): New include.
10993         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10994         (Arm_relobj::~Arm_relobj): Delete object pointed by
10995         attributes_section_data_.
10996         (Arm_relobj::attributes_section_data): New method definition.
10997         (Arm_relobj::attributes_section_data_): New data member declaration.
10998         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10999         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
11000         attributes_section_data_.
11001         (Arm_dynobj::attributes_section_data): New method definition.
11002         (Arm_dynobj::attributes_section_data_): New data member declaration.
11003         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
11004         initialization value of may_use_blx_ to false.
11005         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
11006         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
11007         object attributes to compute results instead of hard-coding.
11008         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
11009         Target_arm::get_secondary_compatible_arch,
11010         Target_arm::set_secondary_compatible_arch
11011         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11012         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
11013         New method declarations.
11014         (Target_arm::get_aeabi_object_attribute): New method definition.
11015         (Target_arm::attributes_section_data_): New data member declaration.
11016         (read_arm_attributes_section): New template definition.
11017         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
11018         (Arm_dynobj::do_read_symbols): Ditto.
11019         (Target_arm::do_finalize_sections): Merge attributes sections from
11020         input.  Check for BLX use after attributes section merging.
11021         Fix __exidx_start and __exidx_end visibility.  Create an
11022         .ARM.attributes section if necessary.
11023         (Target_arm::get_secondary_compatible_arch,
11024         Target_arm::set_secondary_compatible_arch,
11025         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
11026         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
11027         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
11028         New method definitions.
11029
11030 2009-12-09  Ian Lance Taylor  <iant@google.com>
11031
11032         * plugin.cc (Plugin::load): Don't cast from void* to a function
11033         pointer.
11034
11035 2009-12-09  Ian Lance Taylor  <iant@google.com>
11036
11037         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
11038         information fields.
11039
11040 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
11041
11042         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
11043         Replace two_file_shared_1.so with two_file_shared_2.so.
11044         * testsuite/Makefile.in: Regenerated.
11045
11046 2009-12-08  Doug Kwan  <dougkwan@google.com>
11047
11048         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
11049         (HFILES): Add attributes.h and int_encoding.h.
11050         * Makefile.in: Regenerate.
11051         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
11052         function definitions to int_encoding.cc
11053         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
11054         prototypes to int_encoding.h
11055         * reduced_debug_output.cc (int_encoding.h): New include.
11056         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
11057         function definitions to int_encoding.cc
11058         (insert_into_vector, read_from_pointer): Move template definitions to
11059         int_encoding.h
11060         * attributes.cc: New file.
11061         * attributes.h: New file.
11062         * int_encoding.cc: New file.
11063         * int_encoding.h: New file.
11064
11065 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
11066
11067         PR gold/11055
11068         * incremental-dump.cc (dump_incremental_inputs): New.
11069         (main): Use dump_incremental_inputs.
11070
11071 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
11072
11073         PR gold/10893
11074         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
11075         checking elfcpp::STT_FUNC.
11076         (Target_i386::Relocate::relocate): Likewise.
11077         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
11078
11079         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
11080         symbols from shared libraries into normal FUNC symbols.
11081
11082         * symtab.h (Symbol): Add is_func and use it.
11083
11084 2009-12-05  Doug Kwan  <dougkwan@google.com>
11085
11086         * arm.cc (Target_arm::arm_info): Initialize new fields
11087         attributes_section and attributes_vendor.
11088         * i386.cc (Target_i386::i386_info): Same.
11089         * object.cc (Sized_relobj::do_layout): Skip attribute section.
11090         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
11091         fields attributes_section and attributes_vendor.
11092         * sparc.cc (Target_sparc::sparc_info): Same.
11093         * target.h (Target::attributes_section, Target::attributes_vendor,
11094         Target::is_attributes_section, Target::attribute_arg_type,
11095         Target::attributes_order): New method definitions.
11096         (Target::Target_info::attributes_section,
11097         Target::Target_info::attributes_vendor): New fields.
11098         (Target::do_attribute_arg_type, Target::do_attributes_order): New
11099         virtual method definitions.
11100         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
11101         attributes_section and attributes_vendor.
11102         * testsuite/testfile.cc (Target_test::test_target_info): Same.
11103
11104 2009-12-05  Doug Kwan  <dougkwan@google.com>
11105
11106         * arm.cc: Update comments about interworking and stub generation.
11107         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
11108         considered as non-PIC.
11109         (Arm_relocate_functions::base_abs): Fix formatting.
11110         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
11111         of function to use GOT entry address instead of offset.
11112         (Target_arm::Scan::global): Issue an error if a symbol would need a
11113         PLT does not get one because it is untyped.  Remove code to create
11114         dynamic symbols for relative branches.
11115         (Target_arm::Relocate::relocate: Use 0 instead of false since function
11116         takes unsigned integer instead of boolean.
11117
11118 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
11119
11120         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
11121         (two_file_test_LDADD): Likewise.
11122         (common_test_1_LDADD): Likewise.
11123         (exception_test_LDADD) Likewise.
11124         (weak_test_LDADD): Likewise.
11125         (many_sections_test_LDADD): Likewise.
11126         (initpri1_LDADD): Likewise.
11127         (script_test_1_LDADD): Likewise.
11128         (script_test_2_LDADD): Likewise.
11129         (justsyms_LDADD): Likewise.
11130         (binary_test_LDADD): Likewise.
11131         (large_LDADD): Likewise.
11132         * testsuite/Makefile.in: Regenerated.
11133
11134 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
11135
11136         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
11137         (Symbol_table::override_with_special): Likewise.
11138         (Symbol_table::add_from_object): Likewise.
11139
11140 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11141
11142         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11143         Don't set the data_offset twice.
11144
11145 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
11146
11147         * testsuite/Makefile.in: Regenerate.
11148
11149 2009-12-03  Doug Kwan  <dougkwan@google.com>
11150
11151         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
11152         (Target_arm::do_finalize_sections): Add parameter for symbol table
11153         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
11154         * i386.cc (Target_i386::do_finalize_sections): Add an additional
11155         parameter for symbol table pointer.
11156         * layout.cc (Layout::finalize): Call Target::finalize_sections with
11157         an additional parameter for a pointer to symbol table.
11158         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
11159         parameter for a symbol table pointer.
11160         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
11161         * target.h (Target::finalize_sections, Target::do_finalize_sections):
11162         Ditto.
11163         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11164         parameter for a symbol table pointer.
11165
11166 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11167
11168         * incremental.cc (Incremental_inputs_header)
11169         (Incremental_inputs_header_write, Incremental_inputs_entry)
11170         (Incremental_inputs_entry_write): Move ...
11171         * incremental.h (Incremental_inputs_header)
11172         (Incremental_inputs_header_write, Incremental_inputs_entry)
11173         (Incremental_inputs_entry_write): here.
11174
11175 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11176
11177         * incremental.cc (make_sized_incremental_binary): Set the target.
11178         Error if it is incompatible.
11179         * output.h (Output_file): Add filename method.
11180
11181 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11182
11183         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11184         from the get_* methods.
11185
11186 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11187
11188         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11189         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11190         Write 0 for the data_offset of scripts.
11191
11192 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11193
11194         * testsuite/Makefile.am: Add the incremental_test.sh test.
11195         * testsuite/incremental_test.sh: New.
11196         * testsuite/incremental_test_1.c: New.
11197         * testsuite/incremental_test_2.c: New.
11198
11199 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11200
11201         * incremental-dump.cc (main): Fix typos.
11202
11203 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11204
11205         PR gold/11025
11206         * incremental-dump.cc (main): Use llu to print 64 bit values.
11207
11208 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11209             H.J. Lu  <hongjiu.lu@intel.com>
11210
11211         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11212         $(LIBDL).
11213         (incremental_dump_LDADD): Likewise.
11214         * Makefile.in: Regenerated.
11215
11216 2009-11-25  Doug Kwan  <dougkwan@google.com>
11217
11218         Revert:
11219
11220         2009-11-25  Doug Kwan  <dougkwan@google.com>
11221
11222                 * arm.cc (Target_arm::Target_arm): Move method definition
11223                 outside of class definition.  Add code to handle
11224                 --target1-rel, --target1-abs and --target2= options.
11225                 (Target_arm::get_reloc_reloc_type): Change method to be
11226                 non-static and const.
11227                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11228                 New data member declaration.
11229                 (Target_arm::Scan::local, Target_arm::Scan::global,
11230                 Target_arm::Relocate::relocate,
11231                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11232                 Adjust call to Target_arm::get_real_reloc_type.
11233                 (Target_arm::get_real_reloc_type): Use command line options
11234                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11235                 * options.h (--target1-rel, --target1-abs, --target2): New
11236                 ARM-only options.
11237
11238 2009-11-25  Doug Kwan  <dougkwan@google.com>
11239
11240         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11241         class definition.  Add code to handle --target1-rel, --target1-abs
11242         and --target2= options.
11243         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11244         and const.
11245         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11246         member declaration.
11247         (Target_arm::Scan::local, Target_arm::Scan::global,
11248         Target_arm::Relocate::relocate,
11249         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11250         call to Target_arm::get_real_reloc_type.
11251         (Target_arm::get_real_reloc_type): Use command line options to
11252         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11253         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11254         options.
11255
11256 2009-11-25  Doug Kwan  <dougkwan@google.com>
11257
11258         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11259         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11260         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11261         formatting.
11262         (Arm_relocate_functions::thm_call): Replace body with a call to
11263         Arm_relocate_functions::thumb_branch_common.
11264         (Arm_relocate_functions::thm_jump24,
11265         Arm_relocate_functions::thm_xpc22): New method definitions.
11266         (Arm_relocate_functions::thumb_branch_common): New method definition.
11267         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11268         operator.
11269         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11270         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11271
11272 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11273
11274         * Makefile.am: Build incremental-dump
11275         * Makefile.in: Regenerate.
11276         * incremental-dump.cc: New.
11277         * incremental.cc (Incremental_inputs_header_data,
11278         Incremental_inputs_entry_data): Move to incremental.h
11279         * incremental.h: (Incremental_inputs_header_data,
11280         Incremental_inputs_entry_data): Move from incremental.cc
11281
11282 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11283
11284         * incremental.cc (Incremental_inputs_header,
11285         Incremental_inputs_header_write, Incremental_inputs_entry,
11286         Incremental_inputs_entry_write): Add a typedef with the data type.
11287
11288 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11289
11290         * incremental.cc (Incremental_inputs_header,
11291         Incremental_inputs_header_write, Incremental_inputs_entry,
11292         Incremental_inputs_entry_write): Update comment about which
11293         type has the filed descriptions.
11294
11295 2009-11-15  Doug Kwan  <dougkwan@google.com>
11296
11297         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11298         (Arm_relocate_functions::arm_branch_common): Change method defintion
11299         in class definition to a method declaration and update list of formal
11300         parameters.
11301         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11302         Arm_relocation_functions::jump24): Adjust call to
11303         Arm_relocate_functions::arm_branch_common.  Update list of formal
11304         parameters.
11305         (Arm_relocate_functions::xpc25): New method definition.
11306         (Arm_relocate_functions::arm_branch_common): Move method defintion
11307         out from class definition.  Use stubs for mode-switching and extending
11308         branch ranges.
11309         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11310         specially.  Change code to enable use of stubs in ARM branches.
11311
11312 2009-11-10  Doug Kwan  <dougkwan@google.com>
11313
11314         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11315         in method declaration.
11316         (Target_arm::relocate_stub): New method declaration.
11317         (Target_arm::default_target): Change to return a pointer instead of
11318         a const reference.
11319         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11320         Target_arm::default_target.
11321         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11322         method definition.
11323         (Target_arm::relocate_section): Adjust view.
11324         (Target_arm::relocate_stub): New method definition.
11325
11326 2009-11-10  Doug Kwan  <dougkwan@google.com>
11327
11328         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11329         a format warning.
11330         * incremental.cc (open_incremental_binary): Initialized local
11331         variables to avoid warnings.
11332         * object.cc (make_elf_object): Ditto.
11333         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11334         a format warning.
11335
11336 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11337
11338         PR gold/10930
11339         * testsuite/plugin_test.c: Include "config.h".
11340
11341 2009-11-09  Doug Kwan  <dougkwan@google.com>
11342
11343         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11344         (arm_symbol_value): Remove.
11345         (Arm_relocate_functions::arm_branch_common,
11346         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11347         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11348         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11349         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11350         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11351         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11352         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11353         Arm_relocate_functions::thm_mobw_abs_nc,
11354         Arm_relocate_functions::thm_mov_abs,
11355         Arm_relocate_functions::movw_prel_nc,
11356         Arm_relocate_functions::thm_movt_abs,
11357         Arm_relocate_functions::movt_prel,
11358         Arm_relocate_functions::thm_movw_prel_nc,
11359         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11360         (Target_arm::Relocate::relocate): Only decompose address into two
11361         parts if relocation type uses the thumb-bit and pass the actual
11362         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11363         calls to methods in Arm_relocate_functions for this change.
11364
11365 2009-11-08  Ian Lance Taylor  <iant@google.com>
11366
11367         PR 10925
11368         * reloc.cc: Instantiate
11369         Sized_relobj::initialize_input_to_output_maps and
11370         Sized_relobj:free_input_to_output_maps.
11371
11372 2009-11-06  Ian Lance Taylor  <iant@google.com>
11373
11374         PR 10876
11375         * defstd.cc (in_segment): Set only_if_ref true for "end".
11376
11377 2009-11-06  Doug Kwan  <dougkwan@google.com>
11378
11379         * arm.cc (class Reloc_stub): Correct a comment.
11380         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11381         (Target_arm::scan_section_for_stubs): New method declaration.
11382         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11383         Change methods from private to protected.
11384         (Target_arm::do_may_relax): New method definition.
11385         (Target_arm::do_relax, Target_arm::group_sections,
11386         Target_arm::scan_reloc_for_stub,
11387         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11388         (Target_arm::arm_input_section_map_): New data member declaration.
11389         (Target_arm::scan_reloc_for_stub,
11390         Target_arm::scan_reloc_section_for_stubs,
11391         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11392         Target_arm::do_relax): New method definitions.
11393
11394 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11395
11396         * configure.ac: Check for (struct stat)::st_mtim
11397         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11398         * config.in: Regenerate.
11399         * configure: Regenerate.
11400
11401 2009-11-05  Ian Lance Taylor  <iant@google.com>
11402
11403         PR 10910
11404         * output.cc (Output_segment::add_output_section): Add missing
11405         return statement.
11406
11407 2009-11-04  Ian Lance Taylor  <iant@google.com>
11408
11409         PR 10880
11410         * object.h (class Object): Add is_needed and set_is_needed
11411         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11412         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11413         defined in a dynamic object and referenced by a regular object,
11414         set is_needed for the dynamic object.
11415         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11416         if the file is marked with as_needed and it is not needed.
11417
11418 2009-11-04  Ian Lance Taylor  <iant@google.com>
11419
11420         PR 10887
11421         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11422         tags if data is discarded by linker script.
11423         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11424         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11425         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11426         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11427
11428 2009-11-04  Ian Lance Taylor  <iant@google.com>
11429
11430         * layout.cc (Layout::get_output_section): Add is_interp and
11431         is_dynamic_linker_section parameters.  Change all callers.
11432         (Layout::choose_output_section): Likewise.
11433         (Layout::make_output_section): Likewise.
11434         (Layout::add_output_section_data): Add is_dynamic_linker_section
11435         parameter.  Change all callers.
11436         * layout.h (class Layout): Update declarations.
11437         * output.h (class Output_section): Add is_interp, set_is_interp,
11438         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11439         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11440         generate_code_fills_at_write_ to a bitfield.
11441         * output.cc (Output_section::Output_sections): Initialize new
11442         fields.
11443         (Output_segment::add_output_section): Add do_sort parameter.
11444         Change all callers.
11445
11446 2009-11-03  Ian Lance Taylor  <iant@google.com>
11447
11448         PR 10860
11449         * options.h (class General_options): Add --warn-common.
11450         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11451         merging two common symbols.
11452         (Symbol_table::should_override): Handle --warn-common when merging
11453         a common symbol with a defined symbol.  Use report_resolve_problem
11454         for multiple definitions.
11455         (Symbol_table::report_resolve_problem): New function.
11456         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11457
11458 2009-11-03  Doug Kwan  <dougkwan@google.com>
11459
11460         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11461         stub_factory_.
11462         (Target_arm::stub_factory): New method definition.
11463         (Target_arm::new_arm_input_section,
11464         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11465         Target_arm::reloc_uses_thumb_bit): New method declarations.
11466         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11467         New type definitions.
11468         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11469         member declarations.
11470         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11471         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11472         New method definitions.
11473
11474 2009-11-03  Ian Lance Taylor  <iant@google.com>
11475
11476         * options.h (class General_options): Add --warn_constructors.
11477
11478 2009-11-03  Ian Lance Taylor  <iant@google.com>
11479
11480         PR 10893
11481         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11482         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11483
11484 2009-11-03  Ian Lance Taylor  <iant@google.com>
11485
11486         PR 10895
11487         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11488         --msgid-bugs-address.
11489         (install-pdf): New target.
11490         (install-data_yes): Look up one directory to find mkinstalldirs.
11491
11492 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11493
11494         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11495         tree.
11496
11497 2009-10-30  Doug Kwan  <dougkwan@google.com>
11498
11499         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11500
11501 2009-10-30  Doug Kwan  <dougkwan@google.com>
11502
11503         * arm.cc (Stub_addend_reader): New struct template definition
11504         and partial specializations.
11505         (Stub_addend_reader::operator()): New method definition for a
11506         partially specialized template.
11507
11508 2009-10-30  Doug Kwan  <dougkwan@google.com>
11509
11510         * arm.cc (Arm_relobj::processor_specific_flags): New method
11511         definition.
11512         (Arm_relobj::do_read_symbols): New method declaration.
11513         (Arm_relobj::processor_specific_flags_): New data member declaration.
11514         (Arm_dynobj): New class definition.
11515         (Target_arm::do_finalize_sections): Add input_objects parameter.
11516         (Target_arm::do_adjust_elf_header): New method declaration.
11517         (Target_arm::are_eabi_versions_compatible,
11518         (Target_arm::merge_processor_specific_flags): New method declaration.
11519         (Target_arm::do_make_elf_object): New overloaded method definitions
11520         and declaration.
11521         (Arm_relobj::do_read_symbols): New method definition.
11522         (Arm_dynobj::do_read_symbols): Ditto.
11523         (Target_arm::do_finalize_sections): Add input_objects parameters.
11524         Merge processor-specific flags from all input objects.
11525         (Target_arm::are_eabi_versions_compatible,
11526         Target_arm::merge_processor_specific_flags,
11527         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11528         New method definitions.
11529         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11530         Input_objects pointer type parameter.
11531         * layout.cc (Layout::finalize): Pass input objects to target's.
11532         finalize_sections function.
11533         * output.cc (Output_file_header::do_sized_write): Set ELF file
11534         header's processor-specific flags.
11535         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11536         Input_objects pointer type parameter.
11537         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11538         * target.h (Input_objects): New forward class declaration.
11539         (Target::processor_specific_flags,
11540         Target::are_processor_specific_flags_sect): New method definitions.
11541         (Target::finalize_sections): Add input_objects parameter.
11542         (Target::Target): Initialize processor_specific_flags_ and
11543         are_processor_specific_flags_set_.
11544         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11545         parameter.
11546         (Target::set_processor_specific_flags): New method definition.
11547         (Target::processor_specific_flags_,
11548         Target::are_processor_specific_flags_set_): New data member
11549         declarations.
11550         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11551         Input_objects pointer type parameter.
11552
11553 2009-10-30  Doug Kwan  <dougkwan@google.com>
11554
11555         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11556
11557 2009-10-28  Ian Lance Taylor  <iant@google.com>
11558
11559         * object.h (class Relobj): Drop options parameter from
11560         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11561         do_scan_relocs, do_relocate.  Change all callers.
11562         (class Sized_relobj): Drop options parameters from
11563         do_gc_process_relocs, do_scan_relocs, do_relocate,
11564         do_relocate_sections, relocate_sections, emit_relocs_scan,
11565         emit_relocs_scan_reltype.  Change all callers.
11566         (struct Relocate_info): Remove options field and all references to
11567         it.
11568         * reloc.h (class Read_relocs): Remove options constructor
11569         parameter and options_ field.  Change all callers.
11570         (class Gc_process_relocs, class Scan_relocs): Likewise.
11571         (class Relocate_task): Likewise.
11572         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11573         all callers.
11574         (scan_relocatable_relocs): Likewise.
11575         * target.h (class Sized_target): Remove options parameter from
11576         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11577         all callers.
11578         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11579         callers.
11580         * arm.cc: Update functions to remove options parameters.
11581         * i386.cc: Likewise.
11582         * powerpc.cc: Likewise.
11583         * sparc.cc: Likewise.
11584         * x86_64.cc: Likewise.
11585         * testsuite/testfile.cc: Likewise.
11586
11587 2009-10-28  Doug Kwan  <dougkwan@google.com>
11588
11589         * arm.cc (Arm_relobj): New class definition.
11590         (Arm_relobj::scan_sections_for_stubs,
11591         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11592         New method definitions.
11593
11594 2009-10-28  Cary Coutant  <ccoutant@google.com>
11595
11596         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11597         (Plugin::cleanup_done_): New member.
11598         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11599         (Plugin_manager::cleanup_done_): Remove.
11600         (Plugin_manager::add_input_file): Edit error message.
11601         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11602         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11603
11604 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11605
11606         * fileread.cc: (File_read::View::~View): Use the new
11607         data_ownership_ filed.
11608         (File_read::~File_read): Dispose the new whole_file_view_.
11609         (File_read::open): Mmap the whole file if needed.
11610         (File_read::open): Use whole_file_view_ instead of contents_.
11611         (File_read::find_view): Use whole_file_view_ if applicable.
11612         (File_read::do_read): Use whole_file_view_ instead of contents_.
11613         (File_read::make_view): Use whole_file_view_ instead of contents_,
11614         update File_read::View::View call.
11615         (File_read::find_or_make_view): Update File_read::View::View
11616         call.
11617         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11618         remove contents_
11619         (File_read::View::Data_ownership): New enum.
11620         (File_read::View::View): Replace bool mapped_ with Data_ownership
11621         argument.
11622         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11623         (File_read::View::data_ownership_): New field.
11624         (File_read::contents_): Remove (replaced by whole_file_view_).
11625         (File_read::whole_file_view_): New field.
11626         * options.h (class General_options): Add --keep-files-mapped.
11627
11628 2009-10-27  Cary Coutant  <ccoutant@google.com>
11629
11630         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11631         * testsuite/Makefile.am (plugin_test_5): New test case.
11632         * testsuite/Makefile.in: Regenerate.
11633
11634 2009-10-25  Doug Kwan  <dougkwan@google.com>
11635
11636         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11637         from private to protected to allow access by child class.
11638         (Sized_relobj::do_relocate_sections): New method declaration.
11639         (Sized_relobj::relocate_sections): Virtualize.
11640         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11641         Sized_relobj::relocate_sections.  Instantiate template explicitly
11642         for different target sizes and endianity.
11643
11644 2009-10-24  Doug Kwan  <dougkwan@google.com>
11645
11646         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11647         (Arm_input_section::as_arm_input_section): New method.
11648         (Arm_output_section): New class definition.
11649         (Arm_output_section::create_stub_group,
11650         Arm_output_section::group_sections): New method definitions.
11651
11652 2009-10-22  Doug Kwan  <dougkwan@google.com>
11653
11654         * arm.cc (Arm_input_section): New class definition.
11655         (Arm_input_section::init, Arm_input_section:do_write,
11656         Arm_input_section::set_final_data_size,
11657         Arm_input_section::do_reset_address_and_file_offset): New method
11658         definitions.
11659
11660 2009-10-21  Doug Kwan  <dougkwan@google.com>
11661
11662         * arm.cc (Stub_table, Arm_input_section): New forward class
11663         declarations.
11664         (Stub_table): New class defintion.
11665         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11666         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11667         New method definition.
11668
11669 2009-10-21  Doug Kwan  <dougkwan@google.com>
11670
11671         * arm.cc: Update copyright comments.
11672         (Target_arm): New forward class template declaration.
11673         (Arm_address): New type.
11674         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11675         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11676         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11677         constants.
11678         (Insn_template): Same.
11679         (DEF_STUBS): New macro.
11680         (Stub_type): New enum type.
11681         (Stub_template): New class definition.
11682         (Stub): Same.
11683         (Reloc_stub): Same.
11684         (Stub_factory): Same.
11685         (Target_arm::Target_arm): Initialize may_use_blx_ and
11686         should_force_pic_veneer_.
11687         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11688         Target_arm::should_force_pic_veneer,
11689         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11690         Target_arm::using_thumb_only, Target_arm:;default_target): New
11691         method defintions.
11692         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11693         New data member declarations.
11694         (Insn_template::size, Insn_template::alignment): New method defintions.
11695         (Stub_template::Stub_template): New method definition.
11696         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11697         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11698         (Stub_factory::Stub_factory): New method definition.
11699         * gold.h (string_hash): New template.
11700         * output.h (Input_section_specifier::hash_value): Use
11701         gold::string_hash.
11702         (Input_section_specifier::string_hash): Remove.
11703         * stringpool.cc (Stringpool_template::string_hash): Use
11704         gold::string_hash.
11705
11706 2009-10-20  Doug Kwan  <dougkwan@google.com>
11707
11708         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11709         symbols of relaxed input sections.
11710         * output.h (Output_section::find_relaxed_input_section): Make
11711         method public.
11712
11713 2009-10-16  Doug Kwan  <dougkwan@google.com>
11714
11715         * dynobj.cc (Versions::Versions): Initialize version_script_.
11716         Only insert base version symbol definition for a shared object
11717         if version script defines any version versions.
11718         (Versions::define_base_version): New method definition.
11719         (Versions::add_def): Check that base version is not needed.
11720         (Versions::add_need): Define base version lazily.
11721         * dynobj.h (Versions::define_base_version): New method declaration.
11722         (Versions::needs_base_version_): New data member declaration.
11723         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11724         (check_DATA): Add no_version_test.stdout.
11725         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11726         New make rules.
11727         * testsuite/Makefile.in: Regenerate.
11728         * testsuite/no_version_test.c: New file.
11729         * testsuite/no_version_test.sh: Ditto.
11730
11731 2009-10-16  Doug Kwan  <dougkwan@google.com>
11732
11733         * expression.cc (class Segment_start_expression): New class definition.
11734         (Segment_start_expression::value): New method definition.
11735         (script_exp_function_segment_start): Return a new
11736         Segment_start_expression.
11737         * gold/script-c.h (script_saw_segment_start_expression): New function
11738         prototype.
11739         * script-sections.cc (Script_sections::Script_sections): Initialize
11740         SAW_SEGMENT_START_EXPRESSION_ to false.
11741         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11742         and -Tbbs options to specify section addresses if given in
11743         command line and no SEGMENT_START expression is seen in a script.
11744         * script-sections.h (Script_sections::saw_segment_start_expression,
11745         Script_sections::set_saw_segment_start_expression): New method
11746         definition.
11747         (Script_sections::saw_segment_start_expression_): New data member
11748         declaration.
11749         * script.cc (script_saw_segment_start_expression): New function.
11750         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11751         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11752         script_test_7.sh and script_test_8.sh.
11753         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11754         script_test_8.stdout.
11755         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11756         (script_test_6, script_test_6.stdout, script_test_7,
11757         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11758         * Makefile.in: Regenerate.
11759         * testsuite/script_test_6.sh: New file.
11760         * testsuite/script_test_6.t: Same.
11761         * testsuite/script_test_7.sh: Same.
11762         * testsuite/script_test_7.t: Same.
11763         * testsuite/script_test_8.sh: Same.
11764
11765 2009-10-16  Doug Kwan  <dougkwan@google.com>
11766
11767         * output.cc (Output_segment::set_section_list_address): Cast
11768         expressions to unsigned long long type to avoid format warnings.
11769
11770 2009-10-15  Ian Lance Taylor  <iant@google.com>
11771
11772         * script.cc (Script_options::add_symbol_assignment): Always add a
11773         dot assignment to script_sections_.
11774         * script-sections.cc (Script_sections::add_dot_assignment):
11775         Initialize if necessary.
11776
11777         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11778         program headers with no load segment if there is a linker script.
11779
11780         * layout.cc (Layout::set_segment_offsets): Align the file offset
11781         to the segment aligment for -N or -n with no load segment.
11782         * output.cc (Output_segment::add_output_section): Don't crash if
11783         the first section is a TLS section.
11784         (Output_segment::set_section_list_addresses): Print an error
11785         message if the address moves backward in a linker script.
11786         * script-sections.cc
11787         (Output_section_element_input::set_section_addresses): Don't
11788         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11789         (Orphan_output_section::set_section_addresses): Likewise.
11790
11791 2009-10-15  Doug Kwan  <dougkwan@google.com>
11792
11793         * layout.cc (Layout::finish_dynamic_section): Generate tags
11794         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11795         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11796         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11797
11798 2009-10-14  Ian Lance Taylor  <iant@google.com>
11799
11800         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11801         fields.
11802         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11803         data_shdr fields of relinfo.
11804         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11805         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11806         R_386_TLS_LDO_32, adjust based on section flags.
11807         (Target_i386::Relocate::fix_up_ldo): Remove.
11808
11809 2009-10-13  Ian Lance Taylor  <iant@google.com>
11810
11811         Add support for -pie.
11812         * options.h (class General_options): Add -pie and
11813         --pic-executable.
11814         (General_options::output_is_position_independent): Test -pie.
11815         (General_options::output_is_executable): Return true if not shared
11816         and not relocatable.
11817         (General_options::output_is_pie): Remove.
11818         * options.cc (General_options::finalize): Reject incompatible uses
11819         of -pie.
11820         * gold.cc (queue_middle_tasks): A -pie link is not static.
11821         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11822         * symtab.cc (Symbol::final_value_is_known): Return false if
11823         output_is_position_independent.
11824         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11825         output_is_position_independent.
11826         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11827         output_is_position_independent.
11828         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11829         output_is_position_independent.
11830         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11831         two_file_pie_test.
11832         (basic_pie_test.o, basic_pie_test): New targets.
11833         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11834         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11835         (two_file_pie_test): New target.
11836         * testsuite/Makefile.in: Rebuild.
11837         * README: Remove note saying that -pie is not supported.
11838
11839 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11840
11841         * options.h (class General_options): Add -init and -fini.
11842         * layout.cc (Layout::finish_dynamic_section): Emit
11843         given init and fini functions.
11844
11845 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11846
11847         * gc.h (gc_process_relocs): Check if icf is enabled using new
11848         function.
11849         * gold.cc (queue_initial_tasks): Likewise.
11850         (queue_middle_tasks): Likewise.
11851         * object.cc (do_layout): Likewise.
11852         * symtab.cc (is_section_folded): Likewise.
11853         * main.cc (main): Likewise.
11854         * reloc.cc (Read_relocs::run): Likewise.
11855         (Sized_relobj::do_scan_relocs): Likewise.
11856         * icf.cc (is_function_ctor_or_dtor): New function.
11857         (Icf::find_identical_sections): Check if function is ctor or dtor when
11858         safe icf is chosen.
11859         * options.h (General_options::icf): Change option to be an enum.
11860         (Icf_status): New enum.
11861         (icf_enabled): New method.
11862         (icf_safe_folding): New method.
11863         (set_icf_status): New method.
11864         (icf_status_): New variable.
11865         * (options.cc) (General_options::finalize): Set icf_status_.
11866         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11867         icf_test and icf_keep_unique_test to use the --icf enum flag.
11868         * testsuite/icf_safe_test.sh: New file.
11869         * testsuite/icf_safe_test.cc: New file.
11870
11871 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11872
11873         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11874         includes to gc.h and icf.h.
11875         * arm.cc: Include gc.h.
11876         * gold.cc: Likewise.
11877         * i386.cc: Likewise.
11878         * powerpc.cc: Likewise.
11879         * sparc.cc: Likewise.
11880         * x86_64.cc: Likewise.
11881         * gc.h: Include icf.h.
11882
11883 2009-10-11  Ian Lance Taylor  <iant@google.com>
11884
11885         * plugin.cc: Include "gold.h" before other header files.
11886
11887 2009-10-10  Chris Demetriou  <cgd@google.com>
11888
11889         * options.h (Input_file_argument::Input_file_type): New enum.
11890         (Input_file_argument::is_lib_): Replace with...
11891         (Input_file_argument::type_): New member.
11892         (Input_file_argument::Input_file_argument): Take Input_file_type
11893         'type' rather than boolean 'is_lib' as second argument.
11894         (Input_file_argument::is_lib): Use type_.
11895         (Input_file_argument::is_searched_file): New function.
11896         (Input_file_argument::may_need_search): Handle is_searched_file.
11897         * options.cc (General_options::parse_library): Support -l:filename.
11898         (General_options::parse_just_symbols): Update for Input_file_argument
11899         changes.
11900         (Command_line::process): Likewise.
11901         * archive.cc (Archive::get_file_and_offset): Likewise.
11902         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11903         * script.cc (read_script_file, script_add_file): Likewise.
11904         * fileread.cc (Input_file::Input_file): Likewise.
11905         (Input_file::will_search_for): Handle is_searched_file.
11906         (Input_file::open): Likewise.
11907         * readsyms.cc (Read_symbols::get_name): Likewise.
11908         * testsuite/Makefile.am (searched_file_test): New test.
11909         * testsuite/Makefile.in: Regenerate.
11910         * testsuite/searched_file_test.cc: New file.
11911         * testsuite/searched_file_test_lib.cc: New file.
11912
11913 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11914             Ian Lance Taylor  <iant@google.com>
11915
11916         * descriptor.cc: Include <cstdio> and "binary-io.h".
11917         (Descriptors::open): Open the files in binary mode always.
11918         * script.cc (Lex::get_token): Treat \r as whitespace.
11919
11920 2009-10-09  Ian Lance Taylor  <iant@google.com>
11921
11922         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11923
11924 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11925             Ian Lance Taylor  <iant@google.com>
11926
11927         * configure.ac: Check for readv function also.
11928         * fileread.cc (readv): Define if not HAVE_READV.
11929         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11930         does not exist.
11931         * config.in: Regenerate.
11932         * configure: Regenerate.
11933
11934 2009-10-09  Doug Kwan  <dougkwan@google.com>
11935
11936         * layout.cc (Layout::make_output_section): Call target hook to make
11937         ordinary output section.
11938         (Layout::finalize): Adjust parameter list of call the
11939         Target::may_relax().
11940         * layout.h (class Layout::section_list): New method.
11941         * merge.h (Output_merge_base::entsize): Change visibility to public.
11942         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11943         New methods.
11944         (Output_merge_string::do_is_string): New method.
11945         * object.cc (Sized_relobj::do_setup): renamed from
11946         Sized_relobj::set_up.
11947         * object.h (Sized_relobj::adjust_shndx,
11948         Sized_relobj::initializ_input_to_output_maps,
11949         Sized_relobj::free_input_to_output_maps): Change visibilities to
11950         protected.
11951         (Sized_relobj::setup): Virtualize.
11952         (Sized_relobj::do_setup): New method declaration.
11953         (Sized_relobj::invalidate_section_offset,
11954         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11955         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11956         * options.cc (parse_int): New function.
11957         * options.h (parse_int): New declaration.
11958         (DEFINE_int): New macro.
11959         (stub_group_size): New option.
11960         * output.cc (Output_section::Output_section): Initialize memebers
11961         merge_section_map_, merge_section_by_properties_map_,
11962         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11963         (Output_section::add_input_section): Handled deferred code-fill
11964         generation and remove an old comment.
11965         (Output_section::add_relaxed_input_section): New method definition.
11966         (Output_section::add_merge_input_section): Use merge section by
11967         properties map to speed to search.  Update merge section maps
11968         as appropriate.
11969         (Output_section::build_relaxation_map): New method definition.
11970         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11971         Same.
11972         (Output_section::relax_input_section): Renamed to
11973         Output_section::convert_input_sections_to_relaxed_sections and change
11974         interface to take a vector of pointers to relaxed sections.
11975         (Output_section::find_merge_section,
11976         Output_section::find_relaxed_input_section): New method definitions.
11977         (Output_section::is_input_address_mapped,
11978         Output_section::output_offset, Output_section::output_address):
11979         Use output section data maps to speed up searching.
11980         (Output_section::find_starting_output_address): Add comments.
11981         (Output_section::do_write,
11982         Output_section::write_to_postprocessing_buffer): Do code-fill
11983         generation as appropriate.
11984         (Output_section::get_input_sections): Invalidate relaxed input section
11985         map.
11986         (Output_section::restore_states): Adjust type of checkpoint .
11987         Invalidate relaxed input section map.
11988         * output.h (Output_merge_base): New class declaration.
11989         (Input_section_specifier): New class defintion.
11990         (class Output_relaxed_input_section) Change base class to
11991         Output_section_data_build.
11992         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11993         base class initializer.
11994         (Output_section::add_relaxed_input_section): New method declaration.
11995         (Output_section::Input_section): Change visibility to protected.
11996         (Output_section::Input_section::relobj,
11997         Output_section::Input_section::shndx): Handle relaxed input sections.
11998         Output_section::input_sections) Change visibility to protected.  Also
11999         define overload to return a non-const pointer.
12000         (Output_section::Merge_section_properties): New class defintion.
12001         (Output_section::Merge_section_by_properties_map,
12002         Output_section::Output_section_data_by_input_section_map,
12003         Output_section::Relaxation_map): New types.
12004         (Output_section::relax_input_section): Rename method to
12005         Output_section::convert_input_sections_to_relaxed_sections and change
12006         interface to take a vector of relaxed section pointers.
12007         (Output_section::find_merge_section,
12008         Output_section::find_relaxed_input_section,
12009         Output_section::build_relaxation_map,
12010         Output_section::convert_input_sections_in_list_to_relaxed_sections):
12011         New method declarations.
12012         (Output_section::merge_section_map_
12013         Output_section::merge_section_by_properties_map_,
12014         Output_section::relaxed_input_section_map_,
12015         Output_section::is_relaxed_input_section_map_valid_,
12016         Output_section::generate_code_fills_at_write_): New data members.
12017         * script-sections.cc
12018         (Output_section_element_input::set_section_addresses): Call
12019         current_data_size and addralign methods of relaxed input sections.
12020         (Orphan_output_section::set_section_addresses): Call current_data_size
12021         and addralign methods of relaxed input sections.
12022         * symtab.cc (Symbol_table::compute_final_value): Extract template
12023         from the body of Symbol_table::sized_finalize_symbol.
12024         (Symbol_table::sized_finalized_symbol): Call
12025         Symbol_table::compute_final_value.
12026         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
12027         (Symbol_table::compute_final_value): New templated method declaration.
12028         * target.cc (Target::do_make_output_section): New method defintion.
12029         * target.h (Target::make_output_section): New method declaration.
12030         (Target::relax): Add more parameters for input objects, symbol table
12031         and layout.  Adjust call to do_relax.
12032         (Target::do_make_output_section): New method declaration.
12033         (Target::do_relax): Add parameters for input objects, symbol table
12034         and layout.
12035
12036 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12037
12038         * pread.c: Include stdio.h.
12039
12040 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12041
12042         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
12043         defined.
12044
12045 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
12046
12047         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
12048         Change read_shndx type to unsigned int.
12049         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12050         int.
12051         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12052         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
12053         Change read_shndx type to unsigned int.
12054         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
12055         int.
12056         (Sized_dwarf_line_info::read_line_mappings): Likewise.
12057         * layout.cc (Layout::create_symtab_sections): Cast the result of
12058         local_symcount * symsize to off_t in the gold_assert.
12059
12060 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12061
12062         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
12063         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
12064         R_ARM_BASE_ABS.
12065         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
12066         (Arm_relocate_functions::thm_abs5): New function.
12067         (Arm_relocate_functions::abs12): New function.
12068         (Arm_relocate_functions::abs16): New function.
12069         (Arm_relocate_functions::base_abs): New function.
12070         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
12071         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
12072         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
12073         R_ARM_BASE_ABS.
12074         (Scan::global): Likewise.
12075         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
12076         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
12077         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
12078         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
12079         R_ARM_BASE_ABS.
12080
12081 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12082
12083         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
12084         (Arm_relocate_functions::movt_prel): New function.
12085         (Arm_relocate_functions::thm_movw_prel_nc): New function.
12086         (Arm_relocate_functions::thm_movt_prel): New function.
12087         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
12088         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
12089         (Scan::global, Relocate::relocate): Likewise.
12090         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12091
12092 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12093
12094         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
12095         Incremental_checker.
12096         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
12097         unsigned int.
12098         (class Incremental_inputs_header): New class.
12099         (Incremental_inputs_header_writer): Edit comment.
12100         (Incremental_inputs_entry): New class.
12101         (Incremental_inputs_entry_writer): Edit comment.
12102         (Sized_incremental_binary::do_find_incremental_inputs_section):
12103         Add *strtab_shndx parameter, fill it.
12104         (Sized_incremental_binary::do_check_inputs): New method.
12105         (Incremental_checker::can_incrementally_link_output_file): Use
12106         Sized_incremental_binary::check_inputs.
12107         (Incremental_inputs::report_command_line): Save command line in
12108         command_line_.
12109         * incremental.h:
12110         (Incremental_binary::find_incremental_inputs_section): New
12111         method.
12112         (Incremental_binary::do_find_incremental_inputs_section): Add
12113         strtab_shndx parameter.
12114         (Incremental_binary::do_check_inputs): New pure virtual method.
12115         (Sized_incremental_binary::do_check_inputs): Declare.
12116         (Incremental_checker::Incremental_checker): Add incremental_inputs
12117         parameter, use it to initialize incremental_inputs_.
12118         (Incremental_checker::incremental_inputs_): New field.
12119         (Incremental_checker::command_line): New method.
12120         (Incremental_checker::inputs): New method.
12121         (Incremental_checker::command_line_): New field.
12122
12123 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
12124
12125         * incremental.cc: Include <cstdarg> and "target-select.h".
12126         (vexplain_no_incremental): New function.
12127         (explain_no_incremental): New function.
12128         (Incremental_binary::error): New method.
12129         (Sized_incremental_binary::do_find_incremental_inputs_section): New
12130         method.
12131         (make_sized_incremental_binary): New function.
12132         (open_incremental_binary): New function.
12133         (can_incrementally_link_file): Add checks if output is ELF and has
12134         inputs section.
12135         * incremental.h: Include "elfcpp_file.h" and "output.h".
12136         (Incremental_binary): New class.
12137         (Sized_incremental_binary): New class.
12138         (open_incremental_binary): Declare.
12139         * object.cc (is_elf_object): Use
12140         elfcpp::Elf_recognizer::is_elf_file.
12141         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
12142         * output.h (Output_file::filesize): New method.
12143
12144 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12145
12146         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
12147         New function.
12148         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
12149         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
12150         function.
12151         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
12152         function.
12153         (Arm_relocate_functions::movw_abs_nc): New function.
12154         (Arm_relocate_functions::movt_abs): New function.
12155         (Arm_relocate_functions::thm_movw_abs_nc): New function.
12156         (Arm_relocate_functions::thm_movt_abs): New function.
12157         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
12158         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
12159         (Scan::global): Likewise.
12160         (Relocate::relocate): Likewise.
12161         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12162
12163 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12164
12165         * arm.cc (Arm_relocate_functions::got_prel) New function.
12166         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12167         (Relocate::relocate): Likewise.
12168         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12169
12170 2009-10-06  Ian Lance Taylor  <iant@google.com>
12171
12172         * options.h (class General_options): Define
12173         split_stack_adjust_size parameter.
12174         * object.h (class Object): Add uses_split_stack_ and
12175         has_no_split_stack_ fields.  Add uses_split_stack and
12176         has_no_split_stack accessor functions.  Declare
12177         handle_split_stack_section.
12178         (class Reloc_symbol_changes): Define.
12179         (class Sized_relobj): Define Function_offsets.  Declare
12180         split_stack_adjust, split_stack_adjust_reltype, and
12181         find_functions.
12182         * object.cc (Object::handle_split_stack_section): New function.
12183         (Sized_relobj::do_layout): Call handle_split_stack_section.
12184         * dynobj.cc (Sized_dynobj::do_layout): Call
12185         handle_split_stack_section.
12186         * reloc.cc (Sized_relobj::relocate_sections): Call
12187         split_stack_adjust for executable sections in split_stack
12188         objects.  Pass reloc_map to relocate_section.
12189         (Sized_relobj::split_stack_adjust): New function.
12190         (Sized_relobj::split_stack_adjust_reltype): New function.
12191         (Sized_relobj::find_functions): New function.
12192         * target-reloc.h: Include "object.h".
12193         (relocate_section): Add reloc_symbol_changes parameter.  Change
12194         all callers.
12195         * target.h (class Target): Add calls_non_split method.  Declare
12196         do_calls_non_split virtual method.  Declare match_view and
12197         set_view_to_nop.
12198         * target.cc: Include "elfcpp.h".
12199         (Target::do_calls_non_split): New function.
12200         (Target::match_view): New function.
12201         (Target::set_view_to_nop): New function.
12202         * gold.cc (queue_middle_tasks): Give an error if mixing
12203         split-stack and non-split-stack objects with -r.
12204         * i386.cc (Target_i386::relocate_section): Add
12205         reloc_symbol_changes parameter.
12206         (Target_i386::do_calls_non_split): New function.
12207         * x86_64.cc (Target_x86_64::relocate_section): Add
12208         reloc_symbol_changes parameter.
12209         (Target_x86_64::do_calls_non_split): New function.
12210         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12211         parameter.
12212         * powerpc.cc (Target_powerpc::relocate_section): Add
12213         reloc_symbol_changes parameter.
12214         * sparc.cc (Target_sparc::relocate_section): Add
12215         reloc_symbol_changes parameter.
12216         * configure.ac: Call AM_CONDITIONAL for the default target.
12217         * configure: Rebuild.
12218         * testsuite/Makefile.am (TEST_AS): New variable.
12219         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12220         (check_DATA): Add split_i386 and split_x86_64 files.
12221         (SPLIT_DEFSYMS): Define.
12222         (split_i386_[1234n].o): New targets.
12223         (split_i386_[124]): New targets.
12224         (split_i386_[1234r].stdout): New targets.
12225         (split_x86_64_[1234n].o): New targets.
12226         (split_x86_64_[124]): New targets.
12227         (split_x86_64_[1234r].stdout): New targets.
12228         (MOSTLYCLEANFILES): Add new executables.
12229         * testsuite/split_i386.sh: New file.
12230         * testsuite/split_x86_64.sh: New file.
12231         * testsuite/split_i386_1.s: New file.
12232         * testsuite/split_i386_2.s: New file.
12233         * testsuite/split_i386_3.s: New file.
12234         * testsuite/split_i386_4.s: New file.
12235         * testsuite/split_i386_n.s: New file.
12236         * testsuite/split_x86_64_1.s: New file.
12237         * testsuite/split_x86_64_2.s: New file.
12238         * testsuite/split_x86_64_3.s: New file.
12239         * testsuite/split_x86_64_4.s: New file.
12240         * testsuite/split_x86_64_n.s: New file.
12241         * testsuite/testfile.cc (Target_test): Update relocation_section
12242         function.
12243         * testsuite/Makefile.in: Rebuild.
12244
12245 2009-10-06  Ian Lance Taylor  <iant@google.com>
12246
12247         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12248         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12249         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12250         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12251         the address on ldo_addrs_.
12252         (Target_i386::Relocate::fix_up_ldo): New function.
12253
12254 2009-10-06   Rafael Espindola  <espindola@google.com>
12255
12256         * plugin.cc (add_input_library): New.
12257         (Plugin::load): Add add_input_library to tv.
12258         (Plugin_manager::add_input_file): Add the is_lib argument.
12259         (add_input_file): Update call to Plugin_manager::add_input_file.
12260         (add_input_library): New.
12261         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12262
12263 2009-09-30  Doug Kwan  <dougkwan@google.com>
12264
12265         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12266         symbol and call Symbol::may_need_copy_reloc to determine if
12267         a copy reloc is needed.
12268         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12269         nocopyreloc is given in command line.
12270         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12271         given in command line.
12272         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12273         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12274         of the removed Target_i386::may_need_copy_reloc.
12275         * options.h (copyreloc): New option with default value false.
12276         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12277         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12278         instead of the removed Target_powerpc::may_need_copy_reloc.
12279         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12280         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12281         instead of the removed Target_sparc::may_need_copy_reloc.
12282         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12283         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12284         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12285         instead of the removed Target_x86_64::may_need_copy_reloc.
12286
12287 2009-09-30  Ian Lance Taylor  <iant@google.com>
12288
12289         * object.h (class Object): Remove target_ field, and target,
12290         sized_target, and set_target methods.
12291         (Object::sized_target): Remove.
12292         (class Sized_relobj): Update declarations.  Remove sized_target.
12293         * object.cc (Sized_relobj::setup): Remove target parameter.
12294         Change all callers.
12295         (Input_objects::add_object): Don't do anything with the target.
12296         (make_elf_sized_object): Add punconfigured parameter.  Change all
12297         callers.  Set or test parameter target.
12298         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12299         Change all callers.
12300         * parameters.cc (Parameters::set_target): Change parameter type to
12301         be non-const.
12302         (Parameters::default_target): Remove.
12303         (set_parameters_target): Change parameter type to be non-const.
12304         (parameters_force_valid_target): New function.
12305         (parameters_clear_target): New function.
12306         * parameters.h (class Parameters): Update declarations.  Remove
12307         default_target method.  Add sized_target and clear_target
12308         methods.  Change target_ to be non-const.
12309         (set_parameters_target): Update declaration.
12310         (parameters_force_valid_target): Declare.
12311         (parameters_clear_target): Declare.
12312         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12313         as NULL if we aren't searching.
12314         (Add_symbols::run): Don't check for compatible target.
12315         * fileread.cc (Input_file::open_binary): Call
12316         parameters_force_valid_target.
12317         * gold.cc (queue_middle_tasks): Likewise.
12318         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12319         set_target on object.
12320         * dynobj.h (class Sized_dynobj): Update declarations.
12321         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12322         make_elf_object returns NULL.
12323         (Archive::include_member): Don't check whether object target is
12324         compatible.
12325         * output.cc (Output_section::add_input_section): Get target from
12326         parameters.
12327         (Output_section::relax_input_section): Likewise.
12328         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12329         parameters.
12330         (Sized_relobj::do_scan_relocs): Likewise.
12331         (Sized_relobj::relocate_sections): Likewise.
12332         * resolve.cc (Symbol_table::resolve): Likewise.
12333         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12334         parameter.  Change all callers.
12335         (Symbol_table::add_from_object): Get target from parameters.
12336         (Symbol_table::add_from_relobj): Don't check object target.
12337         (Symbol_table::add_from_dynobj): Likewise.
12338         (Symbol_table::define_special_symbol): Get target from
12339         parameters.
12340         * symtab.h (class Symbol_table): Update declaration.
12341         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12342         parameter.  Change all callers.  Clear parameter target.
12343         (Binary_test): Test target here.
12344         * testsuite/object_unittest.cc (gold_testsuite): Remove
12345         target_test_pointer parameter.  Change all callers.
12346         (Object_test): Test target here.
12347
12348 2009-09-26  Ian Lance Taylor  <iant@google.com>
12349
12350         * testsuite/initpri1.c: Don't try to use constructor priorities if
12351         compiling with gcc before 4.3.
12352
12353 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12354
12355         * testsuite/retain_symbols_file_test.sh (check_present): Change
12356         output file name to retain_symbols_file_test.stdout.
12357         (check_absent): Likewise.
12358
12359 2009-09-18  Craig Silverstein  <csilvers@google.com>
12360
12361         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12362         * options.cc: Include <cerrno> and <fstream>.
12363         (General_options::finalize): Parse -retain-symbols-file tag.
12364         * options.h: New flag.
12365         (General_options): New method should_retain_symbol, new
12366         variable symbols_to_retain.
12367         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12368         should_retain_symbol map.
12369         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12370         * testsuite/Makefile.in: Regenerate.
12371         * testsuite/retain_symbols_file_test.sh: New file.
12372
12373 2009-09-18  Nick Clifton  <nickc@redhat.com>
12374
12375         * po/es.po: Updated Spanish translation.
12376
12377 2009-09-17  Doug Kwan  <dougkwan@google.com>
12378
12379         * debug.h (DEBUG_RELAXATION): New constant.
12380         (DEBUG_ALL): Add DEBUG_RELAXATION.
12381         (debug_string_to_enum): Add relaxation debug option.
12382         * layout.cc
12383         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12384         Layout::Relaxation_debug_check::read_sections,
12385         Layout::Relaxation_debug_check::read_sections): New method definitions.
12386         (Layout::Layout): Initialize data members
12387         record_output_section_data_from_scrips_,
12388         script_output_section_data_list_ and relaxation_debug_check_.
12389         (Layout::save_segments, Layout::restore_segments,
12390         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12391         Layout::relaxation_loop_body): New method definitions.
12392         (Layout::finalize): Support relaxation.  Move section layout code to
12393         Layout::relaxation_loop_body.
12394         (Layout::set_asection_address_from_script): Move code for orphan
12395         section placement out.
12396         (Layout::place_orphan_sections_in_script): New method definition.
12397         * layout.h (Output_segment_headers, Output_file_header):
12398         New forward class declarations.
12399         (Layout::~Layout): Define.
12400         (Layout::new_output_section_data_from_script): New method definition.
12401         (Layout::place_orphan_sections_in_script): New method declaration.
12402         (Layout::Segment_states): New type declaration.
12403         (Layout::save_segments, Layout::restore_segments,
12404         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12405         Layout::relaxation_loop_body): New method declarations.
12406         (Layout::Output_section_data_list): New type declaration.
12407         (Layout::Relaxation_debug_check): New class definition.
12408         (Layout::record_output_section_data_from_script_,
12409         Layout::script_output_section_data_list_, Layout::segment_states_,
12410         Layout::relaxation_debug_check_): New data members.
12411         * output.cc: (Output_section_headers::do_size): New method definition.
12412         (Output_section_headers::Output_section_headers): Move size
12413         computation to Output_section_headers::do_size.
12414         (Output_segment_headers::do_size): New method definition.
12415         (Output_file_header::Output_file_header): Move size computation to
12416         Output_file_header::do_size and call it.
12417         (Output_file_header::do_size): New method definition.
12418         (Output_data_group::Output_data_group): Adjust call to
12419         Output_section_data.
12420         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12421         (Output_symtab_xindex::do_write): Add array bound check.
12422         (Output_section::Input_section::print_to_mapfile): Handle
12423         RELAXED_INPUT_SECTION_CODE.
12424         (Output_section::Output_section): Initialize data member checkpoint_.
12425         (Output_section::~Output_section): Delete checkpoint object pointed
12426         by checkpoint_.
12427         (Output_section::add_input_section): Always add an Input_section if
12428         relaxing.
12429         (Output_section::add_merge_input_section): Add assert.
12430         (Output_section::relax_input_section): New method definition.
12431         (Output_section::set_final_data_size): Set load address to zero for
12432         an unallocated section.
12433         (Output_section::do_address_and_file_offset_have_reset_values):
12434         New method definition.
12435         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12436         Handle relaxed input section.
12437         (Output_section::sort_attached_input_sections): Checkpoint input
12438         section list lazily.
12439         (Output_section::get_input_sections): Change type of input_sections to
12440         list of Simple_input_section pointers.  Checkpoint input section list
12441         lazily.  Also handle relaxed input sections.
12442         (Output_section::add_input_section_for_script): Take a reference to
12443         a Simple_input_section object instead of Relobj pointer and section
12444         index as parameter.  Handle relaxed input sections.
12445         (Output_section::save_states, Output_section::restore_states): New
12446         method definitions.
12447         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12448         (Output_data::is_data_size_fixed): New method definition.
12449         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12450         if it is fixed.
12451         (Output_data::address_and_file_offset_have_reset_values): New method
12452         definition.
12453         (Output_data::do_address_and_file_offset_have_reset_values): New method
12454         definition.
12455         (Output_data::set_data_size): Check that data size is not fixed.
12456         (Output_data::fix_data_size): New method definition.
12457         (Output_data::is_data_size_fixed_): New data member.
12458         (Output_section_headers::set_final_data_size): New method definition.
12459         (Output_section_headers::do_size): New method declaration.
12460         (Output_segment_headers::set_final_data_size): New method definition.
12461         (Output_segment_headers::do_size): New method declaration.
12462         (Output_file_header::set_final_data_size)::New method definition.
12463         (Output_file_header::do_size)::New method declaration.
12464         (Output_section_data::Output_section_data): Add new parameter
12465         is_data_size_fixed and use it to fix data size.
12466         (Output_data_const::Output_data_const): Adjust call to base class
12467         constructor and fix data size.
12468         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12469         base class constructor and fix data size.
12470         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12471         base class constructor and fix data size.
12472         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12473         class constructor and fix data size.
12474         (Output_data_group::set_final_data_size): New method definition.
12475         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12476         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12477         class constructor and fix data size.
12478         (Output_relaxed_input_section): New class definition.
12479         (Output_section::Simple_input_section): New class definition.
12480         (Output_section::get_input_sections): Adjust parameter list.
12481         (Output_section::add_input_section_for_script): Same.
12482         (Output_section::save_states, Output_section::restore_states,
12483         Output_section::do_address_and_file_offset_have_reset_values,
12484         (Output_section::Input_section::Input_section): Handle
12485         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12486         Output_relaxed_input_section.
12487         (Output_section::Input_section::is_input_section,
12488         Output_section::Input_section::set_output_section): Handle relaxed
12489         input section.
12490         (Output_section::Input_section::is_relaxed_input_section,
12491         Output_section::Input_section::output_section_data,
12492         Output_section::Input_section::relaxed_input_section): New method
12493         definitions.
12494         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12495         value.
12496         (Output_section::Input_section::u1_): Update comments.
12497         (Output_section::Input_section::u2_): Add new union member poris.
12498         (Output_section::Checkpoint_output_section): New classs definition.
12499         (Output_section::relax_input_section): New method declaration.
12500         (Output_section::checkpoint_): New data member.
12501         (Output_segment): Update comments.
12502         (Output_segment::Output_segment): Un-privatize copy constructor.
12503         (Output_segment::operator=): Un-privatize.
12504         * script-sections.cc (Output_section_element::Input_section_list):
12505         Change element type to Output_section::Simple_input_section.
12506         (Output_section_element_dot_assignment::set_section_addresses):
12507         Register output section data for relaxation clean up.
12508         (Output_data_exression::Output_data_expression): Adjust call to base
12509         constructor to fix data size.
12510         (Output_section_element_data::set_section_addresses): Register
12511         Output_data_expression object for relaxation clean up.
12512         (struct Input_section_info): Replace Relobj pointer and section index
12513         pair with Output_section::Simple_input_section and Convert struct to a
12514         class.
12515         (Input_section_sorter::operator()): Adjust access to
12516         Input_section_info data member to use accessors.
12517         (Output_section_element_input::set_section_addresses): Use layout
12518         parameter.  Adjust code to use Output_section::Simple_input_section
12519         and Input_secction_info classes.  Register filler for relaxation
12520         clean up.
12521         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12522         and section index pair with Output_section::Simple_input_section
12523         class.  Adjust code accordingly.
12524         (Phdrs_element::release_segment): New method definition.
12525         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12526         segment list.
12527         (Script_sections::release_segments): New method definition.
12528         * gold/script-sections.h (Script_sections::release_segments): New
12529         method declaration.
12530         * gold/target.h (Target::may_relax, Target::relax,
12531         Target::do_may_relax, Target::do_relax): New method definitions.
12532
12533 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12534
12535         * arm.cc (has_signed_unsigned_overflow): New function.
12536         (Arm_relocate_functions::abs8): New function.
12537         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12538         (Target_arm::Scan::global): Likewise.
12539         (Target_arm::relocate::relocate): Likewise.
12540         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12541         Likewise.
12542
12543 2009-09-16  Cary Coutant  <ccoutant@google.com>
12544
12545         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12546         * testsuite/Makefile.in: Regenerate.
12547
12548 2009-09-11  Nick Clifton  <nickc@redhat.com>
12549
12550         * po/gold.pot: Updated by the Translation project.
12551
12552 2009-09-08  Cary Coutant  <ccoutant@google.com>
12553
12554         * output.cc (Output_file::open): Add execute permission to empty file.
12555         * testsuite/Makefile.am (permission_test): New test.
12556         * testsuite/Makefile.in: Regenerate.
12557
12558 2009-09-02  Ian Lance Taylor  <iant@google.com>
12559
12560         * output.cc (Output_file::resize): Call map_no_anonymous rather
12561         than map.
12562
12563 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12564
12565         * gold.cc: Include "incremental.h".
12566         (queue_initial_tasks): Call Incremental_checker methods.
12567         * incremental.cc: Include "output.h".
12568         (Incremental_checker::can_incrementally_link_output_file): New
12569         method.
12570         * incremental.h (Incremental_checker): New class.
12571
12572         * output.cc (Output_file::open_for_modification): New method.
12573         (Output_file::map_anonymous): Changed return type to bool.  Record
12574         map in base_ field.
12575         (Output_file::map_no_anonymous): New method, broken out of map.
12576         (Output_file::map): Use map_no_anonymous and map_anonymous.
12577         * output.h (class Output_file): Update declarations.
12578
12579 2009-08-24  Cary Coutant  <ccoutant@google.com>
12580
12581         * options.h (Command_line::Pre_options): New class.
12582         (Command_line::pre_options): New member.
12583         * options.cc (gold::options::ready_to_register): New variable.
12584         (One_option::register_option): Do nothing if not registering options.
12585         Assert if same short option registered twice.
12586         (General_options::General_options): Turn off option registration when
12587         done constructing.
12588         (Command_line::Pre_options::Pre_options): New constructor.
12589
12590 2009-08-24  Cary Coutant  <ccoutant@google.com>
12591
12592         * options.h (General_options::no_keep_memory): Remove incorrect
12593         short option.
12594
12595 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12596
12597         * Makefile.am (am__skiplex, am__skipyacc): New.
12598         * Makefile.in: Regenerate.
12599
12600 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12601
12602         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12603         (INCLUDES): ... this.
12604         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12605         (AM_CPPFLAGS): Renamed from ...
12606         (INCLUDE): ... this.
12607         * Makefile.in, testsuite/Makefile.in: Regenerate.
12608
12609         * Makefile.in: Regenerate.
12610         * aclocal.m4: Likewise.
12611         * config.in: Likewise.
12612         * configure: Likewise.
12613         * testsuite/Makefile.in: Likewise.
12614
12615         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12616         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12617         * Makefile.in: Regenerate.
12618         * testsuite/Makefile.in: Regenerate.
12619
12620 2009-08-19  Cary Coutant  <ccoutant@google.com>
12621
12622         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12623         symbols in shared libraries overridden by hidden or internal symbols
12624         in the main program.
12625
12626 2009-08-19  Chris Demetriou  <cgd@google.com>
12627
12628         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12629         checking source file names in error messages.
12630
12631 2009-08-18  Doug Kwan  <dougkwan@google.com>
12632
12633         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12634         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12635         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12636         an elfcpp::Ehdr as parameter.
12637         * object.cc (Object::set_target): Remove the version that looks up
12638         a target and sets it.
12639         (Sized_relobj::setup): Take a Target object instead of
12640         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12641         (make_elf_sized_object): Find target and ask target to
12642         make an ELF object.
12643         * object.h: (Object::set_target): Remove the version that looks up
12644         a target and sets it.
12645         (Sized_relobj::setup): Take a Target object instead of
12646         an elfcpp:Ehdr as parameter.
12647         * target.cc: Include dynobj.h.
12648         (Target::do_make_elf_object_implementation): New.
12649         (Target::do_make_elf_object): New.
12650         * target.h (Target::make_elf_object): New template declaration.
12651         (Target::do_make_elf_object): New method declarations.
12652         (Target::do_make_elf_object_implementation): New template declaration.
12653
12654 2009-08-14  Ian Lance Taylor  <iant@google.com>
12655
12656         * gold.h (FUNCTION_NAME): Define.
12657         (gold_unreachable): Use FUNCTION_NAME.
12658
12659 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12660
12661         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12662         symbol in the --keep-unique list is not found.
12663
12664 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12665
12666         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12667         been maked as --keep-unique.
12668         (Icf::unfold_section): New function.
12669         * icf.h (Icf::unfold_section): New function.
12670         * options.h (General_options::keep_unique): New option.
12671         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12672         * testsuite/Makefile.in: Regenerate.
12673         * testsuite/icf_keep_unique_test.sh: New file.
12674         * testsuite/icf_keep_unique_test.cc: New file.
12675
12676 2009-08-12  Cary Coutant  <ccoutant@google.com>
12677
12678         PR 10471
12679         * resolve.cc (Symbol_table::resolve): Check for references from
12680         dynamic objects to hidden and internal symbols.
12681         * testsuite/Makefile.am (hidden_test.sh): New test.
12682         * testsuite/Makefile.in: Regenerate.
12683         * testsuite/hidden_test.sh: New script.
12684         * testsuite/hidden_test_1.c: New test source.
12685         * testsuite/hidden_test_main.c: New test source.
12686
12687 2009-08-11  Doug Kwan  <dougkwan@google.com>
12688
12689         * arm.cc: Update comments.
12690         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12691         segment to locate the .ARM.exidx section if present.
12692
12693 2009-08-09  Doug Kwan  <dougkwan@google.com>
12694
12695         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12696         patch.
12697
12698 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12699         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12700         compiler warnings.
12701
12702 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12703
12704         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12705         valid tls_segment only for non-debug-section relocations.
12706         * testsuite/Makefile.am: Add gc_tls_test.
12707         * testsuite/Makefile.in: Regenerate.
12708         * testsuite/gc_tls_test.cc: New file.
12709         * testsuite/gc_tls_test.sh: New file.
12710
12711 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12712
12713         * icf.cc: New file.
12714         * icf.h: New file.
12715         * Makefile.am (CCFILES): Add icf.cc.
12716         (HFILES): Add icf.h
12717         * Makefile.in: Regenerate.
12718         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12719         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12720         section, symbol and addend information for the relocs.
12721         * gold.cc (queue_middle_tasks): Call identical code folding.
12722         * gold.h: Add defines for multimap.
12723         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12724         to the call of finalize_local_symbols.
12725         * main.cc (main): Create object of class Icf.
12726         * object.cc (Sized_relobj::do_layout): Allow this function to be
12727         called twice during icf.
12728         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12729         to sections marked as identical by icf.
12730         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12731         when available.
12732         (Sized_relobj::do_section_entsize): New function.
12733         * object.h (Object::section_entsize): New function.
12734         (Object::do_section_entsize): New pure virtual function.
12735         (Relobj::finalize_local_symbols): Add new parameter.
12736         (Relobj::do_section_entsize): New function.
12737         * options.h (General_options::icf): New option.
12738         (General_options::icf_iterations): New option.
12739         (General_options::print_icf_sections): New option.
12740         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12741         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12742         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12743         icf.
12744         * symtab.cc (Symbol_table::is_section_folded): New function.
12745         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12746         to sections marked as identical by icf.
12747         * symtab.h (Symbol_table::set_icf): New function.
12748         (Symbol_table::icf): New function.
12749         (Symbol_table::is_section_folded): New function.
12750         (Symbol_table::icf_): New data member.
12751         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12752         * testsuite/Makefile.am: Add commands to build icf_test.
12753         * testsuite/Makefile.in: Regenerate.
12754         * testsuite/icf_test.sh: New file.
12755         * testsuite/icf_test.cc: New file.
12756
12757 2009-07-24  Chris Demetriou  <cgd@google.com>
12758
12759         * layout.cc (is_compressible_debug_section): Fix incorrect
12760         comment about compressed section names.
12761
12762 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12763
12764         PR 10419
12765         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12766
12767 2009-07-16  Ian Lance Taylor  <iant@google.com>
12768
12769         PR 10400
12770         * layout.h: #include <map>.
12771         (class Kept_section): Change from struct to class.  Add accessors
12772         and setters.  Add section size to Comdat_group mapping.  Change
12773         Comdat_group to std::map.  Add is_comdat_ field.  Add
12774         linkonce_size field in union.
12775         (class Layout): Update declaration of find_or_add_kept_section.
12776         Don't declare find_kept_object.
12777         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12778         parameter.  Add object, shndx, is_comdat, and is_group_name
12779         parameters.  Change all callers.  Adjust for new Kept_section.
12780         (Layout::find_kept_object): Remove.
12781         * object.cc (Sized_relobj::include_section_group): Update use of
12782         Kept_section.  Rename secnum to shndx.  Only record
12783         Kept_comdat_section if sections are the same size.
12784         (Sized_relobj::include_linkonce_section): Update use of
12785         Kept_section.  Only record Kept_comdat_section if sections are the
12786         same size.  Set size of linkonce section.
12787         (Sized_relobj::map_to_kept_section): Update call to
12788         get_kept_comdat_section.
12789         * object.h (class Sized_relobj): Rename fields in
12790         Kept_comdat_section to drop trailing underscores; change object
12791         field to Relobj*.  Change Kept_comdat_section_table to store
12792         struct rather than pointer.
12793         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12794         Add kept_object and kept_shndx parameters.  Change all callers.
12795         (Sized_relobj::get_kept_comdat_section): Change return type to
12796         bool.  Add kept_object and kept_shndx parameters.  Change all
12797         callers.
12798         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12799         Layout::find_or_add_kept_section.
12800
12801 2009-07-09  Ian Lance Taylor  <iant@google.com>
12802
12803         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12804         Reserve space in the hash table.
12805
12806 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12807
12808         * fileread.cc (File_read::get_mtime): New method.
12809         * fileread.h (Timespec): New structure.
12810         (File_read::get_mtime): New method.
12811         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12812         Renamed from timestamp_nsec.
12813         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12814         Elf_Xword.
12815         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12816         timestamp_nsec.
12817         (Incremental_inputs::report_archive): Save mtime; style fix.
12818         (Incremental_inputs::report_obejct): Save mtime; style fix.
12819         (Incremental_inputs::report_script): Save mtime; style fix.
12820         (Incremental_inputs::finalize_inputs): Style fix.
12821         (Incremental_inputs::finalize): Style fix.
12822         (Incremental_inputs::create_input_section_data): Store inputs
12823         mtime.
12824         * incremental.h (Incremental_inputs::report_script): Add mtime
12825         argument.
12826         (Incremental_inputs::Input_info::Input_info): Intialize only one
12827         union member.
12828         (Incremental_inputs::Input_info::archive): Move to nameless
12829         union.
12830         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12831         (Incremental_inputs::Input_info::script): Move to nameless union.
12832         (Incremental_inputs::mtime): New field.
12833         * script.cc (read_input_script): Pass file mtime to
12834         Incremental_input.
12835         * script.h (Script_info::inputs): Style fix.
12836
12837 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12838
12839         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12840         instead of 32.
12841
12842 2009-06-24  Ian Lance Taylor  <iant@google.com>
12843
12844         PR 10156
12845         * layout.cc (Layout::choose_output_section): If we find an
12846         existing section, update the flags.
12847         (Layout::create_notes): New function, broken out of
12848         Layout::finalize.
12849         (Layout::finalize): Don't create note sections.
12850         (Layout::create_note): Don't crash if linker script discards
12851         section.
12852         (Layout::create_gold_note): Likewise.
12853         (Layout::create_build_id): Likewise.  Don't set
12854         after_input_sections on the section.
12855         (Layout::create_executable_stack_info): Remove target parameter.
12856         Change caller.
12857         * layout.h (class Layout): Declare create_notes.  Update
12858         declaration of create_executable_stack_info.
12859         * gold.cc (queue_middle_tasks): Call create_notes.
12860         * output.cc (Output_section::update_flags_for_input_section): Move
12861         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12862         invalid.
12863         * output.h (Output_data::mark_address_invalid): New function.
12864         (class Output_section): Only declare, not define,
12865         update_flags_for_input_section.  Remove set_flags.
12866
12867 2009-06-24  Ian Lance Taylor  <iant@google.com>
12868
12869         * script-sections.cc (Output_section_definition::
12870         set_section_addresses): Rename shadowing local load_address to
12871         laddr.
12872
12873 2009-06-24  Ian Lance Taylor  <iant@google.com>
12874
12875         PR 10244
12876         * reloc.cc (relocate_sections): Skip empty relocation sections.
12877
12878 2009-06-23  Ian Lance Taylor  <iant@google.com>
12879
12880         PR 10156
12881         * layout.cc (Layout::create_note): Use choose_output_section
12882         rather than make_output_section.
12883
12884 2009-06-23  Ian Lance Taylor  <iant@google.com>
12885
12886         PR 10237
12887         * options.cc (General_options::parse_V): Set printed_version_.
12888         (General_options::General_options): Initialize printed_version_.
12889         * options.h (class General_options): Add printed_version_ field.
12890         * gold.cc (queue_initial_tasks): If there are no input files,
12891         don't give a fatal error if we printed the version information.
12892         (queue_middle_tasks): If using -r with a shared object, give a
12893         fatal error rather than an ordinary error.
12894
12895 2009-06-23  Ian Lance Taylor  <iant@google.com>
12896
12897         PR 10219
12898         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12899         (Layout::make_output_section): Set have_stabstr_section_ if we see
12900         a .stab*str section.
12901         (Layout::finalize): Call link_stabs_sections.
12902         (Layout::link_stabs_sections): New file.
12903         * layout.h (class Layout): Add have_stabstr_section_ field.
12904         Declare link_stabs_sections.
12905
12906 2009-06-23  Doug Kwan  <dougkwan@google.com>
12907
12908         * Makefile.am (libgold_a_LIBADD): New.
12909         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12910         * Makefile.in: Regenerate.
12911         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12912         * configure: Regenerate.
12913         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12914         * fileread.cc: Include sys/state.h
12915         * gold.h: Declare memmem and strndup if found missing.
12916         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12917
12918 2009-06-23  Ian Lance Taylor  <iant@google.com>
12919
12920         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12921         * configure: Rebuild.
12922
12923 2009-06-23  Ian Lance Taylor  <iant@google.com>
12924
12925         PR 10147
12926         * object.cc (Object::section_contents): Don't try to get a view if
12927         the section has length zero.
12928         (Object::handle_gnu_warning_section): If the section is empty, use
12929         the name of the section as the warning.
12930
12931 2009-06-23  Ian Lance Taylor  <iant@google.com>
12932
12933         PR 10133
12934         * stringpool.h (class Stringpool_template): Add optimize_ field.
12935         (Stringpool_template::set_optimize): New function.
12936         * stringpool.cc (Stringpool_template::Stringpool_template):
12937         Initialize optimize_ field.
12938         (Stringpool_template::set_string_offsets): Test local optimize
12939         fild rather than parameter.
12940         * layout.cc (Layout::Layout): Call set_optimize on the section
12941         name stringpool.
12942
12943 2009-06-22  Ian Lance Taylor  <iant@google.com>
12944
12945         PR 10030
12946         * yyscript.y: Parse TARGET.
12947         * script.cc (script_set_target): New function.
12948         * script-c.h (script_set_target): Declare.
12949         * options.cc (General_options::string_to_object_format): Rename
12950         from string_to_object_format in anonymous namespace.  Change
12951         callers.
12952         * options.h (class General_options): Declare
12953         string_to_object_format.
12954
12955 2009-06-22  Ian Lance Taylor  <iant@google.com>
12956
12957         * script-sections.cc (Script_sections::create_segments): Don't put
12958         program headers in a PT_LOAD segment if -n or -N.
12959
12960 2009-06-22  Ian Lance Taylor  <iant@google.com>
12961
12962         PR 10141
12963         * options.h (class General_options): Add -z lazy and -z now.  Sort
12964         -z options into alphabetical order.
12965         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12966
12967 2009-06-21  Ian Lance Taylor  <iant@google.com>
12968
12969         * layout.cc (Layout::make_output_section): Call
12970         Target::new_output_section.
12971         (Layout::attach_allocated_section_to_segment): Put large section
12972         sections in a separate load segment with the large segment flag
12973         set.
12974         (Layout::segment_precedes): Sort large data segments after other
12975         load segments.
12976         (align_file_offset): New static function.
12977         (Layout::set_segment_offsets): Use align_file_offset.
12978         * output.h (class Output_section): Add is_small_section_ and
12979         is_large_section_ fields.
12980         (Output_section::is_small_section): New function.
12981         (Output_section::set_is_small_section):  New function.
12982         (Output_section::is_large_section): New function.
12983         (Output_section::set_is_large_section): New function.
12984         (Output_section::is_large_data_section): New function.
12985         (class Output_segment): Add is_large_data_segment_ field.
12986         (Output_segment::is_large_data_segment): New function.
12987         (Output_segment::set_is_large_data_segment): New function.
12988         * output.cc (Output_section::Output_section): Initialize new
12989         fields.
12990         (Output_segment::Output_segment): Likewise.
12991         (Output_segment::add_output_section): Add assertion that large
12992         data sections always go in large data segments.  Force small data
12993         sections to the end of the list of data sections.  Force small BSS
12994         sections to the start of the list of BSS sections.  For large BSS
12995         sections to the end of the list of BSS sections.
12996         * symtab.h (class Symbol): Declare is_common_shndx.
12997         (Symbol::is_defined): Check Symbol::is_common_shndx.
12998         (Symbol::is_common): Likewise.
12999         (class Symbol_table): Define enum Commons_section_type.  Update
13000         declarations.  Add small_commons_ and large_commons_ fields.
13001         * symtab.cc (Symbol::is_common_shndx): New function.
13002         (Symbol_table::Symbol_table): Initialize new fields.
13003         (Symbol_table::add_from_object): Put small and large common
13004         symbols in the right list.
13005         (Symbol_table::sized_finalized_symbol): Check
13006         Symbol::is_common_shndx.
13007         (Symbol_table::sized_write_globals): Likewise.
13008         * common.cc (Symbol_table::do_allocate_commons): Allocate new
13009         common symbol lists.  Don't call do_allocate_commons_list if the
13010         list is empty.
13011         (Symbol_table::do_allocate_commons_list): Remove is_tls
13012         parameter.  Add comons_section_type parameter.  Change all
13013         callers.  Handle small and large common symbols.
13014         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
13015         Symbol::is_common_shndx.
13016         * resolve.cc (symbol_to_bits): Likewise.
13017         * target.h (Target::small_common_shndx): New function.
13018         (Target::small_common_section_flags): New function.
13019         (Target::large_common_shndx): New function.
13020         (Target::large_common_section_flags): New function.
13021         (Target::new_output_section): New function.
13022         (Target::Target_info): Add small_common_shndx, large_common_shndx,
13023         small_common_section_flags, and large_common_section_flags
13024         fields.
13025         (Target::do_new_output_section): New virtual function.
13026         * arm.cc (Target_arm::arm_info): Initialize new fields.
13027         * i386.cc (Target_i386::i386_info): Likewise.
13028         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
13029         Likewise.
13030         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
13031         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
13032         (Target_x86_64::do_new_output_section): New function.
13033         * configure.ac: Define conditional MCMODEL_MEDIUM.
13034         * testsuite/Makefile.am (check_PROGRAMS): Add large.
13035         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
13036         (large_LDFLAGS): Define.
13037         * testsuite/large.c: New file.
13038         * testsuite/testfile.cc (Target_test::test_target_info):
13039         Initialize new fields.
13040         * configure, testsuite/Makefile.in: Rebuild.
13041
13042 2009-06-05  Doug Kwan  <dougkwan@google.com>
13043
13044         * Makefile.am (CCFILES): Add target.cc.
13045         * Makefile.in: Regenerate.
13046         * i386.cc (class Target_i386): Define new virtual method to
13047         override do_is_local_label_name in parent.
13048         * object.cc (Sized_relobj::do_count_local_symbols): Discard
13049         local symbols if --discard-locals or -X is given.
13050         * options.h (class General_options): Declare new options
13051         '--discard-locals' and '-X' for discarding locals.
13052         * target.h (class Target): Define new methods is_local_label_name.
13053         Declare new virtual method do_is_local_label_name.
13054         * target.cc: New file.
13055         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
13056         (check_SCRIPTS): Add discard_locals_test.sh.
13057         (check_DATA): Add discard_local_tests.syms.
13058         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
13059         (discard_local_tests.syms, discard_locals_test.o): New make rules.
13060         * testsuite/Makefile.in: Regenerate.
13061         * testsuite/discard_locals_test.c: New file.
13062         * testsuite/discard_locals_test.sh: Same.
13063
13064 2009-06-05  Doug Kwan  <dougkwan@google.com>
13065
13066         * object.cc (Sized_relobj::Sized_relobj): Initialize
13067         discarded_eh_frame_shndx_ to -1U.
13068         (Sized_relobj::do_layout): Record index of a discard .eh_frame
13069         section.
13070         (Sized_relobj::do_count_local_symbols): Skip local symbols in
13071         a discarded .eh_frame section.
13072         (Sized_relobj::do_finalize_local_symbols): Ditto.
13073         * object.h (class Sized_relobj): Declare new member
13074         discarded_eh_frame_shndx_.
13075         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
13076         (local_labels_test.o, local_labels_test): New rules.
13077         * testsuite/Makefile.in: Regenerate.
13078
13079 2009-06-04  Doug Kwan  <dougkwan@google.com>
13080
13081         * layout.cc (Layout::section_name_mapping): Add mapping for
13082         special ARM sections.
13083
13084 2009-06-03  Doug Kwan  <dougkwan@google.com>
13085
13086         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
13087         (utils::has_overflow): Same.
13088
13089 2009-06-03  Ian Lance Taylor  <iant@google.com>
13090
13091         * layout.cc (Layout::section_name_mapping): New array, replacing
13092         Layout::linkonce_mapping.
13093         (Layout::section_name_mapping_count): New variable, replacing
13094         Layout::linkonce_mapping_count.
13095         (Layout::linkonce_output_name): Remove.
13096         (Layout::output_section_name): Rewrite.
13097         * layout.h (class Layout): Rename Linkonce_mapping to
13098         Section_name_mapping, linkonce_mapping to section_name_mapping,
13099         linkonce_mapping_count to section_name_mapping_count.  Don't
13100         declare linkonce_output_name.
13101
13102 2009-06-03  Doug Kwan  <dougkwan@google.com>
13103
13104         * gold/arm.cc (namespace utils): New.
13105         (Target_arm::reloc_is_non_pic): Define new method.
13106         (class Arm_relocate_functions): New.
13107         (Target_arm::Relocate::relocate): Handle relocation types used by
13108         Android.
13109
13110 2009-06-03  Ian Lance Taylor  <iant@google.com>
13111
13112         * arm.cc (Target_arm::scan::global): Use || instead of |.
13113
13114 2009-06-02  Doug Kwan  <dougkwan@google.com>
13115
13116         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
13117         issued_non_pic_error_.
13118         (class Target_arm::Scan): Declare new method check_non_pic.
13119         Define new method symbol_needs_plt_entry.
13120         Declare new data member issued_non_pic_error_.
13121         (class Target_arm::Relocate): Declare new method
13122         should_apply_static_reloc.
13123         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
13124         (Target_arm::Scan::check_non_pic): Define new method.
13125         (Target_arm::Scan::local): Handle a small subset of reloc types used
13126         by Android.
13127         (Target_arm::Scan::local): Same.
13128         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
13129
13130 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
13131
13132         * incremental.cc (Incremental_inputs::report_command_line): Filter
13133         out --incremental-* options.
13134
13135 2009-05-29  Doug Kwan  <dougkwan@google.com>
13136
13137         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
13138         template class.
13139         (class Target_arm): Update comment.
13140         (Target_arm::Target_arm): Initialize new data members GOT_,
13141         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
13142         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
13143         and Target_arm::rel_dyn_section.
13144         Declare new_enum Target_arm::Got_type.
13145         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
13146         and DYNBSS_.
13147         Update commments for member do_dynsym_value.
13148         (Target_arm::got_size, Target_arm::plt_section,
13149         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
13150         new methods inside class defintion.
13151         (Target_arm::got_section): Define new method.
13152         (Target_arm::rel_dyn_section): Same.
13153         (Output_data_plt_arm): New template class.
13154         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
13155         (Output_data_plt_arm:do_adjust_output_section): Define new method.
13156         (Output_data_plt_arm::add_entry): Same.
13157         (Output_data_plt_arm::first_plt_entry): Define new
13158         static data member for PLT instruction template.
13159         (Output_data_plt_arm::plt_entry): Same.
13160         (Output_data_plt_arm::do_write): Define new method.
13161         (Target_arm::make_plt_entry): Same.
13162         (Target_arm::do_finalize_sections): Same.
13163         (Target_arm::do_dynsym_value): Same.
13164
13165 2009-05-28  Doug Kwan  <dougkwan@google.com>
13166
13167         * Makefile.am (TARGETSOURCES): Add arm.cc.
13168         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13169         * Makefile.in: Regenerate.
13170         * arm.cc: New file.
13171         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13172
13173 2009-05-26  Doug Kwan  <dougkwan@google.com>
13174
13175         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13176         (General_options::check_excluded_libs): Strip off directories in
13177         archive name before matching like GNU ld does.
13178         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13179         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13180         (exclude_libs_test_LDFLAGS): Add linker option
13181         -Wl,--exclude-libs,libexclude_libs_test_3
13182         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13183         an explicit archive without using -l.
13184         (alt/libexclude_libs_test_3.a): New make rule.
13185         * testsuite/Makefile.in: Regenerate.
13186         * testsuite/exclude_libs_test.c : Declare lib3_default().
13187         (main): Call it.
13188         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13189         * exclude_libs_test_3.c: New file.
13190
13191 2009-05-26  Nick Clifton  <nickc@redhat.com>
13192
13193         * po/id.po: New Indonesian translation.
13194         * po/gold.pot: Updated template file.
13195
13196 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13197
13198         * testsuite/Makefile.am: Add -ffunction-sections to compile
13199         gc_comdat_test files.  Add -Wl,--gc-sections to build
13200         gc_comdat_test.
13201         * testsuite/Makefile.in: Regenerate.
13202         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13203
13204 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13205
13206         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13207         kept comdat section was garbage collected.
13208         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13209         * testsuite/Makefile.in: Regenerate.
13210         * testsuite/gc_comdat_test.sh: New file.
13211         * testsuite/gc_comdat_test_1.cc: New file.
13212         * testsuite/gc_comdat_test_2.cc: New file.
13213
13214 2009-05-19  Doug Kwan  <dougkwan@google.com>
13215
13216         * archive.cc (Archive::Archive): Move constructor from archive.h
13217         to here.  Initialize no_export_.
13218         (Archive::get_elf_object_for_member): Set no_export flag of object.
13219         * archive.h (Archive::Archive): Move constructor body to
13220         archive.cc.
13221         (Archive::no_export): New method.
13222         (Archive::no_export_): New field.
13223         * object.h (Object::Object): Initialize no_export_ to false.
13224         (Object::no_export, Object::set_no_export): New methods.
13225         (Object::no_export_): New field.
13226         * options.cc (General_options::parse_exclude_libs): New method.
13227         (General_options::check_excluded_libs) Same.
13228         * options.h (exclude_libs): New option.
13229         (General_options::check_excluded_libs): New method declaration.
13230         (General_options::excluded_libs_): New field.
13231         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13232         default or protected visibility if an object has no-export flag set.
13233         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13234         (check_SCRIPTS): Add exclude_libs_test.sh.
13235         (check_DATA): Add exclude_libs_test.syms.
13236         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13237         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13238         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13239         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13240         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13241         libexclude_libs_test_2.a): New rules.
13242         * testsuite/Makefile.in: Regenerate.
13243         * testsuite/exclude_libs_test.c: New file.
13244         * testsuite/exclude_libs_test.sh: Ditto.
13245         * testsuite/exclude_libs_test_1.c: Ditto.
13246         * testsuite/exclude_libs_test_2.c: Ditto.
13247
13248 2009-05-15  Ian Lance Taylor  <iant@google.com>
13249
13250         * configure.ac: Check for declarations for cases where libiberty.h
13251         checks HAVE_DECL_xxx.
13252         * configure, config.in: Rebuild.
13253
13254 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13255
13256         * gold.h (Incremental_argument_list): Remove (invalid) forward
13257         declaration.
13258         * incremental.cc (Incremental_inputs::report_achive): New method.
13259         (Incremental_inputs::report_object): New method.
13260         (Incremental_inputs::report_script): New method.
13261         (Incremental_inputs::finalize_inputs): New method.
13262         (Incremental_inputs::finalize): Call finalize_inputs().
13263         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13264         Create inputs entries.
13265         * incremental.h (Incremental_input_type): New enum.
13266         (Incremental_inputs::Incremental_input): Initialize new fields.
13267         (Incremental_inputs::report_inputs): New method.
13268         (Incremental_inputs::report_achive): New method.
13269         (Incremental_inputs::report_object): New method.
13270         (Incremental_inputs::report_script): New method.
13271         (Incremental_inputs::finalize_inputs): New method.
13272         (Incremental_inputs::Input_info): New struct.
13273         (Incremental_inputs::Input_info_map): New typedef.
13274         (Incremental_inputs::lock_): New field.
13275         (Incremental_inputs::Inputs_): New field.
13276         (Incremental_inputs::Inputs_map): New field.
13277         * main.cc (main): Call Incremental_input::report_inputs.
13278         * options.h (Input_argument_list): Typedef moved from
13279         Input_arguments.
13280         (Input_file_group::Files): Remove, use ::Input_argument_list.
13281         (Input_file_group::Input_argument_list): Remove, use
13282         ::Input_argument_list.
13283         * plugin.cc (Plugin_manager::add_input_file): Add error in
13284         incremental build.
13285         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13286         functions.
13287         * script.cc (read_input_script): Call
13288         Incremental_input::report_script.
13289         * script.h (Script_info): New class.
13290
13291 2009-04-27  Ian Lance Taylor  <iant@google.com>
13292
13293         * x86_64.cc (do_adjust_output_section): Set entsize to
13294         plt_entry_size.
13295
13296 2009-04-23  Elliott Hughes  <enh@google.com>
13297
13298         * output.cc (Output_file::close): After short writes, continue
13299         writing from the correct offset in the buffer being written.
13300
13301 2009-04-23  Chris Demetriou  <cgd@google.com>
13302
13303         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13304         * configure: Regenerate.
13305         * config.in: Regenerate.
13306         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13307         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13308
13309 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13310
13311         * incremental.cc (Incremental_inputs_header_data): Renamed from
13312         Incremental_input_header_data.
13313         (Incremental_inputs_header_data::data_size): New field.
13314         (Incremental_inputs_header_data::put_input_file_count): Renamed
13315         from input_file_count.
13316         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13317         from command_line_offset.
13318         (Incremental_inputs_header_data::put_reserved): Renamed from
13319         put_reserved.
13320         (Incremental_inputs_entry_data): Renamed from
13321         Incremental_input_entry_data.
13322         (Incremental_inputs_entry_data::data_size): New field.
13323         (Incremental_inputs::report_command_line): New method.
13324         (Incremental_inputs::finalize): New method.
13325         (Incremental_inputs::create_incremental_inputs_data): New method.
13326         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13327         * incremental.h: New file.
13328         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13329         (Layout::finalize): Create incremental inputs section in
13330         incremental builds.
13331         (Layout::create_incremental_info_sections): New method.
13332         * layout.h (Layout::incremental_inputs): New method.
13333         (Layout::create_incremental_info_sections): New method.
13334         (Layout::incremental_inputs_): New field.
13335         * main.cc (main): Notify Incremental_input of the command line.
13336
13337 2009-04-01  Ian Lance Taylor  <iant@google.com>
13338             Mikolaj Zalewski  <mikolajz@google.com>
13339
13340         * gold.h (reserve_unordered_map): Define, three versions, one for
13341         each version of Unordered_map.
13342         * layout.cc (Layout::Layout): Remove options parameter.  Add
13343         number_of_input_files parameter.  Don't initialize options_.
13344         Initialize number_of_input_files_ and resized_signatures_.  Move
13345         sections_are_attached_.
13346         (Layout::layout_group): Reserve space for group_signatures_.
13347         (Layout::find_or_add_kept_section): Change name parameter to be a
13348         reference.  Resize signatures_ map when it gets large enough.
13349         (Layout::layout_eh_frame): Use parameters->options() instead of
13350         this->options_.
13351         (Layout::make_output_section): Likewise.
13352         (Layout::attach_allocated_section_to_segment): Likewise.
13353         (Layout::finalize, Layout::create_executable_stack): Likewise.
13354         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13355         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13356         * layout.h (class Layout): Update declarations.  Remove options_
13357         field.  Add number_of_input_files_ and resized_signatures_
13358         fields.  Move sections_are_attached_ field.
13359         * main.cc (main): Pass number of input files to Layout
13360         constructor.  Don't pass options.
13361
13362 2009-03-30  Ian Lance Taylor  <iant@google.com>
13363
13364         * ffsll.c (ffsll): Correct implementation.
13365
13366 2009-03-27  Ian Lance Taylor  <iant@google.com>
13367
13368         * ffsll.c: New file.
13369         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13370         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13371         * ftruncate.c (ftruncate): Declare before definition.
13372         * mremap.c (mremap): Likewise.
13373         * pread.c (pread): Likewise.
13374         * configure, Makefile.in, config.in: Rebuild.
13375
13376         * mremap.c: New file.
13377         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13378         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13379         (mremap): Declare if HAVE_MREMAP is not defined.
13380         * configure, Makefile.in, config.in: Rebuild.
13381
13382 2009-03-27  Cary Coutant  <ccoutant@google.com>
13383
13384         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13385         position independent.
13386         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13387         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13388
13389 2009-03-24  Cary Coutant  <ccoutant@google.com>
13390
13391         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13392         an executable.
13393         (needs_dynamic_reloc): Likewise.
13394
13395 2009-03-24  Ian Lance Taylor  <iant@google.com>
13396
13397         * yyscript.y (file_cmd): Recognize EXTERN.
13398         (extern_name_list, extern_name_list_body): New nonterminals.
13399         * script.cc (script_add_extern): Define.
13400         * script-c.h (script_add_extern): Declare.
13401
13402 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13403
13404         * object.cc (is_elf_object): Define.
13405         * object.h (is_elf_object): Declare.
13406         * archive.cc (Archive::get_elf_object_for_member): Call
13407         is_elf_object.
13408         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13409
13410 2009-03-24  Elliott Hughes  <enh@google.com>
13411
13412         * output.cc (Output_file::map_anonymous): Define.
13413         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13414         try an anonymous one.  Report the size if the mmap fails.
13415         * output.h (class Output_file): Declare map_anonymous.
13416
13417 2009-03-24  Ian Lance Taylor  <iant@google.com>
13418
13419         * target-select.cc (instantiate_target): Don't acquire the lock if
13420         the instantiated_target_ field has already been set.
13421
13422 2009-03-23  Ian Lance Taylor  <iant@google.com>
13423
13424         * gold-threads.h (class Initialize_lock): Define.
13425         * gold-threads.cc (class Initialize_lock_once): Define.
13426         (initialize_lock_control): New static variable.
13427         (initialize_lock_pointer): New static variable.
13428         (initialize_lock_once): New static function.
13429         (Initialize_lock::Initialize_lock): Define.
13430         (Initialize_lock::initialize): Define.
13431         * target-select.h: Include "gold-threads.h".
13432         (class Target_selector): Add lock_ and initialize_lock_ fields.
13433         Don't define instantiate_target, just declare it.
13434         * target-select.cc (Target_selector::Target_selector): Initialize
13435         new fields.
13436         (Target_selector::instantiate_target): Define.
13437         * descriptors.h: Include "gold-threads.h".
13438         (class Descriptors): Add initialize_lock_ field.
13439         * descriptors.cc (Descriptors::Descriptors): Initialize new
13440         field.
13441         (Descriptors::open): Use initialize_lock_ field
13442         * errors.h (class Errors): Add initialize_lock_ field.
13443         * errors.cc (Errors::Errors): Initialize new field.
13444         (Errors::initialize_lock): Use initialize_lock_ field.
13445         * powerpc.cc (class Target_selector_powerpc): Remove
13446         instantiated_target_ field.  In do_recognize call
13447         instantiate_target rather than do_instantiate_target.  In
13448         do_instantiate_target just allocate a new target.
13449         * sparc.cc (class Target_selector_sparc): Likewise.
13450
13451         * freebsd.h: New file.
13452         * i386.cc: Include "freebsd.h".
13453         (Target_i386): Derive from Target_freebsd rather than
13454         Sized_target.
13455         (Target_selector_i386): Derive from Target_selector_freebsd rather
13456         than Target_selector.
13457         * x86_64.cc: Include "freebsd.h".
13458         (Target_x86_64): Derive from Target_freebsd rather than
13459         Sized_target.
13460         (Target_selector_x86_64): Derive from Target_selector_freebsd
13461         rather than Target_selector.
13462         * target.h (class Target): Add adjust_elf_header and
13463         do_adjust_elf_header.
13464         * output.cc (Output_file_header:: do_sized_write): Call target
13465         adjust_elf_header routine.
13466         * configure.tgt: Set targ_osabi.
13467         * configure.ac: Define GOLD_DEFAULT_OSABI.
13468         * parameters.cc (Parameters::default_target): Pass
13469         GOLD_DEFAULT_OSABI to select_target.
13470         * target-select.h (class Target_selector): Make instantiate_target
13471         protected rather than private.
13472         * Makefile.am (HFILES): Add freebsd.h.
13473         * configure, Makefile.in, config.in: Rebuild.
13474
13475         * merge.cc (do_add_input_section): Correct pend value.  Change
13476         message about last entry not being null terminated from error to
13477         warning.
13478
13479 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13480
13481         * incremental.cc: New file.
13482         * Makefile.am (CCFILES): Add incremental.cc.
13483         * Makefile.in: Rebuild.
13484
13485 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13486
13487         * layout.cc (Layout::output_section_name): Preserve names
13488         of '.note.' sections.
13489
13490 2009-03-19  Ian Lance Taylor  <iant@google.com>
13491
13492         * descriptors.cc (Descriptors::open): Check that the options are
13493         valid before using them.
13494
13495 2009-03-18  Ian Lance Taylor  <iant@google.com>
13496
13497         * script-sections.h: Include <list>.
13498         (class Script_sections): Change Sections_elements from std::vector
13499         to std::list.  Typedef public Elements_iterator.  Add
13500         orphan_section_placement_, data_segment_align_start_, and
13501         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13502         field.
13503         * script-sections.cc (class Orphan_section_placement): New class.
13504         (class Sections_element): Add virtual functions is_relro and
13505         orphan_section_init.  Remove virtual function place_orphan_here.
13506         (class Output_section_definition): Add is_relro and
13507         orphan_section_init.  Remove place_orphan_here.
13508         (class Orphan_output_section): Likewise.
13509         (Script_sections::Script_sections): Update for field changes.
13510         (Script_sections::data_segment_align): Set saw_data_segment_align_
13511         and data_segment_align_start_, not data_segment_align_index.
13512         (Script_sections::data_segment_relro_end): Check
13513         saw_data_segment_align_.  Use data_segment_align_start_ rather
13514         than data_segment_align_index_.
13515         (Script_sections::place_orphan): Rewrite to use
13516         Orphan_section_placement.
13517
13518 2009-03-17  Ian Lance Taylor  <iant@google.com>
13519
13520         * archive.cc (Archive::add_symbols): Check for a version attached
13521         to the symbol name in the archive map.
13522         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13523         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13524         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13525         (ver_test_11.a): New target.
13526         * testsuite/Makefile.in: Rebuild.
13527
13528         * configure.ac: Check for chsize and posix_fallocate.  Replace
13529         ftruncate.
13530         * ftruncate.c: New file, from gnulib.
13531         * output.cc (posix_fallocate): Define dummy version if not
13532         HAVE_POSIX_FALLOCATE.
13533         (Output_file::map): Call posix_fallocate rather than lseek and
13534         write.
13535         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13536         * configure, Makefile.in, config.in: Rebuild.
13537
13538 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13539
13540         * layout.h (Layout::create_note): Add section_name parameter.
13541         * layout.cc (Layout::create_note): Likewise.
13542         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13543
13544 2009-03-17  Ian Lance Taylor  <iant@google.com>
13545
13546         * descriptors.cc: Include "options.h".
13547         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13548         (Descriptors::open): Always use O_CLOEXEC when opening a new
13549         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13550         then set FD_CLOEXEC.
13551
13552         * sparc.cc (class Target_sparc): Add has_got_section.
13553         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13554         make sure we have a GOT section.
13555
13556         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13557         (Target_sparc::Scan::local): Likewise.
13558         (Target_sparc::Scan::global): Likewise.
13559         (Target_sparc::Relocate::relocate): Likewise.
13560         (Target_sparc::Relocate::relocate_tls): Likewise.
13561
13562         * symtab.cc (Symbol_table::define_default_version): New function,
13563         broken out of add_from_object.
13564         (Symbol_table::add_from_object): Call define_default_version.
13565         (Symbol_table::define_special_symbol): Add resolve_oldsym
13566         parameter.  Change all callers.  If the version for a symbol comes
13567         from a version script, resolve it with the symbol with the same
13568         name with no version.  Also add the symbol without a version if
13569         appropriate.
13570         (do_define_in_output_data): If resolving with oldsym, don't delete
13571         sym.
13572         (do_define_in_output_segment): Likewise.
13573         (do_define_as_constant): Likewise.
13574         * symtab.h (class Symbol_table): Update declarations.
13575
13576 2009-03-13  Ian Lance Taylor  <iant@google.com>
13577
13578         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13579         (Read_symbols::requeue): New function.
13580         (Read_symbols::do_read_symbols): If make_elf_object fails because
13581         the target type is not configured, and the file was searched for,
13582         issue a warning and retry with the next directory.
13583         (Add_symbols::run): If the file has an incompatible format, and
13584         it was searched for, requeue the Read_symbols task.  On error,
13585         release the object.
13586         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13587         dirindex parameter to constructor.  Change all callers.  Declare
13588         incompatible_warning and requeue.
13589         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13590         input_argument_ and input_group_ fields.  Add them to
13591         constructor.  Change all callers.
13592         (class Read_script): Add dirindex_ field.  Add it to constructor.
13593         Change all callers.
13594         * archive.cc (Archive::setup): Remove input_objects parameter.
13595         Change all callers.
13596         (Archive::get_file_and_offset): Likewise.
13597         (Archive::read_all_symbols): Likewise.
13598         (Archive::read_symbols): Likewise.
13599         (Archive::get_elf_object_for_member): Remove input_objects
13600         parameter.  Add punconfigured parameter.  Change all callers.
13601         (Archive::add_symbols): Change return type to bool.  Check return
13602         value of include_member.
13603         (Archive::include_all_members): Likewise.
13604         (Archive::include_member): Change return type to bool.  Return
13605         false if first included object has incompatible target.  Set
13606         included_member_ field.
13607         (Add_archive_symbols::run): If add_symbols returns false, requeue
13608         Read_symbols task.
13609         * archive.h (class Archive): Add included_member_ field.
13610         Initialize it in constructor.  Add input_file and searched_for
13611         methods.  Update declarations.
13612         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13613         input_argument_ fields.  Add them to constructor.  Change all
13614         callers.
13615         * script.cc: Include "target-select.h".
13616         (class Parser_closure): Add skip_on_incompatible_target_ and
13617         found_incompatible_target_ fields.  Add
13618         skip_on_incompatible_target parameter to constructor.  Change all
13619         callers.  Add methods skip_on_incompatible_target,
13620         clear_skip_on_incompatible_target, found_incompatible_target, and
13621         set_found_incompatible_target.
13622         (read_input_script): Add dirindex parameter.  Change all callers.
13623         If parser finds an incompatible target, requeue Read_symbols
13624         task.
13625         (script_set_symbol): Clear skip_on_incompatible_target in
13626         closure.
13627         (script_add_assertion, script_parse_option): Likewise.
13628         (script_start_sections, script_add_phdr): Likewise.
13629         (script_check_output_format): New function.
13630         * script.h (read_input_script): Update declaration.
13631         * script-c.h (script_check_output_format): Declare.
13632         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13633         (ignore_cmd): Remove OUTPUT_FORMAT.
13634         * fileread.cc (Input_file::Input_file): Add explicit this.
13635         (Input_file::will_search_for): New function.
13636         (Input_file::open): Add pindex parameter.  Change all callers.
13637         * fileread.h (class Input_file): Add input_file_argument method.
13638         Declare will_search_for.  Update declarations.
13639         * object.cc (make_elf_object): Add punconfigured parameter.
13640         Change all callers.
13641         * object.h (class Object): Make input_file public.  Add
13642         searched_for method.
13643         (make_elf_object): Update declaration.
13644         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13645         restart search.
13646         * dirsearch.h (class Dirsearch): Update declaration.
13647         * options.h (class General_options): Add --warn-search-mismatch.
13648         * parameters.cc (Parameters::is_compatible_target): New function.
13649         * parameters.h (class Parameters): Declare is_compatible_target.
13650         * workqueue.cc (Workqueue::add_blocker): New function.
13651         * workqueue.h (class Workqueue): Declare add_blocker.
13652
13653         * fileread.cc (Input_file::open): Remove options parameter.
13654         Change all callers.
13655         (Input_file::open_binary): Likewise.
13656         * script.cc (read_input_script): Likewise.
13657         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13658         options parameter from constructor.  Change all callers.
13659         (class Read_script): Likewise.
13660         * fileread.h (class Input_file): Update declarations.
13661         * script.h (read_input_script): Update declaration.
13662
13663 2009-03-10  Nick Clifton  <nickc@redhat.com>
13664
13665         * po/es.po: New Spanish translation.
13666
13667 2009-03-06  Cary Coutant  <ccoutant@google.com>
13668
13669         * options.cc (parse_short_option): Keep dash_z from registering itself.
13670
13671 2009-03-03  Ian Lance Taylor  <iant@google.com>
13672
13673         PR 9918
13674         * target-reloc.h (relocate_section): Pass output_section to
13675         relocate.
13676         * i386.cc (Target_i386::should_apply_static_reloc): Add
13677         output_section parameter.  Change all callers.
13678         (Target_i386::Relocate::relocate): Add output_section parameter.
13679         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13680         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13681         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13682         * testsuite/two_file_shared.sh: New script.
13683         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13684         (check_DATA): Add two_file_shared.dbg.
13685         (two_file_shared.dbg): New target.
13686         * testsuite/Makefile.in: Rebuild.
13687
13688 2009-03-01  Ian Lance Taylor  <iant@google.com>
13689
13690         * configure.ac: Check for byteswap.h.
13691         * configure: Rebuild.
13692         * config.in: Rebuild.
13693
13694 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13695
13696         * layout.cc (Layout::find_or_add_kept_section): New function.
13697         (Layout::add_comdat): Removed.
13698         * layout.h (struct Kept_section): Move out of class Layout.
13699         Remove trailing underscores from field names.  Add group_sections
13700         field.  Rename group_ field to is_group.  Change all uses.
13701         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13702         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13703         comdat_groups_ field.
13704         (Sized_relobj::include_section_group): Use
13705         find_or_add_kept_section and Kept_section::group_sections.
13706         (Sized_relobj::include_linkonce_section): Likewise.
13707         * object.cc (class Sized_relobj): Don't define Comdat_group or
13708         Comdat_group_table.  Remove find_comdat_group and
13709         add_comdat_group.  Remove comdat_groups_ field.
13710         * plugin.cc (include_comdat_group): Use
13711         Layout::find_or_add_kept_section.
13712
13713 2009-02-28  Ian Lance Taylor  <iant@google.com>
13714
13715         * README: --gc-sections and map files are now supported.  Document
13716         some build requirements.
13717
13718         PR 6992
13719         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13720         relocatable link set the value of the section symbol to zero.
13721         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13722         relocatable link don't include the section address in the local
13723         symbol value.
13724
13725 2009-02-27  Ian Lance Taylor  <iant@google.com>
13726
13727         PR 6811
13728         * options.h (class Search_directory): Add is_system_directory.
13729         (class General_options): Declare is_in_system_directory.
13730         * options.cc (get_relative_sysroot): Make static.
13731         (get_default_sysroot): Make static.
13732         (General_optoins::is_in_system_directory): New function.
13733         * fileread.cc (Input_file::is_in_system_directory): New function.
13734         * fileread.h (class Input_file): Declare is_in_system_directory.
13735         * object.h (class Object): Add is_in_system_directory.
13736         (class Input_objects): Remove system_library_directory_ field.
13737         * object.cc (Input_objects::add_object): Don't set
13738         system_library_directory_.
13739         (input_objects::found_in_system_library_directory): Remove.
13740         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13741         parameter.  Change all callers.
13742         (Symbol_table::sized_write_globals): Likewise.
13743         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13744         Call Object::is_in_system_directory.
13745         * symtab.h (class Symbol_table): Update declarations.
13746
13747         PR 5990
13748         * descriptors.h (Open_descriptor): Add is_on_stack field.
13749         * descriptors.cc (Descriptors::open): If the descriptor is on the
13750         top of the stack, remove it.  Initialize is_on_stack field.
13751         (Descriptors::release): Only add pod to stack if it is not on the
13752         stack already.
13753         (Descriptors::close_some_descriptor): Clear stack_next and
13754         is_on_stack fields.
13755
13756         PR 7091
13757         * output.cc (Output_section::find_starting_output_address): Rename
13758         from starting_output_address; add PADDR parameter; change return
13759         type.
13760         * output.h (class Output_section): Declare
13761         find_starting_output_address instead of starting_output_address.
13762         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13763         section symbol for which we can't find a merge section.
13764
13765         PR 9836
13766         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13767         hidden or internal, force the symbol to be local.
13768         * resolve.cc (Symbol::override_visibility): Define.
13769         (Symbol::override_base): Use override_visibility.
13770         (Symbol_table::resolve): Likewise.
13771         (Symbol::override_base_with_special): Likewise.
13772         (Symbol_table::override_with_special): If the visibility is hidden
13773         or internal, force the symbol to be local.
13774         * symtab.h (class Symbol): Add set_visibility and
13775         override_visibility.
13776         * testsuite/ver_test_1.sh: New file.
13777         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13778         (check_DATA): Add ver_test_1.syms.
13779         (ver_test_1.syms): New target.
13780         * testsuite/Makefile.in: Rebuild.
13781
13782 2009-02-25  Cary Coutant  <ccoutant@google.com>
13783
13784         * layout.cc (Layout::choose_output_section): Don't rename sections
13785         when using a linker script that has a SECTIONS clause.
13786         * Makefile.in: Regenerate.
13787
13788         * testsuite/Makefile.am (script_test_5.sh): New test case.
13789         * testsuite/Makefile.in: Regenerate.
13790         * testsuite/script_test_5.cc: New file.
13791         * testsuite/script_test_5.sh: New file.
13792         * testsuite/script_test_5.t: New file.
13793
13794 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13795
13796         * archive.cc (Archive::include_member): Update calls to add_symbols.
13797         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13798         the Layout argument.
13799         * dynobj.h (do_add_symbols): Add the Layout argument.
13800         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13801         Layout argument.
13802         * object.h (Object::add_symbols): Add the Layout argument.
13803         (Object::do_add_symbols): Add the Layout argument.
13804         (Sized_relobj::do_add_symbols): Add the Layout argument.
13805         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13806         Unify the two versions.
13807         (Add_plugin_symbols): Remove.
13808         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13809         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13810         (Add_plugin_symbols): Remove.
13811         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13812         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13813         (Add_symbols::run): Make it work with Pulginobj.
13814
13815 2009-02-06  Ian Lance Taylor  <iant@google.com>
13816
13817         * object.cc (Sized_relobj::do_layout): Make info message start
13818         with lower case letter.
13819
13820 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13821
13822         * binary.cc: Fix file comment.
13823
13824         * options.h (enum Incremental_disposition): Define.
13825         (class General_options): Add new options: --incremental,
13826         --incremental_changed, --incremental_unchanged,
13827         --incremental_unknown.  Add incremental_disposition_ and
13828         implicit_incremental_ fields.
13829         (General_options::incremental_disposition): New function.
13830         (class Position_dependent_options): Add incremental_disposition
13831         option.
13832         (Position_dependent_options::copy_from_options): Set incremental
13833         dispositions.
13834         * options.cc (General_options::parse_incremental_changed): New
13835         function.
13836         (General_options::parse_incremental_unchanged): New function.
13837         (General_options::parse_incremental_unknown): New function.
13838         (General_options::General_options): Initialize new fields
13839         incremental_disposition_ and implicit_incremental_.
13840         (General_options::finalize): Check for uasge of --incremental-*
13841         without --incremental.
13842
13843 2009-02-06  Chris Demetriou  <cgd@google.com>
13844
13845         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13846         pointer and to report location as the file name associated with
13847         the symbol.
13848         (gold_undefined_symbol_at_location): New function to replace the
13849         old gold_undefined_symbol functionality.
13850         * target-reloc.h (relocate_section): Update to use
13851         gold_undefined_symbol_at_location.
13852         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13853         Call gold_undefined_symbol function rather than gold_error.
13854         * errors.h (Errors::undefined_symbol): Take location as a
13855         string, rather than calculating it from a relocation.
13856         * errors.cc (Errors::fatal): Print "fatal error:" before the
13857         formatted message.
13858         (Errors::error, Errors::error_at_location): Print "error: "
13859         before the formatted message.
13860         (Errors::undefined_symbol): Take location as a string, rather
13861         than calculating it from a relocation.
13862         (gold_undefined_symbol_at_location): New function akin to
13863         old gold_undefined_symbol, calculates location from relocation.
13864         (gold_undefined_symbol): Change to take only a Symbol pointer
13865         and to report location as the file name associated with the symbol.
13866         * testsuite/debug_msg.sh: Update for changed error messages.
13867         * testsuite/undef_symbol.sh: Likewise.
13868
13869 2009-02-04  Duncan Sands  <baldrick@free.fr>
13870
13871         PR 9812
13872         * reduced_debug_output.h
13873         (Output_reduced_debug_abbrev_section::failed): Use format for
13874         gold_warning.
13875         (Output_reduced_debug_info_section::faild): Likewise.
13876
13877 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13878
13879         * script.cc (Lazy_demangler): New class.
13880         (Version_script_info::get_symbol_version_helper): Demangle a
13881         symbol only once.
13882
13883 2009-01-29  Cary Coutant  <ccoutant@google.com>
13884
13885         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13886         to __tls_get_addr.
13887         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13888
13889 2009-01-28  Ian Lance Taylor  <iant@google.com>
13890
13891         * version.cc (version_string): Bump to 1.9.
13892
13893         * gold.h: Include <cstring> and <stdint.h>.
13894         * version.cc: Include <cstdio>.
13895         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13896         warning.
13897         * reduced_debug_output.cc (insert_into_vector): Rename from
13898         Insert_into_vector; change all callers.  Use Swap_unaligned to
13899         avoid aliasing issue; remove union since it is unnecessary.
13900
13901 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13902
13903         * Makefile.am (CCFILES): Add gc.cc.
13904         (HFILES): Add gc.h.
13905         * Makefile.in: Regenerate.
13906         * gold.cc (Gc_runner): New class.
13907         (queue_initial_tasks): Call garbage collection related tasks
13908         when corresponding options are invoked.
13909         (queue_middle_gc_tasks): New function.
13910         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13911         processed early before laying out sections during garbage collection.
13912         * gold.h (queue_middle_gc_tasks): New function.
13913         (is_prefix_of): Move from "layout.cc".
13914         * i386.cc (Target_i386::gc_process_relocs): New function.
13915         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13916         * main.cc (main): Create object of class "Garbage_collection".
13917         * object.cc (Relobj::copy_symbols_data): New function.
13918         (Relobj::is_section_name_included): New function.
13919         (Sized_relobj::do_layout): Allow this function to be called twice
13920         during garbage collection and defer layout of section during the
13921         first call.
13922         * object.h (Relobj::get_symbols_data): New function.
13923         (Relobj::is_section_name_included): New function.
13924         (Relobj::copy_symbols_data): New function.
13925         (Relobj::set_symbols_data): New function.
13926         (Relobj::get_relocs_data): New function.
13927         (Relobj::set_relocs_data): New function.
13928         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13929         (Relobj::gc_process_relocs): New function.
13930         (Relobj::do_gc_process_relocs): New pure virtual function.
13931         (Relobj::sd_): New data member.
13932         (Sized_relobj::is_output_section_offset_invalid): New function.
13933         (Sized_relobj::do_gc_process_relocs): New function.
13934         * options.h (General_options::gc_sections): Modify to not be a no-op.
13935         (General_options::print_gc_sections): New option.
13936         * plugin.cc (Plugin_finish::run): Remove function call to
13937         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13938         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13939         * reloc.cc (Read_relocs::run): Add task to process relocs and
13940         determine unreferenced sections when doing garbage collection.
13941         (Gc_process_relocs): New class.
13942         (Sized_relobj::do_gc_process_relocs): New function.
13943         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13944         sections that are garbage collected.
13945         * reloc.h (Gc_process_relocs): New class.
13946         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13947         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13948         symbols whose corresponding sections are garbage collected.
13949         (Symbol_table::Symbol_table): Add new parameter for the garbage
13950         collection object.
13951         (Symbol_table::gc_mark_undef_symbols): New function.
13952         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13953         (Symbol_table::gc_mark_dyn_syms): New function.
13954         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13955         as garbage.
13956         (Symbol_table::add_from_object): Likewise.
13957         (Symbol_table::add_from_relobj): When building shared objects, do not
13958         treat externally visible symbols as garbage.
13959         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13960         table information for static and relocatable links.
13961         * symtab.h (Symbol_table::set_gc): New function.
13962         (Symbol_table::gc): New function.
13963         (Symbol_table::gc_mark_undef_symbols): New function.
13964         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13965         (Symbol_table::gc_mark_dyn_syms): New function.
13966         (Symbol_table::gc_): New data member.
13967         * target.h (Sized_target::gc_process_relocs): New pure virtual
13968         function.
13969         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13970         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13971
13972 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13973
13974         * options.h (General_options::gc_sections): Define as a no-op for now.
13975         (General_options::no_keep_memory): Ditto.
13976         (General_options::Bshareable): Define.
13977         * options.cc (General_options::finalize): Honor -Bshareable.
13978
13979 2009-01-20  Andreas Schwab  <schwab@suse.de>
13980
13981         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13982         read the value in the contents, since we don't use it.  Use the
13983         template endianness when writing.
13984         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13985
13986 2009-01-19  Andreas Schwab  <schwab@suse.de>
13987
13988         * configure.tgt (powerpc64-*): Fix targ_obj.
13989
13990 2009-01-15  Ian Lance Taylor  <iant@google.com>
13991
13992         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13993         local symbols when stripping all symbols.
13994
13995 2009-01-14  Cary Coutant  <ccoutant@google.com>
13996
13997         * output.cc (Output_reloc): Add explicit instantiations.
13998
13999 2009-01-14  Cary Coutant  <ccoutant@google.com>
14000
14001         * archive.cc (Archive::get_elf_object_for_member): Remove call
14002         to File_read::claim_for_plugin.
14003         * descriptors.cc (Descriptors::open): Remove reference to
14004         is_claimed.
14005         (Descriptors::claim_for_plugin): Remove.
14006         * descriptors.h (Descriptors::claim_for_plugin): Remove.
14007         (Descriptors::is_claimed): Remove.
14008         (claim_descriptor_for_plugin): Remove.
14009         * fileread.cc (File_read::claim_for_plugin): Remove.
14010         * fileread.h (File_read::claim_for_plugin): Remove.
14011         (File_read::descriptor): Reopen descriptor if necessary.
14012         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
14013         (Plugin_manager::all_symbols_read): Add task parameter. Change
14014         all callers.
14015         (Plugin_manager::get_input_file): New function.
14016         (Plugin_manager::release_input_file): New function.
14017         (Pluginobj::Pluginobj): Add filesize parameter and initialize
14018         corresponding data member.
14019         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
14020         and pass to base constructor. Change all callers.
14021         (get_input_file, release_input_file): New functions.
14022         (make_sized_plugin_object): Add filesize parameter. Change all callers.
14023         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
14024         (Plugin_manager::all_symbols_read): Add task parameter.
14025         (Plugin_manager::get_input_file): New function.
14026         (Plugin_manager::release_input_file): New function.
14027         (Plugin_manager::task_): New data member.
14028         (Pluginobj::Pluginobj): Add filesize parameter.
14029         (Pluginobj::filename): New function.
14030         (Pluginobj::descriptor): New function.
14031         (Pluginobj::filesize): New function.
14032         (Pluginobj::filesize_): New data member.
14033         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
14034         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
14035         File_read::claim_for_plugin; use Object::unlock to unlock the file.
14036
14037         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
14038         with archive libraries.
14039         * testsuite/Makefile.in: Regenerate.
14040         * testsuite/plugin_test.c (struct sym_info): New type.
14041         (get_input_file, release_input_file): New static variables.
14042         (onload): Capture new transfer vector entries.
14043         (claim_file_hook): Stop reading at end of file according to filesize.
14044         Factor out parsing of readelf output into separate function.
14045         (all_symbols_read_hook): Exercise get_input_file and release_input_file
14046         APIs and get the source file name from the symbol table.  Convert
14047         source file name to corresponding object file name.  Print info
14048         message when adding new input files.
14049         (parse_readelf_line): New function.
14050         * testsuite/plugin_test_1.sh: Add checks for new info messages.
14051         * testsuite/plugin_test_2.sh: Likewise.
14052         * testsuite/plugin_test_3.sh: Likewise.
14053         * testsuite/plugin_test_4.sh: New test case.
14054
14055 2009-01-07  Ian Lance Taylor  <iant@google.com>
14056
14057         * version.cc (version_string): Bump to 1.8.
14058
14059 2008-12-23  Cary Coutant  <ccoutant@google.com>
14060
14061         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
14062         * plugin.cc (Plugin_manager::finish): Rename as
14063         layout_deferred_objects.  Move cleanup to separate function.
14064         (Plugin_manager::cleanup): New function.
14065         (Plugin_finish::run): Call layout_deferred_objects and cleanup
14066         separately.
14067         * plugin.h (Plugin_manager::finish): Rename as
14068         layout_deferred_objects.
14069         (Plugin_manager::cleanup): New function.
14070         (Plugin_manager::cleanup_done): New field.
14071
14072 2008-12-23  Cary Coutant  <ccoutant@google.com>
14073
14074         * plugin.cc (is_visible_from_outside): New function.
14075         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
14076         so we don't return "IR only" status for exported symbols or -r links.
14077
14078         * testsuite/Makefile.am (plugin_test_3): New test case.
14079         * testsuite/Makefile.in: Regenerate.
14080         * testsuite/plugin_test_3.sh: New file.
14081
14082 2008-12-22  Cary Coutant  <ccoutant@google.com>
14083
14084         * object.cc (Sized_relobj::layout_section): New function.
14085         (Sized_relobj::do_layout): Defer layout of input sections until after
14086         plugin has provided replacement files.
14087         (Sized_relobj::do_layout_deferred_sections): New function.
14088         * object.h (Relobj::set_section_offset): Remove virtual keyword.
14089         (Relobj::layout_deferred_sections): New function.
14090         (Relobj::do_layout_deferred_sections): New function.
14091         (Sized_relobj::do_layout_deferred_sections): New function.
14092         (Sized_relobj::layout_section): New function.
14093         (Sized_relobj::Deferred_layout): New structure.
14094         (Sized_relobj::deferred_layout_): New field.
14095         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
14096         Change all callers.  Layout deferred sections.
14097         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
14098         references.
14099         (Plugin_hook::run): Move code from do_plugin_hook inline.
14100         (Plugin_hook::do_plugin_hook): Remove.
14101         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
14102         (Plugin_manager::finish): Renamed, was cleanup.
14103         (Plugin_manager::should_defer_layout): New function.
14104         (Plugin_manager::add_deferred_layout_object): New function.
14105         (Plugin_manager::Deferred_layout_list): New type.
14106         (Plugin_manager::deferred_layout_objects_): New field.
14107         (Plugin_hook::do_plugin_hook): Remove.
14108
14109 2008-12-17  Ian Lance Taylor  <iant@google.com>
14110
14111         * options.h (class General_options): Add --no case for
14112         --export-dynamic.
14113
14114 2008-12-16  Cary Coutant  <ccoutant@google.com>
14115
14116         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
14117         vector.
14118         (Plugin_manager::claim_file): Create plugin object even if
14119         plugin did not call the add_symbols callback.
14120         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
14121         asking for more symbols than were added.
14122         * testsuite/Makefile.am (plugin_test_1): Add test case with
14123         no global symbols.
14124         (empty.syms): New target.
14125         * testsuite/Makefile.in: Regenerate.
14126         * testsuite/plugin_test.c (claim_file_hook): Add new debug
14127         message. Don't call add_symbols if no globals.
14128         (all_symbols_read_hook): Don't provide replacement for empty
14129         claimed file.
14130
14131 2008-12-12  Ian Lance Taylor  <iant@google.com>
14132
14133         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
14134         r_type == 0 for a local symbol with r_sym == 0.
14135         (scan_relocatable_relocs): Pass r_sym to
14136         local_non_section_strategy.
14137         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
14138         r_sym parameter.
14139
14140         * configure.ac: Update test for TLS descriptors: they are
14141         supported as of glibc 2.9.
14142         * configure: Rebuild.
14143
14144 2008-12-11  Ian Lance Taylor  <iant@google.com>
14145
14146         PR 7091
14147         * target-reloc.h (Default_scan_relocatable_relocs): For each
14148         function, map r_type == 0 to RELOC_DISCARD.
14149
14150 2008-12-10  Cary Coutant  <ccoutant@google.com>
14151
14152         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
14153         object to override a kept COMDAT group from a plugin object.
14154
14155 2008-12-09  Ian Lance Taylor  <iant@google.com>
14156
14157         PR 7088
14158         * yyscript.y (file_cmd): Handle INPUT.
14159
14160         * testsuite/initpri1.c: Change all declarations to be full
14161         prototypes by adding void, to avoid compiler warnings.
14162
14163 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14164
14165         * options.cc (General_options::parse_plugin_opt): New.
14166         (General_options::add_plugin): The argument now is just the filename.
14167         (General_options::add_plugin_option): New.
14168         * options.h (plugin_opt): New.
14169         (add_plugin): Change argument name.
14170         (add_plugin_option): New.
14171         * plugin.cc (Plugin::load): Don't parse the plugin option.
14172         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14173         (Plugin::add_option): New.
14174         (Plugin::args_): Change type.
14175         (Plugin::filename_): New.
14176         (Plugin_manager::add_plugin_option): New.
14177         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14178         * testsuite/Makefile.in: Regenerate.
14179
14180 2008-12-05  Cary Coutant  <ccoutant@google.com>
14181
14182         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14183         Handle --strip-lto-sections option.
14184         * options.h (strip_lto_sections): New option.
14185
14186 2008-12-01  Cary Coutant  <ccoutant@google.com>
14187
14188         * plugin.cc (ld_plugin_message): Change format parameter to const.
14189         Fix mismatch between new[] and delete.
14190
14191 2008-11-14  Cary Coutant  <ccoutant@google.com>
14192
14193         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14194         instead of -1U.
14195
14196 2008-11-05  Craig Silverstein  <csilvers@google.com>
14197
14198         * options.cc (General_options::parse_dynamic_list): New function.
14199         * options.h (General_options): New flags dynamic_list,
14200         dynamic_list_data, dynamic_list_cpp_new, and
14201         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14202         (General_options::in_dynamic_list): New function.
14203         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14204         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14205         (Lex::can_continue_name): Likewise.
14206         (yylex): Likewise.
14207         (read_script_file): New parameter script_options.
14208         (read_dynamic_list): New function.
14209         (Script_options::define_dynamic_list): New function.
14210         (dynamic_list_keyword_parsecodes): New variable.
14211         (dynamic_list_keywords): New variable.
14212         * script.h (Script_options::define_dynamic_list): New function
14213         prototype.
14214         (read_dynamic_list): New function prototype.
14215         * symtab.cc (strprefix): New macro.
14216         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14217         dynamic_list_data, dynamic_list_cpp_new, and
14218         dynamic_list_cpp_typeinfo.
14219         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14220         (dynamic_list_expr): New rule.
14221         (dynamic_list_nodes): Likewise.
14222         (dynamic_list_node): Likewise.
14223         * testsuite/Makefile.am (dynamic_list): New test.
14224         * testsuite/Makefile.in: Regenerated.
14225         * testsuite/dynamic_list.t: New file.
14226         * testsuite/dynamic_list.sh: New file.
14227
14228 2008-11-05  Craig Silverstein  <csilvers@google.com>
14229
14230         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14231         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14232         (t11_last): Likewise.
14233         * testsuite/ver_test_6.c (main): Likewise.
14234
14235 2008-10-07  Cary Coutant  <ccoutant@google.com>
14236
14237         * options.c (General_options::finalize): Add check for -static and
14238         -shared.
14239         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14240         is not empty.
14241
14242 2008-10-02  Cary Coutant  <ccoutant@google.com>
14243
14244         * plugin.cc (make_sized_plugin_object): Fix conditional
14245         compilation to work when not all targets are enabled.
14246
14247 2008-09-29  Cary Coutant  <ccoutant@google.com>
14248
14249         * archive.cc (Archive::get_file_and_offset): Use filename instead
14250         of name to get library path.
14251         (Archive::include_member): Unlock external member of a thin archive.
14252
14253         * testsuite/Makefile.am (TEST_AR): New variable.
14254         (thin_archive_test_1): New test.
14255         (thin_archive_test_2): New test.
14256         * testsuite/Makefile.in: Regenerate.
14257         * testsuite/thin_archive_main.cc: New file.
14258         * testsuite/thin_archive_test_1.cc: New file.
14259         * testsuite/thin_archive_test_2.cc: New file.
14260         * testsuite/thin_archive_test_3.cc: New file.
14261         * testsuite/thin_archive_test_4.cc: New file.
14262
14263 2008-09-29  Cary Coutant  <ccoutant@google.com>
14264
14265         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14266         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14267         instead of -1U.
14268         (Sized_relobj::do_finalize_local_symbols): Likewise.
14269         (Sized_relobj::map_to_kept_section): Likewise.
14270         * object.h (Sized_relobj::invalid_address): New constant.
14271         (Sized_relobj::do_output_section_offset): Check for invalid_address
14272         and return -1ULL.
14273         * output.cc (Output_reloc::local_section_offset): Use constant
14274         invalid_address instead of -1U.
14275         (Output_reloc::get_address): Likewise.
14276         (Output_section::output_address): Change -1U to -1ULL.
14277         * output.h (Output_reloc::invalid_address): New constant.
14278         * reloc.cc (Sized_relobj::write_sections): Use constant
14279         invalid_address instead of -1U.
14280         (Sized_relobj::relocate_sections): Likewise.
14281         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14282         values for merge sections.
14283         * target-reloc.h (relocate_for_relocatable): Use constant
14284         invalid_address instead of -1U.
14285
14286 2008-09-19  Cary Coutant  <ccoutant@google.com>
14287
14288         Add plugin functionality for link-time optimization (LTO).
14289         * configure.ac (plugins): Add --enable-plugins option.
14290         * configure: Regenerate.
14291         * config.in: Regenerate.
14292         * Makefile.am (LIBDL): New variable.
14293         (CCFILES): Add plugin.cc.
14294         (HFILES): Add plugin.h.
14295         (ldadd_var): Add LIBDL.
14296         * Makefile.in: Regenerate.
14297
14298         * archive.cc: Include "plugin.h".
14299         (Archive::setup): Don't preread archive symbols when using a plugin.
14300         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14301         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14302         files.
14303         (Archive::include_member): Add symbols from plugin objects.
14304         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14305         * descriptors.cc (Descriptors::open): Check for file descriptors
14306         abandoned by plugins.
14307         (Descriptors::claim_for_plugin): New function.
14308         * descriptors.h (Descriptors::claim_for_plugin): New function.
14309         (Open_descriptor::is_claimed): New field.
14310         (claim_descriptor_for_plugin): New function.
14311         * fileread.cc (File_read::claim_for_plugin): New function.
14312         * fileread.h (File_read::claim_for_plugin): New function.
14313         (File_read::descriptor): New function.
14314         * gold.cc: Include "plugin.h".
14315         (queue_initial_tasks): Add task to call plugin hooks for generating
14316         new object files.
14317         * main.cc: Include "plugin.h".
14318         (main): Load plugin libraries.
14319         * object.h (Pluginobj): Declare.
14320         (Object::pluginobj): New function.
14321         (Object::do_pluginobj): New function.
14322         (Object::set_target): New function.
14323         * options.cc: Include "plugin.h".
14324         (General_options::parse_plugin): New function.
14325         (General_options::General_options): Initialize plugins_ field.
14326         (General_options::add_plugin): New function.
14327         * options.h (Plugin_manager): Declare.
14328         (General_options): Add --plugin option.
14329         (General_options::has_plugins): New function.
14330         (General_options::plugins): New function.
14331         (General_options::add_plugin): New function.
14332         (General_options::plugins_): New field.
14333         * plugin.cc: New file.
14334         * plugin.h: New file.
14335         * readsyms.cc: Include "plugin.h".
14336         (Read_symbols::do_read_symbols): Check for archive before checking
14337         for ELF file.  Call plugin hooks to claim files.
14338         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14339         from a real object file; force override when processing replacement
14340         files.
14341         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14342         (Symbol::init_base_object): Likewise.
14343         (Symbol::init_base_output_data): Likewise.
14344         (Symbol::init_base_output_segment): Likewise.
14345         (Symbol::init_base_constant): Likewise.
14346         (Symbol::init_base_undefined): Likewise.
14347         (Symbol::output_section): Assert that object is not a plugin.
14348         (Symbol_table::add_from_pluginobj): New function.
14349         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14350         undefined.
14351         (Symbol_table::sized_write_globals): Likewise.
14352         (Symbol_table::add_from_pluginobj): Instantiate template.
14353         * symtab.h (Sized_pluginobj): Declare.
14354         (Symbol::in_real_elf): New function.
14355         (Symbol::set_in_real_elf): New function.
14356         (Symbol::in_real_elf_): New field.
14357         (Symbol_table::add_from_pluginobj): New function.
14358
14359         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14360         (LIBDL): New variable.
14361         (LDADD): Add LIBDL.
14362         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14363         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14364         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14365         (MOSTLYCLEANFILES): Likewise.
14366         * testsuite/Makefile.in: Regenerate.
14367         * testsuite/plugin_test.c: New file.
14368         * testsuite/plugin_test_1.sh: New file.
14369         * testsuite/plugin_test_2.sh: New file.
14370
14371 2008-09-16  Ian Lance Taylor  <iant@google.com>
14372
14373         * target-reloc.h (relocate_section): Check whether a symbol is
14374         defined by the ABI before reporting an undefined symbol error.
14375         * target.h (Target::is_defined_by_abi): Make parameter const.
14376         (Target::do_is_defined_by_abi): Likewise.
14377         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14378         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14379         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14380         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14381         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14382         * testsuite/Makefile.in: Rebuild.
14383
14384         * fileread.cc (make_view): Add casts to avoid warning.
14385
14386 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14387
14388         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14389         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14390
14391 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14392
14393         * options.h (General_options::output_is_executable): New.
14394         (General_options::output_is_pie): New.
14395         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14396         for shared libraries.
14397         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14398
14399 2008-09-11  Chris Demetriou  <cgd@google.com>
14400
14401         * options.h (origin): New -z option.
14402         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14403         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14404         in DT_FLAGS_1.
14405
14406 2008-09-05  Cary Coutant  <ccoutant@google.com>
14407
14408         * fileread.cc (File_read::make_view): Add check for attempt to map
14409         beyond end of file.
14410
14411 2008-09-05  Cary Coutant  <ccoutant@google.com>
14412
14413         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14414         explicit instantiations.
14415
14416 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14417
14418         PR gold/6858
14419         * options.cc (General_options::finalize): Allow undefined symbols
14420         in shlibs if linking -shared.
14421
14422         PR gold/6859
14423         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14424         symbols as not needing a dynsym entry.
14425
14426 2008-08-20  Craig Silverstein  <csilvers@google.com>
14427
14428         * fileread.cc (File_read::open): Do not lock the file unless it
14429         was successfully opened.
14430
14431 2008-08-14  Cary Coutant  <ccoutant@google.com>
14432
14433         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14434         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14435         * testsuite/tls_test.cc (struct int128): 128-bit struct
14436         for testing TLS relocs with non-zero addend.
14437         (v12): New TLS variable.
14438         (t12): New test.
14439         (t_last): Add check for v12.
14440         * testsuite/tls_test.h (t12): New function.
14441         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14442
14443 2008-08-13  Ian Lance Taylor  <iant@google.com>
14444
14445         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14446         set tls_segment_ or relro_segment_.
14447         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14448         when appropriate.
14449         * output.h (Output_section::clear_is_relro): New function.
14450         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14451         sections specially even when output_data_ is empty.
14452         (Output_segment::maximum_alignment): When first section is relro,
14453         only force alignment for PT_LOAD segments.
14454         * script.cc (script_data_segment_align): New function.
14455         (script_data_segment_relro_end): New function.
14456         * script-c.h (script_data_segment_align): Declare.
14457         (script_data_segment_relro_end): Declare.
14458         * script-sections.h (class Script_sections): Declare
14459         data_segment_align and data_segment_relro_end.  Add fields
14460         segment_align_index_ and saw_relro_end_.
14461         * script-sections.cc (class Sections_element): Add set_is_relro
14462         virtual function.  Add new bool* parameter to place_orphan_here.
14463         Add get_output_section virtual function.
14464         (class Output_section_definition): Add set_is_relro.  Add new
14465         bool* parameter to place_orphan_here.  Add get_output_section.
14466         Add is_relro_ field.
14467         (Output_section_definition::Output_section_definition): Initialize
14468         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14469         and is_relro_ fields.
14470         (Output_section_definition::place_orphan_here): Add is_relro
14471         parameter.
14472         (Output_section_definition::set_section_addresses): Set relro for
14473         output section.
14474         (Output_section_definition::alternate_constraint): Likewise.
14475         (class Orphan_output_section): Add new bool* parameter to
14476         place_orphan_here.  Add get_output_section.
14477         (Orphan_output_section::place_orphan_here): Add is_relro
14478         parameter.
14479         (Script_sections::Script_sections): Initialize
14480         data_segment_align_index_ and saw_relro_end_.
14481         (Script_sections::data_segment_align): New function.
14482         (Script_sections::data_segment_relro_end): New function.
14483         (Script_sections::place_orphan): Set or clear is_relro.
14484         (Script_sections::set_section_addresses): Force alignment of first
14485         TLS section.
14486         * yyscript.y (exp): Call script_data_segment_align and
14487         script_data_segment_relro_end.
14488         * testsuite/relro_script_test.t: New file.
14489         * testsuite/relro_test.cc (using_script): Declare.
14490         (t1, t2): Test using_script.
14491         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14492         (relro_script_test_SOURCES): Define.
14493         (relro_script_test_DEPENDENCIES): Define.
14494         (relro_script_test_LDFLAGS): Define.
14495         (relro_script_test_LDADD): Define.
14496         (relro_script_test.so): New target.
14497         * testsuite/Makefile.in: Rebuild.
14498
14499 2008-08-06  Cary Coutant <ccoutant@google.com>
14500
14501         * archive.cc (Archive::total_archives, Archive::total_members)
14502         (Archive::total_members_loaded): New variables.
14503         (Archive::setup): Add parameter.  Add option to preread
14504         archive symbols.
14505         (Archive::read_armap): Add counter.
14506         (Archive::get_file_and_offset): New function.
14507         (Archive::get_elf_object_for_member): New function.
14508         (Archive::read_all_symbols): New function.
14509         (Archive::read_symbols): New function.
14510         (Archive::add_symbols): Add counters.
14511         (Archive::include_all_members): Use armap to find members if it's
14512         already built.
14513         (Archive::include_member): Skip reading symbols if already read.
14514         Factored code into Archive::get_file_and_offset and
14515         Archive::get_elf_object_for_member.  Changed call to
14516         Mapfile::report_include_archive_member.
14517         (Archive::print_stats): New function.
14518         * archive.h: Declare Object and Read_symbols_data classes.
14519         (Archive::Archive): Add initializers for new members.
14520         (Archive::setup): Add parameter.
14521         (Archive::print_stats): New function.
14522         (Archive::total_archives, Archive::total_members)
14523         (Archive::total_members_loaded): New variables.
14524         (Archive::get_file_and_offset): New function.
14525         (Archive::get_elf_object_for_member): New function.
14526         (Archive::read_all_symbols): New function.
14527         (Archive::read_symbols): New function.
14528         (Archive::Archive_member): New class.
14529         (Archive::members_): New member.
14530         (Archive::num_members_): New member.
14531         * main.cc: Include archive.h.
14532         (main): Call Archive::print_stats.
14533         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14534         archive parameter; member_name is now the fully-decorated name.
14535         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14536         * options.h: (General_options): Add --preread-archive-symbols option.
14537         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14538         Archive::setup.
14539
14540 2008-08-04  Ian Lance Taylor  <iant@google.com>
14541
14542         * symtab.h (Symbol::use_plt_offset): New function.
14543         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14544         * powerpc.cc (Relocate::relocate): Likewise.
14545         * sparc.cc (Relocate::relocate): Likewise.
14546         * x86_64.cc (Relocate::relocate): Likewise.
14547         * testsuite/weak_plt.sh: New test.
14548         * testsuite/weak_plt_main.cc: New test.
14549         * testsuite/weak_plt_shared.cc: New test.
14550         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14551         (check_PROGRAMS): Add weak_plt.
14552         (check_DATA): Add weak_plt_shared.so.
14553         (weak_plt_main_pic.o, weak_plt): New targets.
14554         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14555         * testsuite/Makefile.in: Rebuild.
14556
14557         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14558         gcctestdir/ld.
14559         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14560         * testsuite/Makefile.in: Rebuild.
14561
14562 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14563
14564         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14565         * Makefile.in: Regenerate.
14566         * po/POTFILES.in: Regenerate.
14567
14568 2008-07-29  Ian Lance Taylor  <iant@google.com>
14569
14570         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14571         symbols before other symbols.
14572         * testsuite/script_test_2.cc (test_addr): Declare.
14573         (test_addr_alias): Declare.
14574         (main): Check that test_addr and test_addr_alias have the right
14575         values.
14576         * testsuite/script_test_2.t: Define test_addr_alias and
14577         test_addr.
14578
14579 2008-07-24  Ian Lance Taylor  <iant@google.com>
14580
14581         PR 5990
14582         * descriptors.cc: New file.
14583         * descriptors.h: New file.
14584         * gold-threads.h (class Hold_optional_lock): New class.
14585         * fileread.cc: Include "descriptors.h".
14586         (File_read::~File_read): Release descriptor rather than closing
14587         it.
14588         (File_read::open) [file]: Call open_descriptor rather than open.
14589         Set is_descriptor_opened_.
14590         (File_read::open) [memory]: Assert that descriptor is not open.
14591         (File_read::reopen_descriptor): New function.
14592         (File_read::release): Release descriptor.
14593         (File_read::do_read): Make non-const.  Reopen descriptor.
14594         (File_read::read): Make non-const.
14595         (File_read::make_view): Reopen descriptor.
14596         (File_read::do_readv): Likewise.
14597         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14598         Update declarations.
14599         * layout.cc: Include "descriptors.h".
14600         (Layout::create_build_id): Use open_descriptor rather than open.
14601         * output.cc: Include "descriptors.h".
14602         (Output_file::open): Use open_descriptor rather than open.
14603         * archive.cc (Archive::const_iterator): Change Archive to be
14604         non-const.
14605         (Archive::begin, Archive::end): Make non-const.
14606         (Archive::count_members): Likewise.
14607         * archive.h (class Archive): Update declarations.
14608         * object.h (Object::read): Make non-const.
14609         * Makefile.am (CCFILES): Add descriptors.cc.
14610         (HFILES): Add descriptors.h.
14611         * Makefile.in: Rebuild.
14612
14613         PR 6716
14614         * gold.h: Always include <clocale>.  Add Solaris workarounds
14615         following code in binutils/sysdep.h.
14616
14617         PR 6048
14618         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14619         this->eh_frame_hdr_ is NULL before using it.
14620
14621         * dynobj.cc (Versions::Versions): Update comment.
14622
14623         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14624         the base version name.
14625
14626         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14627         array size plus one.
14628         (Stringpool_template::set_string_offsets): Subtract one from key
14629         before using it as an array index.
14630         (Stringpool_template::get_offset_with_length): Likewise.
14631         (Stringpool_template::write_to_buffer): Likewise.
14632         * stringpool.h (Stringpool_template::get_offset_from_key):
14633         Likewise.
14634
14635 2008-07-23  Ian Lance Taylor  <iant@google.com>
14636
14637         PR 6658
14638         * object.h (Merged_symbol_value::value): Do our best to handle a
14639         negative addend.
14640
14641         PR 6647
14642         * script.cc (Version_script_info::get_versions): Don't add empty
14643         version tag to return value.
14644         (Version_script_info::get_symbol_version_helper): Change return
14645         type to bool.  Add pversion parameter.  Change all callers.
14646         (script_register_vers_node): Don't require a non-NULL tag.
14647         * script.h (class Version_script_info): Update declarations.
14648         (Version_script_info::get_symbol_version): Change return type to
14649         bool.  Add version parameter.  Change all callers.
14650         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14651         handling.  Handle an empty version from a version script.
14652         (Symbol_table::define_special_symbol): Likewise.
14653         * testsuite/ver_test_10.script: New file.
14654         * testsuite/ver_test_10.sh: New file.
14655         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14656         (check_DATA): Add ver_test_10.syms.
14657         (ver_test_10.syms, ver_test_10.so): New target.
14658         * testsuite/Makefile.in: Rebuild.
14659
14660 2008-07-23  Simon Baldwin  <simonb@google.com>
14661
14662         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14663         to zero for undefined symbols from dynamic libraries.
14664
14665 2008-07-23  Ian Lance Taylor  <iant@google.com>
14666
14667         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14668         Change all callers.
14669         * symtab.h (class Symbol_table): Update declaration.
14670         * testsuite/ver_test_9.cc: New file.
14671         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14672         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14673         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14674         (ver_test_9.so, ver_test_9.o): New targets.
14675         * testsuite/Makefile.in: Rebuild.
14676
14677 2008-07-22  Ian Lance Taylor  <iant@google.com>
14678
14679         * options.h (class General_options): Define --check-sections.
14680         * layout.cc (Layout::set_segment_offsets): Handle
14681         --check-sections.
14682
14683         * options.h (class General_options): Define -n/--nmagic and
14684         -N/--omagic.
14685         * options.cc (General_options::finalize): For -n/--nmagic or
14686         -N/--omagic, set -static.
14687         * layout.cc (Layout::attach_allocated_section_to_segment): If
14688         -N/--omagic, don't put read-only and read-write sections in
14689         different segments.
14690         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14691         finding a read-only segment.
14692         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14693         don't set the minimum segment alignment to the common page size,
14694         and don't set the file offset to the address modulo the page size.
14695         * script-sections.cc (Script_sections::create_segments): If
14696         -n/--omagic, don't put read-only and read-write sections in
14697         different segments.
14698
14699         * cref.cc: New file.
14700         * cref.h: New file.
14701         * options.h (class General_options): Add --print-symbol-counts.
14702         * main.cc (main): Issue defined symbol report if requested.
14703         * archive.cc (Archive::interpret_header): Make into a const member
14704         function.
14705         (Archive::add_symbols): Call Input_objects::archive_start and
14706         archive_stop.
14707         (Archive::const_iterator): Define new class.
14708         (Archive::begin, Archive::end): New functions.
14709         (Archive::include_all_members): Rewrite to use iterator.
14710         (Archive::count_members): New function.
14711         * archive.h (class Archive): Update declarations.
14712         (Archive::filename): New function.
14713         * object.cc: Include "cref.h".
14714         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14715         (Sized_relobj::do_get_global_symbol_counts): New function.
14716         (Input_objects::add_object): Add object to cross-referencer.
14717         (Input_objects::archive_start): New function.
14718         (Input_objects::archive_stop): New function.
14719         (Input_objects::print_symbol_counts): New function.
14720         * object.h: Declare Cref and Archive.
14721         (Object::get_global_symbol_counts): New function.
14722         (Object::do_get_global_symbol_counts): New pure virtual function.
14723         (class Sized_relobj): Add defined_count_ field.  Update
14724         declarations.
14725         (class Input_objects): Add cref_ field.  Update constructor.
14726         Update declarations.
14727         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14728         defined_count_.
14729         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14730         symbol counts.
14731         (Sized_dynobj::do_get_global_symbol_counts): New function.
14732         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14733         defined_count_.  Update declarations.  Define Symbols typedef.
14734         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14735         parameter.  Change all callers.
14736         (Symbol_table::add_from_dynobj): Add sympointers and defined
14737         parameters.  Change all callers.
14738         * symtab.h (class Symbol_table): Update declarations.
14739         * Makefile.am (CCFILES): Add cref.cc.
14740         (HFILES): Add cref.h.
14741         * Makefile.in: Rebuild.
14742
14743 2008-07-22  Simon Baldwin  <simonb@google.com>
14744
14745         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14746         to zero when writing undefined symbols.
14747
14748 2008-07-22  Ian Lance Taylor  <iant@google.com>
14749
14750         * output.cc (Output_section::add_input_section): Don't try to
14751         merge empty merge sections.
14752
14753 2008-07-21  Craig Silverstein  <csilvers@google.com>
14754
14755         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14756         Include symbol version in error message.
14757
14758 2008-07-20  Chris Demetriou  <cgd@google.com>
14759
14760         * configure.ac (gold_cv_c_random_seed): New configured variable.
14761         (RANDOM_SEED_CFLAGS): New substituted variable.
14762         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14763         * configure: Rebuild.
14764         * Makefile.in: Likewise.
14765         * testsuite/Makefile.in: Likewise.
14766
14767 2008-07-18  Ian Lance Taylor  <iant@google.com>
14768
14769         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14770         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14771         * testsuite/ver_test_main.cc (main): Call t4.
14772         (t4, t4_2a): Define.
14773         * testsuite/ver_test_2.cc (t4_2): Define.
14774         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14775         * testsuite/ver_test_4.cc (t4_2a): Define.
14776         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14777         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14778
14779 2008-07-17  Ian Lance Taylor  <iant@google.com>
14780
14781         * dynobj.cc (Versions::add_def): If we give an error about a
14782         missing version, go ahead and create the version anyhow.
14783
14784 2008-07-10  Ian Lance Taylor  <iant@google.com>
14785
14786         Handle output sections with more than 0x7fffffff bytes.
14787         * object.h (class Relobj): Change map_to_output_ to
14788         output_sections_, and just keep a section pointer.  Change all
14789         uses.  Move comdat group support to Sized_relobj.
14790         (Relobj::is_section_specially_mapped): Remove.
14791         (Relobj::output_section): Remove poff parameter.  Change all
14792         callers.
14793         (Relobj::output_section_offset): New function.
14794         (Relobj::set_section_offset): Rewrite.
14795         (Relobj::map_to_output): Remove.
14796         (Relobj::output_sections): New function.
14797         (Relobj::do_output_section_offset): New pure virtual function.
14798         (Relobj::do_set_section_offset): Likewise.
14799         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14800         group support from Relobj.  Update declarations.
14801         (Sized_relobj::get_output_section_offset): New function.
14802         (Sized_relobj::do_output_section_offset): New function.
14803         (Sized_relobj::do_set_section_offset): New function.
14804         * object.cc (Relobj::output_section_address): Remove.
14805         (Sized_relobj::Sized_relobj): Initialize new fields.
14806         (Sized_relobj::include_section_group): Cast find_kept_object to
14807         Sized_relobj.
14808         (Sized_relobj::include_linkonce_section): Likewise.
14809         (Sized_relobj::do_layout): Use separate arrays for output section
14810         and output offset.
14811         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14812         output_sections.
14813         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14814         output_sections and section_offsets.
14815         (Sized_relobj::write_local_symbols): Likewise.
14816         (map_to_kept_section): Compute output address directly.
14817         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14818         output_sections and section_offsets.
14819         (Sized_relobj::write_sections): Likewise.
14820         (Sized_relobj::relocate_sections): Likewise.
14821         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14822         * output.h (class Output_reloc): Update declarations.  Change
14823         u2_.relobj to Sized_relobj*.
14824         (class Output_data_reloc): Change add functions to use
14825         Sized_relobj*.
14826         * output.cc (Output_reloc::Output_reloc): Change relobj to
14827         Sized_relobj*.
14828         (Output_reloc::local_section_offset): Change return type to
14829         Elf_Addr.  Use get_output_section_offset.
14830         (Output_reloc::get_address): Likewise.
14831         (Output_section::is_input_address_mapped): Don't call
14832         is_section_specially_mapped.
14833         (Output_section::output_offset): Likewise.
14834         (Output_section::output_address): Likewise.
14835         (Output_section::starting_output_address): Likewise.
14836         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14837         parameter to Sized_relobj*.
14838         (Copy_relocs::need_copy_reloc): Likewise.
14839         (Copy_relocs::save): Likewise.
14840         * copy-relocs.h (class Copy_relocs): Update declarations.
14841         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14842         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14843         * target-reloc.h (relocate_for_relocatable): Change
14844         offset_in_output_section type to Elf_Addr.  Change code that uses
14845         it as well.
14846         * layout.cc (Layout::layout): Always set *off.
14847         * mapfile.cc (Mapfile::print_input_section): Use
14848         output_section_offset.
14849         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14850         Sized_relobj*.
14851         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14852         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14853         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14854
14855 2008-07-03  Ian Lance Taylor  <iant@google.com>
14856
14857         * layout.cc (Layout::include_section): Do not discard unrecognized
14858         SHT_STRTAB sections.
14859
14860 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14861
14862         * script.cc (Lex::can_continue_name): Make '?' allowable in
14863         version-script names.
14864         * testsuite/version_script.map: Change glob pattern to use '?'
14865
14866 2008-06-30  Manish Singh  <yosh@gimp.org>
14867
14868         PR 6585
14869         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14870         Correct typo.
14871
14872 2008-06-30  Ian Lance Taylor  <iant@google.com>
14873
14874         PR 6660
14875         PR 6682
14876         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14877         versions]: Don't try to read the value in the contents, since we
14878         don't use it.  Use the template endianness when writing.
14879
14880 2008-06-25  Cary Coutant  <ccoutant@google.com>
14881
14882         * fileread.cc (File_read::make_view): Assert on zero-length view.
14883         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14884         symbol table when there are no symbols to read.
14885
14886 2008-06-23  Craig Silverstein  <csilvers@google.com>
14887
14888         * version.cc (version_string): Bump to 1.7
14889
14890 2008-06-18  Craig Silverstein  <csilvers@google.com>
14891
14892         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14893         constant 0xFFFF to type Valtype.
14894         (Powerpc_relocate_functions::rel16_ha): Likewise.
14895
14896 2008-06-17  Ian Lance Taylor  <iant@google.com>
14897
14898         * output.h (Output_section::Input_section): Initialize p2align_ to
14899         zero for Output_section_data constructors.
14900         (Output_section::Input_section::addralign): If not an input
14901         section, return the alignment of the Output_section_data.
14902         * testsuite/copy_test.cc: New file.
14903         * testsuite/copy_test_1.cc: New file.
14904         * testsuite/copy_test_2.cc: New file.
14905         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14906         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14907         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14908         (copy_test_1_pic.o, copy_test_1.so): New targets.
14909         (copy_test_2_pic.o, copy_test_2.so): New targets.
14910         * testsuite/Makefile.in: Rebuild.
14911
14912         * script-sections.cc (Script_sections::place_orphan): Initialize
14913         local variable exact.
14914
14915 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14916
14917         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14918
14919 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14920             David S. Miller  <davem@davemloft.net>
14921
14922         * powerpc.cc: New file.
14923         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14924         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14925         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14926         * Makefile.in: Rebuild.
14927
14928 2008-06-09  Ian Lance Taylor  <iant@google.com>
14929
14930         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14931         <exception>.
14932         (throwing, orig_terminate): New static variables.
14933         (terminate_handler): New static function.
14934         (t2): Set terminate handler.
14935
14936 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14937
14938         PR 6584
14939         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14940         alignment.
14941
14942 2008-05-30  Cary Coutant  <ccoutant@google.com>
14943
14944         * archive.cc (Archive::include_all_members) Correct to step
14945         over symbol table and extended name table in thin archives.
14946
14947 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14948
14949         PR 6407
14950         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14951         calculation.
14952
14953 2008-05-28  Caleb Howe  <cshowe@google.com>
14954
14955         * reduced_debug_output.cc: New file.
14956         * reduced_debug_output.h: New file.
14957         * options.h (class General_options): Add --strip-debug-non-line.
14958         * options.cc (General_options::finalize): Add strip_debug_non_line
14959         to the strip heirarchy.
14960         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14961         fields.
14962         * layout.cc: Include "reduced_debug_output.h".
14963         (Layout::Layout): Initialize new fields.
14964         (line_only_debug_sections): New static array.
14965         (is_lines_only_debug_sections): New static inline function.
14966         (Layout::include_section): Handle --strip-debug-non-line.
14967         (Layout::make_output_section): If --strip-debug-non-line, build
14968         new output sections for .debug_abbrev and .debug_info.
14969         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14970         gold.  Warn about possible overflow.
14971         (read_signed_LEB_128): Likewise.
14972         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14973         (read_signed_LEB_128): Declare.
14974         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14975         (HFILES): Add reduced_debug_output.h.
14976         * Makefile.in: Rebuild.
14977
14978 2008-05-21  Ian Lance Taylor  <iant@google.com>
14979
14980         * mapfile.cc: New file.
14981         * mapfile.h: New file.
14982         * options.h (class General_options): Add -M/--print-map and -Map.
14983         * options.cc (General_options::finalize): Make -M equivalent to
14984         -Map -.
14985         * main.cc: Include <cstdio> and "mapfile.h".
14986         (main): Open mapfile if requested.
14987         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14988         constructor.  Change caller.
14989         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14990         (queue_middle_tasks): Likewise.
14991         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14992         declarations.
14993         * archive.cc: Include "mapfile.h".
14994         (Archive::add_symbols): Add mapfile parameter.  Change all
14995         callers.  Pass mapfile, symbol, and reason to include_member.
14996         (Archive::include_all_members): Add mapfile parameter.  Change all
14997         callers.
14998         (Archive::include_member): Add mapfile, sym, and why parameters.
14999         Change all callers.  Report inclusion to map file.
15000         * archive.h: Include "fileread.h".
15001         (class Archive): Update declarations.
15002         (Archive::file): New const method.
15003         (class Add_archive_symbols): Add mapfile_ field.  Update
15004         constructor.  Change all callers.
15005         * readsyms.h (class Read_symbols): Likewise.
15006         (class Finish_group): Likewise.
15007         (class Read_script): Likewise.
15008         * common.cc: Include "mapfile.h".
15009         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
15010         all callers.
15011         (Symbol_table::do_allocate_commons): Likewise.
15012         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
15013         symbol allocation to mapfile.
15014         * common.h (class Allocate_commons_task): Add mapfile_ field.
15015         Update constructor.  Change all callers.
15016         * symtab.h (class Symbol_table): Update declarations.
15017         * layout.cc: Include "mapfile.h".
15018         (Layout_task_runner::run): Print information to mapfile.
15019         (Layout::create_gold_note): Change Output_data_fixed_space to
15020         Output_data_zero_fill.
15021         (Layout::create_build_id): Likewise.
15022         (Layout::print_to_mapfile): New function.
15023         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
15024         constructor.  Change caller.
15025         (class Layout): Declare print_to_mapfile.
15026         * output.cc (Output_section::Input_section::print_to_mapfile): New
15027         function.
15028         (Output_section::add_input_section): If producing a map, always
15029         add to input_sections_ list.
15030         (Output_section::do_print_to_mapfile): New function.
15031         (Output_segment::print_sections_to_mapfile): New function.
15032         (Output_segment::print_section_list_to_mapfile): New function.
15033         * output.h: Include "mapfile.h".
15034         (Output_data::print_to_mapfile): New function.
15035         (Output_data::do_print_to_mapfile): New virtual function.
15036         (Output_segment_headers::do_print_to_mapfile): New function.
15037         (Output_file_header::do_print_to_mapfile): New function.
15038         (Output_data_const::do_print_to_mapfile): New function.
15039         (class Output_data_const_buffer): Add map_name_ field.  Update
15040         constructor.  Change all callers.  Add do_print_to_mapfile
15041         function.
15042         (class Output_data_fixed_space): Likewise.
15043         (class Output_data_space): Likewise.
15044         (class Output_data_zero_fill): New class.
15045         (Output_data_strtab::do_print_to_mapfile): New function.
15046         (Output_data_reloc_base::do_print_to_mapfile): New function.
15047         (Output_relocatable_relocs::do_print_to_mapfile): New function.
15048         (Output_data_group::do_print_to_mapfile): New function.
15049         (Output_data_got::do_print_to_mapfile): New function.
15050         (Output_data_dynamic::do_print_to_mapfile): New function.
15051         (Output_symtab_xindex::do_print_to_mapfile): New function.
15052         (class Output_section): Declare do_print_to_mapflie.  Declare
15053         print_to_mapfile in Input_section.
15054         (class Output_segment): Declare new functions.
15055         * object.h (Sized_relobj::symbol_count): New function.
15056         * script-sections.cc
15057         (Output_section_element_dot_assignment::set_section_addresses):
15058         Change Output_data_fixed_space to Output_data_zero_fill.
15059         (Output_data_expression::do_print_to_mapfile): New function.
15060         * script.cc (read_input_script): Add mapfile parameter.  Change
15061         all callers.
15062         * script.h (read_input_script): Update declaration.
15063         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
15064         (Eh_frame::do_print_to_mapfile): New function.
15065         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
15066         (Output_merge_string::do_print_to_mapfile): New function.
15067         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
15068         function.
15069         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
15070         function.
15071         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
15072         function.
15073         * Makefile.am (CCFILES): Add mapfile.cc.
15074         (HFILES): Add mapfile.h.
15075         * Makefile.in: Rebuild.
15076
15077 2008-05-19  Ian Lance Taylor  <iant@google.com>
15078
15079         * options.h (class General_options): Add -z relro.
15080         * layout.cc (Layout::Layout): Initialize relro_segment_.
15081         (Layout::add_output_section_data): Return the output section.
15082         (Layout::make_output_section): Rcognize relro sections and mark
15083         them appropriately.
15084         (Layout::attach_allocated_section_to_segment): Put relro sections
15085         in a PT_GNU_RELRO segment.
15086         (Layout::create_initial_dynamic_sections): Mark the .dynamic
15087         section as relro.
15088         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
15089         PT_TLS segments.
15090         (Layout::linkonce_mapping): Map d.rel.ro.local to
15091         .data.rel.ro.local.
15092         (Layout::output_section_name): Us .data.rel.ro.local for any
15093         section which begins with that.
15094         * layout.h (class Layout): Update add_output_section_data
15095         declaration.  Add relro_segment_ field.
15096         * output.cc (Output_section::Output_section): Initialize is_relro_
15097         and is_relro_local_ fields.
15098         (Output_segment::add_output_section): Group relro sections.
15099         (Output_segment::is_first_section_relro): New function.
15100         (Output_segment::maximum_alignment): If there is a relro section,
15101         align the segment to the common page size.
15102         (Output_segment::set_section_addresses): Track whether we are
15103         looking at relro sections.  If the last section is a relro
15104         section, align to the common page size.
15105         (Output_segment::set_section_list_addresses): Add in_relro
15106         parameter.  Change all callers.  Align to the page size when
15107         moving from relro to non-relro section.
15108         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
15109         segment.
15110         * output.h (class Output_section): Add is_relro_ and
15111         is_relro_local_ fields.
15112         (Output_section::is_relro): New function.
15113         (Output_section::set_is_relro): New function.
15114         (Output_section::is_relro_local): New function.
15115         (Output_section::set_is_relro_local): New function.
15116         (class Output_segment): Update declarations.
15117         * i386.cc (Target_i386::got_section): Mark .got section as relro.
15118         * sparc.cc (Target_sparc::got_section): Likewise.
15119         * x86_64.cc (Target_x86_64::got_section): Likewise.
15120         * testsuite/relro_test_main.cc: New file.
15121         * testsuite/relro_test.cc: New file.
15122         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
15123         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
15124         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
15125         (relro_test.so, relro_test_pic.o): New targets.
15126         * testsuite/Makefile.in: Rebuild.
15127
15128 2008-05-16  Ian Lance Taylor  <iant@google.com>
15129
15130         * output.cc (Output_segment::add_output_section): Remove front
15131         parameter.
15132         * output.h (class Output_segment): Remove
15133         add_initial_output_section and overloaded add_output_section.
15134         Update declaration of remaining add_output_section.
15135         * layout.cc (Layout::create_interp): Call add_output_section
15136         rather than add_initial_output_section.
15137         (Layout::finish_dynamic_section): Likewise.
15138
15139         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
15140         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
15141         know the dynamic type.
15142         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
15143         field.  Initialize it in constructor.
15144         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
15145         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
15146         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
15147         reloc.
15148
15149         * output.cc (Output_reloc::get_address): Change return type to
15150         Elf_Addr.
15151         * output.h (class Output_reloc): Update get_address declaration.
15152         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
15153         for section addresses.
15154
15155 2008-05-09  Ian Lance Taylor  <iant@google.com>
15156
15157         PR 6493
15158         * gold.cc (gold_nomem): Use return value of write.
15159
15160 2008-05-08  Ian Lance Taylor  <iant@google.com>
15161
15162         * symtab.c (Symbol::init_base_output_data): Add version
15163         parameter.  Change all callers.
15164         (Symbol::init_base_output_segment): Likewise.
15165         (Symbol::init_base_constant): Likewise.
15166         (Symbol::init_base_undefined): Likewise.
15167         (Sized_symbol::init_output_data): Likewise.
15168         (Sized_symbol::init_output_segment): Likewise.
15169         (Sized_symbol::init_constant): Likewise.
15170         (Sized_symbol::init_undefined): Likewise.
15171         (Symbol_table::do_define_in_output_data): If the new symbol has a
15172         version, mark it as the default.
15173         (Symbol_table::do_define_in_output_segment): Likewise.
15174         (Symbol_table::do_define_as_constant): Likewise.
15175         * symtab.h (class Symbol): Update declarations.
15176         (class Sized_symbol): Likewise.
15177         * resolve.cc (Symbol::override_version): New function.
15178         (Symbol::override_base): Call override_version.
15179         (Symbol::override_base_with_special): Likewise.
15180         * testsuite/ver_script_8.script: New file.
15181         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15182         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15183         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15184         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15185
15186 2008-05-06  Ian Lance Taylor  <iant@google.com>
15187
15188         PR 6049
15189         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15190         functions.
15191         (class General_options): Remove existing --undefined, and add
15192         --no-undefined instead.  Add new --undefined as synonym for -u.
15193         * archive.cc (Archive::add_symbols): Check whether symbol was
15194         named with -u.
15195         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15196         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15197         all uses.  Add IS_UNDEFINED.  Update declarations to split
15198         different versions of init_base.  Declare init_base_undefined.
15199         (Symbol::is_defined): Handle IS_UNDEFINED.
15200         (Symbol::is_undefined): Likewise.
15201         (Symbol::is_weak_undefined): Call is_undefined.
15202         (Symbol::is_absolute): Handle IS_CONSTANT.
15203         (class Sized_symbol): Update declarations to split different
15204         versions of init.  Declare init_undefined.
15205         (class Symbol_table): Declare new functions.
15206         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15207         Change all callers.
15208         (Symbol::init_base_output_data): Likewise.
15209         (Symbol::init_base_output_segment): Likewise.
15210         (Symbol::init_base_constant): Likewise.
15211         (Symbol::init_base_undefined): New function.
15212         (Sized_symbol::init_object): Rename from init.  Change all
15213         callers.
15214         (Sized_symbol::init_output_data): Likewise.
15215         (Sized_symbol::init_output_segment): Likewise.
15216         (Sized_symbol::init_constant): Likewise.
15217         (Sized_symbol::init_undefined): New function.
15218         (Symbol_table::add_undefined_symbols_from_command_line): New
15219         function.
15220         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15221         function.
15222         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15223         (Symbol::output_section): Likewise.
15224         (Symbol::set_output_section): Likewise.
15225         (Symbol_table::sized_finalize_symbol): Likewise.
15226         (Symbol_table::sized_write_globals): Likewise.
15227         * resolve.cc (Symbol_table::should_override): Likewise.
15228         (Symbol::override_base_with_special): Likewise.
15229
15230         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15231         symbol, change it to have default visibility.
15232         * testsuite/protected_1.cc: New file.
15233         * testsuite/protected_2.cc: New file.
15234         * testsuite/protected_3.cc: New file.
15235         * testsuite/protected_main_1.cc: New file.
15236         * testsuite/protected_main_2.cc: New file.
15237         * testsuite/protected_main_3.cc: New file.
15238         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15239         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15240         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15241         (protected_1.so): New target.
15242         (protected_1_pic.o, protected_2_pic.o): New targets.
15243         (protected_3_pic.o): New target.
15244         (check_PROGRAMS): Add protected_2.
15245         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15246         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15247         * testsuite/Makefile.in: Rebuild.
15248
15249         * options.h (DEFINE_var): Add set_user_set_##varname__.
15250         (DEFINE_bool_alias): New macro.
15251         (class General_options): Define -Bstatic using DEFINE_bool_alias
15252         rather than DEFINE_special.  Add --undefined as an alias for -z
15253         defs.
15254         * options.cc (General_options::parse_Bstatic): Remove.
15255
15256         * options.h (class General_options): Add --fatal-warnings.
15257         * main.cc (main): Implement --fatal-warnings.
15258         * errors.h (Errors::warning_count): New function.
15259
15260         * options.h (class General_options): Add -Bsymbolic-functions.
15261         * symtab.h (Symbol::is_preemptible): Check for
15262         -Bsymbolic-functions.
15263
15264 2008-05-05  Ian Lance Taylor  <iant@google.com>
15265
15266         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15267         as noVARNAME rather than no-VARNAME.
15268         (class General_options): Add option -z combreloc.
15269         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15270         get_address.
15271         (Output_reloc::sort_before) [SHT_REL]: New function.
15272         (Output_reloc::sort_before) [SHT_RELA]: New function.
15273         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15274         Sort_relocs_comparison.
15275         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15276         parameter.  Change all callers.
15277         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15278         sort_relocs parameter.  Change all callers.
15279         * output.cc (Output_reloc::get_address): New function, broken out
15280         of write_rel.
15281         (Output_reloc::write_rel): Call it.
15282         (Output_reloc::compare): New function.
15283         (Output_data_reloc_base::do_write): Optionally sort relocs.
15284
15285         * configure.ac: If targ_extra_obj is set, link it in.
15286         * configure.tgt: Initialize all variables.
15287         (x86_64*): Set targ_extra_obj and targ_extra_size.
15288         * configure: Rebuild.
15289
15290         * object.cc (Sized_relobj::include_section_group): Adjust section
15291         indexes read from group data.  Build vector to pass to
15292         layout_group.
15293         * layout.cc (Layout::layout_group): Add flags and shndxes
15294         parameters.  Remove contents parameter.  Change caller.  Update
15295         explicit instantiations.
15296         * layout.h (class Layout): Update layout_group declaration.
15297         * output.cc (Output_data_group::Output_data_group): Add flags and
15298         input_shndxes parameters.  Remove contents parameter.  Change
15299         caller.
15300         (Output_data_group::do_write): Change input_sections_ to
15301         input_shndxes_.
15302         * output.h (class Output_data_group): Update constructor
15303         declaration.  Rename input_sections_ to input_shndxes_.
15304         * testsuite/many_sections_test.cc: Add template.
15305
15306 2008-04-30  Cary Coutant  <ccoutant@google.com>
15307
15308         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15309
15310         * layout.cc (Layout::include_section): Refactored check for debug
15311         info section.
15312         (Layout::add_comdat): Add new parameters.  Change type
15313         of signature parameter.  Add object and shndx to signatures table.
15314         (Layout::find_kept_object): New function.
15315         * layout.h: Include <cstring>.
15316         (Layout::is_debug_info_section): New function.
15317         (Layout::add_comdat): Add new parameters.
15318         (Layout::find_kept_object): New function.
15319         (Layout::Kept_section): New struct.
15320         (Layout::Signatures): Change type of map range.
15321         * object.cc (Relobj::output_section_address): New function.
15322         (Sized_relobj::include_section_group): Add new parameters.  Change
15323         calls to Layout::add_comdat.  Change to build table of kept comdat
15324         groups and table mapping discarded sections to kept sections.
15325         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15326         (Sized_relobj::do_layout): Change calls to include_section_group and
15327         include_linkonce_section.
15328         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15329         value to zero when section is discarded.
15330         (Sized_relobj::map_to_kept_section): New function.
15331         * object.h (Relobj::output_section_address): New function.
15332         (Relobj::Comdat_group): New type.
15333         (Relobj::find_comdat_group): New function.
15334         (Relobj::Comdat_group_table): New type.
15335         (Relobj::Kept_comdat_section): New type.
15336         (Relobj::Kept_comdat_section_table): New type.
15337         (Relobj::add_comdat_group): New function.
15338         (Relobj::set_kept_comdat_section): New function.
15339         (Relobj::get_kept_comdat_section): New function.
15340         (Relobj::comdat_groups_): New field.
15341         (Relobj::kept_comdat_sections_): New field.
15342         (Symbol_value::input_value): Update comment.
15343         (Sized_relobj::map_to_kept_section) New function.
15344         (Sized_relobj::include_linkonce_section): Add new parameter.
15345         * target-reloc.h (Comdat_behavior): New type.
15346         (get_comdat_behavior): New function.
15347         (relocate_section): Add code to map a discarded section to the
15348         corresponding kept section when applying a relocation.
15349
15350 2008-04-30  Craig Silverstein  <csilvers@google.com>
15351
15352         * dwarf_reader.cc (next_generation_count): New static var.
15353         (Addr2line_cache_entry): New struct.
15354         (addr2line_cache): New static var.
15355         (Dwarf_line_info::one_addr2line): Added caching.
15356         (Dwarf_line_info::clear_addr2line_cache): New function.
15357         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15358         cache-size parameter.
15359         (Dwarf_line_info::one_addr2line_cache): New function.
15360         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15361         new cache-size argument to one_addr2line(), and clear cache.
15362
15363 2008-04-28  Cary Coutant  <ccoutant@google.com>
15364
15365         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15366         R_386_PC8 relocations.
15367
15368 2008-04-23  Ian Lance Taylor  <iant@google.com>
15369
15370         * object.cc (Sized_relobj::include_section_group): Check for
15371         invalid section group.
15372
15373         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15374         header size.
15375
15376         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15377         than read for file header.
15378         * archive.cc (Archive::include_member): Likewise.
15379
15380 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15381
15382         * aclocal.m4: Regenerate.
15383         * configure: Regenerate.
15384
15385 2008-04-19  Ian Lance Taylor  <iant@google.com>
15386
15387         * version.cc (version_string): Bump to 1.6.
15388
15389         * testsuite/Makefile.am (many_sections_r_test): New target.
15390         (many_sections_r_test_SOURCES): Remove.
15391         (many_sections_r_test_DEPENDENCIES): Remove.
15392         (many_sections_r_test_LDFLAGS): Remove.
15393         (many_sections_r_test_LDADD): Remove.
15394
15395         * object.cc (Sized_relobj::do_add_symbols): Always pass
15396         local_symbol_count_ to add_from_relobj.
15397
15398         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15399         every thousand variables.
15400         * testsuite/Makefile.in: Rebuild.
15401
15402         * object.cc (Xindex::initialize_symtab_xindex): New function.
15403         (Xindex::read_symtab_xindex): New function.
15404         (Xindex::sym_xindex_to_shndx): New function.
15405         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15406         available.
15407         (Sized_relobj::do_initialize_xindex): New function.
15408         (Sized_relobj::do_read_symbols): Adjust section links.
15409         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15410         parameter.  Change all callers.
15411         (Sized_relobj::include_section_group): Adjust section links and
15412         symbol section indexes.
15413         (Sized_relobj::do_layout): Adjust section links.
15414         (Sized_relobj::do_count_local_symbols): Adjust section links and
15415         symbol section indexes.
15416         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15417         ordinary and special symbols.
15418         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15419         dynsym_xindex parameters.  Change all callers.  Adjust section
15420         links.  Use SHN_XINDEX when needed.
15421         (Sized_relobj::get_symbol_location_info): Adjust section links.
15422         Don't get fooled by special symbols.
15423         * object.h (class Xindex): Define.
15424         (class Object): Add xindex_ parameter.  Declare virtual functoin
15425         do_initialize_xindex.
15426         (Object::adjust_sym_shndx): New function.
15427         (Object::set_xindex): New protected function.
15428         (class Symbol_value): Add is_ordinary_shndx_ field.
15429         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15430         (Symbol_value::value): Assert ordinary section.
15431         (Symbol_value::initialize_input_to_output_map): Likewise.
15432         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15433         Change all callers.
15434         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15435         all callers.
15436         (class Sized_relobj): Update declarations.
15437         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15438         parameter.  Change all callers.
15439         (Sized_relobj::adjust_shndx): New function.
15440         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15441         field.
15442         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15443         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15444         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15445         (Sized_dynobj::read_dynsym_section): Adjust section links.
15446         (Sized_dynobj::read_dynamic): Likewise.
15447         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15448         section links.
15449         (Sized_dynobj::do_initialize_xindex): New function.
15450         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15451         do_initialize_xindex.
15452         (Sized_dynobj::adjust_shndx): New function.
15453         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15454         dynsym_xindex_ fields.
15455         (Layout::finalize): Add a call to set_section_indexes before
15456         creating the symtab sections.
15457         (Layout::set_section_indexes): Don't do anything if the section
15458         already has a section index.
15459         (Layout::create_symtab_sections): Add shnum parameter.  Change
15460         caller.  Create .symtab_shndx section if needed.
15461         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15462         caller.
15463         (Layout::allocated_output_section_count): New function.
15464         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15465         needed.
15466         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15467         fields.  Update declarations.
15468         (Layout::symtab_xindex): New function.
15469         (Layout::dynsym_xindex): New function.
15470         (class Write_symbols_task): Add layout_ field.
15471         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15472         Change caller.
15473         * output.cc (Output_section_headers::Output_section_headers): Add
15474         shstrtab_section parameter.  Change all callers.
15475         (Output_section_headers::do_sized_write): Store overflow values
15476         for section count and section string table section index in
15477         section header zero.
15478         (Output_file_header::do_sized_write): Check for overflow of
15479         section count and section string table section index.
15480         (Output_symtab_xindex::do_write): New function.
15481         (Output_symtab_xindex::endian_do_write): New function.
15482         * output.h (class Output_section_headers): Add shstrtab_section_.
15483         Update declarations.
15484         (class Output_symtab_xindex): Define.
15485         (Output_section::has_out_shndx): New function.
15486         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15487         field.
15488         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15489         Change all callers.
15490         (Sized_symbol::init): Likewise.
15491         (Symbol::output_section): Check for ordinary symbol.
15492         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15493         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15494         callers.
15495         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15496         Change all callers.  Simplify handling of symbols from sections
15497         not included in the link.
15498         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15499         distinction.
15500         (Weak_alias_sorter::operator()): Assert that symbols are
15501         ordinary.
15502         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15503         distinction.
15504         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15505         parameters.  Change all callers.
15506         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15507         symbol distinction.  Use SHN_XINDEX when needed.
15508         (Symbol_table::write_section_symbol): Add symtab_xindex
15509         parameter.  Change all callers.
15510         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15511         SHN_XINDEX when needed.
15512         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15513         declarations.
15514         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15515         (Symbol::is_defined): Check is_ordinary.
15516         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15517         (Symbol::is_absolute, Symbol::is_common): Likewise.
15518         (class Sized_symbol): Update declarations.
15519         (class Symbol_table): Update declarations.
15520         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15521         parameters.  Change all callers.
15522         (Sized_symbol::override): Likewise.
15523         (Symbol_table::override): Likewise.
15524         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15525         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15526         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15527         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15528         to be in an ordinary section.
15529         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15530         object and is_ordinary parameters.  Change all callers.
15531         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15532         Change all callers.  Don't add undefined or non-ordinary symbols
15533         to reloc_map_.
15534         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15535         Change all callers.
15536         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15537         declarations.
15538         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15539         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15540         (Sized_relobj::relocate_sections): Likewise.
15541         * target-reloc.h (scan_relocs): Adjust section symbol index.
15542         (scan_relocatable_relocs): Likewise.
15543         * i386.cc (Scan::local): Check for ordinary symbols.
15544         * sparc.cc (Scan::local): Likewise.
15545         * x86_64.cc (Scan::local): Likewise.
15546         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15547         to symbol_section_and_value.
15548         * testsuite/many_sections_test.cc: New file.
15549         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15550         (check_PROGRAMS): Add many_sections_test.
15551         (many_sections_test_SOURCES): Define.
15552         (many_sections_test_DEPENDENCIES): Define.
15553         (many_sections_test_LDFLAGS): Define.
15554         (BUILT_SOURCES): Add many_sections_define.h.
15555         (many_sections_define.h): New target.
15556         (BUILT_SOURCES): Add many_sections_check.h.
15557         (many_sections_check.h): New target.
15558         (check_PROGRAMS): Add many_sections_r_test.
15559         (many_sections_r_test_SOURCES): Define.
15560         (many_sections_r_test_DEPENDENCIES): Define.
15561         (many_sections_r_test_LDFLAGS): Define.
15562         (many_sections_r_test_LDADD): Define.
15563         (many_sections_r_test.o): New target.
15564         * testsuite/Makefile.in: Rebuild.
15565
15566 2008-04-17  Cary Coutant  <ccoutant@google.com>
15567
15568         * errors.cc (Errors::info): New function.
15569         (gold_info): New function.
15570         * errors.h (Errors::info): New function.
15571         * gold.h (gold_info): New function.
15572         * object.cc (Input_objects::add_object): Print trace output.
15573         * options.cc (options::parse_set): New function.
15574         (General_options::parse_wrap): Deleted.
15575         (General_options::General_options): Deleted initializer.
15576         * options.h (options::String_set): New typedef.
15577         (options::parse_set): New function.
15578         (DEFINE_set): New macro.
15579         (General_options::wrap): Changed to use DEFINE_set. Changed
15580         callers of any_wrap_symbols and is_wrap_symbol.
15581         (General_options::trace, General_options::trace_symbol):
15582         New options.
15583         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15584         (General_options::wrap_symbols_): Deleted.
15585         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15586
15587 2008-04-17  David S. Miller  <davem@davemloft.net>
15588
15589         * options.cc (General_options::parse_V): New function.
15590         * options.h: Add entries for -V and -Qy.
15591
15592 2008-04-17  Ian Lance Taylor  <iant@google.com>
15593
15594         * common.cc (Symbol_table::allocate_commons): Remove options
15595         parameter.  Change caller.
15596         (Symbol_table::do_allocate_commons): Remove options parameter.
15597         Change caller.  Just call do_allocate_commons_list twice.
15598         (Symbol_table::do_allocate_commons_list): New function, broken out
15599         of do_allocate_commons.
15600         * common.h (class Allocate_commons_task): Remove options_ field.
15601         Update constructor.
15602         * symtab.cc (Symbol_table::Symbol_table): Initialize
15603         tls_commons_.
15604         (Symbol_table::add_from_object): Put TLS common symbols on
15605         tls_commons_ list.
15606         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15607         which are IN_OUTPUT_DATA.
15608         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15609         allocate_commons and do_allocate_commons declarations.  Declare
15610         do_allocate_commons_list.
15611         * gold.cc (queue_middle_tasks): Update creation of
15612         Allocate_commons_task to not pass options.
15613         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15614         (TLS_TEST_C_FLAGS): New variable.
15615         (tls_test_c_pic.o): New target.
15616         (tls_test_shared.so): Link in tls_test_c_pic.o.
15617         (tls_test_c_pic_ie.o): New target.
15618         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15619         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15620         (tls_test_c.o): New target.
15621         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15622         (tls_pic_test_LDADD): Likewise.
15623         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15624         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15625         (tls_test_c_gnu2.o): New target.
15626         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15627         tls_test_c_gnu2.o.
15628         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15629         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15630         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15631         * testsuite/tls_test.cc: Include "config.h".
15632         (t_last): Call t11_last.
15633         * testsuite/tls_test.h (t11, t11_last): Declare.
15634         * testsuite/tls_test_c.c: New file.
15635         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15636         * configure.ac: Check for OpenMP support.
15637         * configure, config.in, Makefile.in: Rebuild.
15638         * testsuite/Makefile.in: Rebuild.
15639
15640 2008-04-16  Cary Coutant  <ccoutant@google.com>
15641
15642         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15643         (Target_i386::tls_base_symbol_defined_): New field.
15644         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15645         (Target_i386::Scan::global): Likewise.
15646         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15647         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15648         (Target_x86_64::tls_base_symbol_defined_): New field.
15649         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15650         (Target_x86_64::Scan::global): Likewise.
15651
15652 2008-04-16  Cary Coutant  <ccoutant@google.com>
15653
15654         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15655         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15656         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15657         building shared libraries.
15658         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15659         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15660         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15661         * testsuite/Makefile.in: Rebuild.
15662         * testsuite/weak_undef.h: New file.
15663         * testsuite/weak_undef_file1.cc: Add extra test cases.
15664         * testsuite/weak_undef_file2.cc: Likewise.
15665         * testsuite/weak_undef_test.cc: Likewise.
15666
15667 2008-04-16  David S. Miller  <davem@davemloft.net>
15668
15669         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15670         Add issued_non_pic_error_ field.  Declare check_non_pic.
15671         (Target_sparc::Scan::check_non_pic): New function.
15672         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15673         (Target_sparc::Scan::global): Likewise.
15674
15675         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15676         * configure: Rebuild.
15677
15678         * options.h (DEFINE_enable): New macro.
15679         (new_dtags): New enable option.
15680         (initfirst, interpose, loadfltr, nodefaultlib,
15681         nodelete, nodlopen, nodump): New -z options.
15682         * layout.cc (Layout:finish_dynamic_section): If new
15683         dtags enabled, emit DT_RUNPATH.  Also, emit a
15684         DT_FLAGS_1 containing any specified -z flags.
15685
15686 2008-04-16  Ian Lance Taylor  <iant@google.com>
15687
15688         * copy-relocs.cc: New file.
15689         * copy-relocs.h: New file.
15690         * reloc.cc: Remove Copy_relocs code.
15691         * reloc.h: Likewise.
15692         * reloc-types.h (struct Reloc_types) [both versions]: Add
15693         get_reloc_addend_noerror.
15694         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15695         variants of add_global which take an addend which must be zero.
15696         * i386.cc: Include "copy-relocs.h".
15697         (class Target_i386): Change type of copy_relocs_ to variable,
15698         update initializer.
15699         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15700         Change all callers.
15701         (Target_i386::do_finalize_sections): Change handling of
15702         copy_relocs_.
15703         * sparc.cc: Include "copy-relocs.h".
15704         (class Target_sparc): Change type of copy_relocs_ to variable,
15705         update initializer.
15706         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15707         Change all callers.
15708         (Target_sparc::do_finalize_sections): Change handling of
15709         copy_relocs_.
15710         * x86_64.cc: Include "copy-relocs.h".
15711         (class Target_x86_64): Change type of copy_relocs_ to variable,
15712         update initializer.
15713         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15714         class.  Change all callers.
15715         (Target_x86_64::do_finalize_sections): Change handling of
15716         copy_relocs_.
15717         * Makefile.am (CCFILES): Add copy-relocs.cc.
15718         (HFILES): Add copy-relocs.h.
15719
15720         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15721
15722         * testsuite/script_test_4.sh: Permit leading zeroes.
15723
15724 2008-04-15  Ian Lance Taylor  <iant@google.com>
15725
15726         * script-sections.cc (Script_sections::create_segments): Use
15727         header_size_adjustment even when there is enough room for the
15728         headers.
15729         * testsuite/script_test_4.sh: New file.
15730         * testsuite/script_test_4.t: New file.
15731         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15732         (check_DATA): Add script_test_4.stdout.
15733         (MOSTLYCLEANFILES): Likewise.
15734         (script_test_4): New target.
15735         (script_test_4.stdout): New target.
15736         * testsuite/Makefile.in: Rebuild.
15737
15738         * sparc.cc: Add definitions for Output_data_plt_sparc class
15739         constants.
15740
15741 2008-04-14  David S. Miller  <davem@davemloft.net>
15742
15743         * sparc.cc: New file.
15744         * Makefile.am (TARGETSOURCES): Add sparc.cc
15745         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15746         * configure.tgt: Document targ_extra_size and
15747         targ_extra_big_endian.  Add entries for sparc-* and
15748         sparc64-*.
15749         * configure.ac: Handle targ_extra_size and
15750         targ_extra_big_endian.
15751         * Makefile.in: Rebuild.
15752         * configure: Likewise.
15753         * po/POTFILES.in: Likewise.
15754         * po/gold.pot: Likewise.
15755
15756 2008-04-14  Ian Lance Taylor  <iant@google.com>
15757
15758         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15759         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15760         in the name/type/flags to section mapping.  Don't call
15761         allocate_output_section.
15762         (Layout::choose_output_section): Change parameter from adjust_name
15763         to is_input_section.  Don't permit input sections after sections
15764         are attached to segments.  Don't call allocate_output_section.
15765         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15766         not write_enable_output_section.
15767         (Layout::make_output_section): Don't push to
15768         unattached_section_list_ nor call attach_to_segment.  Call
15769         attach_section_to_segment if sections are attached.
15770         (Layout::attach_sections_to_segments): New function.
15771         (Layout::attach_section_to_segment): New function.
15772         (Layout::attach_allocated_section_to_segment): Rename from
15773         attach_to_segment.  Remove flags parameter.
15774         (Layout::allocate_output_section): Remove function.
15775         (Layout::write_enable_output_section): Remove function.
15776         * layout.h (class Layout): Update for above changes.  Add new
15777         field sections_are_attached_.
15778         * output.h (Output_section::update_flags_for_input_section): New
15779         function.
15780         * output.cc (Output_section::add_input_section): Call
15781         update_flags_for_input_section.
15782         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15783
15784 2008-04-11  Cary Coutant  <ccoutant@google.com>
15785
15786         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15787         thought unnecessary.
15788         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15789
15790 2008-04-11  Ian Lance Taylor  <iant@google.com>
15791
15792         * output.h (class Output_section_data): Remove inline definition
15793         of set_addralign.
15794         * output.cc (Output_section_data::set_addralign): New function.
15795
15796 2008-04-11  Cary Coutant  <ccoutant@google.com>
15797
15798         Add support for TLS descriptors for i386 and x86_64.
15799         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15800         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15801         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15802         GOT_TYPE_TLS_DESC.
15803         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15804         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15805         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15806         relocations.
15807         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15808         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15809         Fix problem with initial-exec relocations.
15810         (Target_i386::Relocate::relocate_tls): Likewise.
15811         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15812         relaxation.
15813         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15814         support for section-plus-offset dynamic table entries.
15815         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15816         (Output_data_dynamic::Dynamic_entry): Add support for
15817         section-plus-offset dynamic table entries.
15818         (Output_data_dynamic::Classification): Likewise.
15819         (Output_data_dynamic::classification_): Renamed offset_.
15820         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15821         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15822         (Target_x86_64::make_plt_section): New function.
15823         (Target_x86_64::reserve_tlsdesc_entries): New function.
15824         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15825         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15826         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15827         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15828         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15829         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15830         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15831         add extra PLT entry for TLS descriptors.
15832         (Output_data_plt_x86_64::got_): New field.
15833         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15834         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15835         fields.
15836         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15837         descriptors.
15838         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15839         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15840         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15841         R_386_TLS_DESC_CALL relocations.
15842         (Target_x86_64::Scan::global): Likewise.
15843         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15844         for TLS descriptors.
15845         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15846         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15847         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15848         GD-to-IE relaxation.
15849         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15850         and TLS_DESCRIPTORS.
15851         * Makefile.in: Rebuild.
15852         * configure: Rebuild.
15853         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15854         (tls_test_shared2.so): New target.
15855         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15856         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15857         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15858         (tls_shared_gd_to_ie_test_LDADD): New variable.
15859         (tls_shared_gnu2_gd_to_ie_test): New target.
15860         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15861         New targets.
15862         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15863         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15864         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15865         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15866         (tls_shared_gnu2_test): New target.
15867         (tls_test_gnu2_shared.so): New target.
15868         (tls_shared_gnu2_test_SOURCES): New variable.
15869         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15870         (tls_shared_gnu2_test_LDFLAGS): New variable.
15871         (tls_shared_gnu2_test_LDADD): New variable.
15872         * testsuite/Makefile.in: Rebuild.
15873         * testsuite/Makefile.
15874
15875 2008-04-11  Ian Lance Taylor  <iant@google.com>
15876
15877         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15878         justsyms.t.
15879         * testsuite/Makefile.in: Rebuild.
15880
15881         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15882         long.
15883         * testsuite/script_test_2.cc (main): Adjust test.
15884
15885 2008-04-11  David S. Miller  <davem@davemloft.net>
15886             Ian Lance Taylor  <iant@google.com>
15887
15888         * options.h (General_options): Add entries for '-Y' and
15889         '-relax'.
15890         * options.cc (General_options:finalize): If -Y was used, add those
15891         entries to the library path instead of the default "/lib" and
15892         "/usr/lib".
15893
15894 2008-04-11  David S. Miller  <davem@davemloft.net>
15895
15896         * testsuite/justsyms.t: Start at 0x100.
15897         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15898         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15899         long.
15900         * testsuite/script_test_2.cc: Adjust string and section length
15901         checks.
15902
15903 2008-04-09  Ian Lance Taylor  <iant@google.com>
15904
15905         PR gold/5996
15906         * script-sections.cc (Sections_element::allocate_to_segment): Add
15907         orphan parameter.
15908         (Output_section_definition::allocate_to_segment): Likewise.
15909         (Orphan_output_section::allocate_to_segment): Likewise.
15910         (Script_sections::attach_sections_using_phdrs_clause): Don't
15911         propagate non-PT_LOAD segments to orphan sections.
15912         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15913         readelf rather than objdump.
15914         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15915         .interp section and PT_INTERP segment are the same size.
15916         * testsuite/Makefile.in: Rebuild.
15917
15918         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15919         aliases for symbols defined in the same object.
15920         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15921         (weak_alias_test_SOURCES): New variable.
15922         (weak_alias_test_DEPENDENCIES): New variable.
15923         (weak_alias_test_LDFLAGS): New variable.
15924         (weak_alias_test_LDADD): New variable.
15925         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15926         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15927         (weak_alias_test_3.o): New target.
15928         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15929         * testsuite/weak_alias_test_main.cc: New file.
15930         * testsuite/weak_alias_test_1.cc: New file.
15931         * testsuite/weak_alias_test_2.cc: New file.
15932         * testsuite/weak_alias_test_3.cc: New file.
15933
15934 2008-04-08  Ian Lance Taylor  <iant@google.com>
15935
15936         * options.h (class General_options): Add --noinhibit-exec option.
15937         * main.cc (main): Check --noinhibit-exec.
15938
15939         * options.h (class General_options): Define --wrap as a special
15940         option.  Add wrap_symbols_ field.
15941         (General_options::any_wrap_symbols): New function.
15942         (General_options::is_wrap_symbol): New function.
15943         * options.cc (General_options::parse_wrap): New function.
15944         (General_options::General_options): Initialize wrap_symbols_.
15945         * symtab.cc (Symbol_table::wrap_symbol): New function.
15946         (Symbol_table::add_from_object): Handle --wrap.
15947         * symtab.h (class Symbol_table): Declare wrap_symbol.
15948         * target.h (Target::wrap_char): New function.
15949         (Target::Target_info): Add wrap_char field.
15950         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15951         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15952         * testsuite/testfile.cc (Target_test::test_target_info):
15953         Likewise.
15954
15955         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15956         there is one.
15957
15958         * layout.h (class Layout): Add added_eh_frame_data_ field.
15959         * layout.cc (Layout::Layout): Initialize new field.
15960         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15961         output section until we find a section we merged successfully.
15962         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15963         that the size be non-zero.
15964
15965         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15966         qualifier.
15967
15968 2008-04-08  Craig Silverstein  <csilvers@google.com>
15969
15970         * configure.ac: Export new conditional variable HAVE_ZLIB.
15971         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15972         on HAVE_ZLIB.
15973         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15974         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15975
15976 2008-04-07  Ian Lance Taylor  <iant@google.com>
15977
15978         * version.cc (version_string): Set to "1.5".
15979
15980         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15981         Add issued_non_pic_error_ field.  Declare check_non_pic.
15982         (Target_x86_64::Scan::check_non_pic): New function.
15983         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15984         (Target_x86_64::Scan::global): Likewise.
15985
15986         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15987         addend parameter.  Change caller.  Handle merge sections.
15988         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15989         Address to Addend.  Don't add in the result of
15990         local_section_offset, pass down the addend and use the returned
15991         value.
15992         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15993         Update declarations of local_section_offset and symbol_value.
15994         * testsuite/two_file_test_1.cc (t18): New function.
15995         * testsuite/two_file_test_2.cc (f18): New function.
15996         * testsuite/two_file_test_main.cc (main): Call t18.
15997         * testsuite/two_file_test.h (t18, f18): Declare.
15998
15999         * configure.ac: Don't test for objdump, c++filt, or readelf.
16000         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
16001         conditionals.
16002         (TEST_READELF): New variable.
16003         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
16004         (check_PROGRAMS): Add two_file_strip_test.
16005         (two_file_strip_test): New target.
16006         (check_PROGRAMS): Add two_file_same_shared_strip_test.
16007         (two_file_same_shared_strip_test_SOURCES): New variable.
16008         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
16009         (two_file_same_shared_strip_test_LDFLAGS): New variable.
16010         (two_file_same_shared_strip_test_LDADD): New variable.
16011         (two_file_shared_strip.so): New target.
16012         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
16013         (ver_test_5.syms, ver_test_7.syms): Likewise.
16014         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
16015         (strip_test_3.stdout): Use TEST_OBJDUMP.
16016         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16017
16018 2008-04-04  Cary Coutant  <ccoutant@google.com>
16019
16020         * symtab.h (Symbol::is_weak_undefined): New function.
16021         (Symbol::is_strong_undefined): New function.
16022         (Symbol::is_absolute): New function.
16023         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
16024         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
16025         absolute symbols.
16026         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
16027         (weak_undef_test): New target.
16028         * testsuite/Makefile.in: Rebuild.
16029         * testsuite/weak_undef_file1.cc: New file.
16030         * testsuite/weak_undef_file2.cc: New file.
16031         * testsuite/weak_undef_test.cc: New file.
16032
16033 2008-04-03  Craig Silverstein  <csilvers@google.com>
16034
16035         * compressed_output.h (class Output_compressed_section): Use
16036         unsigned buffer.
16037         * compressed_output.cc (zlib_compress): Use unsigned buffers,
16038         add zlib header.
16039         (zlib_compressed_suffix): Removed.
16040         (Output_compressed_section::set_final_data_size): Use unsigned
16041         buffers.
16042         * testsuite/Makefile.am (flagstest_compress_debug_sections):
16043         Fix linker invocation.
16044         (flagstest_o_specialfile_and_compress_debug_sections):
16045         Likewise.
16046         * testsuite/Makefile.in: Regenerated.
16047
16048 2008-04-02  David S. Miller  <davem@davemloft.net>
16049
16050         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
16051         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
16052
16053 2008-04-02  Craig Silverstein  <csilvers@google.com>
16054
16055         * TODO: New file.
16056
16057 2008-04-02  Ian Lance Taylor  <iant@google.com>
16058
16059         * fileread.cc (File_read::find_view): Add byteshift and vshifted
16060         parameters.  Update for new key type to views_.  Change all
16061         callers.
16062         (File_read::read): Adjust for byteshift in returned view.
16063         (File_read::add_view): New function, broken out of
16064         find_and_make_view.
16065         (File_read::make_view): New function, broken out of
16066         find_and_make_view.
16067         (File_read::find_or_make_view): Add offset and aligned
16068         parameters.  Rewrite accordingly.  Change all callers.
16069         (File_read::get_view): Add offset and aligned parameters.  Adjust
16070         for byteshift in return value.
16071         (File_read::get_lasting_view): Likewise.
16072         * fileread.h (class File_read): Update declarations.
16073         (class File_read::View): Add byteshift_ field.  Add byteshift to
16074         constructor.  Add byteshift method.
16075         * archive.h (Archive::clear_uncached_views): New function.
16076         (Archive::get_view): Add aligned parameter.  Change all callers.
16077         * object.h (Object::get_view): Add aligned parameter.  Change all
16078         callers.
16079         (Object::get_lasting_view): Likewise.
16080
16081         * fileread.cc (File_read::release): Don't call clear_views if
16082         there are multiple objects.
16083         * fileread.h (File_read::clear_uncached_views): New function.
16084         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
16085         on the archive.
16086
16087 2008-03-31  Cary Coutant  <ccoutant@google.com>
16088
16089         Add thin archive support.
16090         * archive.cc (Archive::armagt): New const.
16091         (Archive::setup): Remove task parameter and calls to unlock.
16092         (Archive::unlock_nested_archives): New function.
16093         (Archive::read_header): Add nested_off parameter. Change
16094         all callers.
16095         (Archive::interpret_header): Likewise.
16096         (Archive::include_all_members): Change to handle thin
16097         archives.
16098         (Archive::include_member): Likewise.
16099         * archive.h (Archive::Archive): Add new parameters and
16100         initializers.
16101         (Archive::armagt): New const.
16102         (Archive::setup): Remove task parameter.
16103         (Archive::unlock_nested_archives): New function.
16104         (Archive::read_header): Add nested_off parameter.
16105         (Archive::interpret_header): Likewise.
16106         (Archive::Nested_archive_table): New typedef.
16107         (Archive::is_thin_archive_): New field.
16108         (Archive::nested_archives_): New field.
16109         (Archive::options_): New field.
16110         (Archive::dirpath_): New field.
16111         (Archive::task_): New field.
16112         * readsyms.cc (Read_symbols::do_read_symbols): Add check
16113         for thin archives.  Pass additional parameters to
16114         Archive::Archive.  Unlock the archive file after calling
16115         Archive::setup.
16116
16117 2008-03-29  Ian Lance Taylor  <iant@google.com>
16118
16119         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
16120         version symbol to be local.
16121         * testsuite/ver_test_4.sh: New file.
16122         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
16123         (check_DATA): Add ver_test_4.syms.
16124         (ver_test_4.syms): New target.
16125         * testsuite/Makefile.in: Rebuild.
16126
16127         * output.cc
16128         (Output_section::Input_section_sort_entry::has_priority): New
16129         function.
16130         (Output_section::Input_section_sort_entry::match_file_name): New
16131         function.
16132         (Output_section::Input_section_sort_entry::match_section_name):
16133         Remove.
16134         (Output_section::Input_section_sort_entry::match_section_name_prefix):
16135         Remove.
16136         (Output_section::Input_section_sort_entry::match_section_file):
16137         Remove.
16138         (Output_section::Input_section_sort_compare::operator()): Rewrite
16139         using new Input_section_sort_entry functions.  Sort crtbegin and
16140         crtend first.  Sort sections with no priority before sections with
16141         a priority.
16142         * testsuite/initpri1.c (d3): Check j != 4.
16143         (cd5): New constructor/destructor function.
16144         (main): Check j != 2.
16145
16146         * symtab.cc (Symbol_table::add_from_object): If we don't use the
16147         new symbol when resolving, don't call set_is_default.
16148         * testsuite/ver_test_7.cc: New file.
16149         * testsuite/ver_test_7.sh: New file.
16150         * testsuite/Makefile.am (ver_test_7.so): New target.
16151         (ver_test_7.o): New target.
16152         (check_SCRIPTS): Add ver_test_7.sh.
16153         (check_DATA): Add ver_test_7.syms.
16154         (ver_test_7.syms): New target.
16155
16156 2008-03-28  Ian Lance Taylor  <iant@google.com>
16157
16158         * layout.cc (Layout::layout): If we see an input section with a
16159         name that needs sorting, set the must_sort flag for the output
16160         section.
16161         (Layout::make_output_section): If the name of the output section
16162         indicates that it might require sorting, set the may_sort flag.
16163         * output.h (Output_section::may_sort_attached_input_sections): New
16164         function.
16165         (Output_section::set_may_sort_attached_input_sections): New
16166         function.
16167         (Output_section::must_sort_attached_input_sections): New
16168         function.
16169         (Output_section::set_must_sort_attached_input_sections): New
16170         function.
16171         (class Output_section): Declare Input_section_sort_entry.  Define
16172         Input_section_sort_compare.  Declare
16173         sort_attached_input_sections.  Add new fields:
16174         may_sort_attached_input_sections_,
16175         must_sort_attached_input_sections_,
16176         attached_input_sections_are_sorted_.
16177         * output.cc (Output_section::Output_section): Initialize new
16178         fields.
16179         (Output_section::add_input_section): Add an entry to
16180         input_sections_ if may_sort or must_sort are true.
16181         (Output_section::set_final_data_size): Call
16182         sort_attached_input_sections if necessary.
16183         (Output_section::Input_section_sort_entry): Define new class.
16184         (Output_section::Input_section_sort_compare::operator()): New
16185         function.
16186         (Output_section::sort_attached_input_sections): New function.
16187         * configure.ac: Check whether the compiler supports constructor
16188         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16189         * testsuite/initpri1.c: New file.
16190         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16191         CONSTRUCTOR_PRIORITY.
16192         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16193         (initpri1_LDFLAGS): New variable.
16194         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16195
16196 2008-03-27  Ian Lance Taylor  <iant@google.com>
16197
16198         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16199         * testsuite/common_test_1.c: New file.
16200         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16201         (common_test_1_SOURCES): New variable.
16202         (common_test_1_DEPENDENCIES): New variable.
16203         (common_test_1_LDFLAGS): New variable.
16204
16205         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16206         and commons_ correctly when NAME/VERSION does not override
16207         NAME/NULL.
16208         * testsuite/ver_test_6.c: New file.
16209         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16210         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16211         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16212
16213 2008-03-26  Ian Lance Taylor  <iant@google.com>
16214
16215         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16216         of an undefined symbol from a version script.
16217         * testsuite/Makefile.am (ver_test_5.so): New target.
16218         (ver_test_5.o): New target.
16219         (check_SCRIPTS): Add ver_test_5.sh.
16220         (check_DATA): Add ver_test_5.syms.
16221         (ver_test_5.syms): New target.
16222         * testsuite/ver_test_5.cc: New file.
16223         * testsuite/ver_test_5.script: New file.
16224         * testsuite/ver_test_5.sh: New file.
16225         * Makefile.in, testsuite/Makefile.in: Rebuild.
16226
16227         PR gold/5986
16228         Fix problems building gold with gcc 4.3.0.
16229         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16230         (gold_error_at_location, gold_warning_at_location): Use it.
16231         * configure.ac: Check whether we can compile and use a template
16232         function with a printf attribute.
16233         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16234         when jumping over bytes.
16235         * object.cc: Instantiate Object::read_section_data.
16236         * debug.h: Include <cstring>
16237         * dwarf_reader.cc: Include <algorithm>
16238         * main.cc: Include <cstring>.
16239         * options.cc: Include <cstring>.
16240         * output.cc: Include <cstring>.
16241         * script.cc: Include <cstring>.
16242         * script.h: Include <string>.
16243         * symtab.cc: Include <cstring> and <algorithm>.
16244         * target-select.cc: Include <cstring>.
16245         * version.cc: Include <string>.
16246         * testsuite/testmain.cc: Include <cstdlib>.
16247         * configure, config.in: Rebuild.
16248
16249 2008-03-25  Ian Lance Taylor  <iant@google.com>
16250
16251         * options.cc: Include "../bfd/bfdver.h".
16252         (options::help): Print bug reporting address.
16253
16254         * version.cc (print_version): Adjust output for current value of
16255         BFD_VERSION_STRING.
16256
16257         * NEWS: New file.
16258
16259         * options.cc (options::help): Print list of supported targets.
16260         * target-select.h: Include <vector>.
16261         (class Target_selector): Make machine_, size_, and is_big_endian_
16262         fields const.  Add bfd_name_ and instantiated_target_ fields.
16263         (Target_selector::Target_selector): Add bfd_name parameter.
16264         (Target_selector::recognize): Make non-virtual, call
16265         do_recognize.
16266         (Target_selector::recognize_by_name): Make non-virtual, call
16267         do_recognize_by_name.
16268         (Target_selector::supported_names): New function.
16269         (Target_selector::bfd_name): New function.
16270         (Target_selector::do_instantiate_target): New pure virtual
16271         function.
16272         (Target_selector::do_recognize): New virtual function.
16273         (Target_selector::do_recognize_by_name): New virtual function.
16274         (Target_selector::instantiate_target): New private function.
16275         (supported_target_names): Declare.
16276         * target-select.cc (Target_selector::Target_selector): Update for
16277         new parameter and fields.
16278         (select_target_by_name): Check that the name matches before
16279         calling recognize_by_name.
16280         (supported_target_names): New function.
16281         * i386.cc (class Target_selector_i386): Update Target_selector
16282         constructor call.  Remove recognize and recognize_by_name.  Add
16283         do_instantiate_target.
16284         * x86_64.cc (class Target_selector_x86_64): Likewise.
16285         * testsuite/testfile.cc (class Target_selector_test): Update for
16286         changes to Target_selector.
16287
16288         * README: Rewrite, with some notes on unsupported features.
16289
16290 2008-03-24  Cary Coutant  <ccoutant@google.com>
16291
16292         * i386.cc (Target_i386::Got_type): New enum declaration.
16293         (Target_i386::Scan::local): Updated callers of Output_data_got
16294         member functions.
16295         (Target_i386::Scan::global): Likewise.
16296         (Target_i386::Relocate::relocate): Likewise.
16297         (Target_i386::Relocate::relocate_tls): Likewise.
16298         * object.h (Got_offset_list): New class.
16299         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16300         (Sized_relobj::local_got_offset): Likewise.
16301         (Sized_relobj::set_local_got_offset): Likewise.
16302         (Sized_relobj::local_has_tls_got_offset): Removed.
16303         (Sized_relobj::local_tls_got_offset): Removed.
16304         (Sized_relobj::set_local_tls_got_offset): Removed.
16305         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16306         * output.cc (Output_data_got::add_global): Added got_type parameter.
16307         (Output_data_got::add_global_with_rel): Likewise.
16308         (Output_data_got::add_global_with_rela): Likewise.
16309         (Output_data_got::add_global_pair_with_rel): New function.
16310         (Output_data_got::add_global_pair_with_rela): New function.
16311         (Output_data_got::add_local): Added got_type parameter.
16312         (Output_data_got::add_local_with_rel): Likewise.
16313         (Output_data_got::add_local_with_rela): Likewise.
16314         (Output_data_got::add_local_pair_with_rel): New function.
16315         (Output_data_got::add_local_pair_with_rela): New function.
16316         (Output_data_got::add_global_tls): Removed.
16317         (Output_data_got::add_global_tls_with_rel): Removed.
16318         (Output_data_got::add_global_tls_with_rela): Removed.
16319         (Output_data_got::add_local_tls): Removed.
16320         (Output_data_got::add_local_tls_with_rel): Removed.
16321         (Output_data_got::add_local_tls_with_rela): Removed.
16322         * output.h (Output_data_got::add_global): Added got_type parameter.
16323         (Output_data_got::add_global_with_rel): Likewise.
16324         (Output_data_got::add_global_with_rela): Likewise.
16325         (Output_data_got::add_global_pair_with_rel): New function.
16326         (Output_data_got::add_global_pair_with_rela): New function.
16327         (Output_data_got::add_local): Added got_type parameter.
16328         (Output_data_got::add_local_with_rel): Likewise.
16329         (Output_data_got::add_local_with_rela): Likewise.
16330         (Output_data_got::add_local_pair_with_rel): New function.
16331         (Output_data_got::add_local_pair_with_rela): New function.
16332         (Output_data_got::add_global_tls): Removed.
16333         (Output_data_got::add_global_tls_with_rel): Removed.
16334         (Output_data_got::add_global_tls_with_rela): Removed.
16335         (Output_data_got::add_local_tls): Removed.
16336         (Output_data_got::add_local_tls_with_rel): Removed.
16337         (Output_data_got::add_local_tls_with_rela): Removed.
16338         * resolve.cc (Symbol::override_base_with_special): Removed
16339         reference to has_got_offset_ field.
16340         * symtab.cc (Symbol::init_fields): Replaced initialization
16341         of got_offset_ with got_offsets_.  Removed initialization
16342         of has_got_offset_
16343         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16344         (Symbol::got_offset): Likewise.
16345         (Symbol::set_got_offset): Likewise.
16346         (Symbol::has_tls_got_offset): Removed.
16347         (Symbol::tls_got_offset): Removed.
16348         (Symbol::set_tls_got_offset): Removed.
16349         (Symbol::got_offset_): Removed.
16350         (Symbol::tls_mod_got_offset_): Removed.
16351         (Symbol::tls_pair_got_offset_): Removed.
16352         (Symbol::got_offsets_): New field.
16353         (Symbol::has_got_offset): Removed.
16354         (Symbol::has_tls_mod_got_offset): Removed.
16355         (Symbol::has_tls_pair_got_offset): Removed.
16356         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16357         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16358         member functions.
16359         (Target_x86_64::Scan::global): Likewise.
16360         (Target_x86_64::Relocate::relocate): Likewise.
16361         (Target_x86_64::Relocate::relocate_tls): Likewise.
16362
16363 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16364
16365         * yyscript.y: Fix spelling error in comment.
16366
16367 2008-03-24  Ian Lance Taylor  <iant@google.com>
16368
16369         * options.h (class General_options): Define build_id option.
16370         * layout.h (class Layout): Declare write_build_id, create_note,
16371         create_build_id.  Add build_id_note_ member.
16372         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16373         "libiberty.h", "md5.h", "sha1.h".
16374         (Layout::Layout): Initialize eh_frame_data_,
16375         eh_frame_hdr_section_, and build_id_note_.
16376         (Layout::finalize): Call create_build_id.
16377         (Layout::create_note): New function, broken out of
16378         Layout::create_gold_note.
16379         (Layout::create_gold_note): Call create_note.
16380         (Layout::create_build_id): New function.
16381         (Layout::write_build_id): New function.
16382         (Close_task_runner::run): Call write_build_id.
16383
16384         * x86_64.cc: Correct license to GPLv3.
16385
16386 2008-03-23  Ian Lance Taylor  <iant@google.com>
16387
16388         * options.cc: Include "demangle.h".
16389         (parse_optional_string): New function.
16390         (parse_long_option): Handle takes_optional_argument.
16391         (parse_short_option): Update dash_z initializer.  Handle
16392         takes_optional_argument.
16393         (General_options::General_options): Initialize do_demangle_.
16394         (General_options::finalize): Set do_demangle_.  Handle demangling
16395         style.
16396         * options.h (parse_optional_string): Declare.
16397         (struct One_option): Add optional_arg field.  Update constructor.
16398         Update call constructor calls.  Add takes_optional_argument
16399         function.
16400         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16401         (DEFINE_optional_string): Define.
16402         (General_options::demangle): Change from DEFINE_bool to
16403         DEFINE_optional_string.
16404         (General_options::no_demangle): New function.
16405         (General_options::do_demangle): New function.
16406         (General_options::set_do_demangle): New function.
16407         (General_options::execstack_status_): Move definition to end of
16408         class definition.
16409         (General_options::static_): Likewise.
16410         (General_options::do_demangle_): New field.
16411         * object.cc (big_endian>::get_symbol_location_info): Call
16412         Options::do_demangle, not Options::demangle.
16413         * symtab.cc (demangle): Likewise.
16414
16415 2008-03-22  Ian Lance Taylor  <iant@google.com>
16416
16417         * gold.h: Include <cstddef> and <sys/types.h>
16418         * options.h: Include <cstring>.
16419
16420 2008-03-21  Ian Lance Taylor  <iant@google.com>
16421
16422         * Added source code to GNU binutils.
16423 \f
16424 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16425
16426 Copying and distribution of this file, with or without modification,
16427 are permitted in any medium without royalty provided the copyright
16428 notice and this notice are preserved.
16429
16430 Local Variables:
16431 mode: change-log
16432 left-margin: 8
16433 fill-column: 74
16434 version-control: never
16435 End: