Misc about gold for aarch64 backend.
[external/binutils.git] / gold / ChangeLog
1 2014-10-29  Han Shen  <shenhan@google.com>
2             Jing Yu   <jingyu@google.com>
3
4         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
5         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
6         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
7         Symbol::TLS_REF.
8         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
9         method.
10         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
11         (Target_aarch64::tls_ld_to_le): New method.
12         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
13         for 64bit targets.
14         (Output_data_plt_aarch64::irelative_rel_): New data member.
15         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
16         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
17         (Output_data_plt_aarch64::add_relocation): New method.
18         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
19         offset. Add got_irelative size to got size.
20         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
21         type string with the new typename.
22         (AArch64_relocate_functions::update_adr): Replace parameter x with
23         immed.
24         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
25         (AArch64_relocate_functions::reloc_common): New method.
26         (AArch64_relocate_funcsions::rela_general): Extract common part out
27         into reloc_common method.
28         (AArch64_relocate_functions::rela_general): Likewise.
29         (AArch64_relocate_functions::pcrela_general): Likewise.
30         (AArch64_relocate_functions::adr): New method.
31         (AArch64_relocate_functions::adrp): Calculate immed before calling
32         update_adr.
33         (AArch64_relocate_functions::adrp): Likewise.
34         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
35         comparing x to 0. Calculate immed from ~x when x < 0.
36         (Target_aarch64::optimize_tls_reloc): Add new cases for
37         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
38         TLSLD_MOVW_DTPREL_G0_NC.
39         (Target_aarch64::possible_function_pointer_reloc): Implement this
40         method.
41         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
42         comment.
43         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
44         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
45         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
46         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
47         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
48         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
49         (Target_aarch64::make_plt_entry): Call add_entry with two more
50         parameters.
51         (Target_aarch64::make_local_ifunc_plt_entry): New method.
52         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
53         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
54         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
55         (Target_aarch64::Relocate::relocate_tls): Add cases for
56         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
57         TLSLD_MOVW_DTPREL_G0_NC.
58         * testsuite/icf_safe_so_test.cc: Correct test comment.
59         * testsuite/icf_safe_test.sh: Add AArch64 arch.
60
61 2014-10-22  Alan Modra  <amodra@gmail.com>
62
63         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
64         thread_starter.
65
66 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
67
68         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
69
70 2014-10-17  Cary Coutant  <ccoutant@google.com>
71
72         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
73         Add "typename" keyword.
74
75 2014-09-22  Han Shen  <shenhan@google.com>
76             Jing Yu   <jingyu@google.com>
77
78         Patch for gold aarch64 backend to support relaxation.
79         * aarch64-reloc.def: Change format.
80         * aarch64.cc (class Reloc_stub): New class.
81         (class Stub_table): New class.
82         (class AArch64_relobj): New class.
83         (class AArch64_input_section): New class.
84         (class AArch64_output_section): New class.
85         (Target_aarch64::new_stub_table): New method.
86         (Target_aarch64::new_aarch64_input_section): New method.
87         (Target_aarch64::find_aarch64_input_section): New method.
88         (Target_aarch64::scan_section_for_stubs): New method.
89         (Target_aarch64::scan_reloc_section_for_stubs): New method.
90         (Target_aarch64::relocate_stub): New method.
91         (Target_aarch64::current_target): New method.
92         (Target_aarch64::do_make_elf_object): New method.
93         (Target_aarch64::do_may_relax): New method.
94         (Target_aarch64::do_relax): New method.
95         (Target_aarch64::group_sections): New method.
96         (Target_aarch64::scan_reloc_for_stub): New method.
97         (Target_aarch64::do_make_output_section): New method.
98         (Target_aarch64::stub_tables_): New data member.
99         (Target_aarch64::aarch64_input_section_map_): New data member.
100         (AArch64_relocate_functions::maybe_apply_stub): New method.
101
102 2014-09-30  Cary Coutant  <ccoutant@google.com>
103
104         PR gold/17432
105         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
106
107 2014-09-30  Kito Cheng  <kito@0xlab.org>
108
109         PR gold/13597
110         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
111         hash table before sysv-style hash table.
112
113 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
114
115         * options.h (--pic-executable): Add negative to alias to -no-pie.
116
117 2014-09-26  Cary Coutant  <ccoutant@google.com>
118
119         PR gold/16773
120         * object.cc (Sized_relobj_file): Compute value of section symbols
121         for TLS sections the same as TLS symbols.
122
123 2014-09-25  Cary Coutant  <ccoutant@google.com>
124
125         PR gold/17432
126         * resolve.cc (Symbol_table::resolve): Override common placeholder
127         symbols, but adjust sizes.
128         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
129         symbols to common lists.
130
131 2014-09-24  Alan Modra  <amodra@gmail.com>
132
133         * po/POTFILES.in: Regenerate.
134
135 2014-09-23  Taiju Tsuiki  <tzik@google.com>
136             Cary Coutant  <ccoutant@google.com>
137
138         PR gold/14860
139         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
140         on input_sections_blocker.
141         * layout.cc (Write_sections_task::locks): Unblock
142         input_sections_blocker_.
143         * layout.h (Write_sections_task::Write_sections_task): Add
144         input_sections_blocker.
145         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
146         to DEPENDENCIES.
147         * testsuite/Makefile.in: Regenerate.
148
149 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
150
151         * testsuite/Makefile.am (plugin_test_10): New test.
152         * testsuite/Makefile.in: Regenerate
153         * testsuite/plugin_common_test_2.c (c1): Align to 8.
154         * testsuite/plugin_test_10.sh: New file.
155
156 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
157
158         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
159         * resolve.cc (Symbol_table::resolve): Don't override common symbols
160         during the replacement phase.
161
162 2014-09-17  Han Shen  <shenhan@google.com>
163             Jing Yu  <jingyu@google.com>
164
165         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
166         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
167         * aarch64.cc (Target_aarch64): Add data members
168         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
169         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
170         constructor.
171         (Target_aarch64::do_reloc_symbol_index): New method.
172         (Target_aarch64::do_reloc_addend): New method.
173         (Target_aarch64::add_tlsdesc_info): New method.
174         (Target_aarch64::do_dynsym_value): New method.
175         (Target_aarch64::do_make_data_plt): Add new parameters: got,
176         got_irelative. Pass them to Output_data_plt_aarch64_standard.
177         (Target_aarch64::make_data_plt): Add new parameters: got,
178         got_irelative. Pass them to do_make_data_plt.
179         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
180         (Target_aarch64::Relocate:tls_gd_to_le): New method.
181         (Target_aarch64::Relocate:tls_ie_to_le): New method.
182         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
183         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
184         (Target_aarch64::got_tlsdesc_section): New method.
185         (Target_aarch64::make_local_ifunc_plt_entry): New method.
186         (Target_aarch64::define_tls_base_symbol): New method.
187         (Target_aarch64::reserve_tlsdesc_entries): New method.
188         (Target_aarch64::got_mod_index_entry): New method.
189         (Target_aarch64::rela_tlsdesc_section): New method.
190         (Target_aarch64::rela_irelative_section): New method.
191         (Target_aarch64::Tlsdesc_info): New struct.
192         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
193         relocations and tlsdesc relocations.
194         (Target_aarch64::optimize_tls_reloc): Implement method.
195         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
196         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
197         in constructor.
198         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
199         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
200         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
201         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
202         (Output_data_plt_aarch64::rela_tlsdesc): New method.
203         (Output_data_plt_aarch64::rela_irelative): New method.
204         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
205         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
206         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
207         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
208         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
209         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
210         (Output_data_plt_aarch64_standard): New member variables:
211         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
212         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
213         New parameter: got, got_irelative.
214         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
215         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
216         (Output_data_plt_aarch64::do_write): Replace got_address with
217         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
218         (AArch64_relocate_functions::update_movnz): New method.
219         (AArch64_relocate_functions): Correct format.
220         (AArch64_relocate_functions::movnz): New method.
221         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
222         before the switch. Add new cases to switch.
223         Check ie_to_le relaxation on tlsie relocations. Add code handling
224         tlsgd tlsdesc cases.
225         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
226         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
227         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
228         Call reloc_name_in_error_message to print unsupported reloc.
229         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
230         make_data_plt.
231         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
232         relocs. Fill in some more dynamic tags.
233         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
234         Skip call tls_get_addr when tlsgd is relaxed.
235         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
236         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
237         tlsdesc->ie relaxation.
238
239 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
240
241         * mips.cc (Target_mips_nacl): New class.
242         (Target_selector_mips_nacl): New class.
243         (target_selector_mips32): Rename from target_selector_mips32be and use
244         Target_selector_mips_nacl instead of Target_selector_mips.
245         (target_selector_mips32el): Rename from target_selector_mips32 and use
246         Target_selector_mips_nacl instead of Target_selector_mips.
247         (target_selector_mips64): Rename from target_selector_mips64be and use
248         Target_selector_mips_nacl instead of Target_selector_mips.
249         (target_selector_mips64el): Rename from target_selector_mips64 and use
250         Target_selector_mips_nacl instead of Target_selector_mips.
251         (Target_mips::mips_info): Add const attribute.
252
253 2014-09-02  Cary Coutant  <ccoutant@google.com>
254
255         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
256         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
257         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
258         (Sized_incr_dynobj::do_section_name): Likewise.
259         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
260         (Sized_incr_dynobj::do_section_name): Likewise.
261         * object.h (Object::section_name): Likewise.
262         (Object::do_section_name): Likewise.
263         (Sized_relobj_file::do_section_name): Likewise.
264         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
265         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
266
267 2014-09-02  Cary Coutant  <ccoutant@google.com>
268
269         PR gold/17005
270         * ehframe.cc (Fde::write): Add output_offset parameter.
271         (Cie::write): Likewise.
272         (Eh_frame::set_final_data_size): Account for offset within output
273         section.
274         (Eh_frame::do_sized_write): Likewise.
275         * ehframe.h (Fde::write): Add output_offset parameter.
276         (Cie::write): Likewise.
277         * output.cc (Output_section::Input_section_sort_entry): Remove
278         section_has_name_; add output_section_name parameter. Use
279         output section name for non-input sections.
280         (Output_section::Input_section_sort_entry::section_has_name): Remove.
281         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
282         (Output_section::Input_section_sort_compare): Remove logic for
283         sections without names.
284         (Output_section::Input_section_sort_init_fini_compare): Likewise.
285         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
286         Likewise.
287         (Output_section::Input_section_sort_section_name_compare): Likewise.
288
289 2014-08-29 Han Shen <shenhan@google.com>
290            Jing Yu <jingyu@google.com>
291
292         * aarch64-reloc-property.cc
293         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
294         reference reloc property in the table.
295         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
296         3 other entries.
297         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
298         2 new overloaded methods.
299         (Output_data_got_aarch64::do_write): Add code to write out
300         static relocs.
301         (class Output_data_got_aarch64::Static_reloc): New class to wrap
302         static relocs.
303         (Output_data_got_aarch64::static_relocs): New vector to
304         hold static relocs.
305         (Target_aarch64::TCB_SIZE): New const static memeber.
306         (Target_aarch64::tcb_size): New method.
307         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
308         (Target_aarch64::Relocate::relocate_tls): New method.
309         (Target_aarch64::Scan::local): Add code handling new reloc types.
310         (Target_aarch64::Scan::global): Add code handling new reloc types.
311
312 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
313
314         * options.h (-no-pie): Add option.
315
316 2014-08-08  Jing Yu  <jingyu@google.com>
317             Han Shen  <shenhan@google.com>
318
319         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
320         (DEFFILES): add aarch64-reloc.def.
321         (TARGETSOURCES): Add aarch64-reloc-property.cc.
322         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
323         * Makefile.in: Regenerate.
324         * aarch64-reloc-property.cc: New file.
325         * aarch64-reloc-property.h: New file.
326         * aarch64-reloc.def: New file.
327         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
328         with tab to make the format consistent.
329         (Output_data_got_aarch64::symbol_table_): New method.
330         (Target_aarch64::do_plt_address_for_global): New method.
331         (Target_aarch64::do_plt_address_for_local): New method.
332         (Target_aarch64::do_select_as_default_target): New method.
333         (Target_aarch64::do_make_data_plt): New method.
334         (Target_aarch64::make_data_plt): New method.
335         (Output_data_plt_aarch64::has_irelative_section): New method.
336         (Output_data_plt_aarch64::address_for_global): New method.
337         (Output_data_plt_aarch64::address_for_local): New method.
338         (Output_data_plt_aarch64::irelative_rel_): New parameter.
339         (Output_data_plt_aarch64::add_entry): Implement contents.
340         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
341         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
342         the got_pov entry to plt0.
343         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
344         Implement contents.
345         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
346         (AArch64_howto): New struct.
347         (aarch64_howto[]): New static const array.
348         (AArch64_relocate_functions): New class.
349         (Target_aarch64::Scan::get_reference_flags): Remove method.
350         (Target_aarch64::Scan::local): Implement to support a few relocations.
351         (Target_aarch64::Scan::global): Implement to support a few relocations.
352         (Target_aarch64::make_plt_section): Implement contents.
353         (Target_aarch64::make_plt_entry): Implement contents.
354         (Target_aarch64::do_finalize_sections): Implement contents.
355         (Target_aarch64::Relocate::relocate): Implement a few relocations.
356         (Target_aarch64::relocate_section): Implement contents.
357
358 2014-08-06  Alan Modra  <amodra@gmail.com>
359
360         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
361
362 2014-08-06  Alan Modra  <amodra@gmail.com>
363
364         PR 13227
365         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
366
367 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
368
369         * object.cc (Relobj::is_section_name_included): Add
370         ".rodata.nptl_version" to not garbage collect this section.
371
372 2014-07-08  Cary Coutant  <ccoutant@google.com>
373
374         * expression.cc (struct Expression::Expression_eval_info): Add
375         new fields type_pointer, vis_pointer, and nonvis_pointer.
376         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
377         nonvis_pointer parameters. Adjust all calls.
378         (Symbol_expression::value): Update type, visibility, and nonvis bits
379         in caller.
380         * script.cc (Symbol_assignment::sized_finalize): Update type,
381         visibility, and remaining st_other bits for new symbol.
382         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
383         vis_pointer, and nonvis_pointer parameters.
384         * symtab.h (Symbol::set_type): New method.
385
386         * testsuite/Makefile.am (defsym_test): New test.
387         * testsuite/Makefile.in: Regenerate.
388         * testsuite/defsym_test.c: New file.
389         * testsuite/defsym_test.sh: New file.
390
391 2014-07-08  Cary Coutant  <ccoutant@google.com>
392
393         PR gold/15639
394         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
395         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
396         (Sized_dynobj::base_read_symbols): ...new method.
397         * object.h (Sized_relobj_file::base_read_symbols): New method.
398         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
399         (Sized_relobj_file::base_read_symbols): ...new method.
400         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
401         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
402         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
403
404 2014-07-04  Alan Modra  <amodra@gmail.com>
405
406         * po/POTFILES.in: Regenerate.
407
408 2014-07-02  Jing Yu  <jingyu@google.com>
409
410         * aarch64.cc: New file
411         * Makefile.am (TARGETSOURCES): Add aarch64.cc
412         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
413         * Makefile.in: Regenerate.
414         * configure.tgt: Add entries for aarch64*.
415         * configure.ac:  Likewise.
416         * configure: Likewise.
417
418 2014-06-27  Alan Modra  <amodra@gmail.com>
419
420         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
421
422 2014-06-24  Cary Coutant  <ccoutant@google.com>
423
424         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
425         sections.
426         (Dwo_file::sized_read_unit_index): Likewise.
427
428 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
429
430         * mips.cc: New file.
431         * Makefile.am (TARGETSOURCES): Add mips.cc
432         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
433         * configure.tgt: Add entries for mips*.
434         * configure.ac: Likewise.
435         * Makefile.in: Regenerate.
436         * configure: Likewise.
437
438 2014-06-09  Cary Coutant  <ccoutant@google.com>
439
440         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
441         unit_length is within section bounds.
442
443 2014-06-09  Cary Coutant  <ccoutant@google.com>
444
445         PR gold/16980
446         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
447         map.
448
449 2014-06-07  Alan Modra  <amodra@gmail.com>
450
451         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
452
453 2014-06-06  Cary Coutant  <ccoutant@google.com>
454
455         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
456         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
457         (Dwarf_pubnames_table::read_header): Likewise.
458         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
459         .debug_gnu_pubtypes.
460
461 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
462
463         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
464         * Makefile.in, configure: Regenerate.
465
466 2014-06-03  Alan Modra  <amodra@gmail.com>
467
468         * powerpc.cc (addis_12_2): Define.
469         (Stub_table::do_write): Support fusion on ELFv2 stubs.
470
471 2014-06-03  Alan Modra  <amodra@gmail.com>
472
473         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
474         st_other output.
475
476 2014-06-02  Alan Modra  <amodra@gmail.com>
477
478         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
479         Only ignore relocs on ELFv1.
480         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
481
482 2014-05-30  Cary Coutant  <ccoutant@google.com>
483
484         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
485         * testsuite/Makefile.in: Regenerate.
486         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
487
488 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
489
490         PR gold/16945
491         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
492         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
493
494 2014-05-15  Alan Modra  <amodra@gmail.com>
495
496         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
497         Compare FDE contents with DW_CFA_nop rather than 0.
498
499 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
500
501         * symtab.h (may_need_copy_reloc): Remove check for position independent
502         code.
503         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
504         position independence before pc absolute may_need_copy_reloc call.
505         Add check for executable output befor pc relative may_need_copy_reloc
506         call.
507         * i386.cc: Ditto.
508         * arm.cc: Ditto.
509         * sparc.cc: Ditto.
510         * tilegx.cc: Ditto.
511         * powerpc.cc: Add check for no position independence before
512         may_need_copy_reloc calls.
513         * testsuite/pie_copyrelocs_test.cc: New file.
514         * testsuite/pie_copyrelocs_shared_test.cc: New file.
515         * Makefile.am (pie_copyrelocs_test): New test.
516         * Makefile.in: Regenerate.
517
518 2014-05-08  Martin Liška  <mliska@suse.cz>
519
520         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
521
522 2014-05-06  Cary Coutant  <ccoutant@google.com>
523
524         PR gold/16900
525         * i386.cc (Output_data_got_plt_i386): New class.
526         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
527         parameter. Change all callers.
528         (Output_data_plt_i386::layout_): Remove.
529         (Output_data_plt_i386::got_plt_): Change type.
530         (Target_i386::got_plt_): Change type. Change all references.
531         (Target_i386::got_section): Create instance of new class.
532         (Output_data_got_plt_i386::do_write): New function.
533         * x86_64.cc (Output_data_got_plt_x86_64): New class.
534         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
535         parameter. Change all callers.
536         (Output_data_plt_x86_64::layout_): Remove.
537         (Output_data_plt_x86_64::got_plt_): Change type.
538         (Target_x86_64::got_plt_): Change type. Change all references.
539         (Target_x86_64::got_section): Create instance of new class.
540         (Output_data_got_plt_x86_64::do_write): New function.
541         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
542         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
543         class.
544
545 2014-05-05  Cary Coutant  <ccoutant@google.com>
546
547         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
548         if we have pubnames/pubtypes.
549
550 2014-05-02  Cary Coutant  <ccoutant@google.com>
551
552         * defstd.cc (in_segment): Define __ehdr_start here...
553         * layout.cc (Layout::finalize): ...Instead of here.  Set the
554         output segment when known.
555         * resolve.cc (Symbol::override_base_with_special): Remember
556         the original binding.
557         * symtab.cc (Symbol::set_output_segment): New function.
558         (Symbol::set_undefined): New function.
559         * symtab.h (Symbol::is_weak_undefined): Check original undef
560         binding.
561         (Symbol::is_strong_undefined): New function.
562         (Symbol::set_output_segment): New function.
563         (Symbol::set_undefined): New function.
564         * target-reloc.h (is_strong_undefined): Remove.
565         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
566         Check for hidden undefs.
567         (relocate_section): Call Symbol::is_strong_undefined.
568
569         * testsuite/Makefile.am (ehdr_start_test_1)
570         (ehdr_start_test_2, ehdr_start_test_3)
571         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
572         * testsuite/Makefile.in: Regenerate.
573         * testsuite/ehdr_start_def.cc: New source file.
574         * testsuite/ehdr_start_test.cc: New source file.
575         * testsuite/ehdr_start_test.t: New linker script.
576         * testsuite/ehdr_start_test_4.sh: New shell script.
577
578 2014-04-23  Cary Coutant  <ccoutant@google.com>
579
580         PR gold/16870
581         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
582
583 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
584
585         * layout.cc (Layout::include_section): Allow a target to decide
586         whether to include a section.
587         * target.h (Target::should_include_section): New function.
588         (Target::do_should_include_section): New function.
589
590 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
591
592         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
593         inline into ...
594         (Copy_relocs::emit): ... here.
595         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
596         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
597         (Copy_reloc_entry::entries_): Change from private to protected.
598
599 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
600
601         * icf.cc (get_section_contents): Replace copies of reloc
602         vectors with const references.
603
604 2014-04-02  Cary Coutant  <ccoutant@google.com>
605
606         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
607         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
608         * configure: Regenerate.
609         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
610         -fno-use-linker-plugin.
611         (LINK1, CXXLINK1): Add it to the link command.
612         * testsuite/Makefile.in: Regenerate.
613
614 2014-03-12  Alan Modra  <amodra@gmail.com>
615
616         * Makefile.in: Regenerate.
617
618 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
619
620         * symtab.h (Symbol::set_nonvis): New function.
621
622 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
623
624         * symtab.cc (Sized_symbol<32>::init_output_data):
625         Instantiate the template.
626         (Sized_symbol<64>::init_output_data): Likewise.
627
628 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
629
630         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
631         adjust dynamic symbol value.
632         * target.h (Target::adjust_dyn_symbol): New function.
633         (Target::do_adjust_dyn_symbol): New function.
634
635 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
636
637         * output.cc (Output_data_dynamic::Dynamic_entry::write):
638         Get the value of DYNAMIC_CUSTOM dynamic entry.
639         * output.h (Output_data_dynamic::add_custom): New function.
640         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
641         dynamic entry.
642         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
643         * target.h (Target::dynamic_tag_custom_value): New function.
644         (Target::do_dynamic_tag_custom_value): New function.
645
646 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
647
648         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
649         dynsym indexes.
650         * target.h (Target::has_custom_set_dynsym_indexes): New function.
651         (Target::do_has_custom_set_dynsym_indexes): New function.
652         (Target::set_dynsym_indexes): New function.
653         (Target::do_set_dynsym_indexes): New function.
654
655 2014-03-07  Alan Modra  <amodra@gmail.com>
656
657         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
658         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
659         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
660         (Powerpc_relocate_functions::has_overflow_bitfield,
661         overflowed): Use the above.
662         (Target_powerpc::Relocate::relocate): Correct overflow checking
663         for a number of relocations.  Modify overflow test for 16-bit
664         fields in instructions to signed/unsigned according to whether
665         the field takes a signed or unsigned value.
666
667 2014-03-05  Alan Modra  <amodra@gmail.com>
668
669         Update copyright years.
670
671 2014-03-05  Alan Modra  <amodra@gmail.com>
672
673         * powerpc.cc (Target_powerpc::Scan::local, global): Support
674         R_PPC64_ADDR64_LOCAL.
675         (Target_powerpc::Relocate::relocate): Likewise.
676
677 2014-03-03  Alan Modra  <amodra@gmail.com>
678
679         * dwp.cc (print_version): Update copyright year to current.
680
681 2014-02-10  Alan Modra  <amodra@gmail.com>
682
683         * po/gold.pot: Regenerate.
684
685 2014-02-06  Cary Coutant  <ccoutant@google.com>
686
687         Fix problem where -u is ignored when a weak undef is seen.
688
689         * archive.cc (Library_base::should_include_member): Reorder
690         code to check for -u option if a weak undef has already been seen.
691         * testsuite/Makefile.am (weak_undef_test_2): New test case.
692         * testsuite/Makefile.in: Regenerate.
693         * testsuite/weak_undef_file3.cc: New file.
694         * testsuite/weak_undef_file4.cc: New file.
695         * testsuite/weak_undef_test_2.cc: New file.
696
697 2014-02-05  Cary Coutant  <ccoutant@google.com>
698
699         Fix issues with gold undefined symbol diagnostics.
700
701         PR binutils/15435
702         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
703         check to here.
704         * target-reloc.h (is_strong_undefined): New function.
705         (relocate_section): Move undef vtable symbol check from here.
706         Check for is_strong_undefined.
707
708 2014-02-05  Cary Coutant  <ccoutant@google.com>
709
710         Fix problems with the --dynamic-list option.
711
712         PR gold/13577
713         * options.cc (General_options::parse_dynamic_list):
714         Set have_dynamic_list_.
715         (General_options::General_options): Initialize have_dynamic_list_.
716         (General_options::finalize): Turn off -Bsymbolic and
717         -Bsymbolic-functions if --dynamic-list provided.
718         * options.h (General_options::have_dynamic_list): New function.
719         (General_options::have_dynamic_list_): New data member.
720         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
721         correctly.
722
723         PR gold/16530
724         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
725         in --dynamic-list, mark it.
726
727         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
728         (dynamic_list_2): New test case.
729         * testsuite/Makefile.in: Regenerate.
730         * testsuite/dynamic_list_2.cc: New file.
731         * testsuite/dynamic_list_2.t: New file.
732         * testsuite/dynamic_list_lib1.cc: New file.
733         * testsuite/dynamic_list_lib2.cc: New file.
734         * testsuite/gc_dynamic_list_test.c: New file.
735         * testsuite/gc_dynamic_list_test.sh: New file.
736         * testsuite/gc_dynamic_list_test.t: New file.
737
738 2014-01-28  Cary Coutant  <ccoutant@google.com>
739
740         Add .gdb_index version 7 support.
741
742         * gold/dwarf_reader.cc: include <utility> (for make_pair).
743         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
744         debug sections.
745         (Dwarf_ranges_table::read_ranges_table): Likewise.
746         (Dwarf_pubnames_table::read_section): Check for GNU-style
747         sections, and for compressed debug sections.
748         (Dwarf_pubnames_table::read_header): Compute end address of table.
749         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
750         for end of list by offset, not by offset == 0.
751         (Dwarf_info_reader::do_read_string_table): Check for compressed
752         debug sections.
753         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
754         Initialize new data members.
755         (Dwarf_pubnames_table::next_name): return flag_byte.
756         (Dwarf_pubnames_table::end_of_table_): New data member.
757         (Dwarf_pubnames_table::is_gnu_style_): New data member.
758         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
759         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
760         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
761         read skeleton type unit DIEs.
762         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
763         (Gdb_index::do_write): Write flag_byte.
764         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
765         (Gdb_index::Cu_vector): Store flags along with cu indexes.
766         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
767         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
768
769 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
770
771         * version.cc (print_version): Update copyright year to 2014.
772
773 2013-12-19  Dimitry Andric  <dimitry@andric.com>
774
775         * stringpool.cc (Stringpool_template::reserve): Add
776         HAVE_UNORDERED_MAP case.
777         * stringpool.cc (Stringpool_template::print_stats): Likewise.
778
779 2013-12-18  Cary Coutant  <ccoutant@google.com>
780
781         * configure.ac: Check for <unordered_set> and <unordered_map>.
782         * config.in: Regenerate.
783         * configure: Regenerate.
784         * system.h: Use <unordered_set> and <unordered_map> if available.
785
786 2013-12-10  Roland McGrath  <mcgrathr@google.com>
787
788         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
789         with $(INSTALL_PROGRAM_ENV).
790         * Makefile.in: Regenerate.
791
792 2013-11-22  Cary Coutant  <ccoutant@google.com>
793
794         * configure.ac: Add check for which library is needed for
795         dlopen.
796         * configure: Regenerate.
797
798 2013-11-22  Cary Coutant  <ccoutant@google.com>
799
800         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
801         assembler.
802         * testsuite/Makefile.in: Regenerate.
803
804 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
805
806         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
807         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
808         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
809         (Target_x86_64<size>::Scan::local): Likewise.
810         (Target_x86_64<size>::Scan::global): Likewise.
811         (Target_x86_64<size>::Relocate::relocate): Likewise.
812         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
813         Likewise.
814         (Target_x86_64<size>::Scan::check_non_pic(): Handle
815         R_X86_64_PC32_BND.
816
817         * testsuite/Makefile.am (check_PROGRAMS): Add
818         exception_x86_64_bnd_test.
819         (exception_x86_64_bnd_test_SOURCES): New macro.
820         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
821         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
822         (exception_x86_64_bnd_test_LDADD): Likewise.
823         (exception_x86_64_bnd_1.o): New rule.
824         (exception_x86_64_bnd_2.o): Likewise.
825         * testsuite/Makefile.in: Regenerated.
826
827 2013-11-15  Alan Modra  <amodra@gmail.com>
828
829         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
830         accessor.
831         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
832         Only call ppc64_local_entry_offset for 64-bit.  Restrict
833         symval_for_branch lookup to ELFv1.
834         (Stub_table::add_plt_call_entry): Use unsigned int off.
835         (Output_data_glink::Address, invalid_address): New.
836         (Output_data_glink::add_eh_frame): Move out of line.  Add
837         support for ELFv2.
838         (Output_data_glink::add_global_entry, find_global_entry,
839         global_entry_address): New functions.
840         (Output_data_glink::global_entry_stubs_, end_branch_table_,
841         ge_size): New variables.
842         (Output_data_glink::set_final_data_size): Add global entry
843         stub sizing.
844         (Output_data_glink::do_write): Write global entry stubs.
845         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
846         parameter.  Return true for ELFv2.  Adjust callers.
847         (Target_powerpc::Scan::local, global): Restrict opd lookup to
848         ELFv1.  Similarly for ifunc and dynamic relocation processing
849         specific to ELFv1.  Recognize that symbols are defined on
850         their plt entries for ELFv2.
851         (Target_powerpc::symval_for_branch): Assert if called for
852         ELFv2 or ppc32.
853         (Target_powerpc::Relocate::relocate): Use global entry plt
854         stub for symbol value if such exists on ELFv2.
855         (Target_powerpc::Relocate::relocate): Don't call
856         symval_for_branch when ELFv2.  Do adjust for local entry
857         offset when ELFv2.
858         (Target_powerpc::do_dynsym_value): Set symbols to global entry
859         plt stub for ELFv2.
860         (Target_powerpc::do_plt_address_for_global): Similarly.
861
862 2013-11-14  Cary Coutant  <ccoutant@google.com>
863
864         Revert patch -- this did not fix the problem, and there is
865         no race there.
866
867         2013-11-14  Cary Coutant  <ccoutant@google.com>
868
869             PR gold/14860
870             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
871             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
872             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
873             updating fde_offsets_.
874             (Eh_frame_hdr::lock_): New data member.
875
876 2013-11-14  Cary Coutant  <ccoutant@google.com>
877
878         * dwp.cc (Dwo_file_entry): New type.
879         (File_list): Use Dwo_file_entry.
880         (Dwo_file::verify): New function.
881         (Dwo_file::verify_dwo_list): New function.
882         (Dwo_file::sized_verify_dwo_list): New function.
883         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
884         list.
885         (Dwp_options): New enum type.
886         (dwp_options): Add --verify-only.
887         (usage): Likewise.
888         (main): Likewise.
889         * dwp.h (gold_info): Add declaration.
890
891 2013-11-14  Cary Coutant  <ccoutant@google.com>
892
893         PR gold/14860
894         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
895         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
896         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
897         updating fde_offsets_.
898         (Eh_frame_hdr::lock_): New data member.
899
900 2013-11-06  Cary Coutant  <ccoutant@google.com>
901
902         PR gold/15758
903         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
904         before reloc sections.
905
906 2013-11-04  Alan Modra  <amodra@gmail.com>
907
908         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
909         (Symbol::needs_dynamic_reloc): Test new flag.
910         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
911         (Target_powerpc::Scan::get_reference_flags): Add target param.
912         Return FUNC_DESC_ABI for 64-bit ELFv1.
913         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
914         call.
915         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
916         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
917
918 2013-10-31  Cary Coutant  <ccoutant@google.com>
919
920         Restore support for dwp v2 DWARF package file format.
921
922         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
923         tu_length parameter.  Adjust all callers.
924         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
925         * dwp.cc: Include dwarf.h.
926         (Section_bounds): New struct type.
927         (Unit_set): New struct type.
928         (Dwo_file::Dwo_file): Initialize new data member.
929         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
930         Combine and rename to...
931         (Dwo_file::read_unit_index): ...this.
932         (Dwo_file::sized_read_compunit_index)
933         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
934         (Dwo_file::sized_read_unit_index): ...this.
935         (Dwo_file::copy_section): Remove section_name, is_str_offsets
936         parameters; add section_id parameter.
937         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
938         (Dwo_file::add_unit_set): ...this.
939         (Dwo_file::shndx_map_): Remove.
940         (Dwo_file::sect_offsets_): New data member.
941         (Dwp_output_file::Dwp_output_file): Initialize new data members.
942         (Dwp_output_file::add_section): Rename to...
943         (Dwp_output_file::add_contribution): ...this.
944         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
945         (Dwp_output_file::add_tu_set): Likewise.
946         (Dwp_output_file::Contribution): New type.
947         (Dwp_output_file::Section::contributions): New data member.
948         (Dwp_output_file::Cu_or_tu_set): Remove.
949         (Dwp_output_file::Section::Section): New ctor.
950         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
951         (Dwp_output_file::Dwp_index::Section_table): New type.
952         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
953         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
954         parameter.
955         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
956         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
957         (Dwp_output_file::Dwp_index::section_table): New member function.
958         (Dwp_output_file::Dwp_index::section_table_end): New member function.
959         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
960         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
961         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
962         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
963         (Dwp_output_file::Dwp_index::section_table_): New data member.
964         (Dwp_output_file::Dwp_index::section_mask_): New data member.
965         (Dwp_output_file::add_output_section): New member function.
966         (Dwp_output_file::write_new_section): New member function.
967         (Dwp_output_file::write_contributions): New member function.
968         (Dwp_output_file::section_id_map_): New data member.
969         (class Dwo_id_info_reader): Remove.
970         (class Unit_reader): New class.
971         (get_dwarf_section_name): New function.
972         (Dwo_file::read_executable): Adjust initializations of class data.
973         (Dwo_file::read): Add support for v2 package file format.
974         (Dwo_file::read_unit_index): Likewise.
975         (Dwo_file::sized_read_unit_index): Likewise.
976         (Dwo_file::copy_section): Likewise.
977         (Dwo_file::add_unit_set): Likewise.
978         (Dwp_output_file::add_output_section): Likewise.
979         (Dwp_output_file::add_contribution): Likewise.
980         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
981         for empty slot.
982         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
983         file format.
984         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
985         slot.
986         (Dwp_output_file::initialize): Remove unused function.
987         (Dwp_output_file::finalize): Add support for v2 package file format.
988         (Dwp_output_file::write_index): Likewise.
989         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
990         function prototype.
991
992 2013-10-31  Cary Coutant  <ccoutant@google.com>
993
994         * configure.ac: Fix check for -fmerge-constants.
995         * configure.ac: Regenerate.
996
997 2013-10-30  Roland McGrath  <mcgrathr@google.com>
998
999         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
1000         Correct 9-byte nop sequence to match what the assembler generates.
1001
1002 2013-10-30  Alan Modra  <amodra@gmail.com>
1003
1004         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
1005         ppc64_local_entry_offset, ppc64_local_entry_offset,
1006         do_read_symbols): New functions.
1007         (Powerpc_relobj::e_flags_, st_other_): New vars.
1008         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
1009         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
1010         (Powerpc_relobj::e_flags_): New var.
1011         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
1012         and adjust for ELFv2.
1013         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
1014         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
1015         (Powerpc_dynobj::do_find_special_sections): Likewise.
1016         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
1017         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
1018         to ELFv2 local entry.
1019         (Target_powerpc::do_relax): No thread safe barriers needed for
1020         ELFv2.
1021         (Output_data_plt_powerpc::initial_plt_entry_size_,
1022         plt_entry_size): Delete.  Replace all uses with
1023         first_plt_entry_offset() and plt_entry_size().
1024         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
1025         reserved_size parm.  Update callers.
1026         (Output_data_plt_powerpc::entry_count): Update.
1027         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
1028         and use Target_powerpc::first_plt_entry_offset().
1029         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
1030         rename to plt_entry_size.
1031         (Output_data_plt_powerpc::add_ifunc_entry,
1032         add_local_ifunc_entry): Adjust reloc for ELFv2.
1033         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1034         (glink_eh_frame_fde_64v2): New.
1035         (Stub_table::plt_call_size): Support ELFv2 sizing.
1036         (Output_data_glink::add_eh_frame): Use the new FDE.
1037         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1038         (Stub_table::do_write): Write ELFv2 stubs and glink.
1039         (Target_powerpc::Relocate::relocate): Replaces nop after call
1040         with ld 2,24(1) and adjust local offset destination for ELFv2.
1041
1042 2013-10-30  Alan Modra  <amodra@gmail.com>
1043
1044         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1045         (Target_powerpc::Scan::global, local): Likewise.
1046         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1047         on all ppc64 @h and @ha relocs.
1048
1049 2013-10-14  Alan Modra  <amodra@gmail.com>
1050
1051         * output.h (Output_data_got::add_constant): Tidy.
1052         (Output_data_got::add_constant_pair): New function.
1053         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1054         methods used so as to first call reserve_ent().
1055
1056 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1057
1058         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1059         add_got_entry and add_got_entry_pair.
1060
1061         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1062         (HAVE_PUBNAMES): Likewise.
1063         * configure: Regenerate.
1064
1065         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1066         * testsuite/Makefile.in: Regenerate.
1067
1068         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1069         Remove const from declaration.
1070         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1071         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1072         * output.h (Output_file_header): Remove const from member target_
1073         and corresponding constructor argument.
1074         * output.cc (Output_file_header::Output_file_header): Update prototype.
1075         (Output_file_header::do_sized_write): Use this->target_ in place
1076         of parameters()->target().
1077
1078         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1079
1080         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1081         * configure: Regenerate.
1082         * Makefile.in: Regenerate.
1083         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1084         * testsuite/merge_string_literals_2.c: Likewise.
1085         * testsuite/Makefile.am
1086         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1087         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1088         literal -fmerge-constants.
1089         * testsuite/Makefile.in: Regenerate.
1090
1091         * i386.cc (Target_i386): Remove unused member dynbss_.
1092         * arm.cc (Target_arm): Likewise.
1093         * powerpc.cc (Target_powerpc): Likewise.
1094         * sparc.cc (Target_sparc): Likewise.
1095         * tilegx.cc (Target_tilegx): Likewise.
1096         * x86_64.cc (Target_x86_64): Likewise.
1097         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1098         type_signature_, type_offset_.
1099         * plugin.h (Plugin_hook): Remove unused member layout_.
1100         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1101         mapfile_.
1102         (Read_member): Remove unused members input_objects_, symtab_,
1103         mapfile_, layout_.
1104         (Check_library): Remove unused member symtab_.
1105         * archive.h (Lib_group): Remove unused member lib_.
1106         * archive.cc (Lib_group::Lib_group): Update initializer.
1107         * incremental.h (Incremental_binary): Remove unused member target_.
1108         (Incremental_script_entry): Removed unused member script_.
1109         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1110         * icf.h (Icf): Remove unused member num_tracked_relocs.
1111
1112         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1113         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1114         its only use.
1115         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1116
1117         * archive.h: Use struct rather than class for forward declaration
1118         of Read_symbols_data.
1119
1120 2013-10-07  Cary Coutant  <ccoutant@google.com>
1121
1122         PR gold/16010
1123         * testsuite/Makefile.am (icf_test): Fix dependencies.
1124         (icf_safe_test): Likewise.
1125         (icf_safe_so_test): Likewise.
1126         (large_symbol_alignment): Add empty _LDADD rule.
1127         * testsuite/Makefile.in: Regenerate.
1128
1129 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1130
1131         PR gold/15927
1132         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1133         relocation for R_X86_64_32 on x32.
1134
1135 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1136
1137         * output.cc (Output_segment::set_section_addresses): Take new
1138         Target* argument.  If target->isolate_execinstr() and the segment
1139         is executable and starts at a target->abi_pagesize() boundary,
1140         pad its end out to a target->abi_pagesize() boundary with code fill.
1141         * output.h (Output_segment::set_section_addresses): Update decl.
1142         * layout.h (Layout::check_output_data_for_reset_values): Take new
1143         argument RELAX_OUTPUTS.
1144         (Layout): New member relax_output_list_.
1145         (Layout::add_relax_output): New method.
1146         * layout.cc (Layout::Layout): Update constructor.
1147         (Layout::reset_relax_output): New method.
1148         (Layout::clean_up_after_relaxation): Call it.
1149         (Layout::prepare_for_relaxation): Update caller.
1150         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1151         Call reset_relax_output before re-processing segments for
1152         isolate_execinstr case.
1153         (Layout::write_data): Handle relax_output_list_.
1154         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1155         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1156
1157 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1158
1159         PR binutils/15834
1160         * object.h: Fix typos.
1161
1162 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1163
1164         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1165         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1166
1167 2013-08-07  Cary Coutant  <ccoutant@google.com>
1168
1169         Revert support for v2 DWP files:
1170
1171         2013-03-01  Cary Coutant  <ccoutant@google.com>
1172
1173             Add dwp support for v2 DWARF package file format.
1174             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1175             tu_length parameter.  Adjust all callers.
1176             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1177             * dwp.cc: Include dwarf.h.
1178             (Section_bounds): New struct type.
1179             (Unit_set): New struct type.
1180             (Dwo_file::Dwo_file): Initialize new data member.
1181             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1182             Combine and rename to...
1183             (Dwo_file::read_unit_index): ...this.
1184             (Dwo_file::sized_read_compunit_index)
1185             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1186             (Dwo_file::sized_read_unit_index): ...this.
1187             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1188             parameters; add section_id parameter.
1189             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1190             (Dwo_file::add_unit_set): ...this.
1191             (Dwo_file::shndx_map_): Remove.
1192             (Dwo_file::sect_offsets_): New data member.
1193             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1194             (Dwp_output_file::add_section): Rename to...
1195             (Dwp_output_file::add_contribution): ...this.
1196             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1197             (Dwp_output_file::add_tu_set): Likewise.
1198             (Dwp_output_file::Contribution): New type.
1199             (Dwp_output_file::Section::contributions): New data member.
1200             (Dwp_output_file::Cu_or_tu_set): Remove.
1201             (Dwp_output_file::Section::Section): New ctor.
1202             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1203             (Dwp_output_file::Dwp_index::Section_table): New type.
1204             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1205             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1206             parameter.
1207             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1208             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1209             (Dwp_output_file::Dwp_index::section_table): New member function.
1210             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1211             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1212             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1213             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1214             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1215             (Dwp_output_file::Dwp_index::section_table_): New data member.
1216             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1217             (Dwp_output_file::add_output_section): New member function.
1218             (Dwp_output_file::write_new_section): New member function.
1219             (Dwp_output_file::write_contributions): New member function.
1220             (Dwp_output_file::section_id_map_): New data member.
1221             (class Dwo_id_info_reader): Remove.
1222             (class Unit_reader): New class.
1223             (get_dwarf_section_name): New function.
1224             (Dwo_file::read_executable): Adjust initializations of class data.
1225             (Dwo_file::read): Add support for v2 package file format.
1226             (Dwo_file::read_unit_index): Likewise.
1227             (Dwo_file::sized_read_unit_index): Likewise.
1228             (Dwo_file::copy_section): Likewise.
1229             (Dwo_file::add_unit_set): Likewise.
1230             (Dwp_output_file::add_output_section): Likewise.
1231             (Dwp_output_file::add_contribution): Likewise.
1232             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1233             for empty slot.
1234             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1235             file format.
1236             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1237             slot.
1238             (Dwp_output_file::initialize): Remove unused function.
1239             (Dwp_output_file::finalize): Add support for v2 package file format.
1240             (Dwp_output_file::write_index): Likewise.
1241             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1242             function prototype.
1243
1244 2013-07-31  Cary Coutant  <ccoutant@google.com>
1245
1246         * object.cc (Sized_relobj::do_output_section_address): New function.
1247         (Sized_relobj): Instantiate explicitly.
1248         * object.h (Object::output_section_address): New function.
1249         (Object::do_output_section_address): New function.
1250         (Sized_relobj::do_output_section_address): New function.
1251         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1252
1253 2013-07-30  Cary Coutant  <ccoutant@google.com>
1254             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1255
1256         * parameters.cc (Parameters::entry): Return target-specific entry
1257         symbol name.
1258         * target.h (Target::entry_symbol_name): New function.
1259         (Target_info::entry_symbol_name): New data member.
1260
1261         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1262         * i386.cc (Target_i386::i386_info): Likewise.
1263         (Target_i386_nacl::i386_nacl_info): Likewise.
1264         * sparc.cc (Target_sparc::sparc_info): Likewise.
1265         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1266         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1267         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1268         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1269
1270 2013-07-22  Sterling Augustine  <saugustine@google.com>
1271
1272         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1273         Convert parameter shndx to local variable. Add parameters symtab
1274         and symtab_size.  Scan over section names.  Find relocation
1275         section corresponding to current section.  Create and initialize
1276         reloc_mapper_ and reloc_type_.
1277         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1278         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1279         cu_offset_.
1280         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1281         Initialize new fields unit_length_ and cu_offset_.
1282         (Dwarf_pubnames_table::read_section): Update prototype.
1283         (Dwarf_pubnames_table::cu_offset): New member function.
1284         (Dwarf_pubnames_table::subsection_size): Likewise.
1285         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1286         New fields.
1287         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1288         member functions public.
1289         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1290         Update comment.  Rework logic.  Move repeated parts to...
1291         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1292         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1293         pubtypes_table_, and stmt_list_offset.
1294         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1295         Gdb_index::find_pubtype_offset,
1296         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1297         (Gdb_index::pubnames_read): Update prototype and rework logic.
1298         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1299         Forward declare.
1300         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1301         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1302         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1303         Gdb_index::map_pubtable_to_dies):
1304         Declare functions.
1305         (Gdb_index::pubnames_read): Update declaration.
1306         (Gdb_index::Pubname_offset_map): New type.
1307         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1308         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1309         Gdb_index::stmt_list_offset): Declare.
1310         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1311         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1312         Gdb_index::pubtypes_offset_): Remove.
1313
1314 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1315
1316         * options.h (General_options): Add -Trodata-segment option.
1317         * parameters.cc (Parameters::check_rodata_segment): New function.
1318         (Parameters::set_target_once): Call it.
1319         * parameters.h (Parameters): Declare it (private member function).
1320         * layout.cc (load_seg_unusable_for_headers): New function, broken
1321         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1322         then validate rodata segment rather than text segment.
1323         (relaxation_loop_body): Call that.
1324         (is_text_segment): New function.  Don't admit a non-executable
1325         segment if TARGET->isolate_execinstr().
1326         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1327
1328 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1329
1330         PR gold/15070
1331         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1332         * nacl.h (Sniff_file::View::View): Request aligned view.
1333
1334 2013-07-11  Cary Coutant  <ccoutant@google.com>
1335
1336         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1337         correct BRLT entry size.
1338
1339 2013-07-03  Alan Modra  <amodra@gmail.com>
1340
1341         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1342         comment.
1343
1344 2013-07-01  Cary Coutant  <ccoutant@google.com>
1345
1346         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1347         reloc_type_.
1348         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1349         (Dwarf_ranges_table::lookup_reloc): New function.
1350         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1351         reloc_type_.
1352         (Dwarf_ranges_table::lookup_reloc): New function.
1353         (Dwarf_ranges_table::reloc_type_): New data member.
1354
1355 2013-06-27  Jing Yu  <jingyu@google.com>
1356
1357         PR gold/15662
1358         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1359         function.
1360         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1361         (Target_powerpc::do_relax): Call the above.
1362
1363 2013-06-27  Cary Coutant  <ccoutant@google.com>
1364
1365         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1366         on garbage collected .opd section.
1367
1368 2013-06-27  Alan Modra  <amodra@gmail.com>
1369
1370         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1371         is non-zero.
1372         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1373         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1374
1375 2013-06-14  Cary Coutant  <ccoutant@google.com>
1376
1377         * resolve.cc (Symbol::override_base): Don't override st_type
1378         from plugin placeholder symbols.
1379         (Symbol_table::resolve): Likewise.
1380         (Symbol_table::should_override): Don't complain about TLS mismatch
1381         if the TO symbol is a plugin placeholder.
1382         * testsuite/Makefile.am (plugin_test_tls): New test.
1383         * testsuite/Makefile.in: Regenerate.
1384         * testsuite/plugin_test_tls.sh: New test script.
1385         * testsuite/two_file_test_2_tls.cc: New test source.
1386         * testsuite/two_file_test_tls.cc: New test source.
1387
1388 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1389
1390         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1391         the maximum segment alignment is larger than the page size.
1392         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1393         correctly aligns the symbols with large alignemnt.
1394         * testsuite/Makefile.in: Regenerate.
1395         * testsuite/large_symbol_alignment.cc: New file.
1396
1397 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1398             Sriraman Tallam  <tmsriram@google.com>
1399
1400         * options.h (sort_section): New option.
1401         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1402         Rename from Input_section_sort_section_name_special_ordering_compare.
1403         (Input_section_sort_section_name_compare): New struct.
1404         * output.cc (Output_section::Input_section_sort_section_name_compare::
1405         operator()): New function.
1406         (Output_section::sort_attached_input_sections): Use new sort function
1407         for .text if --sort-section=name is specified.
1408         * layout.cc (Layout::make_output_section):
1409         Add sorting by name when --sort-section=name is specified.
1410         * testsuite/Makefile.am (text_section_grouping): Test option
1411         --sort-section=name.
1412         * testsuite/Makefile.in: Regenerate.
1413         * testsuite/section_sorting_name.cc: New file.
1414         * testsuite/section_sorting_name.sh: New file.
1415
1416 2013-05-21  Cary Coutant  <ccoutant@google.com>
1417
1418         * symtab.h (Symbol::is_cxx_vtable): New function.
1419         * target-reloc.h (relocate_section): Check for vtable symbol.
1420         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1421         * testsuite/Makefile.in: Regenerate.
1422         * testsuite/missing_key_func.cc: New test source.
1423         * testsuite/missing_key_func.sh: New test script.
1424
1425 2013-05-21  Cary Coutant  <ccoutant@google.com>
1426
1427         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1428         type of enclosing symbol.
1429         (Relocate_info::location): Check symbol type when describing symbol.
1430         * object.h (Symbol_location_info): Remove unused line_number;
1431         add enclosing_symbol_type.
1432         * testsuite/debug_msg.sh: Adjust expected output.
1433
1434 2013-05-13  Cary Coutant  <ccoutant@google.com>
1435
1436         * configure.ac: Export DEFAULT_TARGET.
1437         * configure: Regenerate.
1438         * Makefile.in: Regenerate.
1439         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1440         * testsuite/Makefile.in: Regenerate.
1441         * testsuite/debug_msg.sh: Delete duplicate tests.
1442         Don't check undef_int error message match for powerpc where the
1443         source file and line number aren't available.
1444
1445 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1446
1447         * options.h (General_options): Add --rosegment-gap option.
1448         * options.cc (finalize): --rosegment-gap implies --rosegment.
1449         * layout.cc (set_segment_offsets): Let user option override
1450         target->rosegment_gap().
1451
1452 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1453
1454         * options.h (General_options): Remove leading space from help
1455         messages for -nostdlib and --rosegment.
1456
1457 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1458
1459         PR ld/15365
1460         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1461
1462 2013-05-03  Alan Modra  <amodra@gmail.com>
1463
1464         * merge.cc (Output_merge_string::do_add_input_section): Correct
1465         scan for number of strings.  Rename vars to avoid shadowing.
1466         Include missing terminator in input_size_.
1467
1468 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1469
1470         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1471         Restore empty string handling.
1472
1473 2013-05-01  Cary Coutant  <ccoutant@google.com>
1474
1475         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1476         uninitialized warning.
1477
1478 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1479
1480         * output.cc (Output_section::add_merge_input_section): Allow
1481         to merge sections if the alignment is more than character size.
1482         * merge.h (Output_merge_string::Output_merge_string): Remove
1483         assert.
1484         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1485         only not-null strings. Check the alignment of strings.
1486         * stringpool.h
1487         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1488         alignment as the argument.
1489         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1490         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1491         Align non-zero length strings according to the addralign_.
1492         (Stringpool_template<Stringpool_char>::set_string_offsets):
1493         Updating offsets according to the given alignment.
1494         * testsuite/Makefile.am (text_section_grouping): Test if string
1495         literals are getting merged.
1496         * testsuite/Makefile.in: Regenerate.
1497         * testsuite/merge_string_literals_1.c: New file.
1498         * testsuite/merge_string_literals_2.c: Ditto.
1499         * testsuite/merge_string_literals.sh: Ditto.
1500
1501 2013-04-26  Ian Lance Taylor  <iant@google.com>
1502
1503         * target-reloc.h (relocate_section): If the reloc offset is out of
1504         range, pass VIEW as NULL to relocate.relocate.
1505         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1506         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1507         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1508         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1509         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1510         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1511
1512 2013-04-26  Geoff Pike  <gpike@chromium.org>
1513
1514         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1515         * layout.cc (Hash_task): New class.
1516         (Layout::queue_build_id_tasks): New function.
1517         (Layout::write_build_id): Handle single-thread portion of build ID
1518         computation.  (In some cases, all of it is single-threaded.)  Replace
1519         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1520         functionality in fewer lines of code.
1521         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1522         * options.h (General_options): make "--build-id" default to tree
1523         rather than sha1.  Add two new options related to --build-id=tree:
1524         --build-id-chunk-size-for-treehash and
1525         --build-id-min-file-size-for-treehash.
1526         * Makefile.am: add testing of --build-id=tree and related new options
1527         (these tests will be invoked by "make check").
1528         * Makefile.in: Regenerate.
1529
1530 2013-04-25  Alan Modra  <amodra@gmail.com>
1531
1532         * configure.tgt: Add powerpcle and powerpc64le.
1533
1534 2013-04-22  Alan Modra  <amodra@gmail.com>
1535
1536         PR gold/15355
1537         * layout.cc (Layout::segment_precedes): Allow more than one
1538         segment with the same type and flags.
1539
1540 2013-04-15  Cary Coutant  <ccoutant@google.com>
1541
1542         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1543         allocate space in file for BSS sections.
1544
1545 2013-04-15  Cary Coutant  <ccoutant@google.com>
1546
1547         * script-sections.cc (Orphan_output_section): Reset address
1548         to zero after each orphaned section for relocatable links.
1549
1550 2013-04-15  Cary Coutant  <ccoutant@google.com>
1551
1552         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1553         section starting address for relocatable link.
1554         * testsuite/Makefile.am (script_test_11): New test.
1555         * testsuite/Makefile.in: Regenerate.
1556         * testsuite/script_test_11.c: New source file.
1557         * testsuite/script_test_11.t: New linker script.
1558
1559 2013-04-13  Alan Modra  <amodra@gmail.com>
1560
1561         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1562         owner when sections are not adjacent and exceed group size.
1563         (Target_powerpc::group_sections): Handle corner case.
1564         (Target_powerpc::Branch_info::make_stub): Handle case where
1565         stub table doesn't exist due to branches in non-exec sections.
1566         (Target_powerpc::Relocate::relocate): Likewise.
1567
1568 2013-04-11  Alan Modra  <amodra@gmail.com>
1569
1570         PR gold/15354
1571         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1572         .branch_lt to match bfd ld.  Adjust comments throughout file.
1573
1574 2013-04-04  Ian Lance Taylor  <iant@google.com>
1575
1576         GCC PR c++/56840
1577         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1578         sections before checking whether they are included in the link.
1579
1580 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1581
1582         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1583         object before calling the plugin claim_file handler.  Pass the elf
1584         object of the archive to the plugin. Delete the elf object if the
1585         plugin claims the file.
1586
1587 2013-03-21  Alan Modra  <amodra@gmail.com>
1588
1589         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1590         segment when omagic.
1591
1592 2013-03-21  Alan Modra  <amodra@gmail.com>
1593
1594         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1595         comparison warning.
1596         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1597         uninitialized" warning.
1598
1599 2013-03-20  Alan Modra  <amodra@gmail.com>
1600
1601         * symtab.h (Symbol::clear_version): New function.
1602         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1603         is_needed by weak references.  Clear version for symbols defined
1604         in as-needed objects that are not needed.
1605
1606 2013-03-15  Alan Modra  <amodra@gmail.com>
1607
1608         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1609         static and public.  Add report_err param.  Return false for data refs.
1610         (Target_powerpc::rela_dyn_section): New overloaded function.
1611         (Target_powerpc::plt_, iplt_): Elucidate.
1612         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1613         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1614         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1615         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1616         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1617         push_branch and make_plt_entry for ifunc syms when
1618         reloc_needs_plt_for_ifunc.
1619         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1620         for ifunc unless reloc_needs_plt_for_ifunc.
1621
1622 2013-03-15  Alan Modra  <amodra@gmail.com>
1623
1624         * gc.h (gc_process_relocs): Don't look through function descriptors.
1625         * icf.cc (get_section_contents): Do so here instead.
1626
1627 2013-03-13  Alan Modra  <amodra@gmail.com>
1628
1629         * powerpc.cc (is_branch_reloc): Forward declare.
1630         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1631         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1632         false for 64-bit, true for 32-bit non-branch relocs.
1633         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1634         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1635         nm output.
1636         (icf_safe_test): Generate linker map file as well as nm output.
1637         (icf_safe_so_test): Likewise.
1638         * testsuite/Makefile.in: Regenerate.
1639         * testsuite/icf_test.sh: Parse linker map file to determine
1640         section folding.
1641         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1642         * testsuite/icf_safe_so_test.sh: Likewise.
1643         (X86_32_or_ARM_specific_safe_fold): Merge into..
1644         (arch_specific_safe_fold): ..this.
1645         (X86_64_specific_safe_fold): Delete unused function.
1646
1647 2013-03-12  Alan Modra  <amodra@gmail.com>
1648
1649         * gc.h (gc_process_relocs): Look through function descriptors
1650         to determine shndx, symvalue and addend used by ICF.  Tidy
1651         variable duplication.
1652
1653 2013-03-11  Alan Modra  <amodra@gmail.com>
1654
1655         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1656         * layout.cc (Layout_task_runner::run): ..to here.
1657         * symtab.h (struct Symbol_location): Extract from..
1658         (class Symbol_table): ..here.
1659         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1660         * target.h (class Target): Add function_location and
1661         do_function_location functions.
1662         (class Sized_target): Add do_function_location.
1663         * object.h (class Sized_relobj_file): Move find_shdr..
1664         (class Object): ..to here.
1665         * object.cc: Likewise.  Update to suit.  Instantiate.
1666         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1667         * powerpc.cc (class Powerpc_dynobj): New.
1668         (Target_powerpc::do_function_location): New function.
1669         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1670         (Powerpc_dynobj::do_read_symbols): New function.
1671         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1672
1673 2013-03-08  Ian Lance Taylor  <iant@google.com>
1674
1675         * options.cc (General_options::string_to_object_format): Accept
1676         "default".
1677
1678 2013-03-08  Alan Modra  <amodra@gmail.com>
1679
1680         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1681         pointer to Post_fde.
1682         (struct Post_fde): Move definition to here..
1683         * ehframe.cc (struct Post_fde): ..from here.
1684         (Cie::write): Don't alloc Post_fde.
1685         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1686
1687 2013-03-07  Alan Modra  <amodra@gmail.com>
1688
1689         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1690         relocation referencing .LC0.
1691         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1692
1693 2013-03-07  Alan Modra  <amodra@gmail.com>
1694
1695         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1696         always_inline.  Add assembly for powerpc to avoid GOT.
1697
1698 2013-03-07  Alan Modra  <amodra@gmail.com>
1699
1700         * testsuite/script_test_10.sh: Don't test .bss section
1701         header number.
1702
1703 2013-03-06  Alan Modra  <amodra@gmail.com>
1704
1705         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1706         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1707         all callers.  Handle folded sections.
1708         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1709         to Powerpc_relobj.
1710         (Global_symbol_visitor_opd::operator()): Likewise.
1711
1712 2013-03-04  Alan Modra  <amodra@gmail.com>
1713
1714         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1715         * testsuite/Makefile.in: Regenerate.
1716
1717 2013-03-01  Cary Coutant  <ccoutant@google.com>
1718
1719         Add dwp support for v2 DWARF package file format.
1720         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1721         tu_length parameter.  Adjust all callers.
1722         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1723         * dwp.cc: Include dwarf.h.
1724         (Section_bounds): New struct type.
1725         (Unit_set): New struct type.
1726         (Dwo_file::Dwo_file): Initialize new data member.
1727         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1728         Combine and rename to...
1729         (Dwo_file::read_unit_index): ...this.
1730         (Dwo_file::sized_read_compunit_index)
1731         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1732         (Dwo_file::sized_read_unit_index): ...this.
1733         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1734         parameters; add section_id parameter.
1735         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1736         (Dwo_file::add_unit_set): ...this.
1737         (Dwo_file::shndx_map_): Remove.
1738         (Dwo_file::sect_offsets_): New data member.
1739         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1740         (Dwp_output_file::add_section): Rename to...
1741         (Dwp_output_file::add_contribution): ...this.
1742         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1743         (Dwp_output_file::add_tu_set): Likewise.
1744         (Dwp_output_file::Contribution): New type.
1745         (Dwp_output_file::Section::contributions): New data member.
1746         (Dwp_output_file::Cu_or_tu_set): Remove.
1747         (Dwp_output_file::Section::Section): New ctor.
1748         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1749         (Dwp_output_file::Dwp_index::Section_table): New type.
1750         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1751         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1752         parameter.
1753         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1754         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1755         (Dwp_output_file::Dwp_index::section_table): New member function.
1756         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1757         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1758         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1759         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1760         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1761         (Dwp_output_file::Dwp_index::section_table_): New data member.
1762         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1763         (Dwp_output_file::add_output_section): New member function.
1764         (Dwp_output_file::write_new_section): New member function.
1765         (Dwp_output_file::write_contributions): New member function.
1766         (Dwp_output_file::section_id_map_): New data member.
1767         (class Dwo_id_info_reader): Remove.
1768         (class Unit_reader): New class.
1769         (get_dwarf_section_name): New function.
1770         (Dwo_file::read_executable): Adjust initializations of class data.
1771         (Dwo_file::read): Add support for v2 package file format.
1772         (Dwo_file::read_unit_index): Likewise.
1773         (Dwo_file::sized_read_unit_index): Likewise.
1774         (Dwo_file::copy_section): Likewise.
1775         (Dwo_file::add_unit_set): Likewise.
1776         (Dwp_output_file::add_output_section): Likewise.
1777         (Dwp_output_file::add_contribution): Likewise.
1778         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1779         for empty slot.
1780         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1781         file format.
1782         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1783         slot.
1784         (Dwp_output_file::initialize): Remove unused function.
1785         (Dwp_output_file::finalize): Add support for v2 package file format.
1786         (Dwp_output_file::write_index): Likewise.
1787         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1788         function prototype.
1789
1790 2013-03-01  Cary Coutant  <ccoutant@google.com>
1791
1792         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1793         function into class definition in header file.
1794         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1795         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1796         New function.
1797         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1798
1799 2013-02-28  Alan Modra  <amodra@gmail.com>
1800
1801         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1802         * target.cc (Target::do_plt_fde_location): New function.
1803         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1804         accessor function, and constructor param.
1805         (struct Post_fde, Post_fdes): Declare.
1806         (Cie::write): Add post_fdes param.
1807         * ehframe.cc (Fde::write): Use plt_fde_location.
1808         (struct Post_fde): Define.
1809         (Cie::write): Stash FDEs added post merge mapping.
1810         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1811         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1812         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1813         other FDEs.
1814         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1815         (Target_powerpc::has_glink): New function.
1816         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1817         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1818         glink_eh_frame_fde_32, default_fde): New data.
1819         (Stub_table::eh_frame_added_): New var.
1820         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1821         Make const.
1822         (Stub_table::add_eh_frame): New function.
1823         (Output_data_glink::add_eh_frame): New function.
1824         (Target_powerpc::make_glink_section): Call add_eh_frame.
1825
1826 2013-02-15  Ian Lance Taylor  <iant@google.com>
1827
1828         * options.h (DEFINE_uint64_alias): Define.
1829         (class General_options): Add -Ttext-segment as an alias for
1830         -Ttext.
1831
1832 2013-02-15  Alan Modra  <amodra@gmail.com>
1833
1834         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1835         (Stub_table::do_write): ..here, two places.
1836         (Stub_table::plt_call_size): Use it here too.
1837
1838 2013-02-11  Ian Lance Taylor  <iant@google.com>
1839
1840         * descriptors.cc (Descriptors::close_all): New function.
1841         * descriptors.h (class Descriptors): Declare close_all.
1842         (close_all_descriptors): New inline function.
1843         * plugin.cc: Include "descriptors.h".
1844         (Plugin_manager::cleanup): Call close_all_descriptors.
1845
1846 2013-02-06  Alan Modra  <amodra@gmail.com>
1847
1848         * README: Update coding style link.
1849
1850 2013-01-28  Cary Coutant  <ccoutant@google.com>
1851
1852         * dwp.cc (File_list): New typedef.
1853         (Dwo_name_info_reader): New class.
1854         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1855         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1856         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1857         (Dwo_file::read_executable): New function.
1858         (Dwo_file::read): Move common setup code to ...
1859         (Dwo_file::make_object): ... here.
1860         (dwp_options): Add --exec/-e.
1861         (usage): Likewise.
1862         (main): Likewise.
1863
1864 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1865
1866         * layout.cc (Layout::layout): Check for option text_reorder.
1867         (Layout::make_output_section): Ditto.
1868         * options.h (text_reorder): New option.
1869         * output.cc (Input_section_sort_compare): Remove special ordering
1870         of section names.
1871         (Output_section::
1872          Input_section_sort_section_name_special_ordering_compare::
1873          operator()): New function.
1874         (Output_section::sort_attached_input_sections): Use new sort function
1875         for .text.
1876         * output.h (Input_section_sort_section_name_special_ordering_compare):
1877         New struct.
1878         * testsuite/Makefile.am (text_section_grouping): Test option
1879         --no-text-reorder
1880         * testsuite/Makefile.in: Regenerate.
1881         * testsuite/text_section_grouping.sh: Check order of functions without
1882         default text reordering.
1883
1884 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1885
1886         * options.h (General_options): Change default to true for new_dtags.
1887
1888 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1889
1890         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1891         when enable_new_dtags is false.  Only add DT_RUNPATH when
1892         enable_new_dtags is true.
1893
1894 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1895
1896         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1897         used in declaration and definition consistent.
1898         (Target_powerpc::symval_for_branch): Ditto.
1899
1900 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1901
1902         * testsuite/plugin_final_layout.cc: Fix comment.
1903
1904 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1905
1906         * layout.cc (Layout::layout): Do not do default sorting for
1907         text sections when section ordering is specified.
1908         (make_output_section): Ditto.
1909         * testsuite/plugin_final_layout.cc: Name the function sections
1910         to catch reordering issues.
1911
1912 2013-01-15  Alan Modra  <amodra@gmail.com>
1913
1914         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1915         plt-thread-safe.
1916
1917 2013-01-15  Alan Modra  <amodra@gmail.com>
1918
1919         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1920         * testsuite/Makefile.in: Regenerate.
1921
1922 2013-01-14  Alan Modra  <amodra@gmail.com>
1923
1924         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1925         * testsuite/Makefile.in: Regenerate.
1926
1927 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1928
1929         PR bfd/14430
1930         Fix mingw gold build with plugins enabled
1931         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1932         * configure.ac: Export DLOPEN_LIBS and add headers check.
1933         * plugin.cc: Handle non-dlfcn case.
1934         * Makefile.in: Regenerate.
1935         * config.in: Regenerate.
1936         * configure: Regenerate.
1937         * testsuite/Makefile.in: Regenerate.
1938
1939 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1940
1941         * output.h (sort_attached_input_sections): Change to be public.
1942         * script-sections.cc
1943         (Output_section_definition::set_section_addresses): Sort
1944         attached input sections according to section order before linker
1945         script assigns section addresses.
1946         (Orphan_output_section::set_section_addresses): Sort
1947         attached input sections according to section order before linker
1948         script assigns section addresses.
1949         * Makefile.am (final_layout.sh): Use a simple linker script to
1950         check if section ordering still works.
1951         * Makefile.in: Regenerate.
1952
1953 2013-01-09  Ben Cheng  <bccheng@google.com>
1954
1955         * arm.cc (Target_arm::attributes_accept_div): New function.
1956         (Target_arm::attributes_forbid_div): New function.
1957         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1958         attribute using the same new functions as what bfd/elf32_arm.c
1959         does.
1960
1961 2013-01-07  Cary Coutant  <ccoutant@google.com>
1962
1963         PR gold/14993
1964         * output.cc (Output_section::add_input_section): For incremental
1965         updates, don't track input sections that are allocated from patch
1966         space.
1967
1968 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1969             Ian Lance Taylor  <iant@google.com>
1970
1971         PR gold/14897
1972         * configure.ac (--enable-ld): Removed.
1973         (install_as_default): Set to yes only for --enable-gold=default
1974         or --disable-ld.
1975         * configure: Regenerated.
1976
1977 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1978
1979         * options.h (General_options): Add -fuse-ld= for GCC linker
1980         option compatibility.
1981
1982 2013-01-04  Cary Coutant  <ccoutant@google.com>
1983
1984         * configure.ac: Fix typo restoring CXXFLAGS.
1985         * configure: Regenerate.
1986
1987 2013-01-04  Cary Coutant  <ccoutant@google.com>
1988
1989         * testsuite/Makefile.am (CXXLINK_S): New macro.
1990         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1991         * testsuite/Makefile.in: Regenerate.
1992
1993 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1994
1995         * version.cc (print_version): Update copyright year to 2013.
1996
1997 2012-12-20  Ian Lance Taylor  <iant@google.com>
1998
1999         * layout.cc (Layout::special_ordering_of_input_section): New
2000         function.
2001         (Layout::layout): If input section requires special ordering, must
2002         sort input sections.
2003         (Layout::make_output_section): May sort .text input sections.
2004         (Layout::is_section_name_prefix_grouped): Remove.
2005         * layout.h (class Layout): Declare
2006         special_ordering_of_input_section.  Don't declare
2007         is_section_name_prefix_grouped.
2008         * output.cc (Output_section::add_input_section): Revert last
2009         change.
2010         (Output_section::Input_section_sort::match_file_name): Don't crash
2011         if called on output section data.
2012         (Output_section::Input_section_sort_compare): Sort based on
2013         special ordering.
2014         (Output_section::Input_section_sort_section_order_index_compare):
2015         Revert last patch.
2016         (Output_section::sort_attached_input_sections): Likewise.
2017
2018 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
2019
2020         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
2021         * layout.h (Layout::is_section_name_prefix_grouped): New function.
2022         * output.cc (Output_section::add_input_section): Check if section
2023         name contains special prefix.  Keep input sections to sort such
2024         sections.
2025         (Output_section::Input_section_sort_section_order_index_compare
2026          ::operator()): Group sections according to prefixes.
2027         (Output_section::sort_attached_input_sections): Add condition to
2028         Input_section_entry constructor call.
2029         * testsuite/Makefile.am (text_section_grouping): New test.
2030         * testsuite/Makefile.in: Regenerate.
2031         * testsuite/text_section_grouping.cc: New file.
2032         * testsuite/text_section_grouping.sh: New file.
2033
2034 2012-12-17  Nick Clifton  <nickc@redhat.com>
2035
2036         * Makefile.am: Add copyright notice.
2037         * NEWS: Likewise.
2038         * README: Likewise.
2039         * configure.ac: Likewise.
2040         * ftruncate.c: Likewise.
2041         * Makefile.in: Regenerate.
2042
2043 2012-12-14  Cary Coutant  <ccoutant@google.com>
2044
2045         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2046         --no-as-needed flag.
2047         (exception_separate_shared_12_test): Likewise.
2048         (incremental_copy_test): Likewise.
2049         * testsuite/Makefile.in: Regenerate.
2050
2051 2012-12-14  Cary Coutant  <ccoutant@google.com>
2052
2053         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2054         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2055
2056 2012-12-12  Alan Modra  <amodra@gmail.com>
2057
2058         * powerpc.cc (class Track_tls): New.
2059         (class Relocate, class Scan): Inherit Track_tls.
2060         (Target_powerpc::Scan::local, global): Track tls optimization
2061         and avoid creating plt entry for __tls_get_addr if all uses
2062         are optimized away.
2063         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2064
2065 2012-12-12  Alan Modra  <amodra@gmail.com>
2066
2067         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2068         Replace no_toc_optimize with toc_optimize.
2069         * output.h (Output_section::input_sections): Provide non-const variant.
2070         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2071         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2072         accessors.
2073         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2074         (class Sort_toc_sections): New.
2075         (Target_powerpc::do_finalize_sections): Sort toc sections.
2076         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2077
2078 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2079
2080         * testsuite/binary_unittest.cc (read_all): New function.
2081         (Sized_binary_test): Use it instead of ::read.
2082         * fileread.cc (do_read): Don't assume pread always reads the whole
2083         amount in a single call.
2084
2085 2012-12-10  Alan Modra  <amodra@gmail.com>
2086
2087         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2088         Set EM_PPC64 or EM_PPC here.
2089         (Target_selector_powerpc::do_recognize): Delete.
2090
2091 2012-12-10  Alan Modra  <amodra@gmail.com>
2092
2093         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2094         stub_table_.
2095         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2096
2097 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2098
2099         * testsuite/binary_unittest.cc (Sized_binary_test):
2100         Use open_descriptor rather than ::open.
2101
2102 2012-12-07  Alan Modra  <amodra@gmail.com>
2103
2104         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2105         typedef and invalid_address constant.
2106         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2107         instantiate constants.
2108
2109 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2110
2111         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2112         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2113         * aclocal.m4: Regenerate.
2114         * configure: Regenerate.
2115         * Makefile.in: Regenerate.
2116         * testsuite/Makefile.in: Regenerate.
2117
2118 2012-12-07  Alan Modra  <amodra@gmail.com>
2119
2120         * options.h (General_options): Add no_toc_optimize.
2121         * powerpc.cc (ok_lo_toc_insn): New function.
2122         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2123
2124 2012-12-06  Alan Modra  <amodra@gmail.com>
2125
2126         * options.h (General_options): Add plt_align, plt_static_chain,
2127         plt_thread_safe.  Update stub_group_size help text.
2128         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2129         for new plt_thread_safe_ var.
2130         (use_plt_offset): Correct comments.
2131         (Target_powerpc::do_relax): Look for thread creation symbols to
2132         determine default plt_thread_safe value.  Clear plt call stubs
2133         as well as branch stubs each iteration.
2134         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2135         insn constants.
2136         (l, hi, ha, write_insn): Move earlier.
2137         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2138         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2139         plt stubs too.
2140         (Stub_table::update_size): Adjust.
2141         (Stub_table::prev_size, set_prev_size): Delete.
2142         (Stub_table::stub_align): Let --plt-align affect result.
2143         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2144         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2145         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2146         (Stub_table::do_write): Support more stub variants.
2147
2148 2012-12-04  Alan Modra  <amodra@gmail.com>
2149
2150         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2151         (Target_powerpc::do_define_standard_symbols): New function.
2152
2153 2012-12-03  Alan Modra  <amodra@gmail.com>
2154
2155         * output.h: Formatting, whitespace.
2156
2157 2012-12-03  Alan Modra  <amodra@gmail.com>
2158
2159         * layout.h (Layout::get_executable_sections): Declare.
2160         * layout.cc (Layout::get_executable_sections): New function.
2161         * arm.cc (Target_arm::group_sections): Use it.
2162         (Arm_output_section::group_sections): Delete now redundant test.
2163         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2164         param to handle relative relocs.
2165         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2166         (Output_data_reloc::add_absolute): Adjust.
2167         (Output_data_reloc::add_relative): New function.
2168         (Output_data::reset_data_size): New function.
2169         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2170         (Output_section::set_addralign): New function.
2171         (Output_section::checkpoint_set_addralign): New function.
2172         (Output_section::clear_section_offsets_need_adjustment): New function.
2173         (Output_section::input_sections): Make public.
2174         * powerpc.cc (class Output_data_brlt_powerpc): New.
2175         (class Stub_table, class Stub_control): New.
2176         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2177         stub_table_, set_stub_table, stub_table): New vectors and accessor
2178         functions.
2179         (Target_powerpc::do_may_relax, do_relax, push_branch,
2180         new_stub_table, stub_tables, brlt_section, group_sections,
2181         add_branch_lookup_table, find_branch_lookup_table,
2182         write_branch_lookup_table, make_brlt_section): New functions.
2183         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2184         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2185         branch_info_): New vars.
2186         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2187         make call stubs here.
2188         (Output_data_glink): Remove all call stub handling from this class.
2189         (Target_powerpc::Scan::local, global): Save interesting branch
2190         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2191         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2192         functions on final link.
2193         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2194         Handle long branch destinations too.
2195         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2196         do_plt_address_for_local): Adjust lookup of plt call stubs.
2197
2198 2012-11-30  Alan Modra  <amodra@gmail.com>
2199
2200         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2201         relocs against protected symbols when building 32-bit shared libs.
2202
2203 2012-11-30  Alan Modra  <amodra@gmail.com>
2204
2205         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2206         param.  Call got_section() to make .got.  Update all callers
2207         and their callers and so on.
2208
2209 2012-11-30  Alan Modra  <amodra@gmail.com>
2210
2211         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2212         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2213         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2214         value if it already exists.
2215
2216 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2217
2218         PR gold/14858
2219         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2220
2221 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2222
2223         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2224         than bfc instruction for data sandboxing.
2225
2226 2012-11-08  Alan Modra  <amodra@gmail.com>
2227
2228         * po/POTFILES.in: Regenerate.
2229
2230 2012-11-05  Alan Modra  <amodra@gmail.com>
2231
2232         * configure.ac: Apply 2012-09-10 change to config.in here.
2233         * configure: Regenerate.
2234
2235 2012-11-05  Alan Modra  <amodra@gmail.com>
2236
2237         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2238         (struct Opd_ent): Use "Address" rather than "Offset".
2239         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2240         (Target_powerpc::got_section): Make public.
2241         (Target_powerpc::scan_relocs): Move code setting symbols..
2242         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2243         Create _SDA_BASE_ only when referenced.
2244
2245 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2246
2247         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2248         from last change.
2249
2250 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2251
2252         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2253         for offset_in_output_section parameter.
2254         (Sized_target::relocate_special_relocatable): Likewise.
2255         * arm.cc (Target_arm::relocate_relocs): Likewise.
2256         (Target_arm::relocate_special_relocatable): Likewise.
2257         * i386.cc (Target_i386::relocate_relocs): Likewise.
2258         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2259         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2260         * target-reloc.h (relocate_relocs): Likewise.
2261         * testsuite/testfile.cc (Target_test): Likewise.
2262         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2263         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2264
2265         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2266         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2267
2268         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2269         parameter, which is unused in the [!F_SETFD] case.
2270
2271         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2272         SYMNDX to off_t before comparing it to this->data_size().
2273         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2274         * incremental.cc (Output_section_incremental_inputs::do_write):
2275         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2276
2277         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2278
2279 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2280
2281         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2282         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2283         in EABI_VER5.
2284
2285 2012-10-29  Cary Coutant  <ccoutant@google.com>
2286
2287         * dwp.cc (usage): Add file and exit status parameters;
2288         add --help and --version options.
2289         (print_version): New function.
2290         (main): Add --help and --version options.
2291
2292 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2293
2294         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2295         final_layout_sequence.txt.
2296         * testsuite/Makefile.in: Regenerated.
2297
2298 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2299
2300         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2301         COMPILE generated by automake.
2302         (LINK1): Likewise.
2303         (CXXCOMPILE1): Likewise.
2304         (CXXLINK1): Likewise.
2305         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2306         (LINK): Likewise.
2307         (CXXCOMPILE): Likewise.
2308         (CXXLINK): Likewise.
2309         * testsuite/Makefile.in: Regenerated.
2310
2311 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2312
2313         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2314         on bad fwrite return.
2315
2316 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2317
2318         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2319         on val.
2320
2321 2012-10-23  Cary Coutant  <ccoutant@google.com>
2322
2323         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2324         * testsuite/Makefile.in: Regenerate.
2325         * testsuite/dwp_test.h: New source file.
2326         * testsuite/dwp_test_1.cc: New source file.
2327         * testsuite/dwp_test_1.s: New source file.
2328         * testsuite/dwp_test_1.sh: New source file.
2329         * testsuite/dwp_test_1b.cc: New source file.
2330         * testsuite/dwp_test_1b.s: New source file.
2331         * testsuite/dwp_test_2.cc: New source file.
2332         * testsuite/dwp_test_2.s: New source file.
2333         * testsuite/dwp_test_2.sh: New source file.
2334         * testsuite/dwp_test_main.cc: New source file.
2335         * testsuite/dwp_test_main.s: New source file.
2336
2337 2012-10-23  Cary Coutant  <ccoutant@google.com>
2338
2339         * dwp.h: New header file.
2340         * dwp.cc: New source file.
2341         * gold.h: Move shared declarations to system.h.
2342         * system.h: New header file.
2343         * Makefile.am: Add dwp.
2344         * Makefile.in: Regenerate.
2345
2346 2012-10-23  Cary Coutant  <ccoutant@google.com>
2347
2348         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2349         Dwarf_info_reader::read_from_pointer.
2350         (Dwarf_pubnames_table::read_header): Likewise.
2351         (Dwarf_pubnames_table::next_name): Likewise.
2352         (Dwarf_die::read_attributes): Likewise.
2353         (Dwarf_die::skip_attributes): Likewise.
2354         (Dwarf_info_reader::read_from_pointer): New function template.
2355         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2356         (Dwarf_pubnames_table): Likewise.
2357         (Dwarf_info_reader::read_from_pointer): New function template.
2358         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2359         Dwarf_pubnames_table ctor.
2360
2361 2012-10-23  Cary Coutant  <ccoutant@google.com>
2362
2363         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2364         abbrev_shndx.
2365         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2366         abbrev_shndx_.
2367         (Dwarf_info_reader::set_abbrev_shndx): New method.
2368         (Dwarf_info_reader::abbrev_shndx_): New data member.
2369
2370 2012-10-23  Cary Coutant  <ccoutant@google.com>
2371
2372         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2373         from object, not parameters.
2374         (Dwarf_info_reader::parse): Likewise.
2375         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2376         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2377         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2378         methods.
2379
2380 2012-10-23  Cary Coutant  <ccoutant@google.com>
2381
2382         * fileread.cc (Input_file::Input_file): New constructor.
2383         * fileread.h (class Input_file): Add new constructor.
2384
2385 2012-10-18  Alan Modra  <amodra@gmail.com>
2386
2387         PR gold/14727
2388         * object.cc (Relobj::is_section_name_included): Also match
2389         .sdata personality section.
2390
2391 2012-10-18  Alan Modra  <amodra@gmail.com>
2392
2393         * target-reloc.h (class Default_comdat_behavior): New, package up..
2394         (get_comdat_behaviour): ..this.
2395         (relocate_section): Add Relocate_comdat_behavior template arg,
2396         adjust code to suit.
2397         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2398         (Target_arm::scan_reloc_section): Likewise.
2399         * i386.cc (Target_i386::relocate_section): Likewise.
2400         * sparc.cc (Target_sparc::relocate_section): Likewise.
2401         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2402         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2403         * powerpc.cc (class Relocate_comdat_behavior): New.
2404         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2405         gold::relocate_section with new template arg.
2406
2407 2012-10-18  Alan Modra  <amodra@gmail.com>
2408
2409         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2410         dynamic relocs for GOT_TPREL got entries, without symbol if
2411         resolving locally.
2412         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2413         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2414         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2415
2416 2012-10-17  Alan Modra  <amodra@gmail.com>
2417
2418         PR gold/14726
2419         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2420
2421 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2422
2423         * layout.cc (Layout::include_section): Keep sections marked
2424         SHF_EXCLUDE when doing relocatable links.
2425
2426 2012-10-16  Alan Modra  <amodra@gmail.com>
2427
2428         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2429         (Target_powerpc::do_finalize_sections): Call it.
2430         (Output_data_save_res): New class and supporting functions.
2431         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2432         normal symbols defined in object files.
2433
2434 2012-10-12  Alan Modra  <amodra@gmail.com>
2435
2436         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2437         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2438         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2439         section if scan_opd_relocs not yet called.
2440         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2441
2442 2012-10-12  Alan Modra  <amodra@gmail.com>
2443
2444         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2445         add_local_ifunc_entry): Revert last change.
2446         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2447
2448 2012-10-05  Alan Modra  <amodra@gmail.com>
2449
2450         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2451         do_plt_address_for_global): New functions.
2452         (Output_data_got_powerpc::do_write): Don't segfault when linking
2453         statically.
2454         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2455         add_local_ifunc_entry): Return true on adding entry..
2456         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2457         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2458         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2459         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2460         set up symbols here.
2461         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2462         syms here.  Do so even when no .iplt.  Don't segfault when linking
2463         statically.
2464         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2465         new variants without reloc param.
2466         (Glink_sym_ent::Glink_sym_ent): Likewise.
2467         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2468         reloc when refs will resolve to plt call stub.
2469         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2470         R_PPC_PLTREL24 to resolve locally.
2471         (Target_powerpc::Scan::global): Correct ifunc handling.
2472         (Target_powerpc::Relocate::relocate): Correct local sym glink
2473         lookup.  Don't destroy "value" when we have a plt call stub,
2474         and when checking plt call validity.
2475         (Target_powerpc::do_dynsym_value): Simplify.
2476
2477 2012-10-05  Alan Modra  <amodra@gmail.com>
2478
2479         * i386.cc (Output_data_plt_i386::address_for_global,
2480         address_for_local): Add plt offset to returned value.  Adjust uses.
2481         * sparc.cc (Output_data_plt_sparc::address_for_global,
2482         address_for_local): Likewise.
2483         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2484         address_for_local): Likewise.
2485         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2486         address_for_local): Likewise.
2487         * target.h (Target::plt_address_for_global, plt_address_for_local):
2488         Update comment.
2489         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2490         (Output_data_got::Got_entry::write): Nor here.
2491         * output.h: Comment fix.
2492
2493 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2494
2495         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2496         global_offset_table_ value for larget got.
2497         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2498
2499 2012-09-29  Alan Modra  <amodra@gmail.com>
2500
2501         * powerpc.cc (Target_powerpc::iplt_): New output section.
2502         (Target_powerpc::iplt_section, make_iplt_section,
2503         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2504         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2505         Target_powerpc::plt_entry_count): Count iplt entries too.
2506         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2507         reloc section in constructor.  New params.
2508         (Target_powerpc::make_plt_section): Create reloc section here instead.
2509         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2510         functions.
2511         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2512         (Output_data_glink::add_entry, find_entry): New functions to
2513         deal with local syms.
2514         (Glink_sym_ent): Add support for local syms.
2515         (Output_data_glink::do_write): Handle ifunc plt entries.
2516         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2517         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2518         (Target_powerpc::Relocate::relocate): Likewise.
2519         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2520
2521 2012-09-25  Alan Modra  <amodra@gmail.com>
2522
2523         * object.h (Sized_relobj_file::adjust_local_symbol,
2524         do_adjust_local_symbol): New functions.
2525         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2526         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2527         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2528         and irregular opd entry spacing.
2529         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2530         (Global_symbol_visitor_opd): New functor.
2531         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2532         on deleted opd entries.
2533
2534 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2535
2536         * tilegx.cc: New file.
2537         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2538         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2539         * configure.tgt: Add entries for tilegx*.
2540         * configure.ac: Likewise.
2541         * Makefile.in: Rebuild.
2542         * configure: Likewise.
2543         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2544         tilegx.
2545
2546 2012-09-13  Alan Modra  <amodra@gmail.com>
2547
2548         * target-reloc.h (scan_relocs): Call scan.local for relocs
2549         against symbols in discarded sections.  Pass is_discarded
2550         param.
2551         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2552         Add is_discarded param.
2553         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2554         is_discarded to flag opd entry as discarded.  Don't emit dyn
2555         relocs on such entries.
2556         (Target_powerpc::Scan::global): Similarly detect and handle
2557         such opd entries.
2558         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2559         opd_ent_.  Update all uses.
2560         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2561         (Target_powerpc::relocate_section): Zero out discarded opd
2562         entry relocs.
2563
2564 2012-09-12  Ian Lance Taylor  <iant@google.com>
2565
2566         PR gold/14570
2567         * output.cc: Rename Output_data_got template parameter from size
2568         to got_size for all functions.  Compile all variants of
2569         Output_data_got.
2570         (Output_data_got::Got_entry::write): Correct use of size for
2571         symbol value.  Use local_is_tls rather than casting to
2572         Sized_relobj_file.
2573         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2574         (class Sized_relobj_file): Add do_local_is_tls.
2575         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2576
2577 2012-09-11  Alan Modra  <amodra@gmail.com>
2578
2579         PR gold/14566
2580         * layout.cc (Layout::set_segment_offsets): When using
2581         common-page-size alignment, ensure we are on a new max-page-size
2582         page.
2583         * output.cc (Output_segment::set_section_addresses): Use
2584         abi_pagesize, not common_pagesize for relro boundary.
2585         (Output_segment::set_offset): Likewise.
2586
2587 2012-09-11  Alan Modra  <amodra@gmail.com>
2588
2589         * output.h (Output_data_got::add_global_tls, add_local_tls,
2590         add_local_tls_pair): New functions.
2591         (Output_data_got::add_local_pair_with_rel): Remove second
2592         reloc param.  Expand comment.
2593         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2594         use_plt_or_tls_offset_, similarly for constructor param.
2595         (Output_data_got::Got_entry::write): Add got_index param.
2596         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2597         add_local_tls_pair): New functions.
2598         (Output_data_got::Got_entry::write): Handle tls symbols
2599         with use_plt_or_tls_offset_ set specially.
2600         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2601         (Output_data_got::do_write): Replace iterator with index, pass
2602         index to entry write function.
2603         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2604         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2605         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2606         call.
2607         * i386.cc (Target_i386::Scan::local): Likewise.
2608         * sparc.cc (Target_sparc::Scan::local): Likewise.
2609         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2610         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2611         do_tls_offset_for_global): New functions.
2612         (Target_powerpc::Scan::local): Correct TLS relocations and got
2613         entry values.
2614         (Target_powerpc::Scan::global): Don't emit unnecessary
2615         dynamic relocations on TLS GOT entries.
2616
2617 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2618
2619         * config.in: Disable sanity check for kfreebsd.
2620
2621 2012-09-10  Sterling Augustine  <saugustine@google.com>
2622
2623         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2624         (Gdb_index::pubtypes_read): New parameter.
2625         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2626         to calls.
2627         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2628         pubtypes_object_.
2629
2630 2012-09-09  Alan Modra  <amodra@gmail.com>
2631
2632         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2633         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2634         * gc.h (gc_process_relocs): Call target gc_add_reference.
2635         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2636         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2637         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2638         unnecessary cast.
2639         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2640         to cater for when we don't need code offset.  Update use.
2641         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2642         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2643         set_opd_valid): New functions.
2644         (Target_powerpc::do_gc_add_reference): New function.
2645         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2646         stashed refs.
2647         (Target_powerpc::do_gc_mark_symbol): New function.
2648
2649 2012-09-06  Cary Coutant  <ccoutant@google.com>
2650
2651         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2652         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2653         (Dwarf_die::skip_attributes): Likewise.
2654         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2655         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2656         (main): Call it.
2657         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2658
2659 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2660
2661         * testsuite/script_test_3.t: Add .got.plt output section
2662         statement.
2663         * testsuite/script_test_4.t: Likewise.
2664
2665 2012-09-05  Alan Modra  <amodra@gmail.com>
2666
2667         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2668         update all uses and lose "enum" when using type.
2669
2670 2012-09-05  Alan Modra  <amodra@gmail.com>
2671
2672         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2673         * configure: Regenerate.
2674         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2675         (plugin_final_layout.stdout): Likewise.
2676         (memory_test): Set page sizes to 0x1000.
2677         * testsuite/Makefile.in: Regenerate.
2678         * testsuite/discard_locals_test.sh: Add FIXME comment.
2679         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2680         * testsuite/pr14265.t: Add .got output section statement.
2681         * testsuite/script_test_2.t: Likewise.
2682         * testsuite/script_test_3.t: Likewise.
2683         * testsuite/script_test_4.t: Likewise.
2684         * testsuite/script_test_5.t: Likewise.
2685         * testsuite/script_test_6.t: Likewise.
2686         * testsuite/script_test_7.t: Likewise.
2687         * testsuite/script_test_9.t: Likewise.
2688
2689 2012-09-05  Alan Modra  <amodra@gmail.com>
2690
2691         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2692         (Powerpc_relocate_functions::Status): New typedef.
2693         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2694         (Target_powerpc::Scan::local): Handle REL64.
2695         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2696         for REL32 and REL64.
2697         (Target_powerpc::symval_for_branch): New function, extracted from..
2698         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2699         checks.  Report overflow errors.
2700
2701 2012-09-05  Alan Modra  <amodra@gmail.com>
2702
2703         * object.h (Sized_relobj_file::emit_relocs): Delete.
2704         (Sized_relobj_file::emit_relocs_reltype): Delete.
2705         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2706         relocate_relocs for --emit-relocs.
2707         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2708         * output.h: Update comment.
2709         (Output_segment::first_section): New function.
2710         (Output_segment::first_section_load_address): Use first_section.
2711         * output.cc (Output_segment::first_section): New function extracted..
2712         (Output_segment::first_section_load_address): ..from here.  Delete.
2713         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2714         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2715         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2716         adjust call to target.h function.
2717         * i386.cc (Target_i386): Likewise.
2718         * sparc.cc (Target_sparc): Likewise.
2719         * x86_64.cc (Target_x86_64): Likewise.
2720         * powerpc.cc (Target_powerpc): Likewise.
2721         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2722         first tls section has section symbol for optimised local dynamic
2723         output relocs.
2724         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2725         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2726         optimised tls code.
2727         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2728         Rename to relocate_relocs.  Update error message.
2729
2730 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2731
2732         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2733         --just-symbols.
2734
2735 2012-08-31  Alan Modra  <amodra@gmail.com>
2736
2737         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2738         (Powerpc_relobj::toc_base_offset): New stub function.
2739         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2740         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2741         (Target_powerpc::Relocate::enum skip_tls): New.
2742         (Target_powerpc::call_tls_get_addr_): New var.
2743         (Target_powerpc::is_branch_reloc): Move to file scope.
2744         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2745         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2746         New functions.
2747         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2748         (powerpc_info): Correct common_pagesize for ppc64.
2749         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2750         (Powerpc_relocate_functions): Add overflow check enums and functions.
2751         Add non-shift version of rela, rela_ua.  Delete all rel public
2752         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2753         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2754         addr16_ha3, addr14 functions.
2755         (Output_data_got_powerpc::add_constant_pair): New function.
2756         (Output_data_got_powerpc::got_base_offset): Likewise.
2757         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2758         (instruction constants): Sort, add some more.
2759         (Output_data_glink::do_write): Add and use Address typedef.  Use
2760         object->toc_base_offset() stub for 64-bit.
2761         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2762         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2763         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2764         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2765         Always treat .opd relocs as against locally defined symbol.
2766         Correct condition for RELATIVE relocs.
2767         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2768         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2769         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2770         calculations.  Handle TLS relocs, and more.  Add overflow
2771         checking and adjust for Powerpc_relocate_functions changes.
2772         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2773         Reinstate --emit-relocs code with FIXME.
2774
2775 2012-08-30  Alan Modra  <amodra@gmail.com>
2776
2777         * layout.cc (Layout::set_segment_offsets): Set p_align to
2778         abi_pagesize, not common_pagesize.
2779         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2780         to determine whether file header can go in segment.
2781
2782 2012-08-30  Alan Modra  <amodra@gmail.com>
2783
2784         * output.h (Output_reloc::Output_reloc <output section>): Add
2785         is_relative param.  Adjust calls.
2786         (Output_reloc::add_output_section_relative): New functions.
2787         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2788         is_relative.
2789         (Output_reloc::symbol_value): Handle SECTION_CODE.
2790
2791 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2792
2793         * gold.cc (queue_middle_tasks): Call layout again when unique
2794         segments for sections is desired.
2795         * layout.cc (Layout::Layout): Initialize new members.
2796         (Layout::get_output_section_flags): New function.
2797         (Layout::choose_output_section): Call get_output_section_flags.
2798         (Layout::layout): Make output section for mapping to a unique segment.
2799         (Layout::insert_section_segment_map): New function.
2800         (Layout::attach_allocated_section_to_segment): Make unique segment for
2801         output sections marked so.
2802         (Layout::segment_precedes): Check for unique segments when sorting.
2803         * layout.h (Layout::Unique_segment_info): New struct.
2804         (Layout::Section_segment_map): New typedef.
2805         (Layout::insert_section_segment_map): New function.
2806         (Layout::get_output_section_flags): New function.
2807         (Layout::is_unique_segment_for_sections_specified): New function.
2808         (Layout::set_unique_segment_for_sections_specified): New function.
2809         (Layout::unique_segment_for_sections_specified_): New member.
2810         (Layout::section_segment_map_): New member.
2811         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2812         Rename is_gc_pass_one to is_pass_one.
2813         Rename is_gc_pass_two to is_pass_two.
2814         Rename is_gc_or_icf to is_two_pass.
2815         Check for which pass based on whether symbols data is present.
2816         Make it two pass when unique segments for sections is desired.
2817         * output.cc (Output_section::Output_section): Initialize new
2818         members.
2819         * output.h (Output_section::is_unique_segment): New function.
2820         (Output_section::set_is_unique_segment): New function.
2821         (Output_section::is_unique_segment_): New member.
2822         (Output_section::extra_segment_flags): New function.
2823         (Output_section::set_extra_segment_flags): New function.
2824         (Output_section::extra_segment_flags_): New member.
2825         (Output_section::segment_alignment): New function.
2826         (Output_section::set_segment_alignment): New function.
2827         (Output_section::segment_alignment_): New member.
2828         (Output_segment::Output_segment): Initialize is_unique_segment_.
2829         (Output_segment::is_unique_segment): New function.
2830         (Output_segment::set_is_unique_segment): New function.
2831         (Output_segment::is_unique_segment_): New member.
2832         * plugin.cc (allow_unique_segment_for_sections): New function.
2833         (unique_segment_for_sections): New function.
2834         (Plugin::load): Add new functions to transfer vector.
2835         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2836         * Makefile.in: Regenerate.
2837         * testsuite/plugin_final_layout.sh: Check if unique segment
2838         functionality works.
2839         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2840         are available.
2841         (allow_unique_segment_for_sections): New global.
2842         (unique_segment_for_sections): New global.
2843         (claim_file_hook): Call allow_unique_segment_for_sections.
2844         (all_symbols_read_hook): Call unique_segment_for_sections.
2845
2846 2012-08-22  Cary Coutant  <ccoutant@google.com>
2847
2848         * layout.cc (Layout::include_section): Don't assert on GROUP
2849         sections with --emit-relocs.
2850
2851 2012-08-21  Cary Coutant  <ccoutant@google.com>
2852
2853         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2854         if --export-dynamic-symbol names an undef symbol.
2855
2856 2012-08-18  Alan Modra  <amodra@gmail.com>
2857
2858         * powerpc.cc: Formatting and white space.
2859         (Powerpc_relobj): Rename got2_section_ to special_.
2860         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2861         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2862         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2863         (Target_powerpc): Add Address typedef and invalid_address.  Use
2864         throughout.
2865         (Target_powerpc::is_branch_reloc): New function.
2866         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2867         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2868         for dst_mask, value and addend.
2869         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2870         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2871         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2872         uint16_t for 24-bit offset.  Use get_output_section_offset and
2873         check return.
2874         (Target_powerpc::Scan::local): Handle more relocs.
2875         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2876         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2877         Plug in toc restoring insn after plt calls.  Translate branches
2878         to function descriptor symbols to corresponding entry point.
2879         (Target_powerpc::relocate_for_relocatable): Check return from
2880         get_output_section_offset.
2881         * symtab.h: Comment typo.
2882
2883 2012-08-14  Ian Lance Taylor  <iant@google.com>
2884
2885         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2886         unsupported_relocal_local to call unsupported_reloc_global.
2887
2888 2012-08-14  Nick Clifton  <nickc@redhat.com>
2889
2890         PR ld/14265
2891         * script-sections.cc (Sections_element::output_section_name): Add
2892         keep return parameter.
2893         (Output_section_element::match_name): Add keep return parameter.
2894         Return the value of the keep_ member.
2895         * script-sections.h (class Output_section): Update
2896         output_section_name prototype.
2897         * layout.cc (Layout::keep_input_section): New public member
2898         function.
2899         (Layout::choose_output_section): Pass keep parameter to
2900         output_section_name.
2901         * layout.h (class Layout): Add keep_input_section.
2902         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2903         sections.
2904         * testsuite/Makefile.am: Add a test.
2905         * testsuite/Makefile.in: Regenerate.
2906         * testsuite/pr14265.c: Source file for the test.
2907         * testsuite/pr14265.t: Linker script for the test.
2908         * testsuite/pr14265.sh: Shell script for the test.
2909
2910 2012-08-14  Alan Modra  <amodra@gmail.com>
2911
2912         * target.h (Target::output_section_name): New function.
2913         (Target::do_output_section_name): New function.
2914         * layout.cc (Layout::choose_output_section): Call the above.
2915         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2916
2917 2012-08-14  Alan Modra  <amodra@gmail.com>
2918
2919         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2920         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2921         for replace_constant call.
2922         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2923         (Output_data_glink::do_print_to_mapfile): New function.
2924         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2925         (Target_powerpc::Relocate::relocate): Likewise.
2926
2927 2012-08-14  Alan Modra  <amodra@gmail.com>
2928
2929         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2930         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2931         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2932         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2933         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2934         here.
2935         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2936         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2937         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2938         here.
2939         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2940         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2941
2942 2012-08-12  Alan Modra  <amodra@gmail.com>
2943
2944         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2945         (glink insn constants): Use uint32_t.
2946         (Output_data_glink::add_entry): Use insert, not [] operator.
2947
2948 2012-08-11  Alan Modra  <amodra@gmail.com>
2949
2950         * object.h (Sized_relobj_file::find_shdr): New function.
2951         (Sized_relobj_file::find_special_sections): New function.
2952         * object.cc (Sized_relobj_file::find_shdr): New function.
2953         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2954         (Sized_relobj_file::find_special_sections): New function, split out..
2955         (Sized_relobj_file::do_read_symbols): ..from here.
2956         * output.h (Output_data_got::replace_constant): New function.
2957         (Output_data_got::num_entries): New function.
2958         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2959         (Output_data_got::got_offset): Protected rather than private.
2960         (Output_data_got::replace_got_entry): New function.
2961         * output.cc (Output_data_got::replace_got_entry): New function.
2962         * powerpc.cc (class Powerpc_relobj): New.
2963         (class Powerpc_relocate_functions): Delete all psymval variants or
2964         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2965         Implement _ha functions using corresponding _hi function.
2966         (Powerpc_relobj::find_special_sections): New function.
2967         (Target_powerpc::do_make_elf_object): New function.
2968         (class Output_data_got_powerpc): New.
2969         (class Output_data_glink): New.
2970         (class Powerpc_scan_relocatable_reloc): New.
2971         Many more changes througout file.
2972
2973 2012-08-09  Nick Clifton  <nickc@redhat.com>
2974
2975         * po/vi.po: Updated Vietnamese translation.
2976
2977 2012-08-07  Ian Lance Taylor  <iant@google.com>
2978
2979         * layout.cc (Layout::add_target_dynamic_tags): If
2980         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2981         plt_rel.
2982
2983 2012-07-30  Nick Clifton  <nickc@redhat.com>
2984
2985         * po/gold.pot: Updated template.
2986         * po/es.po: Updated Spanish translation.
2987
2988 2012-07-18  Cary Coutant  <ccoutant@google.com>
2989
2990         PR gold/14344
2991         * configure.ac: Add check for -gpubnames support.
2992         * configure: Regenerate.
2993         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2994         support; force -gno-pubnames.
2995         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2996         support.
2997         (gdb_index_test_4): New test.
2998         * testsuite/Makefile.in: Regenerate.
2999         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
3000         * testsuite/gdb_index_test_2.sh: Likewise.
3001         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
3002         * testsuite/gdb_index_test_4.sh: New script.
3003         * testsuite/gdb_index_test_comm.sh: New script with common code;
3004         don't look for space after colon.
3005
3006 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
3007
3008         * gold.cc (queue_middle_tasks): Update function order only after
3009         deferred objects due to plugins are processed.
3010
3011 2012-07-11  Ian Lance Taylor  <iant@google.com>
3012
3013         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
3014         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
3015         (Target_arm::scan_reloc_for_stub): Likewise.
3016         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
3017         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
3018         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
3019         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
3020         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
3021
3022 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
3023             Ian Lance Taylor  <iant@google.com>
3024
3025         PR gold/14309
3026         * configure.ac: Test whether std::tr1::hash<off_t> works.
3027         * gold.h: Add a specialization for std::tr1::hash<off_t> if
3028         needed.
3029         * output.h (class Output_fill): Add virtual destructor.
3030         * configure, config.in: Rebuild.
3031
3032 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3033
3034         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3035
3036 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3037
3038         * plugin.cc (Plugin::load): Handle position independent executables.
3039
3040 2012-06-06  Cary Coutant  <ccoutant@google.com>
3041
3042         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3043         add .debug_macro.
3044         (lines_only_debug_sections): Likewise.
3045         (gdb_fast_lookup_sections): New static array.
3046         (is_gdb_debug_section): Rename formal parameter.
3047         (is_lines_only_debug_section): Likewise.
3048         (is_gdb_fast_lookup_section): New function.
3049         (Layout::include_section): Check for ".zdebug_" prefix; pass
3050         section name suffix to is_gdb_debug_section, et al.; check for
3051         fast-lookup sections when building .gdb_index.
3052         * options.h (--strip-debug-gdb): Update GDB version number.
3053
3054 2012-06-06  Cary Coutant  <ccoutant@google.com>
3055
3056         * configure.ac: Add check for fallocate.
3057         * configure: Regenerate.
3058         * config.in: Regenerate.
3059
3060         * options.h (class General_options): Add --mmap-output-file and
3061         --posix-fallocate options.
3062         * output.cc: (posix_fallocate): Remove; replace with...
3063         (gold_fallocate): New function.
3064         (Output_file::map_no_anonymous): Call gold_fallocate.
3065         (Output_file::map): Check --mmap-output-file option.
3066
3067 2012-06-05  Jing Yu  <jingyu@google.com>
3068
3069         * gold.h (textdomain): Add do {} to empty while(0).
3070         (bindtextdomain): Likewise.
3071
3072 2012-06-04  Cary Coutant  <ccoutant@google.com>
3073
3074         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3075         has_dynsym_index.
3076
3077 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3078
3079         * symtab.cc (Symbol_table::define_special_symbol):
3080         Initialize *poldsym to prevent uninitialized variable errors.
3081
3082 2012-05-23  Cary Coutant  <ccoutant@google.com>
3083
3084         * layout.cc (Layout::section_name_mapping): Add rules to handle
3085         exact match on .data.rel.ro.local or .data.rel.ro.
3086         (Layout::output_section_name): Check for exact matches.
3087
3088 2012-05-23  Cary Coutant  <ccoutant@google.com>
3089
3090         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3091         more carefully.
3092
3093 2012-05-22  Cary Coutant  <ccoutant@google.com>
3094
3095         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3096         object before exporting symbol.
3097
3098 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3099
3100         * testsuite/tls_test.cc: Include "config.h" first.
3101         * testsuite/tls_test_c.c: Likewise.
3102
3103 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3104             Nick Clifton  <nickc@redhat.com>
3105
3106         PR 14072
3107         * configure.in: Add check that sysdep.h has been included before
3108         any system header files.
3109         * configure: Regenerate.
3110         * config.in: Regenerate.
3111
3112 2012-05-14  Cary Coutant  <ccoutant@google.com>
3113
3114         * layout.cc (Layout::make_output_section): Mark .tdata section
3115         as RELRO.
3116         * testsuite/relro_test.cc: Add a TLS variable.
3117
3118 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3119
3120         PR gold/14091
3121         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3122         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3123         R_X86_64_64.
3124
3125 2012-05-08  Cary Coutant  <ccoutant@google.com>
3126
3127         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3128         (lines_only_debug_sections): Likewise.
3129
3130 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3131
3132         * nacl.cc: New file.
3133         * nacl.h: New file.
3134         * Makefile.am (CCFILES, HFILES): Add them.
3135         * Makefile.in: Regenerate.
3136         * i386.cc (Output_data_plt_i386_nacl): New class.
3137         (Output_data_plt_i386_nacl_exec): New class.
3138         (Output_data_plt_i386_nacl_dyn): New class.
3139         (Target_i386_nacl): New class.
3140         (Target_selector_i386_nacl): New class.
3141         (target_selector_i386): Use it instead of Target_selector_i386.
3142         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3143         (Target_x86_64_nacl): New class.
3144         (Target_selector_x86_64_nacl): New class.
3145         (target_selector_x86_64, target_selector_x32): Use it instead of
3146         Target_selector_x86_64.
3147         * arm.cc (Output_data_plt_arm_nacl): New class.
3148         (Target_arm_nacl): New class.
3149         (Target_selector_arm_nacl): New class.
3150         (target_selector_arm, target_selector_armbe): Use it instead of
3151         Target_selector_arm.
3152
3153         * target-select.cc (select_target): Take new Input_file* and off_t
3154         arguments, pass them on to recognize method of selector.
3155         * object.cc (make_elf_sized_object): Update caller.
3156         * parameters.cc (parameters_force_valid_target): Likewise.
3157         * incremental.cc (make_sized_incremental_binary): Likewise.
3158         * target-select.h: Update decl.
3159         (Target_selector::recognize): Take new Input_file* argument,
3160         pass it on to do_recognize.
3161         (Target_selector::do_recognize): Take new Input_file* argument.
3162         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3163         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3164         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3165         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3166
3167         * target.h (Target::Target_info): New members isolate_execinstr
3168         and rosegment_gap.
3169         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3170         * arm.cc (Target_arm::arm_info): Update initializer.
3171         * i386.cc (Target_i386::i386_info): Likewise.
3172         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3173         * sparc.cc (Target_sparc::sparc_info): Likewise.
3174         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3175         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3176         * layout.cc (Layout::attach_allocated_section_to_segment):
3177         Take new const Target* argument.  If target->isolate_execinstr(), act
3178         like --rosegment.
3179         (Layout::find_first_load_seg): Take new const Target* argument;
3180         if target->isolate_execinstr(), reject PF_X segments.
3181         (Layout::relaxation_loop_body): Update caller.
3182         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3183         reset file offset to zero when we hit LOAD_SEG, and then do a second
3184         loop over the segments before LOAD_SEG to reassign offsets after
3185         addresses have been determined.  Handle target->rosegment_gap().
3186         (Layout::attach_section_to_segment): Take new const Target* argument;
3187         pass it to attach_allocated_section_to_segment.
3188         (Layout::make_output_section): Update caller.
3189         (Layout::attach_sections_to_segments): Take new const Target* argument;
3190         pass it to attach_section_to_segment.
3191         * gold.cc (queue_middle_tasks): Update caller.
3192         * layout.h (Layout): Update method decls with new arguments.
3193
3194         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3195         Target_info pointer to use.
3196         (Target_arm::do_make_data_plt): New virtual method.
3197         (Target_arm::make_data_plt): New method that calls it.
3198         (Target_arm::make_plt_entry): Use it.
3199         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3200         for the section alignment.
3201         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3202         method.
3203         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3204         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3205         method.
3206         (Output_data_plt_arm::get_plt_entry_size): Call it.
3207         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3208         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3209         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3210         method.
3211         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3212         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3213         method instead of sizeof(plt_entry).
3214         (Output_data_plt_arm::add_entry): Likewise.
3215         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3216         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3217         than static method.
3218         (Target_arm::plt_entry_size): Likewise.
3219         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3220         Move to ...
3221         (Output_data_plt_arm_standard): ... here, new class.
3222         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3223         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3224         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3225
3226         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3227         Take additional argument for the PLT entry size.
3228         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3229         Use get_plt_entry_size method rather than plt_entry_size variable.
3230         (Output_data_plt_x86_64::reserve_slot): Likewise.
3231         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3232         (Output_data_plt_x86_64::add_entry): Likewise.
3233         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3234         (Output_data_plt_x86_64::address_for_global): Likewise.
3235         (Output_data_plt_x86_64::address_for_local): Likewise.
3236         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3237         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3238         Make method non-static.
3239         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3240         method.
3241         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3242         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3243         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3244         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3245         virtual method.
3246         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3247         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3248         virtual method.
3249         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3250         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3251         virtual method.
3252         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3253         (Output_data_plt_x86_64::plt_entry_size)
3254         (Output_data_plt_x86_64::first_plt_entry)
3255         (Output_data_plt_x86_64::plt_entry)
3256         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3257         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3258         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3259         (Output_data_plt_x86_64_standard): ... here, new class.
3260         (Target_x86_64::Target_x86_64): Take optional argument for the
3261         Target_info pointer to use.
3262         (Target_x86_64::do_make_data_plt): New virtual method.
3263         (Target_x86_64::make_data_plt): New method to call it.
3264         (Target_x86_64::init_got_plt_for_update): Use that.
3265         Call this->plt_->add_eh_frame method here.
3266         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3267         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3268         rather than static method.
3269         (Target_x86_64::plt_entry_size): Likewise.
3270         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3271         rather than plt_entry_size variable.  Move guts of PLT filling to...
3272         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3273         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3274         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3275
3276         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3277         additional argument for the section alignment.
3278         Don't do add_eh_frame_for_plt here.
3279         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3280         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3281         variable.
3282         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3283         method.
3284         (Output_data_plt_i386::get_plt_entry_size): Call it.
3285         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3286         (Output_data_plt_i386::add_eh_frame): New method to call it.
3287         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3288         method.
3289         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3290         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3291         method.
3292         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3293         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3294         method instead of plt_entry_size.
3295         (Output_data_plt_i386::plt_entry_size)
3296         (Output_data_plt_i386::plt_eh_frame_fde_size)
3297         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3298         (Output_data_plt_i386_standard): ... here, new class.
3299         (Output_data_plt_i386_exec): New class.
3300         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3301         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3302         (Output_data_plt_i386::exec_plt_entry): Move to ...
3303         (Output_data_plt_i386_exec::plt_entry): ... here.
3304         (Output_data_plt_i386_dyn): New class.
3305         (Output_data_plt_i386::first_plt_entry): Move to ...
3306         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3307         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3308         (Output_data_plt_i386_dyn::plt_entry): ... here.
3309         (Target_i386::Target_i386): Take optional argument for the Target_info
3310         pointer to use.
3311         (Target_i386::do_make_data_plt): New virtual method.
3312         (Target_i386::make_data_plt): New method to call it.
3313         (Target_i386::make_plt_section): Use that.
3314         Call this->plt_->add_eh_frame method here.
3315         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3316         rather than plt_entry_size variable.
3317         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3318         (Output_data_plt_i386::address_for_local): Likewise.
3319         (Output_data_plt_i386::do_write): Likewise.
3320         Move guts of PLT filling to...
3321         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3322         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3323         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3324         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3325
3326 2012-05-01  Cary Coutant  <ccoutant@google.com>
3327
3328         * dwarf_reader.cc (Dwarf_die::read_attributes)
3329         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3330         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3331         * reduced_debug_output.cc
3332         (Output_reduced_debug_info_section::get_die_end): Remove
3333         DW_FORM_GNU_ref_index.  Add default case.
3334
3335 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3336
3337         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3338         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3339         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3340         DW_AT_high_pc as offset from DW_AT_low_pc.
3341
3342         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3343         * testsuite/Makefile.in: Regenerate.
3344         * testsuite/gdb_index_test_3.c: New test source file.
3345         * testsuite/gdb_index_test_3.sh: New test source file.
3346
3347 2012-04-25  Ian Lance Taylor  <iant@google.com>
3348
3349         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3350         pointer.
3351         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3352         as a class, not a struct.
3353         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3354         (Target_arm::apply_cortex_a8_workaround): Likewise.
3355         * gc.h: Declare Reloc_types as a struct, not a class.
3356         * object.h: Declare Symbols_data as a struct.
3357         * reloc.h: Declare Read_relocs_data as a struct.
3358         * target.h: Declare Relocate_info as a struct.
3359
3360 2012-04-24  David S. Miller  <davem@davemloft.net>
3361
3362         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3363         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3364         and R_SPARC_WPLT30.
3365
3366 2012-04-24  Cary Coutant  <ccoutant@google.com>
3367
3368         * incremental-dump.cc (find_input_containing_global): Replace
3369         magic number with symbolic constant.
3370         (dump_incremental_inputs): Update version number.
3371         * incremental.cc (Output_section_incremental_inputs): Update version
3372         number; import symbolic constants from Incremental_inputs_reader.
3373         (Incremental_inputs::create_data_sections): Align relocations
3374         section correctly for 64-bit targets.
3375         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3376         constants; add padding.
3377         (Output_section_incremental_inputs::write_header): Add assert for
3378         header_size.
3379         (Output_section_incremental_inputs::write_input_files): Add assert
3380         for input_entry_size.
3381         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3382         add assert for object_info_size, input_section_entry_size,
3383         global_sym_entry_size.
3384         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3385         for data structure sizes; use them.
3386         (Incremental_input_entry_reader): Import symbolic constants from
3387         Incremental_inputs_reader; use them.
3388
3389 2012-04-23  David S. Miller  <davem@davemloft.net>
3390
3391         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3392         and elf_flags_set_.
3393         (Target_sparc::Target_sparc): Initialize new fields.
3394         (Target_sparc::do_make_elf_object): New function.
3395         (Target_sparc::do_adjust_elf_header): New function.
3396
3397 2012-04-23  Cary Coutant  <ccoutant@google.com>
3398
3399         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3400         CU range table of gdb index.
3401
3402 2012-04-20  David S. Miller  <davem@davemloft.net>
3403
3404         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3405         instead of false.
3406
3407 2012-04-16  David S. Miller  <davem@davemloft.net>
3408
3409         * sparc.cc (Target_sparc::got_address): New function.
3410         (Sparc_relocate_functions::gdop_hix22): New function.
3411         (Sparc_relocate_functions::gdop_lox10): New function.
3412         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3413         relocs.
3414         (Target_sparc::Scan::local): Likewise if the global symbol is not
3415         preemptible and is not IFUNC.
3416         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3417         transformations for local and non-preemptible non-IFUNC global
3418         symbols.
3419
3420         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3421         writing out 64-bit part of ranges.
3422
3423         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3424         -fpic and -fpie respectively.
3425         * Makefile.in: Regenerate.
3426
3427         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3428         (Target_sparc::Target_sparc): Initialize new field.
3429         (Target_sparc::do_plt_section_for_global): New function.
3430         (Target_sparc::do_plt_section_for_local): New function.
3431         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3432         (Target_sparc::make_plt_section): New function, broken out of
3433         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3434         (Target_sparc::make_plt_entry): Call make_plt_section.
3435         (Target_sparc::make_local_ifunc_plt_entry): New function.
3436         (Target_sparc::rela_ifunc_section): New function.
3437         (Target_sparc::plt_section): Remove const.
3438         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3439         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3440         and ifunc_count_ fields.
3441         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3442         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3443         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3444         (Output_data_plt_sparc::rela_ifunc): New function.
3445         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3446         (Output_data_plt_sparc::has_ifunc_section): New function.
3447         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3448         (Output_data_plt_sparc::address_for_global): New function.
3449         (Output_data_plt_sparc::address_for_local): New function.
3450         (Output_data_plt_sparc::plt_index_to_offset): New function.
3451         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3452         and entry_count.
3453         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3454         entry_count.
3455         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3456         R_SPARC_JMP_IREL to switch.
3457         (Target_sparc::Scan::check_non_pic): Likewise.
3458         (Target_sparc::Scan::local): Handle IFUNC symbols.
3459         (Target_sparc::Scan::local): Likewise.
3460         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3461         and plt_address_for_local.
3462         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3463         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3464
3465         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3466         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3467         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3468         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3469         global relocs too.
3470         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3471         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3472         calls.
3473         * sparc.cc (Target_sparc::Scan::global): Likewise.
3474         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3475
3476 2012-04-16  Cary Coutant  <ccoutant@google.com>
3477
3478         * archive.cc (Library_base::should_include_member): Check for
3479         --export-dynamic-symbol.
3480         * options.h (class General_options): Add --export-dynamic-symbol.
3481         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3482         --export-dynamic-symbol.
3483         (Symbol_table::gc_mark_undef_symbols): Likewise.
3484         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3485
3486 2012-04-12  David S. Miller  <davem@davemloft.net>
3487
3488         * sparc.cc (Reloc::wdisp10): New relocation method.
3489         (Reloc::h34): Likewise.
3490         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3491         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3492         R_SPARC_WDISP10.
3493         (Target_sparc::Scan::local): Likewise.
3494         (Target_sparc::Scan::global): Likewise.
3495         (Target_sparc::Relocate::relocate): Likewise.
3496
3497 2012-04-09  Cary Coutant  <ccoutant@google.com>
3498
3499         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3500         low_pc == 0.
3501
3502 2012-04-06  Ian Lance Taylor  <iant@google.com>
3503
3504         * timer.cc: #include <unistd.h>.
3505
3506 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3507
3508         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3509         * config.in: Regenerate.
3510         * configure: Regenerate.
3511
3512 2012-04-05  Nick Clifton  <nickc@redhat.com>
3513
3514         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3515         (AM_LC_MESSAGES): Add.
3516         * aclocal.m4: Regenerate.
3517         * config.in: Regenerate.
3518         * configure: Regenerate.
3519
3520 2012-03-21  Cary Coutant  <ccoutant@google.com>
3521
3522         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3523         * Makefile.in: Regenerate.
3524         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3525         (Sized_elf_reloc_mapper::symbol_section): New function.
3526         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3527         (make_elf_reloc_mapper): New function.
3528         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3529         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3530         (Dwarf_abbrev_table::do_get_abbrev): New function.
3531         (Dwarf_ranges_table::read_ranges_table): New function.
3532         (Dwarf_ranges_table::read_range_list): New function.
3533         (Dwarf_pubnames_table::read_section): New function.
3534         (Dwarf_pubnames_table::read_header): New function.
3535         (Dwarf_pubnames_table::next_name): New function.
3536         (Dwarf_die::Dwarf_die): New function.
3537         (Dwarf_die::read_attributes): New function.
3538         (Dwarf_die::skip_attributes): New function.
3539         (Dwarf_die::set_name): New function.
3540         (Dwarf_die::set_linkage_name): New function.
3541         (Dwarf_die::attribute): New function.
3542         (Dwarf_die::string_attribute): New function.
3543         (Dwarf_die::int_attribute): New function.
3544         (Dwarf_die::uint_attribute): New function.
3545         (Dwarf_die::ref_attribute): New function.
3546         (Dwarf_die::child_offset): New function.
3547         (Dwarf_die::sibling_offset): New function.
3548         (Dwarf_info_reader::check_buffer): New function.
3549         (Dwarf_info_reader::parse): New function.
3550         (Dwarf_info_reader::do_parse): New function.
3551         (Dwarf_info_reader::do_read_string_table): New function.
3552         (Dwarf_info_reader::lookup_reloc): New function.
3553         (Dwarf_info_reader::get_string): New function.
3554         (Dwarf_info_reader::visit_compilation_unit): New function.
3555         (Dwarf_info_reader::visit_type_unit): New function.
3556         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3557         Sized_elf_reloc_mapper.
3558         (Sized_dwarf_line_info::symbol_section): Remove function.
3559         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3560         (Sized_dwarf_line_info::read_line_mappings): Remove object
3561         parameter, adjust callers.
3562         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3563         * dwarf_reader.h: Include <sys/types.h>.
3564         (class Track_relocs): Remove forward declaration.
3565         (class Elf_reloc_mapper): New class.
3566         (class Sized_elf_reloc_mapper): New class.
3567         (class Dwarf_abbrev_table): New class.
3568         (class Dwarf_range_list): New class.
3569         (class Dwarf_ranges_table): New class.
3570         (class Dwarf_pubnames_table): New class.
3571         (class Dwarf_die): New class.
3572         (class Dwarf_info_reader): New class.
3573         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3574         (Sized_dwarf_line_info::symbol_section): Remove member function.
3575         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3576         base class.
3577         * gdb-index.cc: New source file.
3578         * gdb-index.h: New source file.
3579         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3580         and .debug_types sections, call Layout::add_to_gdb_index.
3581         (Sized_relobj_incr::do_section_name): Implement.
3582         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3583         return type; Implement.
3584         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3585         return type.
3586         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3587         parameter list and return type.
3588         (Sized_incr_dynobj::do_section_contents): Likewise.
3589         * layout.cc: Include gdb-index.h.
3590         (Layout::Layout): Initialize gdb_index_data_.
3591         (Layout::init_fixed_output_section): Check for .gdb_index section.
3592         (Layout::add_to_gdb_index): New function. Instantiate.
3593         * layout.h: Add forward declaration for class Gdb_index.
3594         (Layout::add_to_gdb_index): New member function.
3595         (Layout::gdb_index_data_): New data member.
3596         * main.cc: Include gdb-index.h.
3597         (main): Print statistics for gdb index.
3598         * object.cc (Object::section_contents): Move code into
3599         do_section_contents.
3600         (need_decompressed_section): Check for sections needed when building
3601         gdb index.
3602         (build_compressed_section_map): Likewise.
3603         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3604         gdb index.
3605         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3606         sections; call Layout::add_to_gdb_index.
3607         (Sized_relobj_file::do_decompressed_section_contents): Call
3608         do_section_contents directly.
3609         * object.h (Object::do_section_contents): Adjust parameter list and
3610         return type.
3611         (Object::do_decompressed_section_contents): Call do_section_contents
3612         directly.
3613         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3614         return type.
3615         * options.h (class General_options): Add --gdb-index option.
3616         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3617         list and return type.
3618         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3619         * reloc.h (Track_relocs::checkpoint): New function.
3620         (Track_relocs::reset): New function.
3621
3622         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3623         New test cases.
3624         * testsuite/Makefile.in: Regenerate.
3625         * testsuite/gdb_index_test.cc: New test source file.
3626         * testsuite/gdb_index_test_1.sh: New test source file.
3627         * testsuite/gdb_index_test_2.sh: New test source file.
3628
3629 2012-03-19  Doug Kwan  <dougkwan@google.com>
3630
3631         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3632         (Target_arm::do_finalize_sections): Remove code which defines
3633         __exidx_start and __exidx_end.  Make symbol table parameter
3634         anonymous as it is not used.
3635         * gold.cc (queue_middle_tasks): Call target hook to define any
3636         target-specific symbols.
3637         * target.h (Target::define_standard_symbols): New method.
3638         (Target::do_define_standard_symbols): Same.
3639         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3640         * testsuite/Makefile.in: Regenerate.
3641         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3642         and __exidx_end.
3643         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3644         relocations are generated for __exidx_start and __exidx_end.
3645
3646 2012-03-16  Doug Kwan  <dougkwan@google.com>
3647
3648         * testsuite/Makefile.am: Disable test initpri3b.
3649         * testsuite/Makefile.in: Regenerate.
3650
3651 2012-03-15  Doug Kwan  <dougkwan@google.com>
3652
3653         * arm.cc (Target_arm::got_section): Make .got section read-only
3654         if -z now is given.
3655
3656 2012-03-15  Ian Lance Taylor  <iant@google.com>
3657
3658         PR gold/13850
3659         * layout.cc (Layout::make_output_section): Correctly mark
3660         SHT_INIT_ARRAY, et. al., as relro.
3661
3662 2012-03-14  Doug Kwan  <dougkwan@google.com>
3663
3664         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3665         dynamic relocations for protected symbols in shared objects.
3666
3667 2012-03-13  Ian Lance Taylor  <iant@google.com>
3668
3669         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3670         keep the larger alignment.
3671
3672 2012-03-12  Cary Coutant  <ccoutant@google.com>
3673
3674         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3675         handling of DW_LNE_define_file.
3676
3677 2012-03-12  Cary Coutant  <ccoutant@google.com>
3678
3679         * reduced_debug_output.cc
3680         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3681         codes to switch.
3682
3683 2012-02-29  Cary Coutant  <ccoutant@google.com>
3684
3685         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3686
3687 2012-02-29  Cary Coutant  <ccoutant@google.com>
3688
3689         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3690         Call Object::decompressed_section_contents.
3691         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3692         New dtor.
3693         (Sized_dwarf_line_info::buffer_start_): New data member.
3694         * merge.cc (Output_merge_data::do_add_input_section): Call
3695         Object::decompressed_section_contents.
3696         (Output_merge_string::do_add_input_section): Likewise.
3697         * object.cc (need_decompressed_section): New function.
3698         (build_compressed_section_map): Decompress sections needed later.
3699         (Sized_relobj_file::do_decompressed_section_contents): New function.
3700         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3701         * object.h (Object::decompressed_section_contents): New function.
3702         (Object::discard_decompressed_sections): New function.
3703         (Object::do_decompressed_section_contents): New function.
3704         (Object::do_discard_decompressed_sections): New function.
3705         (Compressed_section_info): New type.
3706         (Compressed_section_map): Include decompressed section contents.
3707         (Sized_relobj_file::do_decompressed_section_contents): New function.
3708         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3709
3710 2012-02-16  Cary Coutant  <ccoutant@google.com>
3711
3712         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3713         * testsuite/Makefile.in: Regenerate.
3714
3715 2012-02-14  Cary Coutant  <ccoutant@google.com>
3716
3717         * options.cc (General_options::finalize): Disallow -pie and -static.
3718
3719 2012-02-03  Doug Kwan  <dougkwan@google.com>
3720
3721         * arm.cc (Arm_relocate_functions::abs8,
3722         Arm_relocate_functions::abs16): Use
3723         Bits::has_signed_unsigned_overflow32.
3724         (Arm_relocate_functions::thm_abs8): Correct range of
3725         overflow check.
3726         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3727         in assertions.
3728
3729 2012-02-02  Doug Kwan  <dougkwan@google.com>
3730
3731         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3732         position independent outputs, not just shared objects.
3733
3734 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3735
3736         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3737         * configure: Regenerated.
3738
3739 2012-01-27  Ian Lance Taylor  <iant@google.com>
3740
3741         * reloc.h (Bits): New class with static functions, copied from
3742         namespace utils in arm.cc.
3743         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3744         instead.
3745
3746 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3747
3748         * incremental.cc (write_info_blocks): Correct relocation offset.
3749
3750 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3751
3752         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3753         (Relocate::tls_gd_to_le): Likewise.
3754
3755 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3756
3757         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3758
3759 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3760
3761         * configure.ac: Check if -mcmodel=medium works.
3762         * configure: Regenerated.
3763
3764 2012-01-24  Cary Coutant  <ccoutant@google.com>
3765
3766         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3767         definition and ...
3768         (read_unsigned_LEB_128_x): ... this new function.
3769         (read_signed_LEB_128): Replaced with inline definition and ...
3770         (read_signed_LEB_128_x): ... this new function.
3771         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3772         (read_unsigned_LEB_128): Add inline definition.
3773         (read_signed_LEB_128_x): New function.
3774         (read_signed_LEB_128): Add inline definition.
3775         * testsuite/Makefile.am (leb128_unittest): New unit test.
3776         * testsuite/Makefile.in: Regenerate.
3777         * testsuite/leb128_unittest.cc: New unit test.
3778
3779 2012-01-23  Ian Lance Taylor  <iant@google.com>
3780
3781         PR gold/13617
3782         * i386.cc (Target_i386::do_code_fill): When using a jmp
3783         instruction, pad with nop instructions.
3784         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3785
3786 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3787
3788         * x86_64.cc (gc_process_relocs): Add typename on types used in
3789         template.
3790         (scan_relocs): Likewise.
3791         (relocate_section): Likewise.
3792         (apply_relocation): Likewise.
3793
3794 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3795
3796         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3797         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3798         under x32.
3799
3800 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3801
3802         * x86_64.cc: Initial support for x32.
3803
3804 2012-01-03  Cary Coutant  <ccoutant@google.com>
3805
3806         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3807         Use abstract base class for GOT.
3808         * gold/output.h (class Output_data_got_base): New abstract base class.
3809         (class Output_data_got): Derive from new base class, adjust ctors.
3810         (Output_data_got::reserve_slot): Make virtual; rename to
3811         do_reserve_slot; Adjust callers.
3812         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3813         pointer to abstract base class.
3814         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3815
3816 2011-12-18  Ian Lance Taylor  <iant@google.com>
3817
3818         * object.h (Relobj::local_symbol_value): New function.
3819         (Relobj::local_plt_offset): New function.
3820         (Relobj::local_has_got_offset): New function.
3821         (Relobj::local_got_offset): New function.
3822         (Relobj::set_local_got_offset): New function.
3823         (Relobj::do_local_symbol_value): New pure virtual function.
3824         (Relobj::do_local_plt_offset): Likewise.
3825         (Relobj::do_local_has_got_offset): Likewise.
3826         (Relobj::do_local_got_offset): Likewise.
3827         (Relobj::do_set_local_got_offset): Likewise.
3828         (Sized_relobj::do_local_has_got_offset): Rename from
3829         local_has_got_offset.
3830         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3831         (Sized_relobj::do_set_local_got_offset): Rename from
3832         set_local_got_offset.
3833         (Sized_relobj_file::do_local_plt_offset): Rename from
3834         local_plt_offset.
3835         (Sized_relobj_file::do_local_symbol_value): New function.
3836         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3837         local_plt_offset.
3838         * output.cc (Output_data_got::Got_entry::write): Change object to
3839         Relobj.  Use local_symbol_value.
3840         (Output_data_got::add_global_with_rel): Change rel_dyn to
3841         Output_data_reloc_generic*.  Use add_global_generic.
3842         (Output_data_got::add_global_with_rela): Remove.  Change all
3843         callers to use add_global_with_rel.
3844         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3845         Output_data_reloc_generic*.  Use add_global_generic.
3846         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3847         callers to use add_global_pair_with_rel.
3848         (Output_data_got::add_local): Change object to Relobj*.
3849         (Output_data_got::add_local_plt): Likewise.
3850         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3851         change rel_dyn to Output_data_reloc_generic*.  Use
3852         add_local_generic.
3853         (Output_data_got::add_local_with_rela): Remove.  Change all
3854         callers to use all_local_with_rel.
3855         (Output_data_got::add_local_pair_with_rel): Change object to
3856         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3857         add_output_section_generic.
3858         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3859         callers to use add_local_pair_with_rel.
3860         (Output_data_got::reserve_local): Change object to Relobj*.
3861         * output.h: (class Output_data_reloc_generic): Add pure virtual
3862         declarations for add_global_generic, add_local_generic,
3863         add_output_section_generic.
3864         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3865         functions for Output_data_reloc_generic.  Update declarations for
3866         changes listed in output.cc.
3867         (class Output_data_got): Change template parameter to got_size.
3868         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3869         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3870         function.
3871         (Sized_relobj_incr::do_local_plt_offset): New function.
3872         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3873         add_global_generic.
3874
3875 2011-12-17  Cary Coutant  <ccoutant@google.com>
3876
3877         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3878         * resolve.cc (Symbol_table::resolve): Likewise.
3879         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3880         arrays.
3881         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3882
3883 2011-12-16  Ian Lance Taylor  <iant@google.com>
3884
3885         * output.h (Output_data_reloc_generic::add): Only call
3886         add_dynamic_reloc if this is a dynamic reloc section.
3887
3888 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3889
3890         PR gold/13505
3891         * target-reloc.h (apply_relocation): Replace <64, false> with
3892         <size, big_endian>.
3893
3894 2011-11-25  Nick Clifton  <nickc@redhat.com>
3895
3896         * po/it.po: New Italian translation.
3897
3898 2011-11-17  Sterling Augustine  <saugustine@google.com>
3899
3900         * script.cc (script_include_directive): Implement.
3901         (read_script_file): New local variables name and search_path. Update
3902         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3903         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3904         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3905
3906 2011-11-11  Sterling Augustine  <saugustine@google.com>
3907
3908         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3909         (file_or_sections_cmd): Likewise.
3910
3911 2011-11-11  Doug Kwan  <dougkwan@google.com>
3912
3913         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3914         if --just-symbols is given.
3915
3916 2011-11-10  Doug Kwan  <dougkwan@google.com>
3917
3918         PR gold/13362
3919         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3920         when processing data relocs.
3921         * reloc.h (Relocate_functions::rel_unaligned): New method.
3922         (Relocate_functions::pcrel_unaligned): Ditto.
3923         (Relocate_functions::rel32_unaligned): Ditto.
3924         (Relocate_functions::pcrel32_unaligned): Ditto.
3925
3926 2011-11-09  Doug Kwan  <dougkwan@google.com>
3927
3928         PR gold/13362
3929         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3930         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3931         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3932         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3933         (Relocate_functions::rel_unaligned): New.
3934         (Relocate_functions::rel32_unaligned): New.
3935         * target-reloc.h (relocate_for_relocatable): Add code to handle
3936         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3937         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3938         arm_unaligned_reloc_r): New targets.
3939         * testsuite/Makefile.in: Regenerate.
3940         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3941         linking.
3942
3943 2011-11-02  Ian Lance Taylor  <iant@google.com>
3944
3945         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3946         NATIVE_LINKER.
3947         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3948         * options.cc (General_options::finalize): Use library search path
3949         from configure script if specified.  If not native and no sysroot,
3950         only search TOOLLIBDIR.
3951         * options.h (Search_directory::Search_directory): Change name to
3952         const std::string&.
3953         (General_options::add_to_library_path_with_sysroot): Change arg to
3954         const std::string&.
3955         * configure, Makefile.in, config.in: Rebuild.
3956
3957 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3958
3959         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3960         we are working around the ARM1176 Erratum.
3961         * options.h (General_options::fix_arm1176): Add option.
3962         * testsuite/Makefile.am: Add testcases, and keep current ones
3963         working.
3964         * testsuite/Makefile.in: Regenerate.
3965         * testsuite/arm_fix_1176.s: New file.
3966         * testsuite/arm_fix_1176.sh: Likewise.
3967
3968 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3969
3970         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3971         may_use_blx_.
3972         (Target_arm::may_use_blx): Remove method.
3973         (Target_arm::set_may_use_blx): Likewise.
3974         (Target_arm::may_use_v4t_interworking): New method.
3975         (Target_arm::may_use_v5t_interworking): Likewise.
3976         (Target_arm::may_use_blx_): Remove member variable.
3977         (Arm_relocate_functions::arm_branch_common): Check for v5T
3978         interworking.
3979         (Arm_relocate_functions::thumb_branch_common): Likewise.
3980         (Reloc_stub::stub_type_for_reloc): Likewise.
3981         (Target_arm::do_finalize_sections): Correct interworking checks.
3982         * testsuite/Makefile.am: Add new tests.
3983         * testsuite/Makefile.in: Regenerate.
3984         * testsuite/arm_farcall_arm_arm.s: New test.
3985         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3986         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3987         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3988         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3989         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3990         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3991         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3992
3993 2011-10-31  Cary Coutant  <ccoutant@google.com>
3994
3995         PR gold/13023
3996         * expression.cc (Expression::eval_with_dot): Add
3997         is_section_dot_assignment parameter.
3998         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3999         absolute and assigning to dot within a section.
4000         * script-sections.cc
4001         (Output_section_element_assignment::set_section_addresses): Pass
4002         dot_section to set_if_absolute.
4003         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
4004         as is_section_dot_assignment flag to eval_with_dot.
4005         (Output_section_element_dot_assignment::set_section_addresses):
4006         Likewise.
4007         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
4008         parameter.  Also set value if relative to dot_section; set the
4009         symbol's output_section.
4010         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
4011         parameter.  Adjust all callers.
4012         (Expression::eval_maybe_dot): Likewise.
4013         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
4014         Adjust all callers.
4015         * testsuite/script_test_2.t: Test assignment of an absolute value
4016         to dot within an output section element.
4017
4018 2011-10-31  Cary Coutant  <ccoutant@google.com>
4019
4020         * options.h (class General_options): Add --[no-]gnu-unique options.
4021         * symtab.cc (Symbol_table::sized_write_globals): Convert
4022         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
4023
4024 2011-10-31  Cary Coutant  <ccoutant@google.com>
4025
4026         PR gold/13359
4027         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
4028         unnecessary assertion.
4029         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
4030
4031 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
4032
4033         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4034         gc_mark_symbol.
4035         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4036         gc_mark_symbol.
4037         Change to just keep the section associated with symbol.
4038         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4039         they are externally visible and --export-dynamic is turned on.
4040         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4041
4042 2011-10-19  Ian Lance Taylor  <iant@google.com>
4043
4044         PR gold/13163
4045         * script-sections.cc
4046         (Output_section_element_dot_assignment::needs_output_section): New
4047         function.
4048
4049 2011-10-19  Ian Lance Taylor  <iant@google.com>
4050
4051         PR gold/13204
4052         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4053         --section-start option was seen.
4054         * options.h (General_options::any_section_start): New function.
4055
4056 2011-10-18  David S. Miller  <davem@davemloft.net>
4057
4058         PR binutils/13301
4059         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4060         member to track relocation locations that have moved during TLS
4061         reloc optimizations.
4062         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4063         (Target_sparc::Relocate::relocate): Adjust view down by 4
4064         bytes if it matches reloc_adjust_addr_.
4065         (Target_sparc::Relocate::relocate_tls): Always move the
4066         __tls_get_addr call delay slot instruction forward 4 bytes when
4067         performing relaxation.
4068
4069 2011-10-18  Cary Coutant  <ccoutant@google.com>
4070
4071         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4072         (Output_file::map_no_anonymous): Check for non-zero
4073         return code from posix_fallocate.
4074
4075 2011-10-17  Cary Coutant  <ccoutant@google.com>
4076
4077         PR gold/13245
4078         * plugin.cc (is_visible_from_outside): Check for symbols
4079         referenced from dynamic objects.
4080         * resolve.cc (Symbol_table::resolve): Don't count references
4081         from dynamic objects as references from real ELF files.
4082         * testsuite/plugin_test_2.sh: Adjust expected result.
4083
4084 2011-10-17  Cary Coutant  <ccoutant@google.com>
4085
4086         * gold.cc: Include timer.h.
4087         (queue_middle_tasks): Stamp time.
4088         (queue_final_tasks): Likewise.
4089         * main.cc (main): Store timer in parameters.  Print timers
4090         for each pass.
4091         * parameters.cc (Parameters::Parameters): Initialize timer_.
4092         (Parameters::set_timer): New function.
4093         (set_parameters_timer): New function.
4094         * parameters.h (Parameters::set_timer): New function.
4095         (Parameters::timer): New function.
4096         (Parameters::timer_): New data member.
4097         (set_parameters_timer): New function.
4098         * timer.cc (Timer::stamp): New function.
4099         (Timer::get_pass_time): New function.
4100         * timer.h (Timer::stamp): New function.
4101         (Timer::get_pass_time): New function.
4102         (Timer::pass_times_): New data member.
4103
4104 2011-10-17  Cary Coutant  <ccoutant@google.com>
4105
4106         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4107         task for members of lib groups.
4108
4109 2011-10-17  Cary Coutant  <ccoutant@google.com>
4110
4111         PR gold/13288
4112         * fileread.cc (File_read::find_view): Add assert.
4113         (File_read::make_view): Move bounds check (replace with assert)...
4114         (File_read::find_or_make_view): ... to here.
4115
4116 2011-10-12  Cary Coutant  <ccoutant@google.com>
4117
4118         * output.cc (Output_file::open_base_file): Handle case where
4119         ::read returns less than requested size.
4120
4121 2011-10-10  Cary Coutant  <ccoutant@google.com>
4122
4123         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4124         Initialize defined_count_.
4125         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4126         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4127         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4128         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4129         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4130         * incremental.h (Sized_relobj_incr::defined_count_): New data
4131         member.
4132         (Sized_incr_dynobj::defined_count_): New data member.
4133         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4134         Return zeroes instead of internal error.
4135
4136 2011-10-10  Cary Coutant  <ccoutant@google.com>
4137
4138         PR gold/13249
4139         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4140         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4141         * output.h (class Output_reloc): Add use_plt_offset flag.
4142         (Output_reloc::type_): Adjust size of bit field.
4143         (Output_reloc::use_plt_offset_): New bit field.
4144         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4145         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4146         flag.  Adjust all callers.
4147         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4148         creating RELATIVE relocations.
4149
4150 2011-10-10  Nick Clifton  <nickc@redhat.com>
4151
4152         * po/es.po: Updated Spanish translation.
4153         * po/fi.po: Updated Finnish translation.
4154
4155 2011-10-03   Diego Novillo  <dnovillo@google.com>
4156
4157         * options.cc (parse_uint): Fix dereference of RETVAL.
4158
4159 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4160
4161         * layout.h (section_order_map_): New member.
4162         (get_section_order_map): New member function.
4163         * output.cc (Output_section::add_input_section): Check for patterns
4164         only when --section-ordering-file is specified.
4165         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4166         output_sections have been formed.
4167         * layout.cc (Layout_Layout): Initialize section_order_map_.
4168         * plugin.cc (update_section_order): Store order in order_map. Do not
4169         update the order.
4170         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4171         * testsuite/Makefile.in: Regenerate.
4172         * testsuite/plugin_section_order.c: New file.
4173         * testsuite/plugin_final_layout.cc: New file.
4174         * testsuite/plugin_final_layout.sh: New file.
4175
4176 2011-09-29  Cary Coutant  <ccoutant@google.com>
4177
4178         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4179         Check for NULL.
4180         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4181         symbols during incremental update.
4182         (Symbol_table::add_from_dynobj): Likewise.
4183
4184 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4185             Ian Lance Taylor  <iant@google.com>
4186
4187         * symtab.cc (Symbol_table::define_special_symbol): Always
4188         canonicalize version string.
4189
4190 2011-09-26  Cary Coutant  <ccoutant@google.com>
4191
4192         * gold.cc (queue_initial_tasks): Move option checks ...
4193         * options.cc (General_options::finalize): ... to here. Disable
4194         some options; make others fatal.
4195
4196 2011-09-26  Cary Coutant  <ccoutant@google.com>
4197
4198         gcc PR lto/47247
4199         * plugin.cc (get_symbols_v2): New function.
4200         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4201         (is_referenced_from_outside): New function.
4202         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4203         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4204         (get_symbols): Pass version parameter.
4205         (get_symbols_v2): New function.
4206         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4207         parameter.
4208         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4209         (onload): Add LDPT_GET_SYMBOLS_V2.
4210         (all_symbols_read_hook): Use get_symbols_v2; check for
4211         LDPR_PREVAILING_DEF_IRONLY_EXP.
4212         * testsuite/plugin_test_3.sh: Update expected results.
4213
4214 2011-09-23  Simon Baldwin  <simonb@google.com>
4215
4216         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4217         configuration options.
4218         * configure: Regenerate.
4219         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4220         * Makefile.in: Regenerate.
4221         * testsuite/Makefile.in: Regenerate.
4222
4223 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4224
4225         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4226
4227 2011-09-19  Cary Coutant  <ccoutant@google.com>
4228
4229         * incremental.cc (can_incremental_update): Fix typo in comment.
4230         * incremental.h (can_incremental_update): Likewise.
4231
4232 2011-09-18  Cary Coutant  <ccoutant@google.com>
4233
4234         * incremental.cc (can_incremental_update): New function.
4235         * incremental.h (can_incremental_update): New function.
4236         * layout.cc (Layout::init_fixed_output_section): Call it.
4237         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4238         * object.cc (Sized_relobj_file::do_layout): Call
4239         can_incremental_update.
4240
4241 2011-09-13  Cary Coutant  <ccoutant@google.com>
4242
4243         * configure.ac: Check for glibc support for gnu_indirect_function
4244         support with static linking, setting automake conditional
4245         IFUNC_STATIC.
4246         * Makefile.in: Regenerate.
4247         * configure: Regenerate.
4248
4249         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4250         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4251         for IFUNC_STATIC.
4252         * testsuite/Makefile.in: Regenerate.
4253
4254 2011-09-13  Cary Coutant  <ccoutant@google.com>
4255
4256         * incremental.cc (Sized_relobj_incr::do_layout): Call
4257         report_comdat_group for kept comdat sections.
4258         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4259         * testsuite/Makefile.in: Regenerate.
4260         * testsuite/incr_comdat_test_1.cc: New source file.
4261         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4262         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4263         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4264
4265 2011-09-13  Ian Lance Taylor  <iant@google.com>
4266
4267         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4268         variable external_symbols_offset.
4269
4270 2011-09-12  Ian Lance Taylor  <iant@google.com>
4271
4272         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4273         triggered if object has no symbols.
4274
4275 2011-09-09  David S. Miller  <davem@davemloft.net>
4276
4277         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4278         (Output_fill_debug_line::do_write): Likewise.
4279
4280 2011-08-29  Cary Coutant  <ccoutant@google.com>
4281
4282         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4283         casts to match formatting specs.
4284         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4285
4286 2011-08-26  Cary Coutant  <ccoutant@google.com>
4287
4288         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4289         remaining hole size when allocating.
4290         (Layout::make_output_section): Set fill methods for debug sections.
4291         * layout.h (Free_list::Free_list_node): Move from private to
4292         public.
4293         (Free_list::set_min_hole_size): New function.
4294         (Free_list::begin, Free_list::end): New functions.
4295         (Free_list::min_hole_): New data member.
4296         * output.cc: Include dwarf.h.
4297         (Output_fill_debug_info::do_minimum_hole_size): New function.
4298         (Output_fill_debug_info::do_write): New function.
4299         (Output_fill_debug_line::do_minimum_hole_size): New function.
4300         (Output_fill_debug_line::do_write): New function.
4301         (Output_section::Output_section): Initialize new data member.
4302         (Output_section::set_final_data_size): Ensure patch space is larger
4303         than minimum hole size.
4304         (Output_section::do_write): Fill holes in debug sections.
4305         * output.h (Output_fill): New class.
4306         (Output_fill_debug_info): New class.
4307         (Output_fill_debug_line): New class.
4308         (Output_section::set_free_space_fill): New function.
4309         (Output_section::free_space_fill_): New data member.
4310         * testsuite/Makefile.am (incremental_test_3): Add
4311         --incremental-patch option.
4312         (incremental_test_4): Likewise.
4313         (incremental_test_5): Likewise.
4314         (incremental_test_6): Likewise.
4315         (incremental_copy_test): Likewise.
4316         (incremental_common_test_1): Likewise.
4317         * testsuite/Makefile.in: Regenerate.
4318
4319 2011-08-26  Nick Clifton  <nickc@redhat.com>
4320
4321         * po/es.po: Updated Spanish translation.
4322
4323 2011-08-01  Cary Coutant  <ccoutant@google.com>
4324
4325         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4326         * gold/testsuite/Makefile.in: Regenerate.
4327         * gold/testsuite/justsyms_exec.c: New source file.
4328         * gold/testsuite/justsyms_lib.c: New source file.
4329
4330 2011-08-01  Cary Coutant  <ccoutant@google.com>
4331
4332         * layout.cc (Layout::set_segment_offsets): Don't realign text
4333         segment if -Ttext was specified.
4334         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4335         file type.
4336         * object.h (Sized_relobj_file::e_type): New function.
4337         (Sized_relobj_file::e_type_): New data member.
4338         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4339         base address for ET_EXEC files.
4340         * target.cc (Target::do_make_elf_object_implementation): Allow
4341         ET_EXEC files with --just-symbols option.
4342
4343 2011-07-28  Cary Coutant  <ccoutant@google.com>
4344
4345         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4346         Add thread_number parameter.
4347         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4348         * workqueue-threads.cc
4349         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4350         current thread if its thread number is greater than desired thread
4351         count.
4352         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4353         Add thread_number parameter.
4354         (Workqueue::should_cancel_thread): Likewise.
4355         (Workqueue::find_runnable_or_wait): Pass thread_number to
4356         should_cancel_thread.
4357         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4358         parameter.
4359
4360 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4361
4362         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4363         only after checking if it cannot be forced local.
4364         * symtab.h (is_externally_visible): Check if the symbol is not forced
4365         local.
4366
4367 2011-07-15  Ian Lance Taylor  <iant@google.com>
4368
4369         * options.h (class General_options): Add --print-output-format.
4370         Move -EL next to -EB, for  better --help output.
4371         * target-select.cc: Include <cstdio>, "options.h", and
4372         "parameters.h".
4373         (Target_selector::do_target_bfd_name): New function.
4374         (print_output_format): New function.
4375         * target-select.h (class Target_selector): Update declarations.
4376         (Target_selector::target_bfd_name): New function.
4377         (print_output_format): Declare.
4378         * main.cc: Include "target-select.h".
4379         (main): Handle --print-output-format.
4380         * gold.cc: Include "target-select.h".
4381         (queue_initial_tasks): Handle --print-output-format when there are
4382         no input files.
4383         * parameters.cc (parameters_force_valid_target): Give a better
4384         error message if -EB/-EL does not match target.
4385         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4386         function.
4387
4388 2011-07-15  Ian Lance Taylor  <iant@google.com>
4389
4390         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4391         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4392         (Output_data_plt_i386::do_write): Write address of .dynamic
4393         section to first entry in .got.plt section.
4394         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4395         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4396         Initialize layout_.
4397         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4398         section to first entry in .got.plt section.
4399         * layout.h (Layout::dynamic_section): New function.
4400
4401 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4402
4403         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4404         to claim_file call.
4405         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4406         input_section_position_, and input_section_glob_.
4407         (read_layout_from_file): Call function section_ordering_specified.
4408         * layout.h (is_section_ordering_specified): New function.
4409         (section_ordering_specified): New function.
4410         (section_ordering_specified_): New boolean member.
4411         * main.cc(main): Call load_plugins after layout object is defined.
4412         * output.cc (Output_section::add_input_section): Use
4413         function section_ordering_specified to check if section ordering is
4414         needed.
4415         * output.cc (Output_section::add_relaxed_input_section): Use
4416         function section_ordering_specified to check if section ordering is
4417         needed.
4418         (Output_section::update_section_layout): New function.
4419         (Output_section::sort_attached_input_sections): Check if input section
4420         must be reordered.
4421         * output.h (Output_section::update_section_layout): New function.
4422         * plugin.cc (get_section_count): New function.
4423         (get_section_type): New function.
4424         (get_section_name): New function.
4425         (get_section_contents): New function.
4426         (update_section_order): New function.
4427         (allow_section_ordering): New function.
4428         (Plugin::load): Add the new interfaces to the transfer vector.
4429         (Plugin_manager::load_plugins): New parameter.
4430         (Plugin_manager::all_symbols_read): New parameter.
4431         (Plugin_manager::claim_file): New parameter. Save the elf object for
4432         unclaimed objects.
4433         (Plugin_manager::get_elf_object): New function.
4434         (Plugin_manager::get_view): Change to directly use the bool to check
4435         if get_view is called from claim_file_hook.
4436         * plugin.h (input_objects): New function
4437         (Plugin__manager::load_plugins): New parameter.
4438         (Plugin_manager::claim_file): New parameter.
4439         (Plugin_manager::get_elf_object): New function.
4440         (Plugin_manager::in_claim_file_handler): New function.
4441         (Plugin_manager::in_claim_file_handler_): New member.
4442         (layout): New function.
4443         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4444         handler with an extra parameter. Make the elf object before calling
4445         claim_file handler.
4446         * testsuite/plugin_test.c (get_section_count): New function pointer.
4447         (get_section_type): New function pointer.
4448         (get_section_name): New function pointer.
4449         (get_section_contents): New function pointer.
4450         (update_section_order): New function pointer.
4451         (allow_section_ordering): New function pointer.
4452         (onload): Check if the new interfaces exist.
4453
4454 2011-07-13  Ian Lance Taylor  <iant@google.com>
4455
4456         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4457         relro section.
4458         * x86_64.cc (Target_x86_64::got_section): Likewise.
4459         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4460         (relro_now_test_SOURCES): New variable.
4461         (relro_now_test_DEPENDENCIES): New variable.
4462         (relro_now_test_LDFLAGS): New variable.
4463         (relro_now_test_LDADD): New variable.
4464         (relro_now_test.so): New target.
4465         * testsuite/Makefile.in: Rebuild.
4466
4467 2011-07-12  Ian Lance Taylor  <iant@google.com>
4468
4469         PR gold/12980
4470         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4471         GLOB_DAT relocation rather than a RELATIVE relocation for a
4472         protected symbol when creating a shared library.
4473         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4474         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4475         * testsuite/protected_main_1.cc (main): Test that protected
4476         function has same address.
4477
4478 2011-07-11  Ian Lance Taylor  <iant@google.com>
4479
4480         PR gold/12979
4481         * options.h (class General_options): Add -Bgroup.
4482         * options.cc (General_options::finalize): If -Bgroup is set,
4483         default to --unresolved-symbols=report-all.
4484         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4485         * target-reloc.h (issue_undefined_symbol_error): Handle
4486         --unresolved-symbols=report-all.
4487
4488 2011-07-08  Ian Lance Taylor  <iant@google.com>
4489
4490         PR gold/11985
4491         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4492         if linker script discards key sections.
4493         (Layout::create_dynamic_symtab): Likewise.
4494         (Layout::assign_local_dynsym_offsets): Likewise.
4495         (Layout::sized_create_version_sections): Likewise.
4496         (Layout::create_interp): Likewise.
4497         (Layout::finish_dynamic_section): Likewise.
4498         (Layout::set_dynamic_symbol_size): Likewise.
4499
4500 2011-07-08  Ian Lance Taylor  <iant@google.com>
4501
4502         PR gold/12386
4503         * options.h (class General_options): Add --unresolved-symbols.
4504         * target-reloc.h (issue_undefined_symbol_error): Check
4505         --unresolved-symbols.  Add comments.
4506
4507 2011-07-08  Ian Lance Taylor  <iant@google.com>
4508
4509         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4510         expression more complex.
4511
4512 2011-07-08  Ian Lance Taylor  <iant@google.com>
4513
4514         PR gold/11317
4515         * target-reloc.h (issue_undefined_symbol_error): New inline
4516         function, broken out of relocate_section.
4517         (relocate_section): Call issue_undefined_symbol_error.
4518         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4519         there is no TLS segment if we are about to issue an undefined
4520         symbol error.
4521         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4522
4523 2011-07-08  Ian Lance Taylor  <iant@google.com>
4524
4525         PR gold/12279
4526         * resolve.cc (Symbol_table::should_override): Add fromtype
4527         parameter.  Change all callers.  Give error when linking together
4528         TLS and non-TLS symbol.
4529         (Symbol_table::should_override_with_special): Add fromtype
4530         parameter.  Change all callers.
4531         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4532         there is no TLS segment if we have reported some errors.
4533         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4534
4535 2011-07-08  Ian Lance Taylor  <iant@google.com>
4536
4537         PR gold/12372
4538         * target.h (Target::plt_address_for_global): New function.
4539         (Target::plt_address_for_local): New function.
4540         (Target::plt_section_for_global): Remove.
4541         (Target::plt_section_for_local): Remove.
4542         (Target::do_plt_address_for_global): New virtual function.
4543         (Target::do_plt_address_for_local): New virtual function.
4544         (Target::do_plt_section_for_global): Remove.
4545         (Target::do_plt_section_for_local): Remove.
4546         (Target::register_global_plt_entry): Add Symbol_table and Layout
4547         parameters.
4548         * output.cc (Output_data_got::Got_entry::write): Use
4549         plt_address_for_global and plt_address_for_local.
4550         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4551         address of output section.
4552         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4553         got_irelative_, and irelative_count_ fields.  Update
4554         declarations.
4555         (Output_data_plt_i386::has_irelative_section): New function.
4556         (Output_data_plt_i386::entry_count): Add irelative_count_.
4557         (Output_data_plt_i386::set_final_data_size): Likewise.
4558         (class Target_i386): Add got_irelative_ and rel_irelative_
4559         fields.  Update declarations.
4560         (Target_i386::Target_i386): Initialize new fields.
4561         (Target_i386::do_plt_address_for_global): New function replacing
4562         do_plt_section_for_global.
4563         (Target_i386::do_plt_address_for_local): New function replacing
4564         do_plt_section_for_local.
4565         (Target_i386::got_section): Create got_irelative_.
4566         (Target_i386::rel_irelative_section): New function.
4567         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4568         fields.  Don't define __rel_iplt_{start,end}.
4569         (Output_data_plt_i386::add_entry): Add symtab and layout
4570         parameters.  Change all callers.  Use different PLT and GOT for
4571         IFUNC symbols.
4572         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4573         layout parameters.  Change all callers.  Use different PLT and
4574         GOT.
4575         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4576         (Output_data_plt_i386::rel_irelative): New function.
4577         (Output_data_plt_i386::address_for_global): New function.
4578         (Output_data_plt_i386::address_for_local): New function.
4579         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4580         IRELATIVE GOT when changing IFUNC GOT entries.
4581         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4582         reloc.
4583         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4584         if we didn't create an IRELATIVE GOT.
4585         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4586         plt_address_for_local.
4587         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4588         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4589         got_irelative_, and irelative_count_ fields.  Update
4590         declarations.
4591         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4592         Initialize new fields.  Remove symtab parameter.  Change all
4593         callers.
4594         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4595         irelative_count_.
4596         (Output_data_plt_x86_64::has_irelative_section): New function.
4597         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4598         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4599         fields.  Update declarations.
4600         (Target_x86_64::Target_x86_64): Initialize new fields.
4601         (Target_x86_64::do_plt_address_for_global): New function replacing
4602         do_plt_section_for_global.
4603         (Target_x86_64::do_plt_address_for_local): New function replacing
4604         do_plt_section_for_local.
4605         (Target_x86_64::got_section): Create got_irelative_.
4606         (Target_x86_64::rela_irelative_section): New function.
4607         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4608         all callers.  Don't create __rel_iplt_{start,end}.
4609         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4610         parameters.  Change all callers.  Use different PLT and GOT for
4611         IFUNC symbols.
4612         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4613         layout parameters.  Change all callers.  Use different PLT and
4614         GOT.
4615         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4616         parameters.  Change all callers.  Use different PLT and GOT for
4617         IFUNC symbols.
4618         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4619         (Output_data_plt_x86_64::rela_irelative): New function.
4620         (Output_data_plt_x86_64::address_for_global): New function.
4621         (Output_data_plt_x86_64::address_for_local): New function.
4622         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4623         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4624         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4625         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4626         parameters.
4627         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4628         reloc.
4629         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4630         symbols if we didn't create an IRELATIVE GOT.
4631         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4632         plt_address_for_local.
4633         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4634         * testsuite/ifuncvar1.c: New test file.
4635         * testsuite/ifuncvar2.c: New test file.
4636         * testsuite/ifuncvar3.c: New test file.
4637         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4638         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4639         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4640         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4641         * testsuite/Makefile.in: Rebuild.
4642
4643 2011-07-07  Cary Coutant  <ccoutant@google.com>
4644
4645         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4646         (two_file_test_1_ndebug.o): Likewise.
4647         (two_file_test_1b_ndebug.o): Likewise.
4648         (two_file_test_2_ndebug.o): Likewise.
4649         (two_file_test_main_ndebug.o): Likewise.
4650         (incremental_test_2): Link with no-debug versions.
4651
4652 2011-07-06  Cary Coutant  <ccoutant@google.com>
4653
4654         * gold/incremental.cc
4655         (Output_section_incremental_inputs::write_info_blocks): Check for
4656         hidden and internal symbols.
4657
4658 2011-07-06  Cary Coutant  <ccoutant@google.com>
4659
4660         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4661         Check disposition for startup file.
4662         (Incremental_inputs::report_command_line): Ignore
4663         --incremental-startup-unchanged option.
4664         * options.cc (General_options::parse_incremental_startup_unchanged):
4665         New function.
4666         (General_options::General_options): Initialize new data member.
4667         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4668         (General_options): Add --incremental-startup-unchanged option.
4669         (General_options::incremental_startup_disposition): New function.
4670         (General_options::incremental_startup_disposition_): New data member.
4671
4672 2011-07-06  Cary Coutant  <ccoutant@google.com>
4673
4674         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4675         input file index to Script_info ctor.
4676         (Sized_incremental_binary::do_file_has_changed): Find the
4677         command-line argument for files named in scripts.
4678         * incremental.h (Script_info::Script_info): New ctor
4679         with input file index.
4680         (Script_info::input_file_index): New function.
4681         (Script_info::input_file_index_): New data member.
4682         (Incremental_binary::get_library): Add const.
4683         (Incremental_binary::get_script_info): Add const.
4684         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4685         * testsuite/Makefile.am (incremental_test_5): New test case.
4686         (incremental_test_6): New test case.
4687         * testsuite/Makefile.in: Regenerate.
4688
4689 2011-07-06  Cary Coutant  <ccoutant@google.com>
4690
4691         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4692         debug output when command lines differ.
4693
4694 2011-07-06  Cary Coutant  <ccoutant@google.com>
4695
4696         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4697         --incremental-patch option.
4698         * layout.cc (Free_list::allocate): Extend allocation beyond original
4699         end if enabled.
4700         (Layout::make_output_section): Mark sections that should get
4701         patch space.
4702         * options.cc (parse_percent): New function.
4703         * options.h (parse_percent): New function.
4704         (DEFINE_percent): New macro.
4705         (General_options): Add --incremental-patch option.
4706         * output.cc (Output_section::Output_section): Initialize new data
4707         members.
4708         (Output_section::add_input_section): Print section name when out
4709         of patch space.
4710         (Output_section::add_output_section_data): Likewise.
4711         (Output_section::set_final_data_size): Add patch space when
4712         doing --incremental-full.
4713         (Output_section::do_reset_address_and_file_offset): Remove patch
4714         space.
4715         (Output_segment::set_section_list_addresses): Print debug output
4716         only if --incremental-update.
4717         * output.h (Output_section::set_is_patch_space_allowed): New function.
4718         (Output_section::is_patch_space_allowed_): New data member.
4719         (Output_section::patch_space_): New data member.
4720         * parameters.cc (Parameters::incremental_full): New function.
4721         * parameters.h (Parameters::incremental_full): New function
4722         * testsuite/Makefile.am (incremental_test_2): Add test for
4723         --incremental-patch option.
4724         * testsuite/Makefile.in: Regenerate.
4725         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4726         (t18): Remove function body.
4727
4728 2011-07-05  Doug Kwan  <dougkwan@google.com>
4729
4730         PR gold/12771
4731         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4732         Arm_Address type for relocation result.
4733         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4734         overflow check.
4735         (Arm_relocate_functions::abs32): Use unaligned access.
4736         (Arm_relocate_functions::rel32): Ditto.
4737         (Arm_relocate_functions::prel31): Ditto.
4738         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4739         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4740         static data relocations.
4741         * testsuite/Makefile.in: Regnerate.
4742         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4743
4744 2011-07-05  Ian Lance Taylor  <iant@google.com>
4745
4746         PR gold/12392
4747         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4748         symbols if necessary.
4749         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4750
4751 2011-07-05  Ian Lance Taylor  <iant@google.com>
4752
4753         PR gold/12952
4754         * resolve.cc (Symbol::override_base_with_special): Simply override
4755         version with special symbol version, ignoring previous version.
4756
4757 2011-07-05  Ian Lance Taylor  <iant@google.com>
4758
4759         * object.cc (Sized_relobj_file::include_section_group): Add
4760         information to comment about signature location.
4761
4762 2011-07-02  Ian Lance Taylor  <iant@google.com>
4763
4764         PR gold/12957
4765         * options.h (class General_options): Add -f and -F.
4766         * options.cc (General_options::finalize): Fatal error if -f/-F
4767         are used without -shared.
4768         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4769
4770 2011-07-02  Ian Lance Taylor  <iant@google.com>
4771
4772         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4773
4774 2011-07-01  Ian Lance Taylor  <iant@google.com>
4775
4776         PR gold/12525
4777         PR gold/12952
4778         * resolve.cc (Symbol::override_base_with_special): Don't override
4779         the version if the overriding symbol has a different name.
4780         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4781         all callers.  If we give an error about an undefined version,
4782         define the base version if necessary.
4783         * dynobj.h (class Versions): Update declaration.
4784         * testsuite/weak_alias_test_5.cc: New file.
4785         * testsuite/weak_alias_test.script: New file.
4786         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4787         and versioned_alias have the right value, and call t2.
4788         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4789         weak_alias_test_5.so.
4790         (weak_alias_test_LDADD): Likewise.
4791         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4792         * testsuite/Makefile.in: Rebuild.
4793
4794 2011-07-01  Ian Lance Taylor  <iant@google.com>
4795
4796         PR gold/12525
4797         * options.h (class General_options): Support -z notext.
4798         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4799         -Wl,-z,notext.
4800         (two_file_shared_nonpic.so): Likewise.
4801         (two_file_shared_mixed.so): Likewise.
4802         (two_file_shared_mixed_1.so): Likewise.
4803         (weak_undef_lib_nonpic.so): Likewise.
4804         (alt/weak_undef_lib_nonpic.so): Likewise.
4805         (tls_test_shared_nonpic.so): Likewise.
4806         * testsuite/Makefile.in: Rebuild.
4807
4808 2011-07-01  Ian Lance Taylor  <iant@google.com>
4809
4810         PR gold/12525
4811         * configure.ac: Test whether static linking works, setting
4812         the automake conditional HAVE_STATIC.
4813         * testsuite/Makefile.am: Disable tests using -static if
4814         HAVE_STATIC is not true.
4815         * configure, testsuite/Makefile.in: Rebuild.
4816
4817 2011-07-01  Ian Lance Taylor  <iant@google.com>
4818
4819         PR gold/12525
4820         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4821         Assert if we see DW_EH_PE_indirect.
4822         * target.h (Target::ehframe_datarel_base): New function.
4823         (Target::do_ehframe_datarel_base): New target function.
4824         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4825         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4826         function.
4827
4828 2011-07-01  Ian Lance Taylor  <iant@google.com>
4829
4830         PR gold/12571
4831         * options.h (class General_options): Add
4832         --ld-generated-unwind-info.
4833         * ehframe.cc (Fde::write): Add address parameter.  Change all
4834         callers.  If associated with PLT, fill in address and size.
4835         (Cie::set_output_offset): Only add merge mapping if there is an
4836         object.
4837         (Cie::write): Add address parameter.  Change all callers.
4838         (Eh_frame::add_ehframe_for_plt): New function.
4839         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4840         input_offset_ fields into union u_, with new plt field.
4841         (Fde::Fde): Adjust for new union field.
4842         (Fde::Fde) [Output_data version]: New constructor.
4843         (Fde::add_mapping): Only add merge mapping if there is an object.
4844         (class Cie): Update declarations.
4845         (class Eh_frame): Declare add_ehframe_for_plt.
4846         * layout.cc (Layout::layout_eh_frame): Break out code into
4847         make_eh_frame_section, and call it.
4848         (Layout::make_eh_frame_section): New function.
4849         (Layout::add_eh_frame_for_plt): New function.
4850         * layout.h (class Layout): Update declarations.
4851         * merge.cc (Merge_map::add_mapping): Add assertion.
4852         * i386.cc: Include "dwarf.h".
4853         (class Output_data_plt_i386): Make first_plt_entry,
4854         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4855         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4856         and plt_eh_frame_fde.
4857         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4858         boundary.  Call add_eh_frame_for_plt if appropriate.
4859         * x86_64.cc: Include "dwarf.h".
4860         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4861         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4862         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4863         and plt_eh_frame_fde.
4864         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4865         appropriate.
4866
4867 2011-06-29  Ian Lance Taylor  <iant@google.com>
4868
4869         PR gold/12629
4870         * object.cc (Sized_relobj_file::layout_section): Change shdr
4871         parameter to be const.
4872         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4873         out of do_layout.
4874         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4875         appropriate.  Call layout_eh_frame_section.
4876         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4877         sections.
4878         * object.h (class Sized_relobj_file): Update declarations.
4879
4880 2011-06-29  Ian Lance Taylor  <iant@google.com>
4881
4882         PR gold/12652
4883         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4884         modifier.
4885         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4886
4887 2011-06-29  Ian Lance Taylor  <iant@google.com>
4888
4889         PR gold/12675
4890         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4891         SHT_X86_64_UNWIND.
4892         * layout.cc (Layout::layout_eh_frame): Likewise.
4893
4894 2011-06-29  Ian Lance Taylor  <iant@google.com>
4895
4896         PR gold/12695
4897         * layout.cc (Layout::symtab_section_shndx): New function.
4898         * layout.h (class Layout): Declare symtab_section_shndx.
4899         * output.cc (Output_section::write_header): Call it.
4900
4901 2011-06-29  Ian Lance Taylor  <iant@google.com>
4902
4903         PR gold/12818
4904         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4905         symbols which are not used in a relocation.
4906
4907 2011-06-28  Ian Lance Taylor  <iant@google.com>
4908
4909         PR gold/12898
4910         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4911         script create indistinguishable segments.
4912         (Layout::set_segment_offsets): Use stable_sort when sorting
4913         segments.  Pass this to Compare_segments constructor.
4914         * layout.h (class Layout): Make segment_precedes non-static.
4915         (class Compare_segments): Change from struct to class.  Add
4916         layout_ field.  Add constructor.
4917         * script-sections.cc
4918         (Script_sections::attach_sections_using_phdrs_clause): Rename
4919         local orphan to is_orphan.  Don't report failure to put empty
4920         section in segment.  On attachment failure, report name of
4921         section, and attach to first PT_LOAD segment.
4922
4923 2011-06-28  Ian Lance Taylor  <iant@google.com>
4924
4925         PR gold/12934
4926         * target-select.cc (Target_selector::Target_selector): Add
4927         emulation parameter.  Change all callers.
4928         (select_target_by_bfd_name): Rename from select_target_by_name.
4929         Change all callers.
4930         (select_target_by_emulation): New function.
4931         (supported_emulation_names): New function.
4932         * target-select.h (class Target_selector): Add emulation_ field.
4933         Update declarations.
4934         (Target_selector::recognize_by_bfd_name): Rename from
4935         recognize_by_name.  Change all callers.
4936         (Target_selector::supported_bfd_names): Rename from
4937         supported_names.  Change all callers.
4938         (Target_selector::recognize_by_emulation): New function.
4939         (Target_selector::supported_emulations): New function.
4940         (Target_selector::emulation): New function.
4941         (Target_selector::do_recognize_by_bfd_name): Rename from
4942         do_recognize_by_name.  Change all callers.
4943         (Target_selector::do_supported_bfd_names): Rename from
4944         do_supported_names.  Change all callers.
4945         (Target_selector::do_recognize_by_emulation): New function.
4946         (Target_selector::do_supported_emulations): New function.
4947         (select_target_by_bfd_name): Change name in declaration.
4948         (select_target_by_emulation): Declare.
4949         (supported_emulation_names): Declare.
4950         * parameters.cc (parameters_force_valid_target): Try to find
4951         target based on emulation from -m option.
4952         * options.h (class General_options): Change doc string for -m.
4953         * options.cc (help): Print emulations.
4954         (General_options::parse_V): Likewise.
4955         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4956         Add emulation parameter.  Change all callers.
4957
4958 2011-06-28  Ian Lance Taylor  <iant@google.com>
4959
4960         * target.h (class Target): Add osabi_ field.
4961         (Target::osabi): New function.
4962         (Target::set_osabi): New function.
4963         (Target::Target): Initialize osabi_.
4964         (Target::do_adjust_elf_header): Make pure virtual.
4965         (Sized_target::do_adjust_elf_header): Declare.
4966         * target.cc (Sized_target::do_adjust_elf_header): New function.
4967         (class Sized_target): Instantiate all versions.
4968         * freebsd.h (class Target_freebsd): Remove.
4969         (Target_selector_freebsd::do_recognize): Call set_osabi on
4970         Target.
4971         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4972         (Target_selector_freebsd::set_osabi): Remove.
4973         * i386.cc (class Target_i386): Inherit from Sized_target rather
4974         than Target_freebsd.
4975         * x86_64.cc (class Target_x86_64): Likewise.
4976
4977 2011-06-28  Ian Lance Taylor  <iant@google.com>
4978
4979         * target.h (Target::can_check_for_function_pointers): Rewrite.
4980         Make non-virtual.
4981         (Target::can_icf_inline_merge_sections): Likewise.
4982         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4983         (Target::Target_info): Add can_icf_inline_merge_sections field.
4984         (Target::do_can_check_for_function_pointers): New virtual
4985         function.
4986         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4987         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4988         from can_check_for_function_pointers, move in file.
4989         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4990         section_may_have_icf_unsafe_poineters, move in file.
4991         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4992         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4993         Rename from can_check_for_function_pointers, move in file.
4994         (Target_i386::can_icf_inline_merge_sections): Remove.
4995         (Target_i386::i386_info): Initialize
4996         can_icf_inline_merge_sections.
4997         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4998         Initialize can_icf_inline_merge_sections.
4999         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
5000         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
5001         Rename from can_check_for_function_pointers, move in file.
5002         (Target_x86_64::can_icf_inline_merge_sections): Remove.
5003         (Target_x86_64::x86_64_info): Initialize
5004         can_icf_inline_merge_sections.
5005         * testsuite/testfile.cc (Target_test::test_target_info):
5006         Likewise.
5007         * icf.cc (get_section_contents): Correct formatting.
5008
5009 2011-06-27  Ian Lance Taylor  <iant@google.com>
5010
5011         * symtab.cc (Symbol::versioned_name): New function.
5012         (Symbol_table::add_to_final_symtab): Use versioned_name when
5013         appropriate.
5014         (Symbol_table::sized_write_symbol): Likewise.
5015         * symtab.h (class Symbol): Declare versioned_name.
5016         * stringpool.h (class Stringpool_template): Add variant of add
5017         which takes a std::basic_string.
5018         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
5019         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
5020         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
5021         (ver_test_12.o): New target.
5022         * testsuite/Makefile.in: Rebuild.
5023
5024 2011-06-27  Doug Kwan  <dougkwan@google.com>
5025
5026         * arm.cc (Arm_relocate_functions::thm_jump8,
5027         Arm_relocate_functions::thm_jump11): Use a wider signed
5028         type to compute offset.
5029         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
5030         arm_thm_jump8.
5031         * testsuite/Makefile.in: Regenerate.
5032         * testsuite/arm_branch_in_range.sh: Check test results of
5033         arm_thm_jump11 and arm_thm_jump8.
5034         * testsuite/arm_thm_jump11.s: New test source file.
5035         * testsuite/arm_thm_jump11.t: New linker script.
5036         * testsuite/arm_thm_jump8.s: New test source file.
5037         * testsuite/arm_thm_jump8.t: New linker script.
5038
5039 2011-06-24  Ian Lance Taylor  <iant@google.com>
5040
5041         * layout.cc: Include "object.h".
5042         (ctors_sections_in_init_array): New static variable.
5043         (Layout::is_ctors_in_init_array): New function.
5044         (Layout::layout): Add entry to ctors_sections_in_init_array if
5045         appropriate.
5046         * layout.h (class Layout): Declare is_ctors_in_init_array.
5047         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5048         is_ctors_reverse_view is set.
5049         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5050         all callers.  Set is_ctors_reverse_view field of View_size.
5051         (Sized_relobj_file::reverse_words): New function.
5052         * object.h (Sized_relobj_file::View_size): Add
5053         is_ctors_reverse_view field.
5054         (class Sized_relobj_file): Update declarations.
5055         * testsuite/initpri3.c: New test.
5056         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5057         initpri3b.
5058         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5059         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5060         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5061         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5062         * testsuite/Makefile.in: Rebuild.
5063
5064 2011-06-24  Cary Coutant  <ccoutant@google.com>
5065
5066         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5067         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5068         (debug_msg_cdebug.err): New targets.
5069         * testsuite/Makefile.in: Regenerate.
5070         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5071         Fix checks for link with shared library.
5072
5073 2011-06-24  Doug Kwan  <dougkwan@google.com>
5074
5075         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5076         skip empty text sections.
5077         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5078
5079 2011-06-22  Ian Lance Taylor  <iant@google.com>
5080
5081         PR gold/12910
5082         * options.h (class General_options): Add --ctors-in-init-array.
5083         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5084         friends as SHT_PROGBITS for merging sections.
5085         (Layout::layout): Remove special handling of .init_array and
5086         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5087         and .dtors if ctors_in_init_array.
5088         (Layout::make_output_section): Force correct section types for
5089         .init_array and friends.  Don't sort if doing relocatable link,
5090         Don't sort .ctors and .dtors if ctors_in_init_array.
5091         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5092         (Layout::output_section_name): Add relobj parameter.  Change all
5093         callers.  Handle .ctors. and .dtors. in code rather than table.
5094         Handle .ctors and .dtors if ctors_in_init_array.
5095         (Layout::match_file_name): New function, moved from output.cc.
5096         * layout.h (class Layout): Update declarations.
5097         * output.cc: Include "layout.h".
5098         (Input_section_sort_entry::get_priority): New function.
5099         (Input_section_sort_entry::match_file_name): Just call
5100         Layout::match_file_name.
5101         (Output_section::Input_section_sort_init_fini_compare::operator()):
5102         Handle .ctors and .dtors.  Sort by explicit priority rather than
5103         by name.
5104         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5105         * testsuite/initpri2.c: New test.
5106         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5107         (check_PROGRAMS): Add initpri2.
5108         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5109         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5110         * configure, testsuite/Makefile.in: Rebuild.
5111
5112 2011-06-19  Ian Lance Taylor  <iant@google.com>
5113
5114         PR gold/12880
5115         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5116         .interp section to a PT_INTERP segment even if we have seen a
5117         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5118         clause in a linker script.
5119         (Layout::finalize): Don't create a .interp section if we've
5120         already create a PT_INTERP segment.
5121         (Layout::create_interp): Always call choose_output_section (revert
5122         patch of 2011-06-17).  Don't create PT_INTERP segment.
5123         * script-sections.cc
5124         (Script_sections::create_note_and_tls_segments): Add a .interp
5125         section to a PT_INTERP segment even if we have seen a
5126         --dynamic-linker option.
5127
5128 2011-06-18  Ian Lance Taylor  <iant@google.com>
5129
5130         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5131         merely because a non-PT_LOAD segment has a dynamic reloc.
5132
5133 2011-06-18  Ian Lance Taylor  <iant@google.com>
5134
5135         * layout.cc (Layout::finish_dynamic_section): Don't create
5136         DT_FLAGS entry if not needed.
5137
5138 2011-06-18  Ian Lance Taylor  <iant@google.com>
5139
5140         PR gold/12745
5141         * layout.cc (Layout::layout_eh_frame): Correct handling of
5142         writable .eh_frame section.
5143
5144 2011-06-17  Ian Lance Taylor  <iant@google.com>
5145
5146         PR gold/12893
5147         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5148         symbol is redefined with the exact same object and value.
5149
5150 2011-06-17  Ian Lance Taylor  <iant@google.com>
5151
5152         PR gold/12880
5153         * layout.h (class Layout): Add interp_segment_ field.
5154         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5155         (Layout::attach_allocated_section_to_segment): If making shared
5156         library, put .interp section in PT_INTERP segment.
5157         (Layout::finalize): Also call create_interp if -dynamic-linker
5158         option was used.
5159         (Layout::create_interp): Assert that there is no PT_INTERP
5160         segment.  If not using a SECTIONS clause, use make_output_section.
5161         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5162         * script-sections.cc
5163         (Script_sections::create_note_and_tls_segments): If making shared
5164         library, put .interp section in PT_INTERP segment.
5165
5166 2011-06-17  Ian Lance Taylor  <iant@google.com>
5167
5168         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5169         when making a shared library.
5170
5171 2011-06-17  Ian Lance Taylor  <iant@google.com>
5172
5173         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5174         parameter.  Change all callers.  Don't issue warning about PC32
5175         against locally defined symbol.
5176
5177 2011-06-16  Ian Lance Taylor  <iant@google.com>
5178
5179         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5180         occurs in same object.
5181
5182 2011-06-14  Alan Modra  <amodra@gmail.com>
5183
5184         * po/POTFILES.in: Regenerate.
5185
5186 2011-06-09  Ian Lance Taylor  <iant@google.com>
5187
5188         * script-sections.cc
5189         (Orphan_output_section::set_section_addresses): For a relocatable
5190         link set address to 0.
5191
5192 2011-06-09  Cary Coutant  <ccoutant@google.com>
5193
5194         PR gold/12804
5195         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5196         used with --compress-debug-sections.
5197         * gold/object.cc (Sized_relobj_file::do_layout): Report
5198         uncompressed size of compressed input sections.
5199
5200 2011-06-08  Cary Coutant  <ccoutant@google.com>
5201
5202         PR gold/12804
5203         * testsuite/two_file_test_2_v1.cc: Change initialization of
5204         v2 to keep it in .data.
5205
5206 2011-06-07  Cary Coutant  <ccoutant@google.com>
5207
5208         * common.cc (Symbol_table::do_allocate_commons_list): Call
5209         gold_fallback.
5210         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5211         (Errors::fallback): New function.
5212         (gold_fallback): New function.
5213         * errors.h (Errors::fallback): New function.
5214         * gold.cc (gold_exit): Change status parameter to enum; adjust
5215         all callers.
5216         (queue_initial_tasks): Call gold_fallback.
5217         * gold.h: Include cstdlib.
5218         (Exit_status): New enum type.
5219         (gold_exit): Change status parameter to enum.
5220         (gold_fallback): New function.
5221         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5222         (Layout::create_symtab_sections): Likewise.
5223         (Layout::create_shdrs): Likewise.
5224         * main.cc (main): Adjust call to gold_exit.
5225         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5226         (Output_data_got::add_got_entry_pair): Likewise.
5227         (Output_section::add_input_section): Likewise.
5228         (Output_section::add_output_section_data): Likewise.
5229         (Output_segment::set_section_list_addresses): Likewise.
5230         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5231
5232 2011-06-07  Cary Coutant  <ccoutant@google.com>
5233
5234         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5235         for incremental links.
5236         * output.cc (Output_segment::set_section_list_addresses): Remove
5237         FIXME and test for TLS or BSS.
5238
5239 2011-06-07  Cary Coutant  <ccoutant@google.com>
5240
5241         * testsuite/Makefile.am: Add incremental_copy_test,
5242         incremental_common_test_1.
5243         * testsuite/Makefile.in: Regenerate.
5244         * testsuite/common_test_1_v1.c: New source file.
5245         * testsuite/common_test_1_v2.c: New source file.
5246         * testsuite/copy_test_v1.cc: New source file.
5247
5248 2011-06-07  Cary Coutant  <ccoutant@google.com>
5249
5250         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5251         update, allocate common from bss section's free list.
5252         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5253         linker-defined symbols.
5254         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5255         Skip GOT and PLT entries that are no longer referenced.
5256         (Output_section_incremental_inputs::write_info_blocks): Mark
5257         linker-defined symbols.
5258         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5259         * output.cc (Output_section::allocate): New function.
5260         * output.h (Output_section::allocate): New function.
5261         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5262         linker-defined symbols.
5263         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5264         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5265         (Symbol::init_base_output_data): Likewise.
5266         (Symbol::init_base_output_segment): Likewise.
5267         (Symbol::init_base_constant): Likewise.
5268         (Sized_symbol::init_output_data): Likewise.
5269         (Sized_symbol::init_output_segment): Likewise.
5270         (Sized_symbol::init_constant): Likewise.
5271         (Symbol_table::do_define_in_output_data): Likewise.
5272         (Symbol_table::do_define_in_output_segment): Likewise.
5273         (Symbol_table::do_define_as_constant): Likewise.
5274         * symtab.h (Symbol::is_predefined): New function.
5275         (Symbol::init_base_output_data): Add is_predefined parameter.
5276         (Symbol::init_base_output_segment): Likewise.
5277         (Symbol::init_base_constant): Likewise.
5278         (Symbol::is_predefined_): New data member.
5279         (Sized_symbol::init_output_data): Add is_predefined parameter.
5280         (Sized_symbol::init_output_segment): Likewise.
5281         (Sized_symbol::init_constant): Likewise.
5282         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5283
5284 2011-06-07  Cary Coutant  <ccoutant@google.com>
5285
5286         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5287         instead of emit_copy_reloc.
5288         (Copy_relocs::emit_copy_reloc): Refactor.
5289         (Copy_relocs::make_copy_reloc): New function.
5290         (Copy_relocs::add_copy_reloc): Remove.
5291         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5292         section.
5293         (Copy_relocs::make_copy_reloc): New function.
5294         (Copy_relocs::add_copy_reloc): Remove.
5295         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5296         unchanged input files.
5297         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5298         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5299         Reserve BSS space for COPY relocations.
5300         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5301         (Output_section_incremental_inputs::write_info_blocks): Record
5302         whether a symbol is copied from a shared object.
5303         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5304         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5305         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5306         (Incremental_input_entry_reader::get_output_symbol_index): Add
5307         is_copy parameter.
5308         (Incremental_binary::emit_copy_relocs): New function.
5309         (Incremental_binary::do_emit_copy_relocs): New function.
5310         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5311         new data member.
5312         (Sized_incremental_binary::add_copy_reloc): New function.
5313         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5314         (Sized_incremental_binary::Copy_reloc): New struct.
5315         (Sized_incremental_binary::Copy_relocs): New typedef.
5316         (Sized_incremental_binary::copy_relocs_): New data member.
5317         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5318         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5319         * target.h (Sized_target::emit_copy_reloc): New function.
5320         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5321
5322 2011-06-02  Cary Coutant  <ccoutant@google.com>
5323
5324         PR gold/12163
5325         * gold/archive.cc (Archive::Archive): Initialize new data member.
5326         (Archive::include_all_members): Return if archive has already been
5327         included.
5328         * gold/archive.h (Archive::include_all_members_): New data member.
5329
5330 2011-06-02  Nick Clifton  <nickc@redhat.com>
5331
5332         * dynobj.h: Fix spelling mistake in comment.
5333         * output.cc: Likewise.
5334
5335 2011-05-31  Doug Kwan  <dougkwan@google.com>
5336             Asier Llano
5337
5338         PR gold/12826
5339         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5340         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5341         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5342         redundant arm_exidx_test.so.
5343         * testsuite/Makefile.in: Regenerate.
5344         (check_SCRIPTS): Add pr12826.sh
5345         (check_DATA): Add pr12826.stdout
5346         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5347         * testsuite/pr12826.sh: New file.
5348         * testsuite/pr12826_1.s: Ditto.
5349         * testsuite/pr12826_1.s: Ditto.
5350
5351 2011-05-30  Ian Lance Taylor  <iant@google.com>
5352
5353         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5354         sections.
5355
5356 2011-05-29  Ian Lance Taylor  <iant@google.com>
5357
5358         PR gold/12804
5359         * testsuite/Makefile.am: Use different file name for two_file_test
5360         temporary file for each incremental test.
5361         * testsuite/Makefile.in: Rebuild.
5362
5363 2011-05-29  Ian Lance Taylor  <iant@google.com>
5364
5365         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5366         binary input file is empty.
5367
5368 2011-05-27  Ian Lance Taylor  <iant@google.com>
5369
5370         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5371         (ver_test_9.so): Likewise.
5372         * testsuite/Makefile.in: Rebuild.
5373
5374 2011-05-26 Cary Coutant  <ccoutant@google.com>
5375
5376         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5377         * incremental.cc (Incremental_inputs::report_input_section): Fix
5378         comment, indentation.
5379         (Incremental_inputs::report_comdat_group): New function.
5380         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5381         of data for incremental input file entry.
5382         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5383         group count, COMDAT group signatures.
5384         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5385         an unchanged input file.
5386         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5387         Initialize new data member.
5388         (Incremental_object_entry::add_comdat_group): New function.
5389         (Incremental_object_entry::get_comdat_group_count): New function.
5390         (Incremental_object_entry::get_comdat_signature_key): New function.
5391         (Incremental_object_entry::groups_): New data member.
5392         (Incremental_inputs::report_comdat_group): New function.
5393         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5394         data for incremental input file entry.
5395         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5396         (Incremental_input_entry_reader::get_input_section): Adjust size of
5397         data for incremental input file entry.
5398         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5399         (Incremental_input_entry_reader::get_comdat_group_signature): New
5400         function.
5401         * object.cc (Sized_relobj::include_section_group): Report kept
5402         COMDAT groups for incremental links.
5403
5404 2011-05-24  David Meyer  <pdox@google.com>
5405
5406         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5407         with name parameter.  Add found_name parameter.
5408         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5409         * dirsearch.h (class Dirsearch): Update declaration.
5410
5411 2011-05-24  Ian Lance Taylor  <iant@google.com>
5412
5413         * archive.cc (Library_base::should_include_member): Pull in object
5414         from archive if it defines the entry symbol.
5415         * parameters.cc (Parameters::entry): New function.
5416         * parameters.h (class Parameters): Declare entry.
5417         * output.h (class Output_file_header): Remove entry_ field.
5418         * output.cc (Output_file_header::Output_file_header): Remove entry
5419         parameter.  Change all callers.
5420         (Output_file_header::entry): Use parameters->entry.
5421         * gold.cc (queue_middle_tasks): Likewise.
5422         * plugin.cc (Plugin_hook::run): Likewise.
5423
5424 2011-05-24 Cary Coutant  <ccoutant@google.com>
5425
5426         * gold.cc (queue_initial_tasks): Pass incremental base filename
5427         to Output_file::open_base_file; don't print error message.
5428         * incremental-dump.cc (main): Adjust call to
5429         Output_file::open_for_modification.
5430         * incremental-dump.cc (main): Likewise.
5431         * incremental.cc (Incremental_inputs::report_command_line):
5432         Ignore --incremental-base option when comparing command lines.
5433         Ignore parameter when given as separate argument.
5434         * options.h (class General_options): Add --incremental-base.
5435         * output.cc (Output_file::Output_file):
5436         (Output_file::open_base_file): Add base_name and writable parameters;
5437         read base file into new file; print error message here.
5438         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5439         callers.
5440         * output.h (Output_file::open_for_modification): Rename to...
5441         (Output_file::open_base_file): ...this; add base_name and
5442         writable parameters; adjust all callers.
5443         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5444         callers.
5445         * testsuite/Makefile.am (incremental_test_4): Test
5446         --incremental-base.
5447         * testsuite/Makefile.in: Regenerate.
5448
5449 2011-05-24 Cary Coutant  <ccoutant@google.com>
5450
5451         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5452         incremental_test_4.
5453         * testsuite/Makefile.in: Regenerate.
5454         * testsuite/two_file_test_1_v1.cc: New test source file.
5455         * testsuite/two_file_test_1b_v1.cc: New test source file.
5456         * testsuite/two_file_test_2_v1.cc: New test source file.
5457
5458 2011-05-24 Cary Coutant  <ccoutant@google.com>
5459
5460         * dynobj.h (Dynobj::do_dynobj): New function.
5461         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5462         flag and soname for shared objects.
5463         * incremental.cc (Incremental_inputs::report_object): Make
5464         either Incremental_object_entry or Incremental_dynobj_entry; add
5465         soname to string table.
5466         (Incremental_inputs::report_input_section): Add assertion.
5467         (Output_section_incremental_inputs::set_final_data_size): Adjust
5468         type of input file entry for shared libraries; adjust size of
5469         shared library info entry.
5470         (Output_section_incremental_inputs::write_input_files): Write
5471         as_needed flag for shared libraries.
5472         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5473         of input file entry for shared libraries; write soname.
5474         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5475         soname from incremental info.
5476         * incremental.h (enum Incremental_input_flags): Add
5477         INCREMENTAL_INPUT_AS_NEEDED.
5478         (Incremental_input_entry::Incremental_input_entry): Initialize new
5479         data member.
5480         (Incremental_input_entry::set_as_needed): New function.
5481         (Incremental_input_entry::as_needed): New function.
5482         (Incremental_input_entry::do_dynobj_entry): New function.
5483         (Incremental_input_entry::as_needed_): New data member.
5484         (Incremental_object_entry::Incremental_object_entry): Don't check
5485         for shared library.
5486         (Incremental_object_entry::do_type): Likewise.
5487         (class Incremental_dynobj_entry): New class.
5488         (Incremental_input_entry_reader::as_needed): New function.
5489         (Incremental_input_entry_reader::get_soname): New function.
5490         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5491         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5492         size of shared library info entry.
5493         * layout.cc (Layout::finish_dynamic_section): Don't test for
5494         incremental link when adding DT_NEEDED entries.
5495         * object.h (Object::Object): Initialize new data member.
5496         (Object::dynobj): New function.
5497         (Object::set_as_needed): New function.
5498         (Object::as_needed): New function.
5499         (Object::do_dynobj): New function.
5500         (Object::as_needed_): New data member.
5501
5502 2011-05-24 Cary Coutant  <ccoutant@google.com>
5503
5504         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5505         info; adjust display of GOT entries.
5506         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5507         vector of input objects; remove file_status_.
5508         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5509         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5510         got_plt reader; call target hooks to reserve GOT entries.
5511         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5512         of input file info header and GOT info entry.
5513         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5514         relocation info.
5515         (Got_plt_view_info::got_descriptor): Remove.
5516         (Got_plt_view_info::sym_index): New data member.
5517         (Got_plt_view_info::input_index): New data member.
5518         (Local_got_offset_visitor::visit): Write input file index.
5519         (Global_got_offset_visitor::visit): Write 0 for input file index.
5520         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5521         with sym_index and input_index.
5522         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5523         incremental info GOT entry; replace got_descriptor with input_index.
5524         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5525         map from input file index to object.
5526         (Sized_relobj_incr::do_layout): Replace direct data member reference
5527         with accessor function.
5528         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5529         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5530         Adjust size of input file info header.
5531         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5532         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5533         (Incremental_input_entry_reader::get_input_section): Adjust size of
5534         input file info header.
5535         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5536         of incremental info GOT entry.
5537         (Incremental_got_plt_reader::get_got_desc): Remove.
5538         (Incremental_got_plt_reader::get_got_symndx): New function.
5539         (Incremental_got_plt_reader::get_got_input_index): New function.
5540         (Sized_incremental_binary::Sized_incremental_binary): Remove
5541         file_status_; add input_objects_.
5542         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5543         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5544         (Sized_incremental_binary::file_is_unchanged): Remove.
5545         (Sized_incremental_binary::set_input_object): New function.
5546         (Sized_incremental_binary::input_object): New function.
5547         (Sized_incremental_binary::file_status_): Remove.
5548         (Sized_incremental_binary::input_objects_): New data member.
5549         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5550         references.
5551         (Sized_relobj_incr::invalid_address): Move to base class.
5552         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5553         class.
5554         (Sized_relobj_incr::do_output_section_offset): Likewise.
5555         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5556         (Sized_relobj_incr::section_offsets_): Likewise.
5557         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5558         function.
5559         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5560         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5561         with accessor function.
5562         (Sized_relobj_file::do_layout): Likewise.
5563         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5564         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5565         (Sized_relobj_file::compute_final_local_value): Replace refs to
5566         section_offsets_ with accessor function.
5567         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5568         * object.h (Relobj::Relobj): Initialize new data members.
5569         (Relobj::add_dyn_reloc): New function.
5570         (Relobj::first_dyn_reloc): New function.
5571         (Relobj::dyn_reloc_count): New function.
5572         (Relobj::first_dyn_reloc_): New data member.
5573         (Relobj::dyn_reloc_count_): New data member.
5574         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5575         references.
5576         (Sized_relobj::Address): New typedef.
5577         (Sized_relobj::invalid_address): Move here from child class.
5578         (Sized_relobj::Sized_relobj): Initialize new data members.
5579         (Sized_relobj::sized_relobj): New function.
5580         (Sized_relobj::is_output_section_offset_invalid): Move here from
5581         child class.
5582         (Sized_relobj::get_output_section_offset): Likewise.
5583         (Sized_relobj::local_has_got_offset): Likewise.
5584         (Sized_relobj::local_got_offset): Likewise.
5585         (Sized_relobj::set_local_got_offset): Likewise.
5586         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5587         (Sized_relobj::clear_got_offsets): New function.
5588         (Sized_relobj::section_offsets): Move here from child class.
5589         (Sized_relobj::do_output_section_offset): Likewise.
5590         (Sized_relobj::do_set_section_offset): Likewise.
5591         (Sized_relobj::Local_got_offsets): Likewise.
5592         (Sized_relobj::local_got_offsets_): Likewise.
5593         (Sized_relobj::section_offsets_): Likewise.
5594         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5595         references.
5596         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5597         class.
5598         (Sized_relobj_file::sized_relobj): New function
5599         (Sized_relobj_file::local_has_got_offset): Move to base class.
5600         (Sized_relobj_file::local_got_offset): Likewise.
5601         (Sized_relobj_file::set_local_got_offset): Likewise.
5602         (Sized_relobj_file::get_output_section_offset): Likewise.
5603         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5604         (Sized_relobj_file::do_output_section_offset): Likewise.
5605         (Sized_relobj_file::do_set_section_offset): Likewise.
5606         (Sized_relobj_file::Local_got_offsets): Likewise.
5607         (Sized_relobj_file::local_got_offsets_): Likewise.
5608         (Sized_relobj_file::section_offsets_): Likewise.
5609         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5610         (all constructors).
5611         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5612         (Output_reloc::get_symbol_index): Likewise.
5613         (Output_reloc::local_section_offset): Likewise.
5614         (Output_reloc::get_address): Likewise.
5615         (Output_reloc::symbol_value): Likewise.
5616         (Output_data_got::reserve_slot): Move to class definition.
5617         (Output_data_got::reserve_local): New function.
5618         (Output_data_got::reserve_slot_for_global): Remove.
5619         (Output_data_got::reserve_global): New function.
5620         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5621         (all constructors, two instantiations).
5622         (Output_reloc::get_relobj): New function (two instantiations).
5623         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5624         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5625         (Output_data_reloc::add_global): Adjust type of relobj.
5626         (Output_data_reloc::add_global_relative): Likewise.
5627         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5628         (Output_data_reloc::add_local): Likewise.
5629         (Output_data_reloc::add_local_relative): Likewise.
5630         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5631         (Output_data_reloc::add_local_section): Likewise.
5632         (Output_data_reloc::add_output_section): Likewise.
5633         (Output_data_reloc::add_absolute): Likewise.
5634         (Output_data_reloc::add_target_specific): Likewise.
5635         (Output_data_got::reserve_slot): Move definition here.
5636         (Output_data_got::reserve_local): New function.
5637         (Output_data_got::reserve_global): New function.
5638         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5639         section_offsets_ with accessor function.
5640         (Sized_relobj_file::write_sections): Likewise.
5641         (Sized_relobj_file::do_relocate_sections): Likewise.
5642         * target.h (Sized_target::reserve_local_got_entry): New function.
5643         (Sized_target::reserve_global_got_entry): New function.
5644         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5645         (Target_x86_64::reserve_global_got_entry): New function.
5646         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5647
5648 2011-05-23 Cary Coutant  <ccoutant@google.com>
5649
5650         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5651         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5652         bit when checking got_type.
5653         * incremental.cc (Sized_incremental_binary::setup_readers):
5654         Store symbol table and string table locations; initialize bit vector
5655         of file status flags.
5656         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5657         unchanged files.
5658         (Sized_incremental_binary::do_process_got_plt): New function.
5659         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5660         (Output_section_incremental_inputs::set_final_data_size): Record
5661         file index for each input file.
5662         (Output_section_incremental_inputs::write_got_plt): Store file index
5663         instead of input entry offset for each GOT entry.
5664         * incremental.h
5665         (Incremental_input_entry::Incremental_input_entry): Initialize new
5666         data member.
5667         (Incremental_input_entry::set_offset): Store file index.
5668         (Incremental_input_entry::get_file_index): New function.
5669         (Incremental_input_entry::file_index_): New data member.
5670         (Incremental_binary::process_got_plt): New function.
5671         (Incremental_binary::do_process_got_plt): New function.
5672         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5673         data members.
5674         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5675         (Sized_incremental_binary::set_file_is_unchanged): New function.
5676         (Sized_incremental_binary::file_is_unchanged): New function.
5677         (Sized_incremental_binary::do_process_got_plt): New function.
5678         (Sized_incremental_binary::file_status_): New data member.
5679         (Sized_incremental_binary::main_symtab_loc_): New data member.
5680         (Sized_incremental_binary::main_strtab_loc_): New data member.
5681         * output.cc (Output_data_got::Got_entry::write): Add case
5682         RESERVED_CODE.
5683         (Output_data_got::add_global): Call add_got_entry.
5684         (Output_data_got::add_global_plt): Likewise.
5685         (Output_data_got::add_global_with_rel): Likewise.
5686         (Output_data_got::add_global_with_rela): Likewise.
5687         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5688         (Output_data_got::add_global_pair_with_rela): Likewise.
5689         (Output_data_got::add_local): Call add_got_entry.
5690         (Output_data_got::add_local_plt): Likewise.
5691         (Output_data_got::add_local_with_rel): Likewise.
5692         (Output_data_got::add_local_with_rela): Likewise.
5693         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5694         (Output_data_got::add_local_pair_with_rela): Likewise.
5695         (Output_data_got::reserve_slot): New function.
5696         (Output_data_got::reserve_slot_for_global): New function.
5697         (Output_data_got::add_got_entry): New function.
5698         (Output_data_got::add_got_entry_pair): New function.
5699         (Output_section::add_output_section_data): Edit FIXME.
5700         * output.h
5701         (Output_section_data_build::Output_section_data_build): New
5702         constructor with size parameter.
5703         (Output_data_space::Output_data_space): Likewise.
5704         (Output_data_got::Output_data_got): Initialize new data member; new
5705         constructor with size parameter.
5706         (Output_data_got::add_constant): Call add_got_entry.
5707         (Output_data_got::reserve_slot): New function.
5708         (Output_data_got::reserve_slot_for_global): New function.
5709         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5710         (Output_data_got::add_got_entry): New function.
5711         (Output_data_got::add_got_entry_pair): New function.
5712         (Output_data_got::free_list_): New data member.
5713         * target.h (Sized_target::init_got_plt_for_update): New function.
5714         (Sized_target::register_global_plt_entry): New function.
5715         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5716         Initialize new data member; call init; add constructor with PLT count.
5717         (Output_data_plt_x86_64::init): New function.
5718         (Output_data_plt_x86_64::add_relocation): New function.
5719         (Output_data_plt_x86_64::reserve_slot): New function.
5720         (Output_data_plt_x86_64::free_list_): New data member.
5721         (Target_x86_64::init_got_plt_for_update): New function.
5722         (Target_x86_64::register_global_plt_entry): New function.
5723         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5724         incremental updates.
5725         (Output_data_plt_x86_64::add_relocation): New function.
5726         * testsuite/object_unittest.cc (Object_test): Set default options.
5727
5728 2011-05-16  Ian Lance Taylor  <iant@google.com>
5729
5730         * options.h (class General_options): Make -i a synonym for -r.
5731
5732 2011-05-16  Ian Lance Taylor  <iant@google.com>
5733
5734         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5735
5736 2011-05-10 Cary Coutant  <ccoutant@google.com>
5737
5738         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5739         strip_all (-s).
5740
5741 2011-05-06  Ian Lance Taylor  <iant@google.com>
5742
5743         * layout.cc (Layout::layout): If the output section flags change,
5744         update the ordering.
5745
5746 2011-04-25 Cary Coutant  <ccoutant@google.com>
5747
5748         * incremental-dump.cc (dump_incremental_inputs): Print local
5749         symbol info for each input file.
5750         * incremental.cc
5751         (Output_section_incremental_inputs::set_final_data_size): Add local
5752         symbol info to input file entries in incremental info.
5753         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5754         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5755         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5756         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5757         implementation.
5758         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5759         (Sized_incr_relobj::do_relocate): Write the local symbols.
5760         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5761         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5762         Adjust size of input file header.
5763         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5764         (Incremental_inputs_reader::get_local_symbol_count): New function.
5765         (Incremental_inputs_reader::get_input_section): Adjust size of input
5766         file header.
5767         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5768         (Sized_incr_relobj::This): New typedef.
5769         (Sized_incr_relobj::sym_size): New const data member.
5770         (Sized_incr_relobj::Local_symbol): New struct.
5771         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5772         (Sized_incr_relobj::do_local_symbol_offset): New function.
5773         (Sized_incr_relobj::local_symbol_count_): New data member.
5774         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5775         (Sized_incr_relobj::local_symbol_index_): New data member.
5776         (Sized_incr_relobj::local_symbol_offset_): New data member.
5777         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5778         (Sized_incr_relobj::local_symbols_): New data member.
5779         * object.h (Relobj::output_local_symbol_count): New function.
5780         (Relobj::local_symbol_offset): New function.
5781         (Relobj::do_output_local_symbol_count): New function.
5782         (Relobj::do_local_symbol_offset): New function.
5783         (Sized_relobj::do_output_local_symbol_count): New function.
5784         (Sized_relobj::do_local_symbol_offset): New function.
5785
5786 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5787
5788         * descriptors.cc (set_close_on_exec): New function.
5789         (Descriptors::open): Use set_close_on_exec.
5790         * output.cc (S_ISLNK): Define if not defined.
5791
5792 2011-04-22 Cary Coutant  <ccoutant@google.com>
5793
5794         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5795         global symbol map.
5796         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5797         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5798         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5799         relocations.
5800         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5801         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5802         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5803         * incremental.h
5804         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5805         function.
5806         (Incremental_binary::apply_incremental_relocs): New function.
5807         (Incremental_binary::do_apply_incremental_relocs): New function.
5808         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5809         data member.
5810         (Sized_incremental_binary::add_global_symbol): New function.
5811         (Sized_incremental_binary::global_symbol): New function.
5812         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5813         (Sized_incremental_binary::symbol_map_): New data member.
5814         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5815         * target.h (Sized_target::apply_relocation): New function.
5816         * target-reloc.h (apply_relocation): New function.
5817         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5818
5819 2011-04-22  Doug Kwan  <dougkwan@google.com>
5820
5821         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5822         flag of a SHT_ARM_EXIDX section.
5823         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5824         * testsuite/Makefile.in: Regenerate.
5825         * testsuite/arm_exidx_test.s: New file.
5826         * testsuite/arm_exidx_test.sh: Same.
5827
5828 2011-04-20 Cary Coutant  <ccoutant@google.com>
5829
5830         PR gold/12689
5831         * archive.h (Incremental_archive_entry::Archive_member):
5832         Initialize arg_serial_ (second constructor).
5833
5834 2011-04-17  Ian Lance Taylor  <iant@google.com>
5835
5836         * object.cc (Relocate_info::location): Simplify location string.
5837         * errors.cc (Errors::error_at_location): Don't print program
5838         name.
5839         (Errors::warning_at_location): Likewise.
5840         (Errors::undefined_symbol): Likewise.
5841         * testsuite/debug_msg.sh: Update accordingly.
5842
5843 2011-04-14 Cary Coutant  <ccoutant@google.com>
5844
5845         * gold/layout.cc (Layout::symtab_section_offset): New function.
5846         * gold/layout.h (Layout::symtab_section_offset): New function.
5847         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5848
5849 2011-04-12  Ian Lance Taylor  <iant@google.com>
5850
5851         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5852         with MREMAP_MAYMOVE.
5853         * output.h (class Output_file): Add map_is_allocated_ field.
5854         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5855         not available, provide stubs.  If mremap is not available, #define
5856         it to gold_mremap.
5857         (MREMAP_MAYMOVE): Define if not defined.
5858         (Output_file::Output_file): Initialize map_is_allocated_.
5859         (Output_file::resize): Check map_is_allocated_.
5860         (Output_file::map_anonymous): If mmap fails, use malloc.
5861         (Output_file::unmap): Don't do anything for an anonymous map.
5862         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5863         is not available, provide stubs.
5864         (File_read::View::~View): Use free rather than delete[].
5865         (File_read::make_view): Use malloc rather than new[].  If mmap
5866         fails, use malloc.
5867         (File_read::find_or_make_view): Use malloc rather than new[].
5868         * gold.h: Remove HAVE_REMAP code.
5869         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5870         exists.  Rename mremap to gold_mremap.  If mmap is not available
5871         don't do anything.
5872         * configure, config.in: Rebuild.
5873
5874 2011-04-11  Ian Lance Taylor  <iant@google.com>
5875
5876         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5877         initialize local variable v.
5878
5879 2011-04-11  Cary Coutant  <ccoutant@google.com>
5880
5881         * archive.cc (Archive::include_member): Adjust call to
5882         report_object.
5883         (Add_archive_symbols::run): Track argument serial numbers.
5884         (Lib_group::include_member): Likewise.
5885         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5886         * archive.h (Incremental_archive_entry::Archive_member):
5887         Initialize arg_serial_.
5888         (Archive_member::arg_serial_): New data member.
5889         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5890         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5891         incremental link.
5892         (Sized_dynobj::do_for_all_local_got_entries): New function.
5893         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5894         function.
5895         * fileread.cc (get_mtime): New function.
5896         * fileread.h (get_mtime): New function.
5897         * gold.cc (queue_initial_tasks): Check for incremental update.
5898         (process_incremental_input): New function.
5899         (queue_middle_tasks): Don't force valid target for incremental
5900         update.
5901         * incremental-dump.cc (find_input_containing_global): Adjust
5902         size of symbol info entry.
5903         (dump_incremental_inputs): Dump argument serial number and
5904         in_system_directory flag; bias shndx by 1; print symbol names
5905         when dumping per-file symbol lists; use new symbol info readers.
5906         * incremental.cc
5907         (Output_section_incremental_inputs:update_data_size): New function.
5908         (Sized_incremental_binary::setup_readers): Setup input readers
5909         for each input file; build maps for files added from libraries
5910         and scripts.
5911         (Sized_incremental_binary::check_input_args): New function.
5912         (Sized_incremental_binary::do_check_inputs): Build map of argument
5913         serial numbers to input arguments.
5914         (Sized_incremental_binary::do_file_has_changed): Rename
5915         do_file_is_unchanged to this; compare file modification times.
5916         (Sized_incremental_binary::do_init_layout): New function.
5917         (Sized_incremental_binary::do_reserve_layout): New function.
5918         (Sized_incremental_binary::do_get_input_reader): Remove.
5919         (Sized_incremental_binary::get_symtab_view): New function.
5920         (Incremental_checker::can_incrementally_link_output_file): Remove.
5921         (Incremental_inputs::report_command_line): Exclude --debug options.
5922         (Incremental_inputs::report_archive_begin): Add parameter; track
5923         argument serial numbers; don't put input file entry for archive
5924         before archive members.
5925         (Incremental_inputs::report_archive_end): Put input file entry
5926         for archive after archive members.
5927         (Incremental_inputs::report_object): Add parameter; track argument
5928         serial numbers and in_system_directory flag.
5929         (Incremental_inputs::report_script): Add parameter; track argument
5930         serial numbers.
5931         (Output_section_incremental_inputs::set_final_data_size): Adjust
5932         size of symbol info entry; check for forwarding symbols.
5933         (Output_section_incremental_inputs::write_input_files): Write
5934         in_system_directory flag and argument serial number.
5935         (Output_section_incremental_inputs::write_info_blocks): Map section
5936         indices between incremental info and original input file; store
5937         input section index for each symbol.
5938         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5939         change operator() to visit().
5940         (class Global_got_offset_visitor): Likewise.
5941         (class Global_symbol_visitor_got_plt):
5942         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5943         classes.
5944         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5945         (Sized_incr_relobj::do_read_symbols): New function.
5946         (Sized_incr_relobj::do_layout): New function.
5947         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5948         (Sized_incr_relobj::do_add_symbols): New function.
5949         (Sized_incr_relobj::do_should_include_member): New function.
5950         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5951         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5952         (Sized_incr_relobj::do_section_size): New function.
5953         (Sized_incr_relobj::do_section_name): New function.
5954         (Sized_incr_relobj::do_section_contents): New function.
5955         (Sized_incr_relobj::do_section_flags): New function.
5956         (Sized_incr_relobj::do_section_entsize): New function.
5957         (Sized_incr_relobj::do_section_address): New function.
5958         (Sized_incr_relobj::do_section_type): New function.
5959         (Sized_incr_relobj::do_section_link): New function.
5960         (Sized_incr_relobj::do_section_info): New function.
5961         (Sized_incr_relobj::do_section_addralign): New function.
5962         (Sized_incr_relobj::do_initialize_xindex): New function.
5963         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5964         (Sized_incr_relobj::do_read_relocs): New function.
5965         (Sized_incr_relobj::do_gc_process_relocs): New function.
5966         (Sized_incr_relobj::do_scan_relocs): New function.
5967         (Sized_incr_relobj::do_count_local_symbols): New function.
5968         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5969         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5970         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5971         (Sized_incr_relobj::do_relocate): New function.
5972         (Sized_incr_relobj::do_set_section_offset): New function.
5973         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5974         (Sized_incr_dynobj::do_read_symbols): New function.
5975         (Sized_incr_dynobj::do_layout): New function.
5976         (Sized_incr_dynobj::do_add_symbols): New function.
5977         (Sized_incr_dynobj::do_should_include_member): New function.
5978         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5979         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5980         (Sized_incr_dynobj::do_section_size): New function.
5981         (Sized_incr_dynobj::do_section_name): New function.
5982         (Sized_incr_dynobj::do_section_contents): New function.
5983         (Sized_incr_dynobj::do_section_flags): New function.
5984         (Sized_incr_dynobj::do_section_entsize): New function.
5985         (Sized_incr_dynobj::do_section_address): New function.
5986         (Sized_incr_dynobj::do_section_type): New function.
5987         (Sized_incr_dynobj::do_section_link): New function.
5988         (Sized_incr_dynobj::do_section_info): New function.
5989         (Sized_incr_dynobj::do_section_addralign): New function.
5990         (Sized_incr_dynobj::do_initialize_xindex): New function.
5991         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5992         (make_sized_incremental_object): New function.
5993         (Incremental_library::copy_unused_symbols): New function.
5994         (Incremental_library::do_for_all_unused_symbols): New function.
5995         * incremental.h (enum Incremental_input_flags): New type.
5996         (class Incremental_checker): Remove.
5997         (Incremental_input_entry::Incremental_input_entry): Add argument
5998         serial number.
5999         (Incremental_input_entry::arg_serial): New function.
6000         (Incremental_input_entry::set_is_in_system_directory): New function.
6001         (Incremental_input_entry::is_in_system_directory): New function.
6002         (Incremental_input_entry::arg_serial_): New data member.
6003         (Incremental_input_entry::is_in_system_directory_): New data member.
6004         (class Script_info): Move here from script.h.
6005         (Script_info::Script_info): Add filename parameter.
6006         (Script_info::filename): New function.
6007         (Script_info::filename_): New data member.
6008         (Incremental_script_entry::Incremental_script_entry): Add argument
6009         serial number.
6010         (Incremental_object_entry::Incremental_object_entry): Likewise.
6011         (Incremental_object_entry::add_input_section): Build list of input
6012         sections with map to original shndx.
6013         (Incremental_object_entry::get_input_section_index): New function.
6014         (Incremental_object_entry::shndx_): New data member.
6015         (Incremental_object_entry::name_key_): Rename; adjust all refs.
6016         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
6017         (Incremental_archive_entry::Incremental_archive_entry): Add argument
6018         serial number.
6019         (Incremental_inputs::report_archive_begin): Likewise.
6020         (Incremental_inputs::report_object): Likewise.
6021         (Incremental_inputs::report_script): Likewise.
6022         (class Incremental_global_symbol_reader): New class.
6023         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
6024         and store flags and input file type.
6025         (Incremental_input_entry_reader::arg_serial): New function.
6026         (Incremental_input_entry_reader::type): Extract type from flags.
6027         (Incremental_input_entry_reader::is_in_system_directory): New function.
6028         (Incremental_input_entry_reader::get_input_section_count): Call
6029         accessor function for type.
6030         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
6031         function for type; adjust size of global symbol entry.
6032         (Incremental_input_entry_reader::get_global_symbol_count): Call
6033         accessor function for type.
6034         (Incremental_input_entry_reader::get_object_count): Likewise.
6035         (Incremental_input_entry_reader::get_object_offset): Likewise.
6036         (Incremental_input_entry_reader::get_member_count): Likewise.
6037         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6038         (Incremental_input_entry_reader::get_member_offset): Likewise.
6039         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6040         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6041         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6042         (Incremental_input_entry_reader::get_global_symbol_reader): New
6043         function.
6044         (Incremental_input_entry_reader::get_output_symbol_index): New
6045         function.
6046         (Incremental_input_entry_reader::type_): Remove.
6047         (Incremental_input_entry_reader::flags_): New data member.
6048         (Incremental_inputs_reader::input_file_offset): New function.
6049         (Incremental_inputs_reader::input_file_index): New function.
6050         (Incremental_inputs_reader::input_file): Call input_file_offset.
6051         (Incremental_inputs_reader::input_file_at_offset): New function.
6052         (Incremental_relocs_reader::get_r_type): Reformat.
6053         (Incremental_relocs_reader::get_r_shndx): Reformat.
6054         (Incremental_relocs_reader::get_r_offset): Reformat.
6055         (Incremental_relocs_reader::data): New function.
6056         (Incremental_binary::Incremental_binary): Initialize new data members.
6057         (Incremental_binary::check_inputs): Add cmdline parameter.
6058         (Incremental_binary::file_is_unchanged): Remove.
6059         (Input_reader::arg_serial): New function.
6060         (Input_reader::get_unused_symbol_count): New function.
6061         (Input_reader::get_unused_symbol): New function.
6062         (Input_reader::do_arg_serial): New function.
6063         (Input_reader::do_get_unused_symbol_count): New function.
6064         (Input_reader::do_get_unused_symbol): New function.
6065         (Incremental_binary::input_file_count): New function.
6066         (Incremental_binary::get_input_reader): Change signature to use
6067         index instead of filename.
6068         (Incremental_binary::file_has_changed): New function.
6069         (Incremental_binary::get_input_argument): New function.
6070         (Incremental_binary::get_library): New function.
6071         (Incremental_binary::get_script_info): New function.
6072         (Incremental_binary::init_layout): New function.
6073         (Incremental_binary::reserve_layout): New function.
6074         (Incremental_binary::output_file): New function.
6075         (Incremental_binary::do_check_inputs): New function.
6076         (Incremental_binary::do_file_is_unchanged): Remove.
6077         (Incremental_binary::do_file_has_changed): New function.
6078         (Incremental_binary::do_init_layout): New function.
6079         (Incremental_binary::do_reserve_layout): New function.
6080         (Incremental_binary::do_input_file_count): New function.
6081         (Incremental_binary::do_get_input_reader): Change signature.
6082         (Incremental_binary::input_args_map_): New data member.
6083         (Incremental_binary::library_map_): New data member.
6084         (Incremental_binary::script_map_): New data member.
6085         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6086         new data members.
6087         (Sized_incremental_binary::output_section): New function.
6088         (Sized_incremental_binary::inputs_reader): Add const.
6089         (Sized_incremental_binary::symtab_reader): Add const.
6090         (Sized_incremental_binary::relocs_reader): Add const.
6091         (Sized_incremental_binary::got_plt_reader): Add const.
6092         (Sized_incremental_binary::get_symtab_view): New function.
6093         (Sized_incremental_binary::Inputs_reader): New typedef.
6094         (Sized_incremental_binary::Input_entry_reader): New typedef.
6095         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6096         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6097         (Sized_incremental_binary::do_file_has_changed): New function.
6098         (Sized_incremental_binary::do_init_layout): New function.
6099         (Sized_incremental_binary::do_reserve_layout): New function.
6100         (Sized_input_reader::Inputs_reader): Remove.
6101         (Sized_input_reader::Input_entry_reader): Remove.
6102         (Sized_input_reader::do_arg_serial): New function.
6103         (Sized_input_reader::do_get_unused_symbol_count): New function.
6104         (Sized_input_reader::do_get_unused_symbol): New function.
6105         (Sized_incremental_binary::do_input_file_count): New function.
6106         (Sized_incremental_binary::do_get_input_reader): Change signature;
6107         use index instead of filename.
6108         (Sized_incremental_binary::section_map_): New data member.
6109         (Sized_incremental_binary::input_entry_readers_): New data member.
6110         (class Sized_incr_relobj): New class.
6111         (class Sized_incr_dynobj): New class.
6112         (make_sized_incremental_object): New function.
6113         (class Incremental_library): New class.
6114         * layout.cc (Free_list::num_lists): New static data member.
6115         (Free_list::num_nodes): New static data member.
6116         (Free_list::num_removes): New static data member.
6117         (Free_list::num_remove_visits): New static data member.
6118         (Free_list::num_allocates): New static data member.
6119         (Free_list::num_allocate_visits): New static data member.
6120         (Free_list::init): New function.
6121         (Free_list::remove): New function.
6122         (Free_list::allocate): New function.
6123         (Free_list::dump): New function.
6124         (Free_list::print_stats): New function.
6125         (Layout_task_runner::run): Resize output file for incremental updates.
6126         (Layout::Layout): Initialize new data members.
6127         (Layout::set_incremental_base): New function.
6128         (Layout::init_fixed_output_section): New function.
6129         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6130         incremental updates.
6131         (Layout::create_gold_note): Do not create gold note section for
6132         incremental updates.
6133         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6134         for incremental updates.
6135         (Layout::set_section_offsets): For incremental updates, allocate space
6136         from free list.
6137         (Layout::create_symtab_sections): Layout with offsets relative to
6138         start of section; for incremental updates, allocate space from free
6139         list.
6140         (Layout::create_shdrs): For incremental updates, allocate space from
6141         free list.
6142         (Layout::finish_dynamic_section): For incremental updates, do not
6143         check --as-needed (fixed in subsequent patch).
6144         * layout.h (class Free_list): New class.
6145         (Layout::set_incremental_base): New function.
6146         (Layout::incremental_base): New function.
6147         (Layout::init_fixed_output_section): New function.
6148         (Layout::allocate): New function.
6149         (Layout::incremental_base_): New data member.
6150         (Layout::free_list_): New data member.
6151         * main.cc (main): Print Free_list statistics.
6152         * object.cc (Relobj::finalize_incremental_relocs): Add
6153         clear_counts parameter; clear counts only when clear_counts is set.
6154         (Sized_relobj::Sized_relobj): Initialize new base class.
6155         (Sized_relobj::do_layout): Don't report special sections.
6156         (Sized_relobj::do_for_all_local_got_entries): New function.
6157         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6158         symtab_off to all symbol table offsets.
6159         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6160         * object.h (class Got_offset_list): Move to top of file.
6161         (Object::Object): Allow case where input_file == NULL.
6162         (Object::~Object): Likewise.
6163         (Object::input_file): Assert that input_file != NULL.
6164         (Object::lock): Allow case where input_file == NULL.
6165         (Object::unlock): Likewise.
6166         (Object::is_locked): Likewise.
6167         (Object::token): Likewise.
6168         (Object::release): Likewise.
6169         (Object::is_incremental): New function.
6170         (Object::get_mtime): New function.
6171         (Object::for_all_local_got_entries): New function.
6172         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6173         (Object::set_is_in_system_directory): New function.
6174         (Object::is_in_system_directory): New function.
6175         (Object::do_is_incremental): New function.
6176         (Object::do_get_mtime): New function.
6177         (Object::do_for_all_local_got_entries): New function.
6178         (Object::is_in_system_directory_): New data member.
6179         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6180         (class Sized_relobj_base): New class.
6181         (class Sized_relobj): Derive from Sized_relobj_base.
6182         (class Sized_relobj::Symbols): Redeclare from base class.
6183         (class Sized_relobj::local_got_offset_list): Remove.
6184         (class Sized_relobj::Output_sections): Redeclare from base class.
6185         (class Sized_relobj::do_for_all_local_got_entries): New function.
6186         (class Sized_relobj::write_local_symbols): Add offset parameter.
6187         (class Sized_relobj::local_symbol_offset_): Update comment.
6188         (class Sized_relobj::local_dynsym_offset_): Update comment.
6189         * options.cc (Input_arguments::add_file): Remove const.
6190         * options.h (Input_file_argument::Input_file_argument):
6191         Initialize arg_serial_ (all constructors).
6192         (Input_file_argument::set_arg_serial): New function.
6193         (Input_file_argument::arg_serial): New function.
6194         (Input_file_argument::arg_serial_): New data member.
6195         (Input_arguments::Input_arguments): Initialize file_count_.
6196         (Input_arguments::add_file): Remove const.
6197         (Input_arguments::number_of_input_files): New function.
6198         (Input_arguments::file_count_): New data member.
6199         (Command_line::number_of_input_files): Call
6200         Input_arguments::number_of_input_files.
6201         * output.cc (Output_segment_headers::Output_segment_headers):
6202         Set current size.
6203         (Output_section::Input_section::current_data_size): New function.
6204         (Output_section::Output_section): Initialize new data members.
6205         (Output_section::add_input_section): Don't do merge sections for
6206         an incremental link; allocate space from free list for an
6207         incremental update.
6208         (Output_section::add_output_section_data): Allocate space from
6209         free list for an incremental update.
6210         (Output_section::update_data_size): New function.
6211         (Output_section::set_fixed_layout): New function.
6212         (Output_section::reserve): New function.
6213         (Output_segment::set_section_addresses): Remove const.
6214         (Output_segment::set_section_list_addresses): Remove const; allocate
6215         space from free list for an incremental update.
6216         (Output_segment::set_offset): Adjust size of RELRO segment for an
6217         incremental update.
6218         * output.h (Output_data::current_data_size): Move here from
6219         child classes.
6220         (Output_data::pre_finalize_data_size): New function.
6221         (Output_data::update_data_size): New function.
6222         (Output_section_headers::update_data_size): new function.
6223         (Output_section_data_build::current_data_size): Move to Output_data.
6224         (Output_data_strtab::update_data_size): New function.
6225         (Output_section::current_data_size): Move to Output_data.
6226         (Output_section::set_fixed_layout): New function.
6227         (Output_section::has_fixed_layout): New function.
6228         (Output_section::reserve): New function.
6229         (Output_section::update_data_size): New function.
6230         (Output_section::has_fixed_layout_): New data member.
6231         (Output_section::free_list_): New data member.
6232         (Output_segment::set_section_addresses): Remove const.
6233         (Output_segment::set_section_list_addresses): Remove const.
6234         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6235         New function.
6236         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6237         New function.
6238         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6239         parameter when calling Add_symbols constructor; store argument
6240         serial number for members of a lib group.
6241         (Add_symbols::locks): Allow case where token == NULL.
6242         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6243         (Read_member::~Read_member): New function.
6244         (Read_member::is_runnable): New function.
6245         (Read_member::locks): New function.
6246         (Read_member::run): New function.
6247         (Check_script::~Check_script): New function.
6248         (Check_script::is_runnable): New function.
6249         (Check_script::locks): New function.
6250         (Check_script::run): New function.
6251         (Check_library::~Check_library): New function.
6252         (Check_library::is_runnable): New function.
6253         (Check_library::locks): New function.
6254         (Check_library::run): New function.
6255         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6256         (Add_symbols::library_): New data member.
6257         (class Read_member): New class.
6258         (class Check_script): New class.
6259         (class Check_library): New class.
6260         * reloc.cc (Read_relocs::is_runnable): Allow case where
6261         token == NULL.
6262         (Read_relocs::locks): Likewise.
6263         (Scan_relocs::locks): Likewise.
6264         (Relocate_task::locks): Likewise.
6265         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6266         to clear counters.
6267         (Sized_relobj::incremental_relocs_scan): Fix comment.
6268         (Sized_relobj::do_relocate): Pass output file offset to
6269         write_local_symbols.
6270         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6271         from class declaration.
6272         * script.cc (read_input_script): Allocate Script_info; pass
6273         argument serial number to report_script.
6274         * script.h (class Script_info): Move to incremental.h.
6275         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6276         * symtab.h (Symbol_table::add_from_incrobj): New function.
6277         (Symbol_table::set_file_offset): New function.
6278
6279 2011-04-05  Cary Coutant  <ccoutant@google.com>
6280
6281         * incremental-dump.cc (dump_incremental_inputs): Change signature
6282         to take a Sized_incremental_binary; change caller.  Use readers
6283         in Sized_incremental_binary.
6284         * incremental.cc
6285         (Sized_incremental_binary::find_incremental_inputs_sections):
6286         Rename do_find_incremental_inputs_sections to this.
6287         (Sized_incremental_binary::setup_readers): New function.
6288         (Sized_incremental_binary::do_check_inputs): Check
6289         has_incremental_info_ flag; move setup code to setup_readers;
6290         use input readers.
6291         (Sized_incremental_binary::do_file_is_unchanged): New function.
6292         (Sized_incremental_binary::do_get_input_reader): New function.
6293         * incremental.h (class Incremental_binary): Move to end of file.
6294         (Incremental_binary::file_is_unchanged): New function.
6295         (Incremental_binary::do_file_is_unchanged): New function.
6296         (Incremental_binary::Input_reader): New class.
6297         (Incremental_binary::get_input_reader): New function.
6298         (class Sized_incremental_binary): Move to end of file.
6299         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6300         input section reader classes.
6301         (Sized_incremental_binary::has_incremental_info): New function.
6302         (Sized_incremental_binary::inputs_reader): New function.
6303         (Sized_incremental_binary::symtab_reader): New function.
6304         (Sized_incremental_binary::relocs_reader): New function.
6305         (Sized_incremental_binary::got_plt_reader): New function.
6306         (Sized_incremental_binary::do_file_is_unchanged): New function.
6307         (Sized_incremental_binary::Sized_input_reader): New class.
6308         (Sized_incremental_binary::get_input_reader): New function.
6309         (Sized_incremental_binary::find_incremental_inputs_sections):
6310         Rename do_find_incremental_inputs_sections to this.
6311         (Sized_incremental_binary::setup_readers): New function.
6312         (Sized_incremental_binary::has_incremental_info_): New data member.
6313         (Sized_incremental_binary::inputs_reader_): New data member.
6314         (Sized_incremental_binary::symtab_reader_): New data member.
6315         (Sized_incremental_binary::relocs_reader_): New data member.
6316         (Sized_incremental_binary::got_plt_reader_): New data member.
6317         (Sized_incremental_binary::current_input_file_): New data member.
6318
6319 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6320
6321         PR gold/12640
6322         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6323         violation.
6324
6325 2011-03-30  Cary Coutant  <ccoutant@google.com>
6326
6327         * archive.cc (Archive::include_member): Adjust call to report_object.
6328         (Add_archive_symbols::run): Add script_info to call to
6329         report_archive_begin.
6330         (Lib_group::include_member): Adjust call to report_object.
6331         (Add_lib_group_symbols::run): Adjust call to report_object.
6332         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6333         blocks.  Add object count for script input files.
6334         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6335         script_info parameter; change all callers.
6336         (Incremental_inputs::report_object): Add script_info parameter;
6337         change all callers.
6338         (Incremental_inputs::report_script): Store backpointer to
6339         incremental info entry.
6340         (Output_section_incremental_inputs::set_final_data_size): Record
6341         additional information for scripts.
6342         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6343         * incremental.h (Incremental_script_entry::add_object): New function.
6344         (Incremental_script_entry::get_object_count): New function.
6345         (Incremental_script_entry::get_object): New function.
6346         (Incremental_script_entry::objects_): New data member; adjust
6347         constructor.
6348         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6349         (Incremental_inputs::report_object): Add script_info parameter.
6350         (Incremental_inputs_reader::get_object_count): New function.
6351         (Incremental_inputs_reader::get_object_offset): New function.
6352         * options.cc (Input_arguments::add_file): Return reference to
6353         new input argument.
6354         * options.h (Input_argument::set_script_info): New function.
6355         (Input_argument::script_info): New function.
6356         (Input_argument::script_info_): New data member; adjust all
6357         constructors.
6358         (Input_file_group::add_file): Return reference to new input argument.
6359         (Input_file_lib::add_file): Likewise.
6360         (Input_arguments::add_file): Likewise.
6361         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6362         * script.cc (Parser_closure::Parser_closure): Add script_info
6363         parameter; adjust all callers.
6364         (Parser_closure::script_info): New function.
6365         (Parser_closure::script_info_): New data member.
6366         (read_input_script): Report scripts earlier to incremental info.
6367         (script_add_file): Set script_info in Input_argument.
6368         (script_add_library): Likewise.
6369         * script.h (Script_options::Script_info): Rewrite class.
6370
6371 2011-03-29  Cary Coutant  <ccoutant@google.com>
6372
6373         * archive.cc (Library_base::should_include_member): Move
6374         method here from class Archive.
6375         (Archive::Archive): Initialize base class.
6376         (Archive::should_include_member): Move to base class.
6377         (Archive::do_for_all_unused_symbols): New function.
6378         (Add_archive_symbols::run): Remove redundant access to
6379         incremental_inputs.
6380         (Lib_group::Lib_group): Initialize base class.
6381         (Lib_group::do_filename): New function.
6382         (Lib_group::include_member): Pass pointer to Lib_group to
6383         report_object.
6384         (Lib_group::do_for_all_unused_symbols): New function.
6385         (Add_lib_group_symbols::run): Report archive information for
6386         incremental links.
6387         * archive.h (class Library_base): New base class.
6388         (class Archive): Derive from Library_base.
6389         (Archive::filename): Move to base class.
6390         (Archive::set_incremental_info): Likewise.
6391         (Archive::incremental_info): Likewise.
6392         (Archive::Should_include): Likewise.
6393         (Archive::should_include_member): Likewise.
6394         (Archive::Armap_entry): Remove.
6395         (Archive::Unused_symbol_iterator): Remove.
6396         (Archive::unused_symbols_begin): Remove.
6397         (Archive::unused_symbols_end): Remove.
6398         (Archive::do_filename): New function.
6399         (Archive::do_get_mtime): New function.
6400         (Archive::do_for_all_unused_symbols): New function.
6401         (Archive::task_): Move to base class.
6402         (Archive::incremental_info_): Likewise.
6403         (class Lib_group): Derive from Library_base.
6404         (Lib_group::do_filename): New function.
6405         (Lib_group::do_get_mtime): New function.
6406         (Lib_group::do_for_all_unused_symbols): New function.
6407         (Lib_group::task_): Move to base class.
6408         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6409         function.
6410         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6411         function.
6412         * incremental.cc (Incremental_inputs::report_archive_begin):
6413         Use Library_base; call library's get_mtime; add incremental inputs
6414         entry before members.
6415         (class Unused_symbol_visitor): New class.
6416         (Incremental_inputs::report_archive_end): Use Library_base; use
6417         visitor class to record unused symbols; don't add incremental inputs
6418         entry after members.
6419         (Incremental_inputs::report_object): Use Library_base.
6420         * incremental.h
6421         (Incremental_archive_entry::Incremental_archive_entry): Remove
6422         unused Archive parameter.
6423         (Incremental_inputs::report_archive_begin): Use Library_base.
6424         (Incremental_inputs::report_archive_end): Likewise.
6425         (Incremental_inputs::report_object): Likewise.
6426         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6427         function.
6428         * object.h (Object::for_all_global_symbols): New function.
6429         (Object::do_for_all_global_symbols): New function.
6430         (Sized_relobj::do_for_all_global_symbols): New function.
6431         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6432         function.
6433         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6434         function.
6435
6436 2011-03-27  Ian Lance Taylor  <iant@google.com>
6437
6438         * archive.cc (Archive::interpret_header): Return -1 if something
6439         goes wrong.  Change callers accordingly.
6440
6441 2011-03-25  Cary Coutant  <ccoutant@google.com>
6442
6443         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6444         * testsuite/Makefile.in: Regenerate.
6445
6446 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6447
6448         * plugin.cc (get_view): New.
6449         (Plugin::load): Pass get_view to the plugin.
6450         (Plugin_manager::get_view): New.
6451
6452 2011-03-21  Ian Lance Taylor  <iant@google.com>
6453
6454         * testsuite/final_layout.sh: Rewrite to not use dc.
6455         * testsuite/relro_test.sh: Fail if dc is not present.
6456
6457 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6458
6459         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6460         Change == to -eq.
6461         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6462         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6463         Change == to -eq.
6464         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6465         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6466
6467 2011-03-14  Ian Lance Taylor  <iant@google.com>
6468
6469         * script-sections.cc (Sort_output_sections::script_compare):
6470         Rename from is_before, change return type.
6471         (Sort_output_sections::operator()): Adjust accordingly.
6472
6473 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6474
6475         PR gold/12572
6476         * testsuite/odr_violation2.cc: Add comment to make all error line
6477         numbers double digits.
6478         * testsuite/debug_msg.sh: Adjust expected errors.
6479
6480 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6481
6482         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6483         but mark earlier ones as non-canonical
6484         (offset_to_iterator): Update search target and example
6485         (do_addr2line): Return extra lines in a vector*
6486         (format_file_lineno): Extract from do_addr2line
6487         (one_addr2line): Add vector* out-param
6488         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6489         when a lineno entry appeared last for its instruction
6490         (Dwarf_line_info): Add vector* out-param
6491         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6492         * symtab.cc (Odr_violation_compare): Include the lineno in the
6493         comparison again.
6494         (linenos_from_loc): New. Combine the canonical line for an
6495         address with its other lines.
6496         (True_if_intersect): New. Helper functor to make
6497         std::set_intersection a query.
6498         (detect_odr_violations): Compare sets of lines instead of just
6499         one line for each function. This became less deterministic, but
6500         has fewer false positives.
6501         * symtab.h: Declarations.
6502         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6503         mix an optimized and non-optimized object in the same binary
6504         (odr_violation2.so): Same.
6505         * testsuite/Makefile.in: Regenerate from Makefile.am.
6506         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6507         * testsuite/debug_msg.sh: Update line numbers and add
6508         assertions.
6509         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6510         non-optimized context.
6511         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6512         isn't inlined, and use OdrDerived in an optimized context.
6513         * testsuite/odr_header1.h: Defines OdrDerived, where
6514         optimization will change the
6515         first-instruction-in-the-destructor's file and line number.
6516         * testsuite/odr_header2.h: Defines OdrBase.
6517
6518 2011-03-09  Ian Lance Taylor  <iant@google.com>
6519
6520         * fileread.cc (File_read::clear_views): Don't delete the whole
6521         file view.
6522
6523 2011-03-08  Ian Lance Taylor  <iant@google.com>
6524
6525         PR gold/12525
6526         * fileread.cc: #include <climits>.
6527         (GOLD_IOV_MAX): Define.
6528         (File_read::read_multiple): Limit number of entries by iov_max.
6529         * fileread.h (class File_read): Always set max_readv_entries to
6530         128.
6531
6532 2011-03-07  Ian Lance Taylor  <iant@google.com>
6533
6534         PR gold/12525
6535         * options.h (class General_options): Add -dy and -dn.
6536
6537 2011-03-02  Cary Coutant  <ccoutant@google.com>
6538
6539         * testsuite/script_test_9.t: Add TLS segment.
6540
6541 2011-03-02  Simon Baldwin  <simonb@google.com>
6542
6543         * configure.ac: Add check for gnu_indirect_function support in
6544         the toolchain building binutils.
6545         * configure: Rebuild.
6546
6547 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6548
6549         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6550         plugin only symbols.
6551         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6552         in plugin files as not needed in the symbol table.
6553
6554 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6555
6556         * output.cc (Output_section::add_input_section): Delay fill
6557         generation for section ordering.
6558
6559 2011-02-09  Ian Lance Taylor  <iant@google.com>
6560
6561         PR gold/12316
6562         * object.h (class Sized_relobj): Remove clear_local_symbols.
6563         * reloc.cc (Sized_relobj::do_relocate): Don't call
6564         clear_local_symbols.
6565
6566 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6567
6568         * plugin.cc (is_visible_from_outside): Return true for symbols
6569         in the -u option.
6570
6571 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6572
6573         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6574         filename.
6575
6576 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6577
6578         * icf.h (is_section_foldable_candidate): Change type of parameter
6579         to std::string.
6580         * icf.cc (Icf::find_identical_sections): Change type of local variable
6581         section_name to be std::string.
6582         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6583
6584 2011-01-25  Ian Lance Taylor  <iant@google.com>
6585
6586         * script.cc (script_add_extern): Rewrite to use
6587         add_symbol_reference.
6588
6589 2011-01-25  Doug Kwan  <dougkwan@google.com>
6590
6591         * icf.cc (get_section_contents): Always lock section's object.
6592
6593 2011-01-24  Ian Lance Taylor  <iant@google.com>
6594
6595         * options.h (class General_options): Accept
6596         --no-detect-odr-violations.
6597
6598 2011-01-24  Ian Lance Taylor  <iant@google.com>
6599
6600         * version.cc (version_string): Bump to 1.11.
6601
6602 2011-01-24  Ian Lance Taylor  <iant@google.com>
6603
6604         * plugin.cc (class Plugin_rescan): Define new class.
6605         (Plugin_manager::claim_file): Set any_claimed_.
6606         (Plugin_manager::save_archive): New function.
6607         (Plugin_manager::save_input_group): New function.
6608         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6609         necessary.
6610         (Plugin_manager::new_undefined_symbol): New function.
6611         (Plugin_manager::rescan): New function.
6612         (Plugin_manager::rescannable_defines): New function.
6613         (Plugin_manager::add_input_file): Set any_added_.
6614         * plugin.h (class Plugin_manager): define new fields rescannable_,
6615         undefined_symbols_, any_claimed_, and any_added_.  Declare
6616         Plugin_rescan as friend.  Declare new functions.
6617         (Plugin_manager::Rescannable): Define type.
6618         (Plugin_manager::Rescannable_list): Define type.
6619         (Plugin_manager::Undefined_symbol_list): Define type.
6620         (Plugin_manager::Plugin_manager): Initialize new fields.
6621         * archive.cc (Archive::defines_symbol): New function.
6622         (Add_archive_symbols::run): Pass archive to plugins if any.
6623         * archive.h (class Archive): Declare defines_symbol.
6624         * readsyms.cc (Input_group::~Input_group): New function.
6625         (Finish_group::run): Pass input_group to plugins if any.
6626         * readsyms.h (class Input_group): Declare destructor.
6627         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6628         any.
6629
6630 2011-01-10  Ian Lance Taylor  <iant@google.com>
6631
6632         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6633         section as relro.
6634         (Layout::set_segment_offsets): Reset increase_relro before calling
6635         set_section_addresses a second time.
6636
6637 2011-01-04  Cary Coutant  <ccoutant@google.com>
6638
6639         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6640         sections before NOBITS sections.
6641
6642 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6643
6644         * version.cc (print_version): Update copyright to 2011.
6645
6646 2010-12-23  Cary Coutant  <ccoutant@google.com>
6647
6648         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6649         of OS to this->add.  Add OD parameter to second form of the function.
6650
6651 2010-12-20  Ian Lance Taylor  <iant@google.com>
6652
6653         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6654         second of two consecutive entries with same offset.
6655
6656 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6657
6658         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6659         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6660         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6661         to avoid unneeded links against $(LDADD).
6662         * testsuite/Makefile.in: Regenerate.
6663
6664 2010-12-15  Ian Lance Taylor  <iant@google.com>
6665
6666         PR gold/12324
6667         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6668         for R_X86_64_32 and R_X86_64_PC32.
6669         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6670         ver_matching_def_pic.o.
6671         (ver_matching_def_pic.o): New target.
6672
6673 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6674
6675         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6676         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6677         Move definition before File_read::View member definitions.
6678         (File_read::View::~View): Initialize and hold lock before
6679         updating current_mapped_bytes.
6680
6681 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6682
6683         * dwarf_reader.cc: Remove outdated comment.
6684         * gold-threads.cc: Fix typo in error message.
6685         * archive.cc: Fix typos in comments.
6686         * archive.h: Likewise.
6687         * arm-reloc-property.cc: Likewise.
6688         * arm-reloc-property.h: Likewise.
6689         * arm-reloc.def: Likewise.
6690         * arm.cc: Likewise.
6691         * attributes.h: Likewise.
6692         * cref.cc: Likewise.
6693         * ehframe.cc: Likewise.
6694         * fileread.h: Likewise.
6695         * gold.h: Likewise.
6696         * i386.cc: Likewise.
6697         * icf.cc: Likewise.
6698         * incremental.h: Likewise.
6699         * int_encoding.cc: Likewise.
6700         * layout.h: Likewise.
6701         * main.cc: Likewise.
6702         * merge.h: Likewise.
6703         * object.cc: Likewise.
6704         * object.h: Likewise.
6705         * options.cc: Likewise.
6706         * readsyms.cc: Likewise.
6707         * reduced_debug_output.cc: Likewise.
6708         * reloc.cc: Likewise.
6709         * script-sections.cc: Likewise.
6710         * sparc.cc: Likewise.
6711         * symtab.h: Likewise.
6712         * target-reloc.h: Likewise.
6713         * target.cc: Likewise.
6714         * target.h: Likewise.
6715         * timer.cc: Likewise.
6716         * timer.h: Likewise.
6717         * x86_64.cc: Likewise.
6718
6719 2010-12-09  Cary Coutant  <ccoutant@google.com>
6720
6721         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6722         stack.
6723         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6724         parameter; change all callers.
6725         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6726         * options.h (warn_execstack): New option.
6727
6728 2010-12-07  Doug Kwan  <dougkwan@google.com>
6729
6730         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6731         like function call relocations.
6732
6733 2010-12-07  Ian Lance Taylor  <iant@google.com>
6734
6735         * archive.cc (Archive::get_elf_object_for_member): Permit
6736         punconfigured to be NULL.
6737         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6738         (Archive::include_member): Pass NULL to get_elf_object_for_member
6739         if we searched for the archive and this is the first included
6740         object.
6741
6742 2010-12-01  Ian Lance Taylor  <iant@google.com>
6743
6744         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6745         track_relocs_type_ field.
6746         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6747         Set track_relocs_type_.
6748         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6749         contents when using RELA relocs.
6750         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6751         reloc_map_.
6752         * reloc.cc (Track_relocs::next_addend): New function.
6753         * reloc.h (class Track_relocs): Declare next_addend.
6754
6755 2010-12-01  Ian Lance Taylor  <iant@google.com>
6756
6757         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6758         virtual destructor.
6759
6760 2010-12-01  Ian Lance Taylor  <iant@google.com>
6761
6762         * README: Update compilers known to work and fail.
6763
6764 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6765
6766         * configure.in: For --enable-gold, handle value `default' instead of
6767         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6768         not the default.
6769         * configure: Regenerate.
6770
6771 2010-11-18  Doug Kwan  <dougkwan@google.com>
6772
6773         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6774         and right_alignment to be zero.  Store result alignment only if it is
6775         greater than existing alignment.
6776
6777 2010-11-16  Cary Coutant  <ccoutant@google.com>
6778
6779         PR gold/12220
6780         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6781         Check for ".zdebug_line".
6782
6783 2010-11-16  Doug Kwan  <dougkwan@google.com>
6784             Cary Coutant  <ccoutant@google.com>
6785
6786         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6787         by reference; adjust all callers.
6788         * output.cc (Output_segment::set_section_addresses): Adjust references
6789         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6790         list is empty.
6791         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6792         end at page boundary.
6793
6794 2010-11-16  Cary Coutant  <ccoutant@google.com>
6795
6796         PR gold/12220
6797         * layout.cc (Layout::choose_output_section): Transform names of
6798         compressed sections even when using a script with a SECTIONS clause.
6799         (Layout::output_section_name): Remove code to transform
6800         compressed debug section names.
6801         * output.cc (Output_section::add_input_section): Use uncompressed
6802         section size when tracking input sections.
6803
6804 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6805
6806         * symtab.h (Symbol::NON_PIC_REF): Remove.
6807         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6808         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6809         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6810         (Symbol::use_plt_offset): Take a flags argument and pass it
6811         directly to needs_dynamic_reloc.  Restrict check for undefined
6812         weak symbols to function calls.
6813         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6814         (Target_arm::Scan::global): Use it.
6815         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6816         (Target_arm::Relocate::relocate): Likewise.
6817         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6818         parameter with an r_type parameter.  Use get_reference_flags
6819         to get the flags.
6820         (Target_arm::Relocate::relocate): Update accordingly.
6821         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6822         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6823         (Target_i386::Scan::global): Likewise.
6824         (Target_i386::Relocate::relocate): Likewise.
6825         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6826         parameter with an r_type parameter.  Use get_reference_flags
6827         to get the flags.
6828         (Target_i386::Relocate::relocate): Update accordingly.
6829         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6830         (Target_powerpc::Scan::global): Use it.
6831         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6832         (Target_powerpc::Relocate::relocate): Likewise.
6833         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6834         (Target_sparc::Scan::global): Use it.
6835         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6836         (Target_sparc::Relocate::relocate): Likewise.
6837         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6838         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6839         (Target_x86_64::Scan::global): Likewise.
6840         (Target_x86_64::Relocate::relocate): Likewise.
6841
6842 2010-11-08  Doug Kwan  <dougkwan@google.com>
6843             Cary Coutant  <ccoutant@google.com>
6844
6845         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6846         (Arm_exidx_merge_section::section_contents_): New data member.
6847         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6848         (Arm_input_section::~Arm_input_section): De-allocate memory.
6849         (Arm_input_section::original_contents_): New data member.
6850         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6851         in parameters instead of calling Object::section_contents without
6852         locking.
6853         (Arm_output_section::group_section): New parameter TASK.  Pass it
6854         to callees that need locking objects.
6855         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6856         to lock EXIDX input sections.  Fix a formatting issue.  Call
6857         Arm_exidx_merged_section::build_contents to create merged section
6858         contents.
6859         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6860         to lock object of stub table owner.
6861         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6862         TEXT_SIZE to initialize data member TEXT_SIZE_.
6863         (Arm_exidx_input_section::addralign): Fix typo in comment.
6864         (Arm_exidx_input_section::text_size): New method.
6865         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6866         that require locking objects.  Lock objects before scanning for stubs
6867         and updating local symbols.
6868         (Arm_input_section<big_endian>::init): Copy contents of original
6869         input section.
6870         (Arm_input_section<big_endian>::do_write): Use saved contents of
6871         original input section instead of calling Object::section_contents
6872         without locking.
6873         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6874         size without calling Object::section_size().
6875         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6876         for size.  Allocate a buffer for merged EXIDX entries.
6877         (Arm_exidx_merged_section::build_contents): New method.
6878         (Arm_exidx_merged_section::do_write): Move merge section contents
6879         building code to Arm_exidx_merged_section::build_contetns.  Write
6880         out contetns in buffer instead of building it on the fly.
6881         (Arm_relobj::make_exidx_input_section): Also pass text section size
6882         to Arm_exidx_input_section constructor.
6883         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6884         (Arm_dynobj::do_read_symbols): Fix memory leak.
6885         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6886         * target.h: (class Task): Add forward declaration.
6887         (Target::relax): Add new parameter TASK and pass it to
6888         Target::do_relax().
6889         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6890
6891 2010-11-05  Cary Coutant  <ccoutant@google.com>
6892
6893         PR gold/10708
6894         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6895         object when reading from the file.
6896         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6897         second layout pass.
6898         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6899         when reading section contents.
6900         (get_section_contents): Likewise.
6901         (icf::find_identical_sections): Likewise.
6902         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6903         object when reading from the file.
6904         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6905         the object when doing deferred section layout.
6906
6907 2010-11-03  Nick Clifton  <nickc@redhat.com>
6908
6909         PR gold/12001
6910         * script.h (class Symbol_assignment: name): New member.  Returns
6911         the name of the symbol.
6912         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6913         Returns true if the given symbol name is on the list of
6914         assignments wating to be processed.
6915         * archive.cc (should_incldue_member): If the symbol is undefined,
6916         check to see if it is on the list of symbols pending assignment.
6917
6918 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6919
6920         * script-sections.cc (Script_sections::find_memory_region): Check
6921         for a NULL output section pointer.
6922
6923 2010-10-29  Doug Kwan  <dougkwan@google.com>
6924
6925         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6926         Output_section::add_relaxed_input_section.
6927         * output.cc (Output_section::add_relaxed_input_section): Add new
6928         arguments LAYOUT and NAME.  Set section order index.
6929         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6930         Copy section order index.
6931         * output.h (Output_section::add_relaxed_input_section): Add new
6932         arguments LAYOUT and NAME.
6933
6934 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6935
6936         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6937         NATIVE_OR_CROSS_LINKER.
6938         * testsuite/Makefile.in: Regenerate.
6939
6940 2010-10-20  Doug Kwan  <dougkwan@google.com>
6941
6942         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6943         without SHF_LINK_ORDER flags.
6944         * layout.cc (Layout::choose_output_section): Do not filter
6945         SHF_LINK_ORDER flag in a relocatable link.
6946
6947 2010-10-17  Cary Coutant  <ccoutant@google.com>
6948
6949         * output.h (Output_segment::set_section_addresses): Change function
6950         signature.  Update all callers.
6951         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6952         sections.
6953         (Output_segment::set_section_addresses): Align after last TLS
6954         section.  Add padding before last relro section instead of after.
6955
6956 2010-10-17  Doug Kwan  <dougkwan@google.com>
6957
6958         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6959         GOT output section to be writable.
6960
6961 2010-10-14  Cary Coutant  <ccoutant@google.com>
6962
6963         * debug.h (DEBUG_INCREMENTAL): New flag.
6964         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6965         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6966         mode.
6967         * incremental.cc (report_command_line): Ignore all forms of
6968         --incremental.
6969         * layout.cc (Layout::Layout): Check parameters for incremental link
6970         mode.
6971         * options.cc (General_options::parse_incremental): New function.
6972         (General_options::parse_no_incremental): New function.
6973         (General_options::parse_incremental_full): New function.
6974         (General_options::parse_incremental_update): New function.
6975         (General_options::incremental_mode_): New data member.
6976         (General_options::finalize): Check incremental_mode_.
6977         * options.h (General_options): Update help text for --incremental.
6978         Add --no-incremental, --incremental-full, --incremental-update.
6979         (General_options::Incremental_mode): New enum type.
6980         (General_options::incremental_mode): New function.
6981         (General_options::incremental_mode_): New data member.
6982         * parameters.cc (Parameters::incremental_mode_): New data member.
6983         (Parameters::set_options): Set incremental_mode_.
6984         (Parameters::set_incremental_full): New function.
6985         (Parameters::incremental): New function.
6986         (Parameters::incremental_update): New function.
6987         (set_parameters_incremental_full): New function.
6988         * parameters.h (Parameters::set_incremental_full): New function.
6989         (Parameters::incremental): New function.
6990         (Parameters::incremental_update): New function.
6991         (Parameters::incremental_mode_): New data member.
6992         (set_parameters_incremental_full): New function.
6993         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6994         incremental link mode.
6995         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6996         (Sized_relobj::do_relocate_sections): Likewise.
6997         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6998         option.
6999         * testsuite/Makefile.in: Regenerate.
7000         * testsuite/incremental_test.sh: Filter all forms of --incremental.
7001
7002 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7003
7004         * script-sections.h (class Script_sections): Make
7005         Sections_elements typedef public.
7006         * script-sections.cc (class Sort_output_sections): Add elements_
7007         field.  Add constructor which sets it; change all callers.
7008         (Sort_output_sections::is_before): New function.
7009         (Sort_output_sections::operator()): Call is_before.
7010         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
7011         conditional.
7012         * testsuite/script_test_10.sh: New test. Test script section
7013         order.
7014         * testsuite/script_test_10.t: Likewise.
7015         * testsuite/script_test_10.s: Likewise.
7016         * testsuite/Makefile.am: Wrap the cross linker tests and the
7017         common tests into NATIVE_OR_CROSS_LINKER.
7018         (check_SCRIPTS): Add script_test_10.sh.
7019         (check_DATA): Add script_test_10.stdout.
7020         (script_test_10.o, script_test_10): New targets.
7021         (script_test_10.stdout): New target.
7022         * configure, testsuite/Makefile.in: Regenerate.
7023
7024 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7025
7026         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
7027         error for the deprecated relocations.
7028         (Target_arm::Scan::global): Likewise.
7029         (Target_arm::Relocate::relocate): Likewise.
7030
7031 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
7032
7033         * fileread.cc (Input_file::find_file): Initialize *found_name
7034         and *namep when using the fallback search for case 4.
7035
7036 2010-10-11  Cary Coutant  <ccoutant@google.com>
7037
7038         * options.h (class General_options): Redefine -z lazy as an alias for
7039         the negation of -z now.
7040
7041 2010-10-11  Ian Lance Taylor  <iant@google.com>
7042
7043         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7044         binding.
7045
7046 2010-10-06  Nick Clifton  <nickc@redhat.com>
7047
7048         * script-sections.cc(class Memory_region): Remove
7049         current_lma_offset_ field.  Rename current_vma_offset_ to
7050         current_offset_.  Add last_section_ field.
7051         (Memory_region::get_current_vma_address): Rename to
7052         get_current_address.
7053         (Memory_region::get_current_lma_address): Delete.
7054         (Memory_region::increment_vma_offset): Rename to
7055         increment_offset.
7056         (Memory_region::increment_lma_offset): Delete.
7057         (Memory_region::attributes_compatible): New method.  Returns
7058         true if the provided section is compatible with the region.
7059         (Memory_region::get_last_section): New method.  Returns the last
7060         section to use the region.
7061         (Memory_region::set_last_section): New method.  Stores the last
7062         section to use the region.
7063         (Script_sections::block_in_region): New method.  Returns true if
7064         a block of memory is contained within a region.
7065         (Script_sections::find_memory_region): New method.  Locates a
7066         memory region to be used to set a VMA or LMA address.
7067         (Output_section_definition::set_section_addresses): Add code to
7068         check for addresses set by memory regions.
7069         (Output_segment::set_section_addresses): Remove memory region
7070         walking code.
7071         (Script_sections::create_segment): Add a warning if a header
7072         segment is created outside of any region.
7073         * script-sections.h (class Script_sections): Add prototypes for
7074         find_memory_region and block_in_region methods.
7075         * testsuite/memory_test.s: Use .long instead of .word.
7076         * testsuite/memory_test.t: Add some more output sections.
7077         * testsuite/memory_test.sh: Update expected output.
7078
7079 2010-10-02  Doug Kwan  <dougkwan@google.com>
7080
7081         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7082         defintion to symtab.h
7083         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7084         declaration to defintion.
7085
7086 2010-10-01  Nick Clifton  <nickc@redhat.com>
7087
7088         * expression.cc (eval): Replace dummy argument with NULL.
7089         (eval_maybe_dot): Check for a NULL result section pointer.
7090         (Symbol_expression::value): Likewise.
7091         (Dot_expression::value): Likewise.
7092         (BINARY_EXPRESSION): Likewise.
7093         (Max_expression::value): Likewise.
7094         (Min_expression::value): Likewise.
7095         (Absolute_expression::value): Likewise.
7096         (Addr_expression::value_from_output_section): Likewise.
7097         (Loaddddr_expression::value_from_output_section): Likewise.
7098         (Segment_start_expression::value): Likewise.
7099         * script-sections.cc
7100         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7101         argument with NULL.
7102         (Sections_elememt_dot_assignment::set_section_addresses):
7103         Likewise.
7104         (Output_data_expression::do_write_to_buffer): Likewise.
7105         (Output_section_definition::finalize_symbols): Likewise.
7106         (Output_section_definition::set_section_addresses): Likewise.
7107
7108 2010-09-30  Doug Kwan  <dougkwan@google.com>
7109
7110         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7111
7112 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7113
7114         * target.h (Target::can_icf_inline_merge_sections): New virtual
7115         function.
7116         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7117         virtual function.
7118         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7119         virtual function.
7120         * icf.cc (get_section_contents): Inline merge sections only when
7121         target allows it.
7122
7123 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7124
7125         * configure: Regenerate.
7126
7127 2010-09-17  Ian Lance Taylor  <iant@google.com>
7128
7129         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7130         * testsuite/Makefile.am (memory_test.o): New target.
7131         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7132         memory_test.t.
7133         * testsuite/Makefile.in: Rebuild.
7134
7135 2010-09-17  Doug Kwan  <dougkwan@google.com>
7136
7137         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7138         defintion if relocation uses GOT entries of the symbol.
7139         * testsuite/icf_safe_test.sh: Fix test.
7140         * testsuite/icf_safe_so_test.sh: Fix test.
7141
7142 2010-09-16  Cary Coutant  <ccoutant@google.com>
7143
7144         * script_sections.cc (class Memory_region): Remove "NULL" from
7145         vector initializations.
7146
7147 2010-09-15  Cary Coutant  <ccoutant@google.com>
7148
7149         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7150         Resolve forwarding symbols.
7151
7152 2010-09-15  Doug Kwan  <dougkwan@google.com>
7153
7154         * gold/testsuite/script_test_3.t: Add ARM special sections.
7155         * gold/testsuite/script_test_4.t: Same.
7156         * gold/testsuite/script_test_5.t: Same.
7157         * gold/testsuite/script_test_6.t: Same.
7158         * gold/testsuite/script_test_7.t: Same.
7159         * gold/testsuite/script_test_7.t: Same.
7160         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7161
7162 2010-09-14  Cary Coutant  <ccoutant@google.com>
7163
7164         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7165         (Target_x86_64::Relocate::relocate_tls): Replace check for
7166         saw_tls_block_reloc_ with test for executable section.
7167
7168 2010-09-12  Cary Coutant  <ccoutant@google.com>
7169
7170         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7171         position-independent executables to shared libraries need dynamic
7172         relocations.
7173         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7174         position-independent executables.
7175         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7176         * testsuite/Makefile.in: Regenerate.
7177
7178 2010-09-10  Nick Clifton  <nickc@redhat.com>
7179
7180         PR gold/11997
7181         * testsuite/memory_test.t: Discard any sections that are not
7182         needed.
7183
7184 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7185
7186         PR gold/11996
7187         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7188         "This::" to work around a bug in gcc 4.2.
7189
7190         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7191
7192 2010-09-09  Rafael Espindola  <espindola@google.com>
7193
7194         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7195         sections with different PF_X flags in the same segment.
7196         (Layout::find_first_load_seg): Search all segments to find the first
7197         one.
7198         * options.h (rosegment): New.
7199
7200 2010-09-08  Rafael Espindola  <espindola@google.com>
7201
7202         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7203
7204 2010-09-08  Doug Kwan  <dougkwan@google.com>
7205
7206         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7207         (Arm_relobj::do_relocate_sections): Add new parameter for output
7208         file to match the parent.
7209         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7210         of local symbols instead of input values.  Update code to track
7211         changes in gold::relocate_section.
7212         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7213         (Sized_relobj::compute_final_local_value_internal): New methods.
7214         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7215         body into private version of Sized_relobj::compute_final_local_value.
7216         Call the inline method.
7217         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7218         merged symbol value if there is one.
7219         (Symbol_value::has_output_value): New method defintiion.
7220         (Sized_relobj::Compute_final_local_value_status): New enum type.
7221         (Sized_relobj::compute_final_local_value): New methods.
7222         (Sized_relobj::compute_final_local_value_internal): New methods.
7223         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7224         and arm_cortex_a8.sh.
7225         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7226         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7227         New tests.
7228         * Makefile.in: Regenerate.
7229         * testsuite/arm_bl_out_of_range.s: Update test.
7230         * testsuite/thumb_bl_out_of_range.s: Ditto.
7231         * testsuite/thumb_blx_out_of_range.s: Ditto.
7232         * testsuite/arm_branch_out_of_range.sh: New file.
7233         * testsuite/arm_cortex_a8.sh: Ditto.
7234         * testsuite/arm_cortex_a8_b.s: Ditto.
7235         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7236         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7237         * testsuite/arm_cortex_a8_bl.s: Ditto.
7238         * testsuite/arm_cortex_a8_blx.s: Ditto.
7239         * testsuite/arm_cortex_a8_local.s: Ditto.
7240         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7241         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7242
7243 2010-09-08  Rafael Espindola  <espindola@google.com>
7244
7245         * Makefile.am (memory_test.stdout): Run readelf with -W.
7246         * Makefile.in: Regenerate.
7247         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7248         64 bit output.
7249
7250 2010-09-08  Rafael Espindola  <espindola@google.com>
7251
7252         * script-sections.cc (Script_sections::add_memory_region): Convert
7253         field precision to int.
7254         * script.cc (script_set_section_region, script_set_section_region):
7255         Convert field precision to int.
7256
7257 2010-09-08  Rafael Espindola  <espindola@google.com>
7258
7259         * arm.cc (do_finalize_sections): Create the __exidx_start and
7260         __exdix_end symbols even when the section is missing.
7261
7262 2010-09-08  Nick Clifton  <nickc@redhat.com>
7263
7264         * README: Remove claim that MEMORY is not supported.
7265         * expression.cc (script_exp_function_origin)
7266         (script_exp_function_length): Move from here to ...
7267         * script.cc: ... here.
7268         (script_set_section_region, script_add_memory)
7269         (script_parse_memory_attr, script_include_directive): New
7270         functions.
7271         * script-sections.cc
7272         (class Memory_region): New class.
7273         (class Output_section_definition): Add set_memory_region,
7274         set_section_vma, set_section_lma and get_section_name methods.
7275         (class Script_Sections): Add add_memory_region,
7276         find_memory_region, find_memory_region_origin,
7277         find_memory_region_length and set_memory_region methods.
7278         Have set_section_addresses method walk the list of set memory
7279         regions.
7280         Extend the print methos to display memory regions.
7281         * script-sections.h: Add prototypes for new methods.
7282         Add enum for MEMORY region attributes.
7283         * yyscript.y: Add support for parsing MEMORY regions.
7284         * script-c.h: Add prototypes for new functions.
7285         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7286         * testsuite/Makefile.in: Regenerate.
7287         * testsuite/memory_test.sh: New script.
7288         * testsuite/memory_test.s: New assembler source file.
7289         * testsuite/memory_test.t: New linker script.
7290
7291 2010-08-27  Doug Kwan  <dougkwan@google.com>
7292
7293         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7294         reference override an existing dynamic weak reference.
7295         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7296         * testsuite/Makefile.in: Regenerate.
7297         * testsuite/dyn_weak_ref.sh: New file.
7298         * testsuite/dyn_weak_ref_1.c: Ditto.
7299         * testsuite/dyn_weak_ref_2.c: Ditto.
7300
7301 2010-08-27  Ian Lance Taylor  <iant@google.com>
7302
7303         * incremental.h (class Incremental_input_entry): Add virtual
7304         destructor.
7305
7306 2010-08-27  Ian Lance Taylor  <iant@google.com>
7307
7308         * testsuite/start_lib_test_3.c: Mark t3 as used.
7309
7310 2010-08-27  Nick Clifton  <nickc@redhat.com>
7311
7312         * options.cc (version_script): Fix small typo in previous
7313         whitespace tidyup.
7314
7315 2010-08-25  Nick Clifton  <nickc@redhat.com>
7316
7317         * archive.cc: Formatting fixes: Remove whitespace between
7318         typename and following asterisk.  Remove whitespace between
7319         function name and opening parenthesis.
7320         * archive.h: Likewise.
7321         * arm.cc: Likewise.
7322         * attributes.cc: Likewise.
7323         * attributes.h: Likewise.
7324         * common.cc: Likewise.
7325         * copy-relocs.cc: Likewise.
7326         * dirsearch.h: Likewise.
7327         * dynobj.cc: Likewise.
7328         * ehframe.cc: Likewise.
7329         * ehframe.h: Likewise.
7330         * expression.cc: Likewise.
7331         * fileread.cc: Likewise.
7332         * fileread.h: Likewise.
7333         * gc.h: Likewise.
7334         * gold-threads.cc: Likewise.
7335         * gold.cc: Likewise.
7336         * i386.cc: Likewise.
7337         * icf.h: Likewise.
7338         * incremental-dump.cc: Likewise.
7339         * incremental.cc: Likewise.
7340         * layout.cc: Likewise.
7341         * layout.h: Likewise.
7342         * main.cc: Likewise.
7343         * merge.cc: Likewise.
7344         * merge.h: Likewise.
7345         * object.cc: Likewise.
7346         * object.h: Likewise.
7347         * options.cc: Likewise.
7348         * options.h: Likewise.
7349         * output.cc: Likewise.
7350         * output.h: Likewise.
7351         * plugin.cc: Likewise.
7352         * plugin.h: Likewise.
7353         * powerpc.cc: Likewise.
7354         * reloc.cc: Likewise.
7355         * script-c.h: Likewise.
7356         * script-sections.cc: Likewise.
7357         * script.cc: Likewise.
7358         * stringpool.cc: Likewise.
7359         * symtab.cc: Likewise.
7360         * symtab.h: Likewise.
7361         * target.cc: Likewise.
7362         * timer.cc: Likewise.
7363         * timer.h: Likewise.
7364         * version.cc: Likewise.
7365         * x86_64.cc: Likewise.
7366
7367 2010-08-24  Nick Clifton  <nickc@redhat.com>
7368
7369         PR 11899
7370         * layout.cc (segment_precedes): Sort segments by their physical
7371         addresses, if they have been set.
7372
7373 2010-08-23  Cary Coutant  <ccoutant@google.com>
7374
7375         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7376         symbols data.
7377         (Lib_group::include_member): Unlock object after deleting its
7378         symbols data.
7379         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7380         the bug fixed here.
7381
7382 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7383             Cary Coutant  <ccoutant@google.com>
7384
7385         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7386         constructor, and set_blocker.
7387         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7388         readsyms_blocker_.
7389         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7390         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7391         * testsuite/Makefile.am (start_lib_test): New test case.
7392         * testsuite/Makefile.in: Regenerate.
7393         * testsuite/start_lib_test_main.c: New file.
7394         * testsuite/start_lib_test_1.c: New file.
7395         * testsuite/start_lib_test_2.c: New file.
7396         * testsuite/start_lib_test_3.c: New file.
7397
7398 2010-08-19  Ian Lance Taylor  <iant@google.com>
7399
7400         * Makefile.in: Rebuild with automake 1.11.1.
7401         * aclocal.m4: Likewise.
7402         * testsuite/Makefile.in: Likewise.
7403
7404 2010-08-19  Ian Lance Taylor  <iant@google.com>
7405
7406         PR 10893
7407         * i386.cc (class Output_data_plt_i386): Update declarations.
7408         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7409         local_ifuncs_ fields.
7410         (Target_i386::do_plt_section_for_global): New function.
7411         (Target_i386::do_plt_section_for_local): New function.
7412         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7413         parameter; change all callers.  Initialize global_ifuncs_ and
7414         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7415         __rel_iplt_end.
7416         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7417         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7418         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7419         symbols.
7420         (Target_i386::make_plt_section): New function, broken out of
7421         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7422         (Target_i386::make_plt_entry): Call make_plt_section.
7423         (Target_i386::make_local_ifunc_plt_entry): New function.
7424         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7425         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7426         R_386_IRELATIVE to switch.
7427         (Target_i386::Scan::global): Likewise.
7428         (Target_i386::Relocate::relocate): Likewise.
7429         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7430         switch.
7431         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7432         (Target_x86_64::do_plt_section_for_global): New function.
7433         (Target_x86_64::do_plt_section_for_local): New function.
7434         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7435         parameter; change all callers.  If doing a static link define
7436         __rela_iplt_start and __rela_iplt_end.
7437         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7438         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7439         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7440         to point to .plt.
7441         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7442         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7443         switch.
7444         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7445         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7446         R_X86_64_IRELATIVE to switch.
7447         (Target_x86_64::Scan::global): Likewise.
7448         (Target_x86_64::Relocate::relocate): Likewise.
7449         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7450         switch.
7451         * target.h (class Target): Add plt_section_for_global and
7452         plt_section_for_local functions.  Add do_plt_section_for_global
7453         and do_plt_section_for_local virtual functions.
7454         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7455         clarifying comments.
7456         (Symbol::use_plt_offset): Handle IFUNC symbol.
7457         * object.cc (Sized_relobj::Sized_relobj): Initialize
7458         local_plt_offsets_.
7459         (Sized_relobj::local_has_plt_offset): New function.
7460         (Sized_relobj::local_plt_offset): New function.
7461         (Sized_relobj::set_local_plt_offset): New function.
7462         (Sized_relobj::do_count): Handle IFUNC symbol.
7463         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7464         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7465         is_ifunc_symbol functions.
7466         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7467         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7468         local_plt_offsets_ field.
7469         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7470         * output.h (class Output_section_data): Add non-const
7471         output_section function.
7472         (class Output_data_got): Update declarations.
7473         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7474         Add use_plt_offset parameter to global and local constructors.
7475         Change all callers.  Change local_sym_index_ field to 31 bits.
7476         Change GSYM_CODE and CONSTANT_CODE accordingly.
7477         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7478         doing a static link don't set sh_link field.
7479         (Output_data_got::Got_entry::write): Use PLT offset if
7480         appropriate.
7481         (Output_data_got::add_global_plt): New function.
7482         (Output_data_got::add_local_plt): New function.
7483         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7484         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7485         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7486         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7487         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7488         IFUNC conditional.
7489         * testsuite/ifunc-sel.h: New file.
7490         * testsuite/ifuncmain1.c: New file.
7491         * testsuite/ifuncmain1vis.c: New file.
7492         * testsuite/ifuncmod1.c: New file.
7493         * testsuite/ifuncdep2.c: New file.
7494         * testsuite/ifuncmain2.c: New file.
7495         * testsuite/ifuncmain3.c: New file.
7496         * testsuite/ifuncmod3.c: New file.
7497         * testsuite/ifuncmain4.c: New file.
7498         * testsuite/ifuncmain5.c: New file.
7499         * testsuite/ifuncmod5.c: New file.
7500         * testsuite/ifuncmain6pie.c: New file.
7501         * testsuite/ifuncmod6.c: New file.
7502         * testsuite/ifuncmain7.c: New file.
7503         * configure, testsuite/Makefile.in: Rebuild.
7504
7505 2010-08-18  Ian Lance Taylor  <iant@google.com>
7506
7507         * incremental.cc
7508         (Output_section_incremental_inputs::write_input_files): Add cast
7509         to avoid signed/unsigned comparison warning.
7510         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7511
7512 2010-08-12  Cary Coutant  <ccoutant@google.com>
7513
7514         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7515
7516 2010-08-13  Ian Lance Taylor  <iant@google.com>
7517
7518         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7519
7520 2010-08-12  Cary Coutant  <ccoutant@google.com>
7521             Doug Kwan  <dougkwan@google.com>
7522
7523         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7524         defintion overrides non-weak undef, remember that the original undef
7525         is not weak.
7526         * symtab.cc (Symbol_table::sized_write_global): For undef without
7527         an original weak binding, set binding to global in output.
7528         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7529         * testsuite/Makefile.in: Regenerate.
7530         * testsuite/strong_ref_weak_def.sh: New file.
7531         * testsuite/strong_ref_weak_def_1.c: Ditto.
7532         * testsuite/strong_ref_weak_def_2.c: Ditto.
7533
7534 2010-08-12  Cary Coutant  <ccoutant@google.com>
7535
7536         * testsuite/incremental_test.sh: Rewrite.
7537         * testsuite/incremental_test_1.c: Rewrite.
7538         * testsuite/incremental_test_2.c: Rewrite.
7539
7540 2010-08-12  Cary Coutant  <ccoutant@google.com>
7541
7542         * arm.cc (Target_arm::got_size): Add const.
7543         (Target_arm::got_entry_count): New function.
7544         (Target_arm::plt_entry_count): New function.
7545         (Target_arm::first_plt_entry_offset): New function.
7546         (Target_arm::plt_entry_size): New function.
7547         (Output_data_plt_arm::entry_count): New function.
7548         (Output_data_plt_arm::first_plt_entry_offset): New function.
7549         (Output_data_plt_arm::get_plt_entry_size): New function.
7550         * i386.cc (Target_i386::got_size): Add const.
7551         (Target_i386::got_entry_count): New function.
7552         (Target_i386::plt_entry_count): New function.
7553         (Target_i386::first_plt_entry_offset): New function.
7554         (Target_i386::plt_entry_size): New function.
7555         (Output_data_plt_i386::entry_count): New function.
7556         (Output_data_plt_i386::first_plt_entry_offset): New function.
7557         (Output_data_plt_i386::get_plt_entry_size): New function.
7558         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7559         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7560         * incremental.cc: Include target.h.
7561         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7562         parameter.  Adjust all callers.  Find incremental_got_plt section.
7563         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7564         section.
7565         (Output_section_incremental_inputs::set_final_data_size): Calculate
7566         size of incremental_got_plt section.
7567         (Output_section_incremental_inputs::do_write): Write the
7568         incremental_got_plt section.
7569         (Got_plt_view_info): New struct.
7570         (Local_got_offset_visitor): New class.
7571         (Global_got_offset_visitor): New class.
7572         (Global_symbol_visitor_got_plt): New class.
7573         (Output_section_incremental_inputs::write_got_plt): New function.
7574         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7575         Add parameter.  Adjust all callers.
7576         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7577         (Incremental_inputs::got_plt_section): New function.
7578         (Incremental_inputs::got_plt_section_): New data member.
7579         (Incremental_got_plt_reader): New class.
7580         * layout.cc (Layout::create_incremental_info_sections): Add the
7581         incremental_got_plt section.
7582         * object.h (Got_offset_list::get_list): New function.
7583         (Got offset_list::for_all_got_offsets): New function.
7584         (Sized_relobj::local_got_offset_list): New function.
7585         * powerpc.cc (Target_powerpc::got_size): Add const.
7586         (Target_powerpc::got_entry_count): New function.
7587         (Target_powerpc::plt_entry_count): New function.
7588         (Target_powerpc::first_plt_entry_offset): New function.
7589         (Target_powerpc::plt_entry_size): New function.
7590         (Output_data_plt_powerpc::entry_count): New function.
7591         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7592         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7593         * sparc.cc (Target_sparc::got_size): Add const.
7594         (Target_sparc::got_entry_count): New function.
7595         (Target_sparc::plt_entry_count): New function.
7596         (Target_sparc::first_plt_entry_offset): New function.
7597         (Target_sparc::plt_entry_size): New function.
7598         (Output_data_plt_sparc::entry_count): New function.
7599         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7600         (Output_data_plt_sparc::get_plt_entry_size): New function.
7601         * symtab.h (Symbol::got_offset_list): New function.
7602         (Symbol_table::for_all_symbols): New function.
7603         * target.h (Sized_target::got_entry_count): New function.
7604         (Sized_target::plt_entry_count): New function.
7605         (Sized_target::plt_entry_size): New function.
7606         * x86_64.cc (Target_x86_64::got_size): Add const.
7607         (Target_x86_64::got_entry_count): New function.
7608         (Target_x86_64::plt_entry_count): New function.
7609         (Target_x86_64::first_plt_entry_offset): New function.
7610         (Target_x86_64::plt_entry_size): New function.
7611         (Output_data_plt_x86_64::entry_count): New function.
7612         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7613         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7614
7615 2010-08-12  Cary Coutant  <ccoutant@google.com>
7616
7617         * archive.cc: Include incremental.h.
7618         (Archive::Archive): Initialize incremental_info_.
7619         (Archive::include_member): Record archive members in incremental info.
7620         (Add_archive_symbols::run): Record begin and end of an archive in
7621         incremental info.
7622         (Lib_group::include_member): Record objects in incremental info.
7623         * archive.h (Incremental_archive_entry): Forward declaration.
7624         (Archive::set_incremental_info): New member function.
7625         (Archive::incremental_info): New member function.
7626         (Archive::Unused_symbol_iterator): New class.
7627         (Archive::unused_symbols_begin): New member function.
7628         (Archive::unused_symbols_end): New member function.
7629         (Archive::incremental_info_): New data member.
7630         * incremental-dump.cc (find_input_containing_global): New function.
7631         (dump_incremental_inputs): Dump new incremental info sections.
7632         * incremental.cc: Include symtab.h.
7633         (Output_section_incremental_inputs): New class.
7634         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7635         new incremental info sections.
7636         (Sized_incremental_binary::do_check_inputs): Likewise.
7637         (Incremental_inputs::report_archive): Remove.
7638         (Incremental_inputs::report_archive_begin): New function.
7639         (Incremental_inputs::report_archive_end): New function.
7640         (Incremental_inputs::report_object): New function.
7641         (Incremental_inputs::finalize_inputs): Remove.
7642         (Incremental_inputs::report_input_section): New function.
7643         (Incremental_inputs::report_script): Rewrite.
7644         (Incremental_inputs::finalize): Do nothing but finalize string table.
7645         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7646         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7647         (Incremental_inputs::create_data_sections): New function.
7648         (Incremental_inputs::relocs_entsize): New function.
7649         (Output_section_incremental_inputs::set_final_data_size): New function.
7650         (Output_section_incremental_inputs::do_write): New function.
7651         (Output_section_incremental_inputs::write_header): New function.
7652         (Output_section_incremental_inputs::write_input_files): New function.
7653         (Output_section_incremental_inputs::write_info_blocks): New function.
7654         (Output_section_incremental_inputs::write_symtab): New function.
7655         * incremental.h (Incremental_script_entry): Forward declaration.
7656         (Incremental_object_entry): Forward declaration.
7657         (Incremental_archive_entry): Forward declaration.
7658         (Incremental_inputs): Forward declaration.
7659         (Incremental_inputs_header_data): Remove.
7660         (Incremental_inputs_header): Remove.
7661         (Incremental_inputs_header_write): Remove.
7662         (Incremental_inputs_entry_data): Remove.
7663         (Incremental_inputs_entry): Remove.
7664         (Incremental_inputs_entry_write): Remove.
7665         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7666         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7667         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7668         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7669         Likewise.
7670         (Incremental_input_entry): New class.
7671         (Incremental_script_entry): New class.
7672         (Incremental_object_entry): New class.
7673         (Incremental_archive_entry): New class.
7674         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7675         (Incremental_inputs::report_inputs): Remove.
7676         (Incremental_inputs::report_archive): Remove.
7677         (Incremental_inputs::report_archive_begin): New function.
7678         (Incremental_inputs::report_archive_end): New function.
7679         (Incremental_inputs::report_object): Change prototype.
7680         (Incremental_inputs::report_input_section): New function.
7681         (Incremental_inputs::report_script): Change prototype.
7682         (Incremental_inputs::get_reloc_count): New function.
7683         (Incremental_inputs::set_reloc_count): New function.
7684         (Incremental_inputs::create_data_sections): New function.
7685         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7686         (Incremental_inputs::inputs_section): New function.
7687         (Incremental_inputs::symtab_section): New function.
7688         (Incremental_inputs::relocs_section): New function.
7689         (Incremental_inputs::get_stringpool): Add const.
7690         (Incremental_inputs::command_line): Add const.
7691         (Incremental_inputs::inputs): Remove.
7692         (Incremental_inputs::command_line_key): New function.
7693         (Incremental_inputs::input_file_count): New function.
7694         (Incremental_inputs::input_files): New function.
7695         (Incremental_inputs::relocs_entsize): New function.
7696         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7697         (Incremental_inputs::finalize_inputs): Remove.
7698         (Incremental_inputs::Input_info): Remove.
7699         (Incremental_inputs::lock_): Remove.
7700         (Incremental_inputs::inputs_): Change type.
7701         (Incremental_inputs::inputs_map_): Remove.
7702         (Incremental_inputs::current_object_entry_): New data member.
7703         (Incremental_inputs::inputs_section_): New data member.
7704         (Incremental_inputs::symtab_section_): New data member.
7705         (Incremental_inputs::relocs_section_): New data member.
7706         (Incremental_inputs::reloc_count_): New data member.
7707         (Incremental_inputs_reader): New class.
7708         (Incremental_symtab_reader): New class.
7709         (Incremental_relocs_reader): New class.
7710         * layout.cc (Layout::finalize): Move finalization of incremental info
7711         and creation of incremental info sections to follow finalization of
7712         symbol table.  Set offsets for postprocessing sections.
7713         (Layout::create_incremental_info_sections): Call
7714         Incremental_inputs::create_data_sections.  Add incremental symtab
7715         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7716         sections to layout after input sections.
7717         * layout.h (struct Timespec): Forward declaration.
7718         (Layout::incremental_inputs): Add const.
7719         (Layout::create_incremental_info_sections): Add parameter.
7720         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7721         * object.cc: Include incremental.h.
7722         (Relobj::finalize_incremental_relocs): New function.
7723         (Sized_relobj::do_layout): Record input sections in incremental info.
7724         * object.h (Object::output_section): New function.
7725         (Object::output_section_offset): Moved from Relobj.
7726         (Object::get_incremental_reloc_base): New function.
7727         (Object::get_incremental_reloc_count): New function.
7728         (Object::do_output_section): New function.
7729         (Object::do_output_section_offset): Moved from Relobj.
7730         (Object::do_get_incremental_reloc_base): New function.
7731         (Object::do_get_incremental_reloc_count): New function.
7732         (Object::Object): Initialize new data members.
7733         (Relobj::output_section): Renamed do_output_section and moved to
7734         protected.
7735         (Relobj::output_section_offset): Moved to Object.
7736         (Relobj::do_get_incremental_reloc_base): New function.
7737         (Relobj::do_get_incremental_reloc_count): New function.
7738         (Relobj::allocate_incremental_reloc_counts): New function.
7739         (Relobj::count_incremental_reloc): New function.
7740         (Relobj::finalize_incremental_relocs): New function.
7741         (Relobj::next_incremental_reloc_index): New function.
7742         (Relobj::reloc_counts_): New data member.
7743         (Relobj::reloc_bases_): New data member.
7744         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7745         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7746         (Sized_relobj::incremental_relocs_scan): New function.
7747         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7748         (Sized_relobj::incremental_relocs_write): New function.
7749         (Sized_relobj::incremental_relocs_write_reltype): New function.
7750         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7751         incremental link.
7752         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7753         archives and object files elsewhere.
7754         (Add_symbols::run): Report object files here.
7755         (Finish_group::run): Report end of archive at end of group.
7756         * reloc.cc: Include layout.h, incremental.h.
7757         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7758         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7759         (Sized_relobj::incremental_relocs_scan): New function.
7760         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7761         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7762         (Sized_relobj::incremental_relocs_write): New function.
7763         (Sized_relobj::incremental_relocs_write_reltype): New function.
7764         * script.cc (read_input_script): Rewrite test for incremental link.
7765         Change call to Incremental_inputs::report_script.
7766         * symtab.h (Symbol_table::first_global_index): New function.
7767         (Symbol_table::output_count): New function.
7768
7769 2010-08-12  Doug Kwan  <dougkwan@google.com>
7770
7771         * arm.cc (Target_arm::merge_object_attributes): Check command line
7772         options --no-wchar-size-warning and --no-enum-size-warning.
7773         * options.h (General_options): Add ld-compatible options
7774         --no-enum-size-warning and --no-wchar-size-warning.
7775
7776 2010-08-04  Ian Lance Taylor  <iant@google.com>
7777
7778         * x86_64.cc (Target_x86_64::Scan::local): Use
7779         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7780         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7781         (Target_x86_64::Scan::global): Likewise.
7782         (Target_x86_64::Relocate::relocate): Likewise.
7783         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7784         Likewise.
7785
7786 2010-08-03  Cary Coutant  <ccoutant@google.com>
7787
7788         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7789         to reserve space in merged_strings vector. Keep total input size
7790         for stats.
7791         (Output_merge_string::do_print_merge_stats): Print total input size.
7792         * merge.h (Output_merge_string): Add input_size_ field.
7793         * stringpool.cc (Stringpool_template::string_length): Move
7794         implementations out of Stringpool_template class and place in
7795         stringpool.h.
7796         * stringpool.h (string_length): Move out of Stringpool_template.
7797
7798 2010-08-03  Ian Lance Taylor  <iant@google.com>
7799
7800         PR 11712
7801         * layout.cc (relaxation_loop_body): If address of load segment is
7802         set, adjust address to include headers if possible.
7803
7804 2010-08-03  Ian Lance Taylor  <iant@google.com>
7805
7806         * version.cc (version_string): Bump to 1.10.
7807
7808 2010-08-03  Ian Lance Taylor  <iant@google.com>
7809
7810         PR 11805
7811         * layout.h (enum Output_section_order): Define.
7812         (class Layout): Update declarations.
7813         * layout.cc (Layout::get_output_section): Add order parameter.
7814         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7815         is_first_non_relro parameters.  Change all callers.
7816         (Layout::choose_output_section): Likewise.
7817         (Layout::add_output_section_data): Likewise.
7818         (Layout::make_output_section): Likewise.  Set order.
7819         (Layout::default_section_order): New function.
7820         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7821         * output.cc (Output_section::Output_section): Initialize order_.
7822         Don't initialize deleted fields.
7823         (Output_segment::Output_segment): Don't initialize deleted
7824         fields.
7825         (Output_segment::add_output_section_to_load): New function
7826         replacing add_output_section.  Change all callers to call this or
7827         add_output_section_to_nonload.
7828         (Output_segment::add_output_section_to_nonload): New function.
7829         (Output_segment::remove_output_section): Rewrite.
7830         (Output_segment::add_initial_output_data): Likewise.
7831         (Output_segment::has_any_data_sections): Likewise.
7832         (Output_segment::is_first_section_relro): Likewise.
7833         (Output_segment::maximum_alignment): Likewise.
7834         (Output_segment::has_dynamic_reloc): New function replacing
7835         dynamic_reloc_count.  Change all callers.
7836         (Output_segment::has_dynamic_reloc_list): New function replacing
7837         dynamic_reloc_count_list.  Change all callers.
7838         (Output_segment::set_section_addresses): Rewrite.
7839         (Output_segment::set_offset): Rewrite.
7840         (Output_segment::find_first_and_last_list): Remove.
7841         (Output_segment::set_tls_offsets): Rewrite.
7842         (Output_segment::first_section_load_address): Likewise.
7843         (Output_segment::output_section_count): Likewise.
7844         (Output_segment::section_with_lowest_load_address): Likewise.
7845         (Output_segment::write_section_headers): Likewise.
7846         (Output_segment::print_sections_to_map): Likewise.
7847         * output.h (class Output_data): Remove dynamic_reloc_count_
7848         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7849         (Output_data::add_dynamic_reloc): Rewrite.
7850         (Output_data::has_dynamic_reloc): New function.
7851         (Output_data::dynamic_reloc_count): Remove.
7852         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7853         is_last_relro_, is_first_non_relro_, is_interp_,
7854         is_dynamic_linker_section_ fields.  Add order and set_order
7855         functions.  Remove is_relro_local, set_is_relro_local,
7856         is_last_relro, set_is_last_relro, is_first_non_relro,
7857         set_is_first_non_relro functions, is_interp, set_is_interp,
7858         is_dynamic_linker_section, and set_is_dynamic_linker_section
7859         functions.
7860         (class Output_segment): Change Output_data_list from std::list to
7861         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7862         output_bss_ fields.  Update declarations.
7863
7864 2010-08-02  Ian Lance Taylor  <iant@google.com>
7865
7866         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7867         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7868         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7869
7870 2010-08-02  Ian Lance Taylor  <iant@google.com>
7871
7872         PR 11855
7873         * script.cc (Script_options::Script_options): Initialize
7874         symbol_definitions_ and symbol_references_.
7875         (Script_options::add_symbol_assignment): Update
7876         symbol_definitions_ and symbol_references_.
7877         (Script_options::add_symbol_reference): New function.
7878         (script_symbol): New function.
7879         * script.h (class Script_options): Add symbol_definitions_ and
7880         symbol_references_ fields.
7881         (Script_options::referenced_const_iterator): New type.
7882         (Script_options::referenced_begin): New function.
7883         (Script_options::referenced_end): New function.
7884         (Script_options::is_referenced): New function.
7885         (Script_options::any_unreferenced): New function.
7886         * script-c.h (script_symbol): Declare.
7887         * yyscript.y (exp): Call script_symbol.
7888         * symtab.cc: Include "script.h".
7889         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7890         Change all callers.  Check symbols referenced by scripts.
7891         (Symbol_table::add_undefined_symbols_from_command_line): Add
7892         layout parameter.  Change all callers.
7893         (Symbol_table::do_add_undefined_symbols_from_command_line):
7894         Likewise.  Break out loop body.  Check symbols referenced by
7895         scripts.
7896         (Symbol_table::add_undefined_symbol_from_command_line): New
7897         function broken out of
7898         do_add_undefined_symbols_from_command_line.
7899         * symtab.h (class Symbol_table): Update declarations.
7900         * archive.cc: Include "layout.h".
7901         (Archive::should_include_member): Add layout parameter.  Change
7902         all callers.  Check for symbol mentioned in expression.
7903         * archive.h (class Archive): Update declaration.
7904         * object.cc (Sized_relobj::do_should_include_member): Add layout
7905         parameter.
7906         * object.h (Object::should_include_member): Add layout parameter.
7907         Change all callers.
7908         (Object::do_should_include_member): Add layout parameter.
7909         (class Sized_relobj): Update declaration.
7910         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7911         parameter.
7912         * dynobj.h (class Sized_dynobj): Update declaration.
7913         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7914         layout parameter.
7915         * plugin.h (class Sized_pluginobj): Update declaration.
7916
7917 2010-08-02  Ian Lance Taylor  <iant@google.com>
7918
7919         PR 11866
7920         * output.cc (Output_segment::set_offset): Search for the first and
7921         last sections rather than assuming that the list is in order.
7922         (Output_segment::find_first_and_last_list): New function.
7923         * output.h (class Output_segment): Update declarations.
7924         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7925         (relro_strip_test_SOURCES): New variable.
7926         (relro_strip_test_DEPENDENCIES): New variable.
7927         (relro_strip_test_LDFLAGS): New variable.
7928         (relro_strip_test_LDADD): New variable.
7929         (relro_strip_test.so): New target.
7930
7931 2010-08-02  Ian Lance Taylor  <iant@google.com>
7932
7933         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7934         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7935         (Target_i386::got_tlsdesc_section): New function.
7936         (Target_i386::got_section): Create space for GOT entries for
7937         TLSDESC relocations.
7938         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7939         R_386_TLS_GOTDESC.
7940         (Target_i386::Scan::global): Likewise.
7941         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7942         using TLSDESC GOT.
7943         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7944         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7945         (Target_x86_64::got_tlsdesc_section): New function.
7946         (Target_x86_64::got_section): Create space for GOT entries for
7947         TLSDESC relocations.
7948         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7949         R_386_TLS_GOTDESC.
7950         (Target_x86_64::Scan::global): Likewise.
7951         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7952         using TLSDESC GOT.
7953
7954 2010-08-02  Ian Lance Taylor  <iant@google.com>
7955
7956         * testsuite/final_layout.sh: Use dc to convert from hex to
7957         decimal.
7958
7959 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7960
7961         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7962         paramter to the call to gold::gc_process_relocs.
7963         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7964         paramter to the call to gold::gc_process_relocs.
7965         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7966         parameter to the call to gold::gc_process_relocs.
7967         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7968         template parameter to the call to gold::gc_process_relocs.
7969         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7970         paramter to the call to gold::gc_process_relocs.
7971         * gc.h (get_embedded_addend_size): New function.
7972         (gc_process_relocs): Save the size of the reloc for use by ICF.
7973         * icf.cc (get_section_contents): Get the addend from the text section
7974         for SHT_REL relocation sections.
7975         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7976         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7977         * int_encoding.h (read_from_pointer): New overloaded function.
7978         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7979         * testsuite/icf_sht_rel_addend_test.sh: New file.
7980         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7981         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7982
7983 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7984
7985         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7986         * Makefile.in: Regenerate.
7987         * testsuite/Makefile.in: Regenerate.
7988
7989 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7990
7991         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7992         * gold/testsuite/debug_msg.cc: Likewise.
7993         * gold/testsuite/odr_violation1.cc
7994         * gold/testsuite/odr_violation2.cc
7995
7996 2010-07-21  Cary Coutant  <ccoutant@google.com>
7997
7998         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7999         string, and length fields.
8000         (Output_merge_string::Merged_strings_list): New type.
8001         (Output_merge_string::Merged_strings_lists): New typedef.
8002         (Output_merge_string): Replace merged_strings_ with
8003         merged_strings_lists_.
8004         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
8005         Merged_strings_list per input object and section.  Don't store pointer
8006         to the string.  Don't store length with each merged string entry.
8007         (Output_merge_string::finalize_merged_data): Loop over list of merged
8008         strings lists.  Recompute length of each merged string.
8009
8010 2010-07-15  Cary Coutant  <ccoutant@google.com>
8011
8012         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
8013         here.
8014
8015 2010-07-14  Ian Lance Taylor  <iant@google.com>
8016
8017         * descriptors.cc (Descriptors::open): Report correct name in error
8018         message.
8019
8020 2010-07-13  Doug Kwan  <dougkwan@google.com>
8021
8022         * arm.cc (Arm_input_section::Arm_input_section): For a
8023         SHT_ARM_EXIDX section, always keeps the input sections.
8024         (Arm_input_section::set_exidx_section_link): New method.
8025         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
8026         has_errors_ to false.
8027         (Arm_exidx_input_section::has_errors,
8028         Arm_exidx_input_section::set_has_errors): New methods.
8029         (Arm_exidx_input_section::has_errors_): New data member.
8030         (Arm_relobj::get_exidx_shndx_list): New method.
8031         (Arm_output_section::append_text_sections_to_list): Do not skip
8032         section without SHF_EXECINSTR.
8033         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8034         errors.
8035         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8036         section header.  Make error messages more verbose.  Check for
8037         a non-executable section linked to an EXIDX section.
8038         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8039         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8040         check that there is no deferred EXIDX section if we exit early.
8041         Instead of not making an EXIDX section in case of an error, make one
8042         and set the has_errors flag of it.
8043         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8044         in a relocatable link.
8045         (Target_arm::do_relax): Look for the EXIDX output section instead of
8046         assuming that it is called .ARM.exidx.
8047         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8048         section list.  Do not check for SHF_EXECINSTR section flags but
8049         skip any input section with errors.
8050         * output.cc (Output_section::Output_section): Initialize
8051         always_keeps_input_sections_ to false.
8052         (Output_section::add_input_section): Check for
8053         always_keeps_input_sections_.
8054         *  output.h (Output_section::always_keeps_input_sections,
8055         Output_section::set_always_keeps_input_sections): New methods.
8056         (Output_section::always_keeps_input_sections): New data member.
8057
8058 2010-07-13  Rafael Espindola  <espindola@google.com>
8059
8060         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8061         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8062
8063 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8064             Ian Lance Taylor  <iant@google.com>
8065
8066         * output.h (Output_section_lookup_maps::add_merge_section):
8067         Correct check of whether value was inserted.
8068         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8069         (Output_section_lookup_maps::add_relaxed_input_section):
8070         Likewise.
8071         * arm.cc (Target_arm::got_section): Remove used local os.
8072         * i386.cc (Target_i386::got_section): Likewise.
8073         * x86_64.cc (Target_x86_64::got_section): Likewise.
8074         * sparc.cc (Target_sparc::got_section): Likewise.
8075         (Target_sparc::relocate): Remove unused local have_got_offset.
8076         * powerpc.cc (Target_powerpc::relocate): Likewise.
8077
8078 2010-07-13  Ian Lance Taylor  <iant@google.com>
8079
8080         * compressed_output.cc (zlib_decompress): Fix signature in
8081         !HAVE_ZLIB_H case.
8082
8083         * archive.cc (Archive::include_member): Unlock an external member
8084         of a thin archive.  Don't bother to delete an object we know is
8085         NULL.
8086
8087 2010-07-12  Cary Coutant  <ccoutant@google.com>
8088
8089         * compressed_output.cc (zlib_decompress): New function.
8090         (get_uncompressed_size): New function.
8091         (decompress_input_section): New function.
8092         * compressed_output.h (get_uncompressed_size): New function.
8093         (decompress_input_section): New function.
8094         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8095         Handle compressed debug sections.
8096         * layout.cc (is_compressed_debug_section): New function.
8097         (Layout::output_section_name): Map compressed section names to
8098         canonical names.
8099         * layout.h (is_compressed_debug_section): New function.
8100         (is_debug_info_section): Recognize compressed debug sections.
8101         * merge.cc: Include compressed_output.h.
8102         (Output_merge_data::do_add_input_section): Handle compressed
8103         debug sections.
8104         (Output_merge_string::do_add_input_section): Handle compressed
8105         debug sections.
8106         * object.cc: Include compressed_output.h.
8107         (Sized_relobj::Sized_relobj): Initialize new data members.
8108         (build_compressed_section_map): New function.
8109         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8110         * object.h (Object::section_is_compressed): New method.
8111         (Object::do_section_is_compressed): New method.
8112         (Sized_relobj::Compressed_section_map): New type.
8113         (Sized_relobj::do_section_is_compressed): New method.
8114         (Sized_relobj::compressed_sections_): New data member.
8115         * output.cc (Output_section::add_input_section): Handle compressed
8116         debug sections.
8117         * reloc.cc: Include compressed_output.h.
8118         (Sized_relobj::write_sections): Handle compressed debug sections.
8119
8120 2010-07-08  Cary Coutant  <ccoutant@google.com>
8121
8122         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8123         weak when resolving to a dynamic def.
8124         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8125         for weak undef/dynamic def cases. Adjust callers.
8126         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8127         undef_binding_weak_.
8128         (Symbol_table::sized_write_globals): Adjust symbol binding.
8129         (Symbol_table::sized_write_symbol): Add binding parameter.
8130         * symtab.h (Symbol::set_undef_binding): New method.
8131         (Symbol::is_undef_binding_weak): New method.
8132         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8133         (Symbol_table::should_override): Add new parameter.
8134         (Symbol_table::sized_write_symbol): Add new parameter.
8135
8136         * testsuite/weak_undef_file1.cc: Add new test case.
8137         * testsuite/weak_undef_file2.cc: Fix header comment.
8138         * testsuite/weak_undef_test.cc: Add new test case.
8139
8140 2010-06-29  Doug Kwan  <dougkwan@google.com>
8141
8142         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8143         Initialize USE_SYMBOL_.
8144         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8145         definition.
8146         (Arm_reloc_property::uses_symbol_): New data member declaration.
8147         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8148         uses symbol value and symbol is undefined but not weakly undefined.
8149
8150 2010-06-28  Rafael Espindola  <espindola@google.com>
8151
8152         * plugin.cc (Plugin::load): Use dlerror.
8153
8154 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8155
8156         * symtab.cc (detect_odr_violations): When reporting an ODR
8157         violation, report an object where the symbol is defined.
8158
8159 2010-06-25  Doug Kwan  <dougkwan@google.com>
8160
8161         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8162         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8163         definition.
8164         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8165         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8166         target hook to detect function points.
8167         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8168         * icf.h (Icf::check_section_for_function_pointers): Change type of
8169         parameter SECTION_NAME to const reference to std::string.  Use
8170         target hook to determine if section may have unsafe pointers.
8171         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8172         method definition.
8173
8174 2010-06-21  Rafael Espindola  <espindola@google.com>
8175
8176         * fileread.cc (Input_file::find_fie): New
8177         (Input_file::open): Use Input_file::find_fie.
8178         * fileread.h (Input_file::find_fie): New
8179         * plugin.cc (set_extra_library_path): New.
8180         (Plugin::load): Add set_extra_library_path to the transfer vector.
8181         (Plugin_manager::set_extra_library_path): New.
8182         (Plugin_manager::add_input_file): Use the extra search path if set.
8183         (set_extra_library_path(): New.
8184         * plugin.h (Plugin_manager): Add set_extra_library_path and
8185         extra_search_path_.
8186
8187 2010-06-19  Cary Coutant  <ccoutant@google.com>
8188
8189         * layout.cc (gdb_sections): Add .debug_types.
8190         (lines_only_debug_sections): Likewise.
8191
8192 2010-06-18  Rafael Espindola  <espindola@google.com>
8193
8194         * plugin.cc (add_input_file,add_input_library)
8195         (Plugin_manager::add_input_file): Make filename arguments const.
8196         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8197         const.
8198
8199 2010-06-16  Doug Kwan  <dougkwan@google.com>
8200
8201         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8202         .ARM.attributes section if we have not merged any input
8203         attributes sections.
8204
8205 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8206
8207         * arm.cc: Allow combining objects with no EABI version
8208         information.
8209
8210 2010-06-15  Rafael Espindola  <espindola@google.com>
8211
8212         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8213
8214 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8215
8216         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8217         (struct iovec): Correct !HAVE_READV definition.
8218
8219 2010-06-10  Cary Coutant  <ccoutant@google.com>
8220
8221         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8222         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8223         reloc sections.
8224         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8225
8226         PR 11683
8227         * symtab.h (Symbol::is_placeholder): New member function.
8228         * target-reloc.h (relocate_section): Check for placeholder symbols.
8229
8230         * testsuite/Makefile.am (plugin_test_8): New test.
8231         (plugin_test_9): New test.
8232         * testsuite/Makefile.in: Regenerate.
8233
8234 2010-06-09  Nick Clifton  <nickc@redhat.com>
8235
8236         * yyscript.y (input_list_element): Allow strings prefixed with
8237         the '-' character.  Treat these as libraries.
8238         * script.cc (script_add_library): New function.  Adds a library
8239         specified by "-l<name>" found in an input script.
8240         * script-c.h: Add prototype for script_add_library.
8241
8242 2010-06-07  Doug Kwan  <dougkwan@google.com>
8243
8244         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8245         Restrict stub-group size to be within long conditional branch
8246         range when working around cortex-A8 erratum.
8247
8248 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8249
8250         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8251         #ifdef typo.
8252
8253 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8254
8255         PR gold/11658
8256         * output.cc
8257         (Output_section::Input_section_sort_entry::compare_section_ordering):
8258         Change to return non-zero correctly.
8259         (Output_section::Input_section_sort_section_order_index_compare
8260         ::operator()): Change to fix ambiguity in comparisons.
8261
8262 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8263
8264         * gold.h (is_wildcard_string): New function.
8265         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8266         (Layout::layout_eh_frame): Ditto.
8267         (Layout::find_section_order_index): New method.
8268         (Layout::read_layout_from_file): New method.
8269         * layout.h (Layout::find_section_order_index): New method.
8270         (Layout::read_layout_from_file): New method.
8271         (Layout::input_section_position_): New private member.
8272         (Layout::input_section_glob_): New private member.
8273         * main.cc (main): Call read_layout_from_file here.
8274         * options.h (--section-ordering-file): New option.
8275         * output.cc (Output_section::input_section_order_specified_): New
8276         member.
8277         (Output_section::Output_section): Initialize new member.
8278         (Output_section::add_input_section): Add new parameter.
8279         Keep input sections when --section-ordering-file is used.
8280         (Output_section::set_final_data_size): Sort input sections when
8281         section ordering file is specified.
8282         (Output_section::Input_section_sort_entry): Add new parameter.
8283         Check sorting type.
8284         (Output_section::Input_section_sort_entry::compare_section_ordering):
8285         New method.
8286         (Output_section::Input_section_sort_compare::operator()): Change to
8287         consider section_order_index.
8288         (Output_section::Input_section_sort_init_fini_compare::operator()):
8289         Change to consider section_order_index.
8290         (Output_section::Input_section_sort_section_order_index_compare
8291         ::operator()): New method.
8292         (Output_section::sort_attached_input_sections): Change to sort
8293         according to section order when specified.
8294         (Output_section::add_input_section<32, true>): Add new parameter.
8295         (Output_section::add_input_section<64, true>): Add new parameter.
8296         (Output_section::add_input_section<32, false>): Add new parameter.
8297         (Output_section::add_input_section<64, false>): Add new parameter.
8298         * output.h (Output_section::add_input_section): Add new parameter.
8299         (Output_section::input_section_order_specified): New
8300         method.
8301         (Output_section::set_input_section_order_specified): New method.
8302         (Input_section::Input_section): Initialize section_order_index_.
8303         (Input_section::section_order_index): New method.
8304         (Input_section::set_section_order_index): New method.
8305         (Input_section::section_order_index_): New member.
8306         (Input_section::Input_section_sort_section_order_index_compare): New
8307         struct.
8308         (Output_section::input_section_order_specified_): New member.
8309         * script-sections.cc (is_wildcard_string): Delete and move modified
8310         method to gold.h.
8311         (Output_section_element_input::Output_section_element_input): Modify
8312         call to is_wildcard_string.
8313         (Output_section_element_input::Input_section_pattern
8314         ::Input_section_pattern): Ditto.
8315         (Output_section_element_input::Output_section_element_input): Ditto.
8316         * testsuite/Makefile.am (final_layout): New test case.
8317         * testsuite/Makefile.in: Regenerate.
8318         * testsuite/final_layout.cc: New file.
8319         * testsuite/final_layout.sh: New file.
8320
8321 2010-06-01  Rafael Espindola  <espindola@google.com>
8322
8323         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8324
8325 2010-06-01  Rafael Espindola  <espindola@google.com>
8326
8327         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8328         visibility of symbols.
8329
8330 2010-05-27  Doug Kwan  <dougkwan@google.com>
8331
8332         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8333         from start of output section instead of address for a local symbol
8334         in a merged or relaxed section when doing a relocatable link.
8335
8336 2010-05-26  Rafael Espindola  <espindola@google.com>
8337
8338         PR 11604
8339         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8340         adding sections the garbage collector removed.
8341         * gold/testsuite/Makefile.am: Add test.
8342         * gold/testsuite/Makefile.in: Regenerate.
8343         * gold/testsuite/plugin_test_7.sh: New.
8344         * gold/testsuite/plugin_test_7_1.c: New.
8345         * gold/testsuite/plugin_test_7_2.c: New.
8346
8347 2010-05-26  Rafael Espindola  <espindola@google.com>
8348
8349         * script-sections.cc (Output_section_definition::set_section_addresses):
8350         Check for --section-start.
8351
8352 2010-05-26  Doug Kwan  <dougkwan@google.com>
8353
8354         * arm.cc (Arm_scan_relocatable_relocs): New class.
8355         (Target_arm::relocate_special_relocatable): New method.
8356         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8357         (Arm_relocate_functions::thumb_branch_common): Same.
8358         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8359         instead of Default_scan_relocatable_relocs.
8360         * target-reloc.h (relocate_for_relocatable): Let target handle
8361         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8362         * target.h (Sized_target::relocate_special_relocatable): New method.
8363
8364 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8365
8366         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8367
8368 2010-05-23  Doug Kwan  <dougkwan@google.com>
8369
8370         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8371         instead of a cast.
8372         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8373         with a direct branch, not a conditional branch, to a stub.
8374         * merge.cc (Output_merge_base::record_input_section): New method
8375         defintion.
8376         (Output_merge_data::do_add_input_section): Record input section if
8377         keeps-input-sections flag is set.
8378         (Output_merge_string::do_add_input_section): Ditto.
8379         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8380         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8381         INPUT_SECTIONS_.
8382         (Output_merge_base::keeps_input_sections,
8383         Output_merge_base::set_keeps_input_sections,
8384         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8385         method definitions.
8386         (Output_merge_base::Input_sections): New type declaration.
8387         (Output_merge_base::input_sections_begin,
8388         Output_merge_base::input_sections_end,
8389         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8390         (Output_merge_base::bool keeps_input_sections_,
8391         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8392         Output_merge_base::input_sections_): New data members.
8393         (Output_merge_data::do_set_keeps_input_sections): New method
8394         defintion.
8395         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8396         * output.cc (Output_section::Input_section::relobj): Move method
8397         defintion from class declaration to here and handle merge sections.
8398         (Output_section::Input_section::shndx): Ditto.
8399         (Output_section::Output_section): Remove initializations of removed
8400         data members and initialize new data member LOOKUP_MAPS_.
8401         (Output_section::add_input_section): Set keeps-input-sections flag
8402         for a newly created merge output section as appropriate.  Adjust code
8403         to use Output_section_lookup_maps class.
8404         (Output_section::add_relaxed_input_section): Adjst code for lookup
8405         maps code refactoring.
8406         (Output_section::add_merge_input_section): Add a new parameter
8407         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8408         class.  If adding input section to a newly created merge output
8409         section fails, remove the new merge section.
8410         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8411         Adjust code for use of the Output_section_lookup_maps class.
8412         (Output_section::find_merge_section): Ditto.
8413         (Output_section::build_lookup_maps): New method defintion.
8414         (Output_section::find_relaxed_input_section): Adjust code to use
8415         Output_section_lookup_maps class.
8416         (Output_section::get_input_sections): Export merge sections.  Adjust
8417         code to use Output_section_lookup_maps class.
8418         (Output_section:::add_script_input_section): Adjust code to use
8419         Output_section_lookup_maps class.  Update lookup maps for merge
8420         sections also.
8421         (Output_section::discard_states): Use Output_section_lookup_maps.
8422         (Output_section::restore_states): Same.
8423         * output.h (Merge_section_properties): Move class defintion out of
8424         Output_section.
8425         (Output_section_lookup_maps): New class.
8426         (Output_section::Input_section::is_merge_section): New method
8427         defintion.
8428         (Output_section::Input_section::relobj): Move defintion out of class
8429         defintion.  Declare method only.
8430         (Output_section::Input_section::shndx): Ditto.
8431         (Output_section::Input_section::output_merge_base): New method defintion.
8432         (Output_section::Input_section::u2_.pomb): New union field.
8433         (Output_section::Merge_section_by_properties_map,
8434         Output_section::Output_section_data_by_input_section_map,
8435         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8436         Remove types.
8437         (Output_section::add_merge_input_section): Add new parameter
8438         KEEPS_INPUT_SECTIONS.
8439         (Output_section::build_lookup_maps): New method declaration.
8440         (Output_section::merge_section_map_,
8441         Output_section::merge_section_by_properties_map_,
8442         Output_section::relaxed_input_section_map_,
8443         Output_section::is_relaxed_input_section_map_valid_): Remove data
8444         members.
8445         (Output_section::lookup_maps_): New data member.
8446
8447 2010-05-21  Doug Kwan  <dougkwan@google.com>
8448
8449         PR gold/11619
8450         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8451         avoid a compilation error.
8452
8453 2010-05-19  Rafael Espindola  <espindola@google.com>
8454
8455         * script-sections.cc (Output_section_definition::allocate_to_segment):
8456         Update the phdrs_list even when the output section is NULL.
8457         * testsuite/Makefile.am: Add test.
8458         * testsuite/Makefile.in: Regenerate.
8459         * testsuite/script_test_9.cc: New.
8460         * testsuite/script_test_9.sh: New.
8461         * testsuite/script_test_9.t: New.
8462
8463 2010-05-19  Doug Kwan  <dougkwan@google.com>
8464
8465         * arm.cc (Arm_input_section::original_size): New method.
8466         (Arm_input_section::do_addralign): Add a cast.
8467         (Arm_input_section::do_output_offset): Remove static cast.
8468         (Arm_input_section::original_addralign,
8469          Arm_input_section::original_size_): Change type to uint32_t.
8470         (Arm_input_section::init): Add safe casts for section alignment
8471         and size.
8472         (Arm_input_section::set_final_data_size): Do not set address and
8473         offset of stub table.
8474         (Arm_output_section::fix_exidx_coverage): Change use of of
8475         Output_section::Simple_input_section to that of
8476         Output_section::Input_section.
8477         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8478         except for the first pass.
8479         * output.cc (Output_section::get_input_sections): Change type of
8480         input_sections to std::list<Input_section>.
8481         (Output_section::add_script_input_section): Rename from
8482         Output_section::add_simple_input_section.  Change type of SIS
8483         parameter from Simple_input_section to Input_section.
8484         * output.h (Output_section::Simple_input_section): Remove class.
8485         (Output_section::Input_section): Change class visibility to public.
8486         (Output_section::Input_section::addralign): Use stored alignments
8487         for special input sections if set.
8488         (Output_section::Input_section::set_addralign): New method.
8489         (Output_section::get_input_sections): Change parameter type from
8490         list of Simple_input_section to list of Input_section.
8491         (Output_section::add_script_input_section): Rename from
8492         Output_section::add_simple_input_section. Change first parameter's
8493         type from Simple_input_section to Input_section and remove the
8494         second and third parameters.
8495         * script-sections.cc (Input_section::Input_section_list): Change
8496         type to list of Output_section::Input_section/
8497         (Input_section_info::Input_section_info): Change parameter type of
8498         INPUT_SECTION to Output_section::Input_section.
8499         (Input_section_info::input_section): Change return type.
8500         (Input_section_info::input_section_): Change type to
8501         Output_section::Input_section.
8502         (Output_section_element_input::set_section_addresses): Adjust code
8503         to use Output_section::Input_section instead of
8504         Output_section::Simple_input_section.  Adjust code for renaming
8505         of Output_section::add_simple_input_section.
8506         (Orphan_output_section::set_section_addresses): Ditto.
8507
8508 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8509
8510         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8511         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8512
8513 2010-05-18  Rafael Espindola  <espindola@google.com>
8514
8515         * options.cc (General_options::finalize): Handle -nostdlib.
8516         * options.h (nostdlib): New option.
8517         * script.cc (script_add_search_dir): Handle -nostdlib.
8518
8519 2010-05-12  Doug Kwan  <dougkwan@google.com>
8520
8521         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8522         attributes section only if there no attributes section after merging.
8523         (Target_arm::merge_object_attributes): Move value of
8524         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8525         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8526         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8527         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8528         and arm_attr_merge_7.stdout.
8529         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8530         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8531         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8532         arm_attr_merge_7b.o): New rules.
8533         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8534         arm_attr_merge_7
8535         * testsuite/Makefile.in: Regenerate.
8536         * testsuite/arm_attr_merge.sh: New file.
8537         * testsuite/arm_attr_merge_[67][ab].s: Same.
8538
8539 2010-05-05  Nick Clifton  <nickc@redhat.com>
8540
8541         * po/es.po: Updated Spanish translation.
8542
8543 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8544
8545         * Makefile.am (install-exec-local): Properly install gold as
8546         default cross linker.
8547         * Makefile.in: Regenerated.
8548
8549 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8550             Nick Clifton  <nickc@redhat.com>
8551
8552         * configure.ac (install_as_default): Define and set to false
8553         unless --enable-gold or --enable-gold=both/gold has been
8554         specified.
8555         * configure: Regenerate.
8556
8557         * Makefile.am (install-exec-local): Install the executable as
8558         'ld.gold'.  If install_as_default is true then also install it as
8559         'ld'.
8560         * Makefile.in: Regenerated.
8561
8562 2010-04-24  Ian Lance Taylor  <iant@google.com>
8563
8564         * layout.cc (Layout::layout_reloc): In relocatable link don't
8565         combine reloc sections for grouped sections.
8566
8567 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8568
8569         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8570         sections that are not ordinary to icf.
8571         * icf.cc (get_section_contents): Handle relocation pointing to section
8572         with no object or shndx information.
8573         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8574         * testsuite/Makefile.in: Regenerate.
8575         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8576         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8577
8578 2010-04-22  Ian Lance Taylor  <iant@google.com>
8579
8580         * expression.cc (Expression::Expression_eval_info): Add
8581         result_alignment_pointer field.
8582         (Expression::eval_with_dot): Add result_alignment_pointer
8583         parameter.  Change all callers.
8584         (Expression::eval_maybe_dot): Likewise.
8585         (class Binary_expression): Add alignment_pointer parameter to
8586         left_value and right_value.  Change all callers.
8587         (BINARY_EXPRESSION): Set result alignment.
8588         (class Trinary_expression): Add alignment_pointer parameter to
8589         arg2_value and arg3_value.  Change all callers.
8590         (Trinary_cond::value): Set result alignment.
8591         (Max_expression::value, Min_expression::value): Likewise.
8592         (Align_expression::value): Likewise.
8593         * script-sections.cc (class Sections_element): Add dot_alignment
8594         parameter to set_section_addresses virtual function.  Update
8595         instantiations.
8596         (class Output_section_element): Likewise.
8597         (Script_sections::create_segments): Add dot_alignment parameter.
8598         Change all callers.
8599         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8600         (Script_sections::set_phdrs_clause_addresses): Likewise.
8601         * script-sections.h: Update declarations.
8602         * script.h: Update declarations.
8603         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8604         min_p_align.
8605         * testsuite/script_test_3.t: Set large alignment.
8606         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8607         segment has expected alignment.
8608
8609 2010-04-22  Nick Clifton  <nickc@redhat.com>
8610
8611         * po/gold.pot: Updated by the Translation project.
8612         * po/vi.po: Updated Vietnamese translation.
8613
8614 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8615
8616         * testsuite/Makefile.am (check_PROGRAMS): Add
8617         icf_virtual_function_folding_test.
8618         * testsuite/Makefile.in: Regenerated.
8619
8620 2010-04-15  Andrew Haley  <aph@redhat.com>
8621
8622         * options.h (merge_exidx_entries): New option.
8623         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8624         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8625         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8626         (Target_arm::merge_exidx_entries): New function.
8627         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8628         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8629         to Arm_exidx_fixup constructor.
8630         Add new arg, merge_exidx_entries.
8631         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8632         Arm_output_section::fix_exidx_coverage.
8633
8634 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8635
8636         * icf.cc (get_section_contents): Check for preemptible functions.
8637         Ignore addend when appropriate.
8638         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8639         section folded.
8640         (add_from_relobj): Check for section folded.
8641         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8642         * symtab.h (should_add_dynsym_entry): Add new parameter.
8643         * target-reloc.h (scan_relocs): Check for section folded.
8644         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8645         Check reloc types for function pointers in shared objects.
8646         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8647         case.
8648         (icf_preemptible_functions_test): New test case.
8649         (icf_string_merge_test): New test case.
8650         * testsuite.Makefile.in: Regenerate.
8651         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8652         bar_glob.  Refactor code.
8653         * testsuite/icf_preemptible_functions_test.cc: New file.
8654         * testsuite/icf_preemptible_functions_test.sh: New file.
8655         * testsuite/icf_string_merge_test.cc: New file.
8656         * testsuite/icf_string_merge_test.sh: New file.
8657         * testsuite/icf_virtual_function_folding_test.cc: New file.
8658         * testsuite/icf_virtual_function_folding_test.sh: New file.
8659
8660 2010-04-14  Doug Kwan  <dougkwan@google.com>
8661
8662         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8663         for local symbol recounting if we remove a section due to ICF.
8664         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8665         there are no regular objects in input.
8666
8667 2010-04-13  Doug Kwan  <dougkwan@google.com>
8668
8669         * arm.cc (Arm_input_section::set_final_data_size): Compute
8670         accurate final data size instead of using current data size.
8671
8672 2010-04-09  Doug Kwan  <dougkwan@google.com>
8673
8674         * layout.cc (Layout::choose_output_section): Handle script section
8675         types.
8676         (Layout::make_output_section_for_script): Add section type parameter.
8677         Handle script section types.
8678         * layout.h (Layout::make_output_section_for_script): Add section
8679         type parameter.
8680         * output.cc (Output_section::Output_section): Initialize data member
8681         is_noload_.
8682         (Output_section::do_reset_address_and_file_offset): Do not set address
8683         to 0 if section is a NOLOAD section.
8684         * output.h (Output_section::is_noload): New method.
8685         (Output_section::set_is_noload): Ditto.
8686         (Output_section::is_noload_): New data member.
8687         * script-c.h (Script_section_type): New enum type.
8688         (struct Parser_output_section_header): Add new file section_type.
8689         * script-sections.cc (Sections_element::output_section_name): Add
8690         parameter for returning script section type.
8691         (Output_section_definition::output_section_name): Ditto.
8692         (Output_section_definition::section_type)P; New method.
8693         (Output_section_definiton::script_section_type_name): Ditto.
8694         (Output_section_definition::script_section_type_): New data member.
8695         (Output_section_definition::Output_section_definition): Initialize
8696         data member Output_section_definition::script_section_type_.
8697         (Output_section_definition::create_sections): Pass script section type
8698         to Layout::make_output_section_for_script.
8699         (Output_section_definition::output_section_name): Return script
8700         section type to caller.
8701         (Output_section_definition::set_section_address): Do not advance
8702         dot value and load address if section type is NOLOAD.  Set address
8703         of NOLOAD sections regardless of section flags.
8704         (Output_section_definition::print): Print section type if it is
8705         not SCRIPT_SECTION_TYPE_NONE.
8706         (Output_section_definition::section_type): New method.
8707         (Output_section_definition::script_section_type_name): Ditto.
8708         (Script_sections::output_section_name): Add new parameter
8709         PSECTION_TYPE for returning script section type.  Pass it to
8710         section elements.  Handle discard sections.
8711         (Sort_output_sections::operator()): Handle NOLOAD sections.
8712         * script-sections.h (Script_sections::Section_type): New enum type.
8713         (Script_sections::output_section_name): Add a new parameter for
8714         returning script section type.
8715         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8716         INFO and NOLOAD.
8717         * yyscript.y (union): Add new field SECTION_TYPE.
8718         (COPY, DSECT, INFO, NOLOAD): New tokens.
8719         (opt_address_and_section_type): Change type to output_section_header.
8720         (section_type): New non-terminal
8721         (section_header): Handle section type.
8722         (opt_address_and_section_type): Return section type value.
8723
8724 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8725
8726         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8727         * testsuite/plugin_common_test_2.c (foo): Likewise.
8728
8729 2010-04-08  Doug Kwan  <dougkwan@google.com>
8730
8731         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8732         Output_merge_data.
8733         * output.cc (Output_section::add_merge_input_section): Simplify
8734         code and return status of Output_merge_base::add_input_section.
8735         Update merge section map only if Output_merge_base::add_input_section
8736         returns true.
8737
8738 2010-04-07  Doug Kwan  <dougkwan@google.com>
8739
8740         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8741         if section is marked as containing instructions but has no mapping
8742         symbols.
8743         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8744         correct section index.
8745         (Arm_relobj::find_linked_text_section): Ditto.
8746
8747 2010-04-07  Cary Coutant  <ccoutant@google.com>
8748
8749         * archive.cc (include_member): Destroy Read_symbols_data object before
8750         releasing file.
8751         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8752         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8753         (Read_symbols_data::~Read_symbols_data) New destructor.
8754         (Section_relocs::Section_relocs) New constructor.
8755         (Section_relocs::~Section_relocs) New destructor.
8756         (Read_relocs_data::Read_relocs_data) New constructor.
8757         (Read_relocs_data::~Read_relocs_data) New destructor.
8758         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8759         pointers to NULL after deleting.
8760
8761 2010-04-07  Doug Kwan  <dougkwan@google.com>
8762
8763         * arm.cc: Replace "endianity" with "endianness" in comments.
8764         (Arm_exidx_cantunwind): Ditto.
8765         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8766         (Arm_relobj::merge_flags_and_attributes): New method.
8767         (Arm_relobj::merge_flags_and_attributes_): New data member.
8768         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8769         (Arm_relobj::scan_sections_for_stubs): Ditto.
8770         (Arm_relobj::do_read_symbols): Check to see if we really want to
8771         merge processor-specific flags and attributes.  Exit early if
8772         an object is empty except for section names and the undefined symbol.
8773         (Target_arm::do_finalize_sections): Move check for ELF format to
8774         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8775         attributes from a regular object only when we have determined that
8776         it is aapropriate.  Do not create an .ARM.attributes section in
8777         output if there is no regular input object.
8778         (Target_arm::merge_processor_specific_flags): Check
8779         --warn-mismatch before printing any error.
8780         (Target_arm::merge_object_attributes): Ditto.
8781         * gold.cc (queue_middle_tasks): Handle the case in which there is
8782         no regular object in input.
8783         * options.cc (General_options::parse_EB): New method.
8784         (General_options::parse_EL): Same.
8785         (General_options::General_options): Initialize endianness_.
8786         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8787         New options.
8788         (General_options::Endianness): New enum.
8789         (General_options::endianness): New method.
8790         (General_options::endianness_): New data member.
8791         * parameters.cc (Parameters::set_options): Check target endianness.
8792         (Parameters::set_target_once): Ditto.
8793         (Parameters::check_target_endianness): New method.
8794         (parameters_force_valid_target): If either -EL or -EB is specified,
8795         use it to define endianness of default target.
8796         * parameters.h (Parameters::check_target_endianness): New method
8797         declaration.
8798         * target.h (class Target): Change "endianity" to "endianness"
8799         in comments.
8800
8801 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8802
8803         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8804         * configure: Regenerate.
8805         * Makefile.in: Regenerate.
8806         * testsuite/Makefile.in: Regenerate.
8807
8808 2010-04-06  Cary Coutant  <ccoutant@google.com>
8809
8810         gcc PR lto/42757
8811         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8812         prevailing definitions of common symbols.
8813         * testsuite/plugin_test_6.sh: New test case.
8814         * testsuite/plugin_common_test_1.c: New test case.
8815         * testsuite/plugin_common_test_2.c: New test case.
8816         * testsuite/Makefile.am (plugin_test_6): New test case.
8817         * testsuite/Makefile.in: Regenerate.
8818
8819 2010-04-06  Nick Clifton  <nickc@redhat.com>
8820
8821         * po/vi.po: New Vietnamese translation.
8822
8823 2010-03-30  Doug Kwan  <dougkwan@google.com>
8824
8825         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8826
8827 2010-03-25  Doug Kwan  <dougkwan@google.com>
8828
8829         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8830         to avoid a conversion warning on a 32-bit host.
8831
8832 2010-03-24  Ian Lance Taylor  <iant@google.com>
8833
8834         * testsuite/script_test_3.t: Add a TLS segment.
8835         * testsuite/Makefile.am (check_PROGRAMS): Add
8836         tls_phdrs_script_test.
8837         (tls_phdrs_script_test_SOURCES): Define.
8838         (tls_phdrs_script_test_DEPENDENCIES): Define.
8839         (tls_phdrs_script_test_LDFLAGS): Define.
8840         (tls_phdrs_script_test_LDADD): Define.
8841         * testsuite/Makefile.in: Rebuild.
8842
8843 2010-03-23  Cary Coutant  <ccoutant@google.com>
8844
8845         * fileread.cc (find_or_make_view): Fix comment.
8846
8847 2010-03-23  Ian Lance Taylor  <iant@google.com>
8848
8849         * script-sections.cc (class Orphan_section_placement): Define
8850         PLACE_TLS and PLACE_TLS_BSS.
8851         (Orphan_section_placement::Orphan_section_placement): Initialize
8852         new places.
8853         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8854         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8855         (tls_script_test_SOURCES): Define.
8856         (tls_script_test_DEPENDENCIES): Define.
8857         (tls_script_test_LDFLAGS): Define.
8858         (tls_script_test_LDADD): Define.
8859         * testsuite/Makefile.in: Rebuild.
8860
8861 2010-03-22  Doug Kwan  <dougkwan@google.com>
8862
8863         * arm.cc (Arm_relocate_functions::abs8,
8864         Arm_relocate_functions::abs16): Use correct check for overflow
8865         specified in the ARM ELF specs.
8866         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8867         target of a BLX instruction specially.
8868         (Reloc_stub::stub_type_for_reloc): Ditto.
8869         (Relocate::relocate): Use symbolic names instead of numeric relocation
8870         codes to report error.
8871         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8872         workaround.
8873         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8874         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8875         thumb2_blx_out_of_range.stdout
8876         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8877         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8878         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8879         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8880         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8881         thumb2_blx_in_range, thumb2_blx_in_range.o,
8882         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8883         thumb2_blx_out_of_range.o): New rules.
8884         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8885         thumb2_blx_in_range and thumb2_blx_out_of_range.
8886         * testsuite/Makefile.in: Regenerate.
8887         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8888         * testsuite/thumb_blx_in_range.s: New file.
8889         * testsuite/thumb_blx_out_of_range.s: New file.
8890
8891 2010-03-22  Rafael Espindola  <espindola@google.com>
8892
8893         * archive.cc (Should_include): Move to archive.h.
8894         (should_include_member): Make it a member of Archive.
8895         (Lib_group): New.
8896         (Add_lib_group_symbols): New.
8897         * archive.h: Include options.h.
8898         (Archive_member): Moved from Archive.
8899         (Should_include): Moved from archive.cc.
8900         (Lib_group): New.
8901         (Add_lib_group_symbols): New.
8902         * dynobj.cc (do_should_include_member): New.
8903         * dynobj.h (do_should_include_member): New.
8904         * gold.cc (queue_initial_tasks): Update call to queue.
8905         * main.cc (main): Print lib group stats.
8906         * object.cc (do_should_include_member): New.
8907         * object.h: Include archive.h.
8908         (Object::should_include_member): New.
8909         (Object::do_should_include_member): New.
8910         (Sized_relobj::do_should_include_member): New.
8911         * options.cc (General_options::parse_start_lib): New.
8912         (General_options::parse_end_lib): New.
8913         (Input_arguments::add_file): Handle lib groups.
8914         (Input_arguments::start_group): Check we are not in a lib.
8915         (Input_arguments::start_lib): New.
8916         (Input_arguments::end_lib): New.
8917         * options.h (General_options): Add start_lib and end_lib.
8918         (Input_argument::lib_): New.
8919         (Input_argument::lib): New.
8920         (Input_argument::is_lib): New.
8921         (Input_file_lib): New.
8922         (Input_arguments::in_lib_): New.
8923         (Input_arguments::in_lib): New.
8924         (Input_arguments::start_lib): New.
8925         (Input_arguments::end_lib_): New.
8926         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8927         in unused members as preempted.
8928         (Sized_pluginobj::do_should_include_member): New.
8929         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8930         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8931         return the blocker.
8932         (Read_symbols::do_whole_lib_group): New.
8933         (Read_symbols::do_lib_group): New.
8934         (Read_symbols::do_read_symbols): Handle lib groups.
8935         (Read_symbols::get_name): Handle lib groups.
8936         * readsyms.h (Read_symbols): Add an archive member pointer.
8937         (Read_symbols::do_whole_lib_group): New.
8938         (Read_symbols::do_lib_group): New.
8939         (Read_symbols::member_): New.
8940         * script.cc (read_input_script): Update call to queue_soon.
8941
8942 2010-03-19  Doug Kwan  <dougkwan@google.com>
8943
8944         * arm.cc (Stub_table::Stub_table): Initialize new data members
8945         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8946         (Stub_table::add_reloc_stub): Assign stub offset and update
8947         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8948         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8949         New data members.
8950         (Stub_table::update_data_size_and_addralign): Use
8951         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8952         instead of going over all reloc stubs.
8953         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8954         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8955         Stringpool_template::offset_ to size of Stringpool_char.
8956         (Stringpool_template::new_key_offset): Remove code to initialize
8957         Stringpool_template::offset_.
8958         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8959         Stringpool_template::offset_ to zero.
8960
8961 2010-03-15  Doug Kwan  <dougkwan@google.com>
8962
8963         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8964         offset_.
8965         (Stringpool_template::new_key_offset): New method.
8966         (Stringpool_template::add_string): Assign offsets when adding new
8967         strings.
8968         (Stringpool_template::set_string_offsets): Do not set string offsets
8969         when not optimizing.
8970         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8971         member size_.
8972         (Chunked_vector::clear): Clear size_.
8973         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8974         (Chunked_vector::size): Return size_.
8975         (Chunked_vector::push_back): Use size_ to find insert position.
8976         (Chunked_vector::size_): New data member.
8977         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8978         (Stringpool_template::new_key_offset): New method declaration.
8979         (Stringpool_template::offset_): New data member.
8980
8981 2010-03-15   Rafael Espindola  <espindola@google.com>
8982
8983         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8984         Add_symbols' constructor.
8985         * readsyms.h (Add_symbols): Remove the input_group member.
8986
8987 2010-03-10  Ian Lance Taylor  <iant@google.com>
8988
8989         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8990         target to ask whether a reference to a symbol requires a stack
8991         split.
8992         * target.h (Target::is_call_to_non_split): New function.
8993         (Target::do_is_call_to_non_split): Declare virtual function.
8994         * target.cc: Include "symtab.h".
8995         (Target::do_is_call_to_non_split): New function.
8996         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8997
8998 2010-03-10  Cary Coutant  <ccoutant@google.com>
8999
9000         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
9001         (File_read::open[1]): Remove initial mapping of whole_file_view_.
9002         (File_read::open[2]): Add whole_file_view_ to list of views.
9003         (File_read::make_view): Remove test of whole_file_view_.
9004         (File_read::find_or_make_view): Create whole_file_view_ if
9005         necessary.
9006         (File_read::clear_views): Replace bool parameter with enum;
9007         adjust all callers.  Don't delete views with permanent data;
9008         do delete cached views and views from archives if
9009         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
9010         if clearing the corresponding view.
9011         * fileread.h (File_read::Clear_views_mode): New enum.
9012         (File_read::View::is_permanent_view): New method.
9013         (File_read::clear_views): Replace bool parameter
9014         with enum; adjust all callers.
9015         * options.h (General_options): Change keep_files_mapped option;
9016         add map_whole_files.
9017         * readsyms.cc (Add_symbols::run): Delete sd_ object before
9018         releasing the file.
9019         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
9020         the file.
9021
9022 2010-03-10  David S. Miller  <davem@davemloft.net>
9023
9024         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
9025
9026 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
9027
9028         * icf.cc (get_section_contents): Add '@' marker after processing the
9029         merge reloc.
9030
9031 2010-03-08  Doug Kwan  <dougkwan@google.com>
9032
9033         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9034         due to a conversion warning.
9035         (Arm_relobj::update_output_local_symbol_count): Check for local
9036         symbol with unset output index.
9037
9038 2010-03-05  Ian Lance Taylor  <iant@google.com>
9039
9040         * options.h (class General_options): Add --spare-dynamic-tags.
9041         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9042         --spare-dynamic-tags.
9043
9044 2010-03-05  Ian Lance Taylor  <iant@google.com>
9045
9046         * incremental.cc: Include "libiberty.h".
9047
9048 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9049
9050         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9051         function, is_info_ member.
9052         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9053         (Versions::Versions): Update caller.
9054         (Versions::define_base_version): Likewise.
9055         (Versions::add_def): Likewise.
9056
9057 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9058
9059         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9060         (Scan::possible_function_pointer_reloc): New function.
9061         (Scan::local_reloc_may_be_function_pointer): Change to call
9062         possible_function_pointer_reloc.
9063         (Scan::global_reloc_may_be_function_pointer): Ditto.
9064         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9065         relocations in ".data.rel.ro._ZTV" section.
9066         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9067         * testsuite/icf_safe_so_test.cc: Ditto.
9068         * testsuite/icf_safe_test.cc: Ditto.
9069         * testsuite/icf_safe_test.sh: Ditto.
9070
9071 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9072             Ian Lance Taylor  <iant@google.com>
9073
9074         * target-reloc.h (relocate_section): Check the symbol table index
9075         for -1U before setting the local symbol index.
9076         (scan_relocatable_relocs): If copying the relocation, record that
9077         the local symbol is required.
9078         * object.h (Symbol_value::is_output_symtab_index_set): New
9079         function.
9080         (Symbol_value::may_be_discarded_from_output_symtab): New
9081         function.
9082         (Symbol_value::has_output_symtab_entry): New function.
9083         (Symbol_value::needs_output_symtab_entry): Remove.
9084         (Symbol_value::output_symtab_index): Make sure the symbol index is
9085         set.
9086         (Symbol_value::set_output_symtab_index): Make sure the symbol
9087         index is not set.  Make sure the new index is valid.
9088         (Symbol_value::set_must_have_output_symtab_entry): New function.
9089         (Symbol_value::has_output_dynsym_entry): New function.
9090         (Symbol_value::set_output_dynsym_index): Make sure the new index
9091         is valid.
9092         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9093         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9094         local symbol if permitted.
9095         (Sized_relobj::do_finalize_local_symbols): Call
9096         is_output_symtab_index_set rather than needs_output_symtab_entry.
9097         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9098         rather than needs_output_symtab_entry.  Call
9099         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9100         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9101         is_output_symtab_index_set rather than needs_output_symtab_entry.
9102         * testsuite/discard_locals_relocatable_test.c: New file.
9103         * testsuite/discard_locals_test.sh: Test -r.
9104         * testsuite/Makefile.am (check_DATA): Add
9105         discard_locals_relocatable_test1.syms,
9106         discard_local_relocatable_test2.syms.
9107         (MOSTLYCLEANFILES): Likewise.  Also add
9108         discard_locals_relocatable_test1.lout and
9109         discard_locals_relocatable_test2.out.
9110         (discard_locals_relocatable_test1.syms): New target.
9111         (discard_locals_relocatable_test.o): New target.
9112         (discard_locals_relocatable_test1.out): New target.
9113         (discard_locals_relocatable_test2.syms): New target.
9114         (discard_locals_relocatable_test2.out): New target.
9115         (various): Add missing ../ld-new dependencies.
9116         * testsuite/Makefile.in: Rebuild.
9117
9118 2010-03-03  Nick Clifton  <nickc@redhat.com>
9119
9120         * po/fi.po: New Finnish translation.
9121
9122 2010-03-01  Doug Kwan  <dougkwan@google.com>
9123
9124         * layout.cc (Layout::Layout): Force section types of .init_array*,
9125         .preinit_array* and .fini_array* sections.
9126         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9127         Fix check of return value of std::string::find.().
9128         (Output_section::Input_section_sort_compare::operator()): Remove
9129         comment about .init_array.
9130         (Output_section::Input_section_sort_init_fini_compare::operator()):
9131         New method.
9132         (Output_section::sort_attached_input_sections): Handle .init_array
9133         and .fini_array specially.
9134         * output.h (Output_section::Inut_section_sort_compare): Update
9135         comment.
9136         (Output_section::Input_section_sort_init_fini_compare): New struct.
9137
9138 2010-02-26  Doug Kwan  <dougkwan@google.com>
9139
9140         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9141         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9142         * testsuite/debug_msg.sh: Avoid matching source line number for
9143         use of global variable undef_int.
9144
9145 2010-02-26  Doug Kwan  <dougkwan@google.com>
9146
9147         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9148         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9149         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9150         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9151         * options.cc (General_options::General_options): Initialize member
9152         fix_v4bx_.
9153         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9154         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9155         and rm_no_fix_v4bx.stdout
9156         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9157         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9158         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9159         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9160         and arm_no_fix_v4bx.
9161         * Makefile.in: Regenerate.
9162         * testsuite/arm_fix_v4bx.s: New file.
9163         * testsuite/arm_fix_v4bx.sh: Ditto.
9164
9165 2010-02-24  Doug Kwan  <dougkwan@google.com>
9166
9167         * arm.cc (Target_arm::got_section): Make the .got section the first
9168         non RELRO section in the data segment.
9169         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9170         suffixes of section names.
9171
9172 2010-02-24  Doug Kwan  <dougkwan@google.com>
9173
9174         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9175         flags and attributes merging if an input file is a binary file.
9176         * fileread.cc (Input_file::open): Record format of original file.
9177         * fileread.h (Input_file::Format): New enum type.
9178         (Input_file::Input_file): Initialize data member format_.
9179         (Input_file::format): New method definition.
9180         (Input_file::format_):: New data member.
9181
9182 2010-02-24  Doug Kwan  <dougkwan@google.com>
9183
9184         * arm.cc (Arm_output_data_got): New class.
9185         (ARM_TCB_SIZE): New constant
9186         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9187         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9188         If user uses a script with a SECTIONS clause, issue only a warning
9189         for a misplaced EXIDX input section.  Otherwise, issue an error.
9190         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9191         garbage collection.
9192         (Target_arm::got_mode_index_entry): Handle static linking.
9193         (Target_arm::Scan::local): Ditto.
9194         (Target_arm::Scan::global): Ditto.
9195         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9196         all incorrectly implemented relocations.
9197         (Target_arm::fix_exidx_coverage): Pass layout to
9198         Arm_output_section::fix_exidx_coverage.
9199         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9200         from ".ARM.exidx." and ".ARM.extab.".
9201
9202 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9203
9204         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9205         section if it does not already exist.
9206         * attributes.cc (Attributes_section_data::Attributes_section_data):
9207         Don't crash if size is zero.
9208
9209 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9210             Ian Lance Taylor  <iant@google.com>
9211
9212         * gold.cc (queue_middle_tasks): If no input files were opened,
9213         exit.
9214         * workqueue.h (Task_function::Task_function): Assert that there is
9215         a blocker.
9216
9217 2010-02-22  Doug Kwan  <dougkwan@google.com>
9218
9219         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9220         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9221         types to avoid warnings due to different uint64_t implementations
9222         on different hosts.
9223
9224 2010-02-21  Doug Kwan  <dougkwan@google.com>
9225
9226         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9227         handling of the maximum backward branch offset.
9228         (Arm_relocate_functions::thumb_branch_common): Ditto.
9229         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9230         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9231         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9232         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9233         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9234         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9235         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9236         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9237         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9238         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9239         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9240         thumb2_bl_out_of_range.o): New rules.
9241         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9242         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9243         thumb2_bl_out_of_range
9244         * testsuite/Makefile.in: Regenerate.
9245         * testsuite/arm_bl_in_range.s: New file.
9246         * testsuite/arm_bl_out_of_range.s: Ditto.
9247         * testsuite/arm_branch_in_range.sh: Ditto.
9248         * testsuite/arm_branch_range.t: Ditto.
9249         * testsuite/thumb2_branch_range.t: Ditto.
9250         * testsuite/thumb_bl_in_range.s: Ditto.
9251         * testsuite/thumb_bl_out_of_range.s: Ditto.
9252         * testsuite/thumb_branch_range.t: Ditto.
9253
9254 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9255
9256         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9257         Add reloc offset information.
9258         * icf.cc (get_section_contents): Change iterators to point to the new
9259         vectors. Add reloc offset information to the contents.
9260         * icf.h (Icf::Sections_reachable_info): New typedef.
9261         (Icf::Sections_reachable_list): New typedef.
9262         (Icf::Offset_info): New typedef.
9263         (Icf::Reloc_info): New struct typedef.
9264         (Icf::Reloc_info_list): New typedef.
9265         (Icf::symbol_reloc_list): Delete method.
9266         (Icf::addend_reloc_list): Delete method.
9267         (Icf::section_reloc_list): Delete method.
9268         (Icf::reloc_info_list): New method.
9269         (Icf::reloc_info_list_): New member.
9270
9271 2010-02-19  Doug Kwan  <dougkwan@google.com>
9272
9273         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9274         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9275         * arm.cc (Arm_relocation_functions): New forward declaration.
9276         (Target_arm::Target_arm): Initialize new data members
9277         got_mod_index_offset_ and tls_base_symbol_defined_.
9278         (Target_arm::Relocate::relocate_tls): New method.
9279         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9280          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9281         New methods.
9282         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9283         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9284         (Target_arm::got_mod_index_offset_,
9285         Target_arm::tls_base_symbol_defined_): New data members.
9286         (Target_arm::Scan::local, Target::Scan::global,
9287         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9288         relocations.
9289
9290 2010-02-18  Doug Kwan  <dougkwan@google.com>
9291
9292         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9293         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9294         text section as a parameter becuase some broken tools may not set
9295         the link in section header.
9296         (Target_arm::has_got_section): New method.
9297         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9298         without any mapping symbol as data only.  Remove warning.
9299         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9300         link in its section header, try to discover the link by inspecting the
9301         REL31 relocation at the beginning of the section.
9302         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9303         in error message.
9304         (Target_arm::Scan::global): Treat any reference to the symbol
9305         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9306
9307 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9308
9309         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9310         (Scan::global_reloc_may_be_function_pointer): New function.
9311         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9312         (Scan::global_reloc_may_be_function_pointer): New function.
9313         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9314         (Scan::global_reloc_may_be_function_pointer): New function.
9315         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9316         (Scan::global_reloc_may_be_function_pointer): New function.
9317         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9318         (Scan::global_reloc_may_be_function_pointer): New function.
9319         (Scan::possible_function_pointer_reloc): New function.
9320         (Target_x86_64::can_check_for_function_pointers): New function.
9321         * gc.h (gc_process_relocs): Scan relocation types to determine if
9322         function pointers were taken for targets that support it.
9323         * icf.cc (Icf::find_identical_sections): Include functions for
9324         folding in safe ICF whose pointer is not taken.
9325         * icf.h (Secn_fptr_taken_set): New typedef.
9326         (fptr_section_id_): New member.
9327         (section_has_function_pointers): New function.
9328         (set_section_has_function_pointers): New function.
9329         (check_section_for_function_pointers): New function.
9330         * options.h: Fix comment for safe ICF option.
9331         * target.h (can_check_for_function_pointers): New function.
9332         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9333         Modify icf_safe_test for X86-64.
9334         * testsuite/Makefile.in: Regenerate.
9335         * testsuite/icf_safe_so_test.cc: New file.
9336         * testsuite/icf_safe_so_test.sh: New file.
9337         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9338         (main): Change to take pointer to function kept_func_3.
9339         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9340         folding is done correctly for X86-64.
9341
9342 2010-02-12  David S. Miller  <davem@davemloft.net>
9343
9344         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9345         is_symbolless parameter.
9346         (Output_reloc<SHT_REL>::is_symbolless): New.
9347         (Output_reloc<SHT_REL>::is_symbolless_): New.
9348         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9349         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9350         (Output_reloc<SHT_RELA>::is_symbolless): New.
9351         (Output_data_reloc::add_global): Handle is_symbolless.
9352         (Output_data_reloc::add_global_relative): Likewise.
9353         (Output_data_reloc::add_local): Likewise.
9354         (Output_data_reloc::add_local_relative): Likewise.
9355         (Output_data_reloc::add_symbolless_global_addend): New.
9356         (Output_data_reloc::add_symbolless_local_addend): New.
9357         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9358         is_symbolless.
9359         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9360         instead of ->is_relative_
9361         (Output_reloc::write): Likewise.
9362         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9363         (Output_reloc::write_rel): Simplify.
9364
9365         * sparc.cc (Target_sparc::Scan::local): Use
9366         ->add_symbolless_local_addend as needed.
9367         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9368         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9369         based upon relocation offset.
9370
9371 2010-02-11  Doug Kwan  <dougkwan@google.com>
9372
9373         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9374         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9375         beginning of function.
9376         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9377         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9378         parameter is_32bit in calls to should_apply_static_reloc.
9379         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9380         (check_DATA): Add arm_abs_global.stdout.
9381         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9382         arm_abs_global.stdout): New rules.
9383         (MOSTLLYCLEANFILES): Add arm_abs_global
9384         * Makefile.in: Regenerate.
9385         * testsuite/arm_abs_global.s: New file.
9386         * testsuite/arm_abs_global.sh: Ditto.
9387         * testsuite/arm_abs_lib.s: Ditto.
9388
9389 2010-02-11  Ian Lance Taylor  <iant@google.com>
9390
9391         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9392         Read_relocs task.
9393         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9394         Allocate_commons_task first.
9395         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9396         task, rather than symtab_lock_.
9397         (Gc_process_relocs::~Gc_process_relocs): New function.
9398         (Gc_process_relocs::is_runnable): Check this_blocker_.
9399         (Gc_process_relocs::locks): Use next_blocker_ rather than
9400         blocker_.
9401         (Scan_relocs::~Scan_relocs): New function.
9402         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9403         symtab_lock_.
9404         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9405         next_blocker_.
9406         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9407         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9408         constructor accordingly.
9409         (class Gc_process_relocs): Likewise.
9410         (class Scan_relocs): Likewise.
9411         * common.h (class Allocate_commons_task): Remove symtab_lock_
9412         field, and corresponding constructor parameter.
9413         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9414         symtab_lock_.
9415         (Allocate_commons_task::locks): Likewise.
9416
9417 2010-02-11  Ian Lance Taylor  <iant@google.com>
9418
9419         * gold-threads.h (class Once): Define.
9420         (class Initialize_lock): Rewrite as child of Once.
9421         * gold-threads.cc (class Once_initialize): Define.
9422         (once_pointer_control): New static variable.
9423         (once_pointer, once_arg): New static variables.
9424         (c_run_once): New static function.
9425         (Once::Once, Once::run_once, Once::internal_run): New functions.
9426         (class Initialize_lock_once): Remove.
9427         (initialize_lock_control): Remove.
9428         (initialize_lock_pointer): Remove.
9429         (initialize_lock_once): Remove.
9430         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9431         (Initialize_lock::initialize): Rewrite.
9432         (Initialize_lock::do_run_once): New function.
9433         * archive.cc (Archive::interpret_header): Only clear name if it is
9434         not already empty.
9435         * fileread.cc: Include "gold-threads.h"
9436         (file_counts_lock): New static variable.
9437         (file_counts_initialize_lock): Likewise.
9438         (File_read::release): Only increment counts when using --stats.
9439         Use a lock around the increment.
9440         * parameters.cc (class Set_parameters_target_once): Define.
9441         (set_parameters_target_once): New static variable.
9442         (Parameters::Parameters): Move here from parameters.h.
9443         (Parameters::set_target): Rewrite.
9444         (Parameters::set_target_once): New function.
9445         (Parameters::clear_target): Move here and rewrite.
9446         * parameters.h (class Parameters): Update declarations.  Add
9447         set_parameters_target_once_ field.
9448         (Parameters::Parameters): Move to parameters.cc.
9449         (Parameters::clear_target): Likewise.
9450         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9451         task.
9452         (Start_group::~Start_group): New function.
9453         (Start_group::is_runnable): New function.
9454         (Start_group::locks, Start_group::run): New functions.
9455         (Finish_group::run): Change saw_undefined to size_t.
9456         * readsyms.h (class Start_group): Define.
9457         (class Finish_group): Change saw_undefined_ field to size_t.
9458         (Finish_group::Finish_group): Remove saw_undefined and
9459         this_blocker parameters.  Change all callers.
9460         (Finish_group::set_saw_undefined): New function.
9461         (Finish_group::set_blocker): New function.
9462         * symtab.h (class Symbol_table): Change saw_undefined to return
9463         size_t.  Change saw_undefined_ field to size_t.
9464         * target-select.cc (Set_target_once::do_run_once): New function.
9465         (Target_selector::Target_selector): Initialize set_target_once_
9466         field.  Don't initialize lock_ and initialize_lock_ fields.
9467         (Target_selector::instantiate_target): Rewrite.
9468         (Target_selector::set_target): New function.
9469         * target-select.h (class Set_target_once): Define.
9470         (class Target_selector): Update declarations.  Make
9471         Set_target_once a friend.  Remove lock_ and initialize_lock_
9472         fields.  Add set_target_once_ field.
9473
9474 2010-02-10  Ian Lance Taylor  <iant@google.com>
9475
9476         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9477         queueing any tasks.
9478         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9479         (queue_middle_tasks): Add all blockers before queueing any tasks.
9480         (queue_final_tasks): Likewise.
9481         * token.h (Task_token::add_blockers): New function.
9482         * object.h (Input_objects::number_of_relobjs): New function.
9483
9484 2010-02-10  Ian Lance Taylor  <iant@google.com>
9485
9486         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9487         shared, not if not position independent.
9488         * x86_64.cc (Relocate::relocate_tls): Likewise.
9489         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9490         (tls_pie_pic_test): New target.
9491         * testsuite/Makefile.in: Rebuild.
9492
9493         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9494         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9495         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9496         * testsuite/Makefile.in: Rebuild.
9497
9498 2010-02-09  David S. Miller  <davem@davemloft.net>
9499
9500         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9501         R_SPARC_RELATIVE using ->add_local_relative().
9502         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9503
9504         * output.h (Output_data_dynamic::add_section_size): New method
9505         that takes two Output_data objects.
9506         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9507         entry param.  Handle it in initializers.
9508         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9509         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9510         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9511         arg.
9512         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9513         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9514         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9515         for dynrel_includes_plt.
9516         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9517         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9518         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9519         before .rela.plt
9520         (Target_sparc::do_finalize_sections): Update to pass true for
9521         dynrel_includes_plt.
9522         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9523         output before .rela.plt
9524         (Target_powerpc::do_finalize_sections): Update to pass true for
9525         dynrel_includes_plt when 32-bit.
9526
9527 2010-02-08  Doug Kwan  <dougkwan@google.com>
9528
9529         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9530         method.
9531         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9532         Arm_relobj::scan_section_for_cortex_a8_stubs,
9533         Arm_relobj::do_relocation_section): Instead of calling
9534         Output_section::output_address, use faster
9535         Arm_relobj::simple_input_section_output_address.
9536
9537 2010-02-08  David S. Miller  <davem@davemloft.net>
9538
9539         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9540         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9541         relocation helper function.
9542
9543         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9544         just like R_SPARC_GOT{10,13,22}.
9545         (Target_sparc::Scan::local): Likewise.
9546         (Target_sparc::Relocate:relocate): Likewise.
9547
9548 2010-02-06  Ian Lance Taylor  <iant@google.com>
9549
9550         * configure.ac: Rewrite targetobjs duplicate removal code to use
9551         only shell constructs.
9552         * configure: Rebuild.
9553
9554 2010-02-05  Doug Kwan  <dougkwan@google.com>
9555
9556         PR 11247
9557         * arm.cc (Arm_relobj::section_is_scannable): New method.
9558         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9559         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9560
9561 2010-02-04  Doug Kwan  <dougkwan@google.com>
9562
9563         PR 11247
9564         * arm-reloc-property.cc (cstdio): Include.
9565         * configure.ac (targetobjs): Remove duplicates.
9566         * configure: Regenerate.
9567         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9568         big and little endian version for a given address size.
9569
9570 2010-02-03  Doug Kwan  <dougkwan@google.com>
9571
9572         * arm-reloc-property.cc
9573         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9574         definition.
9575         * arm-reloc-property.h
9576         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9577         New method definition.
9578         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9579         declaration.
9580         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9581         overflow to N.
9582         (GOT_PREL): Change implemented to Y.
9583         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9584         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9585         (Arm_relocate_functions::movw_abs_nc): Remove method.
9586         (Arm_relocate_functions::movt_abs): Ditto.
9587         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9588         (Arm_relocate_functions::thm_movt_abs): Ditto.
9589         (Arm_relocate_functions::movw_rel_nc): Ditto.
9590         (Arm_relocate_functions::movw_rel): Ditto.
9591         (Arm_relocate_functions::movt_rel): Ditto.
9592         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9593         (Arm_relocate_functions:thm_movw_rel): Ditto.
9594         (Arm_relocate_functions:thm_movt_rel): Ditto.
9595         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9596         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9597         New method definitions.
9598         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9599         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9600         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9601         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9602         (Target_arm::Relocate::relocate): Check for non-static or
9603         unimplemented relocation code and exit early.  Change calls to
9604         Target_arm::reloc_uses_thumb_bit and
9605         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9606         instead.  Refactor code to handle similar relocations to increase
9607         code sharing.  Remove check for unsupported relocation code in switch
9608         statement.
9609         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9610         relocation property table to find out size.  Change error message to
9611         print out the name of a relocation code instead of the numeric value.
9612         (Target_arm::scan_reloc_for_stub): Use relocation property table
9613         instead of calling Target_arm::reloc_uses_thumb_bit().
9614
9615 2010-02-02  Doug Kwan  <dougkwan@google.com>
9616
9617         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9618         types of relaxed input section.
9619
9620 2010-02-02  Doug Kwan  <dougkwan@google.com>
9621
9622         * Makefile.am (HFILES): Add arm-reloc-property.h.
9623         (DEFFILES): New.
9624         (TARGETSOURCES): Add arm-reloc-property.cc
9625         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9626         (libgold_a_SOURCES): $(DEFFILES)
9627         * Makefile.in: Regenerate.
9628         * arm-reloc-property.cc: New file.
9629         * arm-reloc-property.h: New file.
9630         * arm-reloc.def: New file.
9631         * arm.cc: Update comments.
9632         (arm-reloc-property.h): New included header.
9633         (arm_reloc_property_table): New global variable.
9634         (Target_arm::do_select_as_default_target): New method definition.
9635         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9636         arm-reloc-property to targ_extra_obj.
9637         * parameters.cc (set_parameters_target): Call
9638         Target::select_as_default_target().
9639         * target.h (Target::select_as_default_target): New method definition.
9640         (Target::do_select_as_default_target): Same.
9641
9642 2010-02-01  Doug Kwan  <dougkwan@google.com>
9643
9644         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9645         first_output_text_section_.
9646         (Arm_exidx_fixup::first_output_text_section): New method definition.
9647         (Arm_exidx_fixup::first_output_text_section_): New data member.
9648         (Arm_exidx_fixup::process_exidx_section): Record the first text
9649         output section seen.
9650         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9651         and entsize in output section header.
9652
9653 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9654
9655         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9656         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9657         (Arm_relocate_functions::thm_alu11): New Method.
9658         (Arm_relocate_functions::thm_pc8): New Method.
9659         (Arm_relocate_functions::thm_pc12): New Method.
9660         (Target_arm::Scan::local): Handle the relocations.
9661         (Target_arm::Scan::global): Likewise.
9662         (Target_arm::Relocate::relocate): Likewise.
9663         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9664
9665 2010-01-29  Doug Kwan  <dougkwan@google.com>
9666
9667         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9668         of relocation types as ld.
9669
9670 2010-01-29  Doug Kwan  <dougkwan@google.com>
9671
9672         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9673         to public.
9674         (Arm_relocate_functions::thumb_branch_common): Ditto.
9675         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9676         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9677         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9678         Arm_relocate_functions::jump24): Remove.
9679         (Target_arm::Relocate::relocate): Adjust code to call
9680         Arm_relocation_functions::arm_branch_common and
9681         Arm_relocation_functions::thumb_branch_common instead of their removed
9682         wrappers.  Merge switch-cases together to reduce source code size.
9683
9684 2010-01-29  Doug Kwan  <dougkwan@google.com>
9685
9686         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9687         output_local_symbol_count_needs_update_.
9688         (Arm_relobj::output_local_symbol_count_needs_update,
9689          Arm_relobj::set_output_local_symbol_count_needs_update,
9690          Arm_relobj::update_output_local_symbol_count): New methods.
9691         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9692         member.
9693         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9694         of pointed function as in a R_ARM_PREL31 relocation.
9695         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9696         for output local symbol count updating.
9697         (Target_arm::do_relax): Update output local symbol counts in objects
9698         if necessary.
9699         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9700
9701 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9702
9703         * arm.cc: Added support for the ARM relocations:
9704         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9705         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9706         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9707         movw_prel_nc).
9708         (Arm_relocate_functions::movw_rel): New method.
9709         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9710         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9711         thm_movw_prel_nc).
9712         (Arm_relocate_functions::thm_movw_rel): New method.
9713         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9714         thm_movt_prel).
9715         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9716         relocations.
9717         (Target_arm::Scan::global): Likewise.
9718         (Target_arm::Relocate::relocate): Likewise.
9719         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9720         Likewise.
9721
9722 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9723
9724         * arm.cc: Added support for ARM group relocations.
9725         (Target_arm::reloc_needs_sym_origin): New method.
9726         (Arm_relocate_functions::calc_grp_kn): New method.
9727         (Arm_relocate_functions::calc_grp_residual): New method.
9728         (Arm_relocate_functions::calc_grp_gn): New method.
9729         (Arm_relocate_functions::arm_grp_alu): New Method.
9730         (Arm_relocate_functions::arm_grp_ldr): New Method.
9731         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9732         (Arm_relocate_functions::arm_grp_ldc): New Method.
9733         (Target_arm::Scan::local): Handle the ARM group relocations.
9734         (Target_arm::Scan::global): Likewise.
9735         (Target_arm::Relocate::relocate): Likewise.
9736         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9737         Likewise.
9738
9739 2010-01-26  Doug Kwan  <dougkwan@google.com>
9740
9741         * arm.cc (set): Include.
9742         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9743         pointer type.
9744         (Arm_output_section::Text_section_list): New type.
9745         (Arm_output_section::append_text_sections_to_list): New method.
9746         (Arm_output_section::fix_exidx_coverage): Ditto.
9747         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9748         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9749         Relobj::set_section_offset() instead of
9750         Sized_relobj::invalidate_section_offset().
9751         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9752         parameter for section headers. Ignore relocation sections for
9753         unallocated sections and EXIDX sections.
9754         (Target_arm::fix_exidx_coverage): New method.
9755         (Target_arm::output_section_address_less_than): New type.
9756         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9757         linked text section instead of the EXIDX section.
9758         (Arm_output_section::create_stub_group): Add an assertion to check
9759         that this is not an EXIDX output section.
9760         (Arm_output_section::append_text_sections_to_list): New method.
9761         (Arm_output_section::fix_exidx_coverage): Ditto.
9762         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9763         Arm_relobj::section_needs_reloc_stub_scanning.
9764         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9765         first pass.
9766         (Target_arm::fix_exidx_coverage): New method.
9767         * object.h (Relobj::set_output_section): New method.
9768         (Sized_relobj::invalidate_section_offset): Remove method.
9769         (Sized_relobj::do_invalidate_section_offset): Remove method.
9770         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9771
9772 2010-01-25  Doug Kwan  <dougkwan@google.com>
9773
9774         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9775         Fix warning due to signed and unsigned comparison on a 32-bit host.
9776
9777 2010-01-22  Doug Kwan  <dougkwan@google.com>
9778
9779         * arm.cc (Target_arm::do_relax): Record an output section for section
9780         offset adjustment it contains any stub table that has changed.
9781         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9782         offsets in an output section if necessary.
9783         * output.cc (Output_section::Output_section): Initialize
9784         section_offsets_need_adjustments_.
9785         (Output_section::add_input_section_for_script): Renamed to
9786         Output_section::add_simple_input_section.
9787         (Output_section::save_states): Add a comment.
9788         (Output_section::discard_states): New method defintion.
9789         (Output_section::adjust_section_offsets): Same.
9790         * output.h (Output_section::add_input_section_for_script): Renamed to
9791         Output_section::add_simple_input_section.
9792         (Output_section::discard_states): New method declaration.
9793         (Output_section::adjust_section_offsets): Same.
9794         (Output_section::section_offsets_need_adjustment,
9795         Output_section::set_section_offsets_need_adjustment): New method
9796         definitions.
9797         (Output_section::section_offsets_need_adjustment_): New data member.
9798         * script-sections.cc
9799         (Output_section_element_input::set_section_address): Adjust code for
9800         renaming of Output_section::add_input_section_for_script.
9801         (Orphan_output_section::set_section_address): Same.
9802
9803 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9804
9805         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9806         Fix_v4bx enum values .
9807         * gold/options.h (General_options): New option definitions.
9808         (General_options::fix_v4bx): New method.
9809         (General_options::Fix_v4bx): New enum.
9810         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9811         (General_options::parse_fix_v4bx_interworking): New method.
9812
9813 2010-01-22  Doug Kwan  <dougkwan@google.com>
9814
9815         * arm.cc (Arm_exidx_fixup): New class.
9816
9817 2010-01-21  Doug Kwan  <dougkwan@google.com>
9818
9819         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9820         classes.
9821         (Arm_exidx_section_offset_map): New type.
9822
9823 2010-01-21  Doug Kwan  <dougkwan@google.com>
9824
9825         * arm.cc (Arm_exidx_input_section): New class.
9826         (Arm_relobj::exidx_input_section_by_link,
9827         Arm_relobj::exidx_input_section_by_shndx,
9828         Arm_relobj::make_exidx_input_section): New methods.
9829         (read_arm_attributes_section): Remove.
9830         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9831         information about them.
9832         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9833         to here.
9834
9835 2010-01-20  Doug Kwan  <dougkwan@google.com>
9836
9837         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9838         Input_section_specifier to Section_id.
9839         (Target_arm::new_arm_input_section: Adjust code for change of key
9840         type.
9841         (Target_arm::find_arm_input_section): Ditto.
9842         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9843         (Section_id): Remove.
9844         (Garbage_collection::Section_id_hash): Remove.
9845         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9846         (Section_id): Remove.
9847         (Icf::Section_id_hash): Remove.
9848         * object.h (Section_id, Const_section_id, Section_id_hash,
9849         Const_section_id_hash): New type definitions.
9850         * output.cc (Output_section::add_relaxed_input_section): Change to
9851         use Const_section_id instead of Input_section_specifier as key type.
9852         (Output_section::add_merge_input_section): Ditto.
9853         (Output_section::build_relaxation_map): Change to use Section_id
9854         instead of Input_section_specifier as key type.
9855         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9856         Ditto.
9857         (Output_section::convert_input_sections_to_relaxed_sections): Change
9858         to use Const_section_id instead of Input_section_specifier as key type.
9859         (Output_section::find_merge_section): Ditto.
9860         (Output_section::find_relaxed_input_section): Ditto.
9861         * output.h (Input_section_specifier): Remove class.
9862         (Output_section::Output_section_data_by_input_section_map): Change
9863         key type to Const_section_id.
9864         (Output_section::Output_relaxed_input_section_by_input_section_map):
9865         Ditto.
9866         (Output_section::Relaxation_map): Change key type to Section_id.
9867
9868 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9869
9870         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9871         (class Arm_v4bx_stub): New class.
9872         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9873         (Stub_factory::make_arm_v4bx_stub): New method.
9874         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9875         (Stub_table::empty): Handle v4bx stubs.
9876         (Stub_table::add_arm_v4bx_stub): New method.
9877         (Stub_table::find_arm_v4bx_stub): New method.
9878         (Arm_relocate_functions::v4bx): New method.
9879         (Target_arm::fix_v4bx): New method.
9880         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9881         (Stub_table::relocate_stubs): Likewise.
9882         (Stub_table::do_write): Likewise.
9883         (Stub_table::update_data_size_and_addralign): Likewise.
9884         (Stub_table::finalize_stubs):  Likewise.
9885         (Target_arm::Scan::local): Likewise.
9886         (Target_arm::Scan::global): Likewise.
9887         (Target_arm::do_finalize_sections): Likewise.
9888         (Target_arm::Relocate::relocate): Likewise.
9889         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9890         Likewise.
9891         (Target_arm::scan_reloc_for_stub): Likewise.
9892         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9893
9894 2010-01-19  Ian Lance Taylor  <iant@google.com>
9895
9896         * output.cc (Output_section_headers::do_sized_write): Write large
9897         segment count to sh_info field.
9898         (Output_file_header::do_sized_write): For large segment count,
9899         write PN_XNUM to e_phnum field.
9900
9901 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9902
9903         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9904         (Arm_relocate_functions::thm_jump8): New function.
9905         (Arm_relocate_functions::thm_jump11): New function.
9906         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9907         R_ARM_THM_JUMP11.
9908         (Target_arm::Scan::global): Likewise.
9909         (Target_arm::Relocate::relocate): Likewise.
9910         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9911         Likewise.
9912
9913 2010-01-14  Doug Kwan  <dougkwan@google.com>
9914
9915         * arm.cc (map, utility): Include headers.
9916         (Target_arm::apply_cortex_a8_workaround): New method.
9917         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9918         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9919         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9920         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9921         the --[no-]fix-cortex-a8 command line options.
9922         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9923         (Target_arm::relocate_stub): Use addend in instruction template.
9924         * options.h (DEFINE_bool): Set the user-set flag.
9925         (General_options): Add --[no-]-fix-cortex options.
9926         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9927         : Update fast look-up map after conversion.
9928
9929 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9930
9931         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9932         in the first pass of do_layout.
9933
9934 2010-01-13  Doug Kwan  <dougkwan@google.com>
9935
9936         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9937         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9938         apparent compiler problem of not folding static constant integral
9939         data members of elfcpp::Elf_sizes<32>.
9940
9941 2010-01-13  Doug Kwan  <dougkwan@google.com>
9942
9943         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9944         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9945         Arm_relobj::scan_section_for_cortex_a8_erratum,
9946         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9947         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9948         sections to scan for relocation stubs into a new method
9949         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9950         relocation and Cortex-A8 stub scanning.
9951         (Target_arm::do_relax): Force stubs to be after stubbed sections
9952         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9953         the beginning of a new relaxation pass.  Update a comment.
9954         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9955
9956 2010-01-12  Ian Lance Taylor  <iant@google.com>
9957
9958         * target-reloc.h (visibility_error): New inline function.
9959         (relocate_section): Call visibility_error.
9960         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9961         (MOSTLYCLEANFILES): Likewise.
9962         (protected_4_pic.o, protected_3.err): New targets.
9963         * testsuite/protected_4.cc: New file.
9964
9965 2010-01-12  Doug Kwan  <dougkwan@google.com>
9966
9967         * arm.cc (Cortex_a8_reloc): New class.
9968         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9969         and cortex_a8_relocs_info_.
9970         (Target_arm::fix_cortex_a8): New method definition.
9971         (Target_arm::Cortex_a8_relocs_info): New type.
9972         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9973         New data member declarations.
9974         (Target_arm::scan_reloc_for_stub): Record information about
9975         relocations for THUMB branches that might be exempted from the
9976         Cortex-A8 workaround.
9977         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9978         at the beginning of a relaxation pass.
9979
9980 2010-01-12  Doug Kwan  <dougkwan@google.com>
9981
9982         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9983         (Arm_relobj::Mapping_symbol_position,
9984          Arm_reloj::Mapping_symbol_position_less,
9985          Arm_relobj::Mapping_symbols_info): New types.
9986         (Target_arm::is_mapping_symbol_name): New method definition.
9987         (Arm_relobj::do_count_local_symbols): Save information about mapping
9988         symbols.
9989
9990 2010-01-11  Doug Kwan  <dougkwan@google.com>
9991
9992         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9993         Arm_relocate_functions::thumb32_branch_upper,
9994         Arm_relocate_functions::thumb32_branch_lower,
9995         Arm_relocate_functions::thumb32_cond_branch_offset,
9996         Arm_relocate_functions::thumb32_cond_branch_upper,
9997         Arm_relocate_functions::thumb32_cond_branch_lower,
9998         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9999         branch offset encoding.
10000         (Arm_relocate_functions::thumb_branch_common): Use new branch
10001         offset encoding methods to avoid code duplication.
10002         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
10003         (Stub_addend_reader::operator()): Use new branch encoding method
10004         to avoid code duplication.
10005
10006 2010-01-11  Doug Kwan  <dougkwan@google.com>
10007
10008         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
10009         (Target_arm::do_finalize_sections): Define special EXIDX section
10010         symbols only if referenced.
10011         * gc.h (Garbage_collection::add_reference): New method.
10012         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
10013         code duplication.
10014
10015 2010-01-11  Ian Lance Taylor  <iant@google.com>
10016
10017         * script.cc (Version_script_info::build_expression_list_lookup):
10018         Change complaing about duplicate wildcard match from error to
10019         warning.
10020
10021         * script.cc (class Lazy_demangler): Recreate--revert part of patch
10022         of 2009-12-30.
10023         (Version_script_info::Version_script_info): Initialize globs_,
10024         default_version_, default_is_global_, and exact_.  Don't
10025         initialize globals_ or locals_.
10026         (Version_script_info::build_lookup_tables): Build local symbols
10027         first.
10028         (Version_script_info::unquote): New function.
10029         (Version_script_info::add_exact_match): New function.
10030         (Version_script_info::build_expression_list_lookup): Remove lookup
10031         parameter.  Add is_global parameter.  Change all callers.  Handle
10032         wildcard pattern specially.  Unquote pattern.  Call
10033         add_exact_match.
10034         (Version_script_info::get_name_to_match): New function.
10035         (Version_script_info::get_symbol_version): New function.
10036         (Version_script_info::get_symbol_version_helper): Remove.
10037         (Version_script_info::check_unmatched_names): Call unquote.
10038         * script.h (class Version_script_info): Change get_symbol_version
10039         to be non-inline and add is_global parameter; change all callers.
10040         Rewrite symbol_is_local.  Update declarations.  Define struct
10041         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10042         Remove globals_ and locals_ members.  Add exact_, globs_,
10043         default_version_, is_global_.
10044         (Version_script_info::Glob): Remove pattern, add expression and
10045         is_global.  Update constructor.  Change all callers.
10046         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10047         default version.
10048         (Versions::symbol_section_contents): If a symbol is undefined, or
10049         defined in a dynamic object, set the version index to
10050         VER_NDX_LOCAL.
10051         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10052         symbol_is_local.
10053         (Symbol_table::add_from_pluginobj): Likewise.
10054         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10055
10056 2010-01-11  Doug Kwan  <dougkwan@google.com>
10057
10058         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10059         (incremental_dump_LDADD): Add linking option for libintl.
10060         * Makefile.in: Regenerate.
10061
10062 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10063
10064         PR gold/11144
10065         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10066         instead of -Ds.
10067         * testsuite/Makefile.in: Regenerated.
10068
10069 2010-01-10  Doug Kwan  <dougkwan@google.com>
10070
10071         * options.h (DEFINE_var): Use parentheses around argument varname__
10072         in macro body to avoid any unintended subsequent substitutions.
10073
10074 2010-01-10  Ian Lance Taylor  <iant@google.com>
10075
10076         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10077         candidates before doing symbol resolution.
10078
10079         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10080         ODR candidates if only one is weak.
10081
10082 2010-01-08  Ian Lance Taylor  <iant@google.com>
10083
10084         * script.cc (Version_script_info::build_expression_list_lookup):
10085         Don't warn about ambiguous version, just record the ambiguity.
10086         (Version_script_info::get_symbol_version_helper): Give error if
10087         version is ambiguous.
10088
10089 2010-01-08  Doug Kwan  <dougkwan@google.com>
10090
10091         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10092         prev_data_size_ and prev_addralign_.  Remove initializer for
10093         deleted data member has_been_changed_.
10094         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10095         to determine if the table is empty.
10096         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10097         Remove.
10098         (Stub_table::add_reloc_stub): Define method in class definition
10099         instead of just declaring it there.
10100         (Stub_table::add_cortex_a8_stub): New method definition.
10101         (Stub_table::update_data_size_and_addralign): Ditto.
10102         (Stub_table::finalize_stubs): Ditto.
10103         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10104         (Stub_table::do_addralign_): Return address alignment in the
10105         (Stub_table::do_reset_address_and_file_offset): Define method in
10106         class definition instead of declaring it there.  Set current data
10107         size to be the data size of the previous pass.
10108         (Stub_table::set_final_data_size): Use current data size as the
10109         final data size.
10110         (Stub_table::relocate_stub): Change parameter type of stub from
10111         Reloc_stub pointer to Stub pointer.
10112         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10113         (Stub_table::Cortex_a8_stub_list): New typedef.
10114         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10115          Stub_table::prev_addralign_): New data member.
10116         (Arm_relobj::Arm_relobj): Initialize data member
10117         section_has_cortex_a8_workaround_.
10118         (Arm_relobj::section_has_cortex_a8_workaround,
10119          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10120          definitions.
10121         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10122         declarations.
10123         (Target_arm::relocate_stub): Change parameter type of stub from
10124         Reloc_stub pointer to Stub pointer.
10125         (Insn_template::size, Insn_template::alignment): Handle
10126         THUMB16_SPECIAL_TYPE.
10127         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10128          Stub_table::update_data_size_and_addralign,
10129          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10130         definitions.
10131         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10132         (Stub_table::do_write): Ditto.
10133         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10134
10135 2010-01-08  Ian Lance Taylor  <iant@google.com>
10136
10137         PR 11108
10138         * symtab.h (class Symbol): Remove fields is_target_special_ and
10139         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10140         (Symbol::is_defined_in_discarded_section): New function.
10141         (Symbol::set_is_defined_in_discarded_section): New function.
10142         (Symbol::has_plt_offset): Rewrite.
10143         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10144         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10145         Don't initialize is_target_special_ or has_plt_offset_.
10146         Initialize is_defined_in_discarded_section_.
10147         (Symbol_table::add_from_relobj): If appropriate, set
10148         is_defined_in_discarded_section.
10149         * resolve.cc (Symbol::override_base_with_special): Don't test
10150         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10151         * target-reloc.h (relocate_section): Do special handling for
10152         symbols defined in discarded sections for global symbols as well
10153         as local symbols.
10154
10155 2010-01-08  Ian Lance Taylor  <iant@google.com>
10156
10157         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10158         the SHT_SYMTAB case.
10159
10160 2010-01-08  Ian Lance Taylor  <iant@google.com>
10161
10162         * object.cc (Sized_relobj::do_layout): Don't get confused if
10163         layout_eh_frame returns NULL.
10164
10165 2010-01-08  Ian Lance Taylor  <iant@google.com>
10166
10167         PR 11084
10168         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10169         dynamic symbol table, use the normal symbol table.
10170         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10171         symbol table.
10172
10173 2010-01-08  Ian Lance Taylor  <iant@google.com>
10174
10175         PR 11072
10176         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10177         sections.
10178
10179 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10180
10181         * version.cc (print_version): Change to "Copyright 2010".
10182
10183 2010-01-08  Ian Lance Taylor  <iant@google.com>
10184
10185         PR 10287
10186         PR 11063
10187         * i386.cc (class Target_i386): Change return type of plt_section
10188         to be non-const.
10189         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10190         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10191         tls_desc_rel_ field.
10192         (Output_data_plt_i386::rel_tls_desc): New function.
10193         (Target_i386::rel_tls_desc_section): New function.
10194         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10195         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10196         R_386_TLS_DESC reloc in rel_tls_desc_section.
10197         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10198         Define struct Tlsdesc_info.
10199         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10200         (Target_x86_64::do_reloc_symbol_index): New function.
10201         (Target_x86_64::add_tlsdesc_info): New function.
10202         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10203         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10204         tlsdesc_rel_ field.
10205         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10206         all callers.
10207         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10208         (Target_x86_64::rela_tlsdesc_section): New function.
10209         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10210         handling.
10211         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10212         (Target_x86_64::do_reloc_addend): New function.
10213         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10214         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10215         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10216         (Output_reloc::type): New function.
10217         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10218         (Output_reloc::is_target_specific): New function.
10219         (Output_reloc::target_arg): New function.
10220         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10221         absolute relocs and target specific relocs.
10222         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10223         add_target_specific.
10224         (class Output_data_reloc) [SHT_RELA]: Likewise.
10225         * output.cc (Output_reloc::Output_reloc): Add four new versions
10226         for absolute relocs and target specific relocs.
10227         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10228         (Output_reloc::get_symbol_index): Likewise.
10229         (Output_reloc::local_section_offset): Check that local_sym_index_
10230         is not TARGET_CODE or 0.
10231         (Output_reloc::symbol_value): Likewise.
10232         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10233         reloc.
10234         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10235         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10236         functions.
10237         * layout.cc (add_target_dynamic_tags): Use output section for
10238         DT_PLTRELSZ and DT_JMPREL.
10239
10240 2010-01-07  Ian Lance Taylor  <iant@google.com>
10241
10242         PR 11061
10243         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10244         function.
10245         (class Output_data_reloc_generic): Define.
10246         (class Output_data_reloc_base): Change base class to
10247         Output_data_reloc_generic.  Change add() method to call
10248         bump_relative_reloc_count for a relative reloc.  Remove
10249         sort_relocs_ field.
10250         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10251         to sort_relocs().
10252         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10253         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10254         appropriate.
10255         * layout.h (class Layout): Update declaration.
10256
10257 2010-01-07  Ian Lance Taylor  <iant@google.com>
10258
10259         * output.h (class Output_data): Add const version of
10260         output_section and do_output_section.
10261         (class Output_section_data): Add const version of
10262         do_output_section.
10263         (class Output_section): Likewise.
10264         * layout.cc (Layout::add_target_dynamic_tags): New function.
10265         * layout.h (class Layout): Update declarations.
10266         * arm.cc (Target_arm::do_finalize_sections): Use
10267         add_target_dynamic_tags.
10268         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10269         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10270         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10271         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10272
10273 2010-01-07  Ian Lance Taylor  <iant@google.com>
10274
10275         PR 11042
10276         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10277         object as needed.
10278
10279 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10280             Ian Lance Taylor  <iant@google.com>
10281
10282         PR 11019
10283         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10284         Xindex::read_symtab_xindex.
10285
10286 2010-01-07  Doug Kwan  <dougkwan@google.com>
10287
10288         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10289         (Insn_template::thumb16_bcond_insn): New method declaration.
10290         (Insn_template): Fix spelling.
10291         (Stub::thumb16_special): New method declaration.
10292         (Stub::do_write): Define virtual method which was previously pure
10293         virtual.
10294         (Stub::do_thumb16_special): New method declaration.
10295         (Stub::do_fixed_endian_write): New template member.
10296         (Reloc_stub::do_write): Remove.
10297         (Reloc_stub::do_fixed_endian_write): Remove.
10298         (Cortex_a8_stub): New class definition.
10299         (Stub_factory::make_cortex_a8_stub): New method definition.
10300         (Stub_factory::Stub_factory): Add missing static storage class
10301         qualifier for elf32_arm_stub_a8_veneer_blx.
10302
10303 2010-01-07  Ian Lance Taylor  <iant@google.com>
10304
10305         PR 10980
10306         * options.h (class General_options): Add --warn-unresolved-symbols
10307         and --error-unresolved-symbols.
10308         * errors.cc (Errors::undefined_symbol): Implement
10309         --warn-unresolved-symbols.
10310
10311         * options.h (class General_options): Add -z text and -z textoff.
10312         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10313
10314 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10315
10316         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10317         (Garbage_collection::cident_sections): New function.
10318         (Garbage_collection::add_cident_section): New function.
10319         (Garbage_collection::cident_sections_): New member.
10320         (gc_process_relocs): Add references to sections whose names are C
10321         identifiers.
10322         * gold.h (cident_section_start_prefix): New constant.
10323         (cident_section_stop_prefix): New constant.
10324         (is_cident): New function.
10325         * layout.cc (Layout::define_section_symbols): Replace string constants
10326         with the newly defined constants.
10327         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10328         C identifiers.
10329         * testsuite/Makefile.am: Add gc_orphan_section_test.
10330         * testsuite/Makefile.in: Regenerate.
10331         * testsuite/gc_orphan_section_test.cc: New file.
10332         * testsuite/gc_orphan_section_test.sh: New file.
10333
10334 2010-01-06  Ian Lance Taylor  <iant@google.com>
10335
10336         PR 10980
10337         * options.h (class General_options): Add --warn-shared-textrel.
10338         * layout.cc (Layout::finish_dynamic_section): Implement
10339         --warn-shared-textrel.
10340
10341         PR 10980
10342         * options.h (class General_options): Add --warn-multiple-gp.
10343
10344 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10345
10346         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10347         $(THREADSLIB) and $(LIBDL).
10348         * Makefile.in: Rebuild.
10349
10350 2010-01-06  Ian Lance Taylor  <iant@google.com>
10351
10352         PR 10980
10353         * options.cc (General_options::parse_section_start): New function.
10354         (General_options::section_start): New function.
10355         (General_options::General_options): Initialize all members.
10356         * options.h: Include <map>
10357         (class General_options): Add --section-start.  Add section_starts_
10358         member.
10359         * layout.cc (Layout::attach_allocated_section_to_segment): If
10360         --section-start was used, set the address of the segment.  Remove
10361         local sort_sections.
10362         (Layout::relaxation_loop_body): If the address of the load segment
10363         has been set by --section-start, don't use it.
10364         * output.h (Output_segment::update_flags_for_output_section): New
10365         function.
10366         * output.cc (Output_segment::add_output_section): Call
10367         update_flags_for_output_section.
10368
10369 2010-01-05  Ian Lance Taylor  <iant@google.com>
10370
10371         PR 10980
10372         * options.h (class General_options): Add --undefined-version.
10373         * script.cc (struct Version_expression): Add was_matched_by_symbol
10374         field.
10375         (Version_script_info::matched_symbol): New function.
10376         (Version_script_info::get_symbol_version_helper): Call
10377         matched_symbol.
10378         (Version_script_info::check_unmatched_names): New function.
10379         * script.h (class Version_script_info): Update declarations.
10380         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10381
10382         * options.h (class General_options): Use DEFINE_bool_alias for
10383         allow_multiple_definition.
10384         * resolve.cc (Symbol_table::should_override): Don't test
10385         allow_multiple_definition.
10386
10387         PR 10980
10388         * options.h (class General_options): Add --cref.
10389         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10390         until after printing cref table.
10391         * cref.cc: Include "symtab.h".
10392         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10393         (Cref_table_compare::operator()): New function.
10394         (Cref_inputs::gather_cref): New function.
10395         (filecol): New static const.
10396         (Cref_inputs::print_cref): New function.
10397         (Cref::print_cref): New function.
10398         * cref.h: Include <cstdio>.
10399         (class Cref): Update declarations.
10400         * mapfile.h (Mapfile::file): New function.
10401         * object.h (class Object): Define Symbols.  Declare virtual
10402         do_get_global_symbols.
10403         (Object::get_global_symbols): New function.
10404         * object.cc (Input_objects::add_object): Pass object to cref_ if
10405         --cref.
10406         (Input_objects::archive_start): Likewise.
10407         (Input_objects::archive_stop): Likewise.
10408         (Input_objects::print_cref): New function.
10409         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10410         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10411         --cref.
10412         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10413         function.
10414         * plugin.h (class Sized_pluginobj): Update declarations.
10415
10416 2010-01-05  Ian Lance Taylor  <iant@google.com>
10417
10418         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10419         to is_default_version.  Rename insdef to insdefault.
10420         (Symbol_table::add_from_relobj): Rename def to is_default_version
10421         and local to is_forced_local.
10422         (Symbol_table::add_from_pluginobj): Likewise.
10423         (Symbol_table::add_from_dynobj): Likewise.
10424         (Symbol_table::define_special_symbol): Rename insdef to
10425         insdefault.
10426
10427 2010-01-04  Ian Lance Taylor  <iant@google.com>
10428
10429         PR 10980
10430         * options.h (class General_options): Add
10431         --allow-multiple-definition and -z muldefs.
10432         * resolve.cc (Symbol_table::should_override): Don't warn about a
10433         multiple symbol definition if --allow-multiple-definition or -z
10434         muldefs.
10435
10436         PR 10980
10437         * options.h (class General_options): Add --add-needed and
10438         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10439         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10440         error if --copy-dt-needed-entries aka --add-needed is used and
10441         would cause a change in behaviour.
10442
10443         PR 10980
10444         * options.h (class General_options): Add -G as a short version of
10445         --shared.  Add no-op options -assert, -g, and -i.
10446
10447 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10448
10449         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10450         check for .text or .gnu.linkonce.t sections.
10451         * icf.cc (Icf::find_identical_sections): Ditto.
10452         Change the detection for mangled function name within the section
10453         name.
10454         * icf.h (is_section_foldable_candidate): New function.
10455
10456 2009-12-30  Ian Lance Taylor  <iant@google.com>
10457
10458         PR 10980
10459         * options.h (class General_options): Permit two dashes with
10460         --retain-symbols-file.
10461
10462 2009-12-30  Ian Lance Taylor  <iant@google.com>
10463
10464         PR 10979
10465         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10466         don't put the file header and segment headers in the text
10467         segment.
10468
10469         PR 10979
10470         * common.cc (Sort_commons::operator()): Stabilize sort when both
10471         entries are NULL.
10472         (Symbol_table::do_allocate_commons_list): When allocating common
10473         symbols, skip a symbol which is no longer common.
10474         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10475         an object before checking its type.
10476         * testsuite/common_test_2.c: New file.
10477         * testsuite/common_test_3.c: New file.
10478         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10479         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10480         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10481         (common_test_2_pic.o, common_test_2.so): New targets.
10482         (common_test_3_pic.o, common_test_3.so): New targets.
10483         * testsuite/Makefile.in: Rebuild.
10484
10485         PR 10979
10486         * script.cc (read_input_script): If we see a new SECTIONS clause,
10487         and we have added an input section, give an error.
10488         * layout.h (class Layout): Add have_added_input_section function.
10489         Add have_added_input_section_ field.
10490         * layout.cc (Layout::Layout): Initialize
10491         have_added_input_section_.
10492         (Layout::layout): Set have_added_input_section_.
10493         (Layout::layout_eh_frame): Likewise.
10494
10495 2009-12-30  Ian Lance Taylor  <iant@google.com>
10496
10497         PR 10931
10498         * options.h (class General_options): Add --sort-common option.
10499         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10500         * common.cc (Sort_common): Add sort_order parameter to
10501         constructor.  Add sort_order_ field.
10502         (Sort_commons::operator): Check sort_order_.
10503         (Symbol_table::allocate_commons): Determine the sort order.
10504         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10505         Change all callers.
10506         (Symbol_table::do_allocate_commons_list): Likewise.
10507
10508 2009-12-30  Ian Lance Taylor  <iant@google.com>
10509
10510         PR 10916
10511         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10512         symbols from this object, don't change the visibility of an
10513         undefined symbol.
10514         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10515
10516 2009-12-30  Ian Lance Taylor  <iant@google.com>
10517
10518         PR 10861
10519         * script.h (class Version_script_info): Define Language enum.
10520         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10521         new fields globals_, locals_, and is_finalized_.
10522         * script.cc: Various formatting fixes.
10523         (class Parser_closure): Change language_stack_ from a vector of
10524         std::string to one of Version_script_info::Language.  Adjust all
10525         uses accordingly.
10526         (class Lazy_demangler): Remove.
10527         (struct Version_expression): Change language from std::string to
10528         Version_script_info::Language.
10529         (Version_script_info::Version_script_info): New function.
10530         (Version_script_info::~Version_script_info): Don't call clear.
10531         (Version_script_info::finalize): New function.
10532         (Version_script_info::build_lookup_tables): New function.
10533         (Version_script_info::build_expression_list_lookup): New
10534         function.
10535         (Version_script_info::get_symbol_version_helper): Rewrite to use
10536         lookup tables.
10537         (Version_script_info::print_expression_list): Adjust to use
10538         Version_script_info::Language.
10539         (script_push_lex_into_version_mode): Check that the version script
10540         has not been finalized.
10541         (version_script_push_lang): Change language string to
10542         Version_script_info::Language.
10543         * options.cc (Command_line::version_script): New function.
10544         * options.h (class General_options): Add finalize_dynamic_list
10545         function.  Change version_script from declaration to definition.
10546         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10547         * testsuite/version_script.map: Remove duplicate def of foo.
10548         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10549         version_script.map.
10550         * testsuite/Makefile.in: Rebuild.
10551
10552 2009-12-30  Ian Lance Taylor  <iant@google.com>
10553
10554         PR 10843
10555         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10556         if the input symbol index is 0, make the output symbol index 0.
10557
10558 2009-12-30  Ian Lance Taylor  <iant@google.com>
10559
10560         PR 10670
10561         * options.h (class General_options): Add -x/--discard-all.
10562         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10563         --discard-all.  If the local symbol needs a dynamic entry, check
10564         that before handling --discard-locals.
10565
10566 2009-12-30  Ian Lance Taylor  <iant@google.com>
10567
10568         PR 10450
10569         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10570         flags to PF_R.
10571         (Output_segment::add_output_section): Don't change the flags if
10572         the type is PT_TLS.
10573
10574         PR 10450
10575         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10576         GNU hash table if they need a dynamic value.  Otherwise, don't add
10577         them if they are defined in a dynamic object or are forced local.
10578
10579 2009-12-29  Ian Lance Taylor  <iant@google.com>
10580
10581         PR 10450
10582         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10583         .gnu.hash table for a 32-bit target.
10584
10585         PR 10450
10586         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10587         regular and a dynamic object only needs a dynamic symbol table
10588         entry if it is externally visible.
10589
10590         PR 10450
10591         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10592         constructor.  Add global_offset_table_ field.
10593         (Target_i386::got_section): Set global_offset_table_.
10594         (Target_i386::do_finalize_sections): Set global_offset_table_
10595         size.
10596         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10597         in constructor.  Add global_offset_table_ field.
10598         (Target_x86_64::got_section): Set global_offset_table_.
10599         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10600         size.
10601
10602         * layout.cc (Layout::Layout): Initialize increase_relro_.
10603         (Layout::get_output_section): Add is_relro, is_last_relro, and
10604         is_first_non_relro parameters.  Change all callers.
10605         (Layout::choose_output_section): Likewise.
10606         (Layout::add_output_section_data): Likewise.
10607         (Layout::make_output_section): Likewise.
10608         (Layout::set_segment_offsets): Clear increase_relro when using a
10609         linker script.
10610         * layout.h (class Layout): Add increase_relro method.  Add
10611         increase_relro_ field.  Update declarations.
10612         * output.cc (Output_section::Output_section): Initialize
10613         is_last_relro_ and is_first_non_relro_.
10614         (Output_segment::add_output_section): Group relro sections is
10615         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10616         (Output_segment::maximum_alignment): Remove relro handling.
10617         (Output_segment::set_section_addresses): Add increase_relro
10618         parameter.  Change all callers.  Add initial alignment to align
10619         relro sections on separate page.  Remove old relro handling.
10620         (Output_segment::set_section_list_addresses): Remove in_relro
10621         parameter.  Change all callers.
10622         (Output_segment::set_offset): Add increase parameter.  Change all
10623         callers.  Remove old relro handling.
10624         * output.h (class Output_section): Add new methods: is_last_relro,
10625         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10626         Add is_last_relro_ and is_first_non_relro_ fields.
10627         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10628         Create separate .got.plt section.  Call increase_relro.
10629         * x86_64.cc (Target_x86_64::got_section): Likewise.
10630         * testsuite/relro_script_test.t: Add .got.plt.
10631
10632         PR 10450
10633         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10634         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10635         (Layout::finalize): Call set_dynamic_symbol_size.
10636         (Layout::set_dynamic_symbol_size): New function.
10637         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10638         set_dynamic_symbol_size.
10639
10640         PR 10450
10641         * output.h (class Output_section): Add is_entsize_zero_ field.
10642         * output.cc (Output_section::Output_section): Initialize
10643         is_entsize_zero_.
10644         (Output_section::set_entsize): If two different entsizes are
10645         requested, force it to zero.
10646         (Output_section::add_input_section): Set flags for .debug_str
10647         before updating section flags.  Set entsize.
10648         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10649         and SHF_STRING if all input sections have those flags.
10650
10651 2009-12-29   Rafael Espindola  <espindola@google.com>
10652
10653         * main.cc (main): Fix the sys time reporting.
10654         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10655         reporting.
10656
10657 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10658
10659         * options.cc (General_options::parse_version): Allow -v to exit
10660         without an error if there is nothing to link.
10661
10662 2009-12-29  Ian Lance Taylor  <iant@google.com>
10663
10664         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10665         using a version of gcc before 4.1.
10666         * configure: Rebuild.
10667
10668 2009-12-28  Chris Demetriou  <cgd@google.com>
10669
10670         * attributes.cc (Output_attributes_section_data::do_write): Use
10671         std::vector::front rather than std::vector::data.
10672
10673 2009-12-28  Ian Lance Taylor  <iant@google.com>
10674
10675         * symtab.h (class Symbol_table): Add enum Defined.
10676         * resolve.cc (Symbol_table::should_override): Add defined
10677         parameter.  Change all callers.  Test whether object is NULL
10678         before calling a method on it.
10679         (Symbol_table::report_resolve_problem): Add defined parameter.
10680         Change all callers.
10681         (Symbol_table::should_override_with_special): Likewise.
10682         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10683         parameter.  Change all callers.
10684         (Symbol_table::do_define_in_output_data): Likewise.
10685         (Symbol_table::define_in_output_segment): Likewise.
10686         (Symbol_table::do_define_in_output_segment): Likewise.
10687         (Symbol_table::define_as_constant): Likewise.
10688         (Symbol_table::do_define_as_constant): Likewise.
10689         * script.h (class Symbol_assignment): Add is_defsym parameter to
10690         constructor; change all callers.
10691         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10692         parameter.  Change all callers.  Add is_defsym_ field.
10693         (class Parser_closure): Add parsing_defsym parameter to
10694         constructor; change all callers.  Add parsing_defsym accessor
10695         function.  Add parsing_defsym_ field.
10696
10697 2009-12-28  Ian Lance Taylor  <iant@google.com>
10698
10699         * gold.cc (queue_middle_tasks): Fix formatting.
10700         * object.cc (Relobj::is_section_name_included): Likewise.
10701
10702 2009-12-23  Ian Lance Taylor  <iant@google.com>
10703
10704         * i386.cc (Target_i386::do_calls_non_split): Recognize
10705         -fsplit-stack prologue for a function with a static chain.
10706         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10707         -fsplit-stack prologue when using %r11.
10708
10709 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10710
10711         * options.cc (General_options::parse_version): Make -v continue and do
10712         the link like GNU ld does.
10713
10714 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10715
10716         * Makefile.am (CCFILES): Add timer.cc.
10717         (HFILES): Add timer.h.
10718         * configure.ac: Check for sysconf and times.
10719         * main.cc: include timer.h.
10720         (main): Use Timer instead of get_run_time.
10721         * timer.cc: New.
10722         * timer.h: New.
10723         * workqueue.cc: include timer.h.
10724         (Workqueue::find_and_run_task):
10725         Report user, sys and wall time.
10726         * Makefile.in: Regenerate.
10727         * config.in: Regenerate.
10728         * configure: Regenerate.
10729
10730 2009-12-16  Doug Kwan  <dougkwan@google.com>
10731
10732         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10733         sections.
10734         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10735         relaxed input sections.
10736         * output.cc (Output_section::find_relaxed_input_section): Change
10737         return type to Output_relaxed_input_section pointer.  Adjust code
10738         for new type of relaxed_input_section_map_.
10739         * output.h (Output_section::find_relaxed_input_section): Change
10740         return type to Output_relaxed_input_section pointer.
10741         (Output_section::Output_relaxed_input_section_by_input_section_map):
10742         New type.
10743         (Output_section::relaxed_input_section_map_): Change type to
10744         Output_section::Output_relaxed_input_section_by_input_section_map.
10745         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10746         input section.
10747
10748 2009-12-15  Ian Lance Taylor  <iant@google.com>
10749
10750         * layout.cc (Layout::create_shstrtab): Only write out after input
10751         sections if we are compressing debug sections.
10752
10753 2009-12-15  Ian Lance Taylor  <iant@google.com>
10754
10755         * archive.cc (Archive::add_symbols): Only look up a symbol without
10756         a version if there is, in fact, a version.
10757
10758 2009-12-14  Ian Lance Taylor  <iant@google.com>
10759
10760         Revert -Wshadow changes, all changes from:
10761         2009-12-11  Doug Kwan  <dougkwan@google.com>
10762         2009-12-11  Nick Clifton  <nickc@redhat.com>
10763         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10764
10765 2009-12-11  Doug Kwan  <dougkwan@google.com>
10766
10767         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10768         due to -Wshadow.
10769         * attributes.cc (Object_attribute::size): Ditto.
10770         (Attributes_section_data::size): Ditto.
10771         (Attributes_section_data::Attributes_section_data): Ditto.
10772         (Output_attributes_section_data::do_write): Ditto.
10773         * attributes.h (Object_attribute::set_type): Ditto.
10774         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10775
10776 2009-12-11  Nick Clifton  <nickc@redhat.com>
10777
10778         * archive.cc: Fix shadowed variable warnings.
10779         * arm.cc: Likewise.
10780         * compressed_output.cc: Likewise.
10781         * compressed_output.h: Likewise.
10782         * configure: Likewise.
10783         * dwarf_reader.cc: Likewise.
10784         * dynobj.cc: Likewise.
10785         * dynobj.h: Likewise.
10786         * ehframe.cc: Likewise.
10787         * ehframe.h: Likewise.
10788         * errors.cc: Likewise.
10789         * expression.cc: Likewise.
10790         * fileread.cc: Likewise.
10791         * fileread.h: Likewise.
10792         * freebsd.h: Likewise.
10793         * i386.cc: Likewise.
10794         * icf.cc: Likewise.
10795         * incremental.h: Likewise.
10796         * layout.cc: Likewise.
10797         * layout.h: Likewise.
10798         * mapfile.cc: Likewise.
10799         * merge.cc: Likewise.
10800         * merge.h: Likewise.
10801         * object.cc: Likewise.
10802         * object.h: Likewise.
10803         * options.h: Likewise.
10804         * output.cc: Likewise.
10805         * output.h: Likewise.
10806         * parameters.cc: Likewise.
10807         * plugin.cc: Likewise.
10808         * powerpc.cc: Likewise.
10809         * reduced_debug_output.cc: Likewise.
10810         * reduced_debug_output.h: Likewise.
10811         * reloc.cc: Likewise.
10812         * reloc.h: Likewise.
10813         * resolve.cc: Likewise.
10814         * script-sections.cc: Likewise.
10815         * script.cc: Likewise.
10816         * script.h: Likewise.
10817         * sparc.cc: Likewise.
10818         * symtab.cc: Likewise.
10819         * symtab.h: Likewise.
10820         * target-select.cc: Likewise.
10821         * target-select.h: Likewise.
10822         * token.h: Likewise.
10823         * workqueue.cc: Likewise.
10824         * workqueue.h: Likewise.
10825         * x86_64.cc: Likewise.
10826
10827 2009-12-10  Doug Kwan  <dougkwan@google.com>
10828
10829         * arm.cc (attributes.h): New include.
10830         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10831         (Arm_relobj::~Arm_relobj): Delete object pointed by
10832         attributes_section_data_.
10833         (Arm_relobj::attributes_section_data): New method definition.
10834         (Arm_relobj::attributes_section_data_): New data member declaration.
10835         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10836         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10837         attributes_section_data_.
10838         (Arm_dynobj::attributes_section_data): New method definition.
10839         (Arm_dynobj::attributes_section_data_): New data member declaration.
10840         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10841         initialization value of may_use_blx_ to false.
10842         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10843         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10844         object attributes to compute results instead of hard-coding.
10845         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10846         Target_arm::get_secondary_compatible_arch,
10847         Target_arm::set_secondary_compatible_arch
10848         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10849         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10850         New method declarations.
10851         (Target_arm::get_aeabi_object_attribute): New method definition.
10852         (Target_arm::attributes_section_data_): New data member declaration.
10853         (read_arm_attributes_section): New template definition.
10854         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10855         (Arm_dynobj::do_read_symbols): Ditto.
10856         (Target_arm::do_finalize_sections): Merge attributes sections from
10857         input.  Check for BLX use after attributes section merging.
10858         Fix __exidx_start and __exidx_end visibility.  Create an
10859         .ARM.attributes section if necessary.
10860         (Target_arm::get_secondary_compatible_arch,
10861         Target_arm::set_secondary_compatible_arch,
10862         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10863         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10864         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10865         New method definitions.
10866
10867 2009-12-09  Ian Lance Taylor  <iant@google.com>
10868
10869         * plugin.cc (Plugin::load): Don't cast from void* to a function
10870         pointer.
10871
10872 2009-12-09  Ian Lance Taylor  <iant@google.com>
10873
10874         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10875         information fields.
10876
10877 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10878
10879         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10880         Replace two_file_shared_1.so with two_file_shared_2.so.
10881         * testsuite/Makefile.in: Regenerated.
10882
10883 2009-12-08  Doug Kwan  <dougkwan@google.com>
10884
10885         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10886         (HFILES): Add attributes.h and int_encoding.h.
10887         * Makefile.in: Regenerate.
10888         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10889         function definitions to int_encoding.cc
10890         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10891         prototypes to int_encoding.h
10892         * reduced_debug_output.cc (int_encoding.h): New include.
10893         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10894         function definitions to int_encoding.cc
10895         (insert_into_vector, read_from_pointer): Move template definitions to
10896         int_encoding.h
10897         * attributes.cc: New file.
10898         * attributes.h: New file.
10899         * int_encoding.cc: New file.
10900         * int_encoding.h: New file.
10901
10902 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10903
10904         PR gold/11055
10905         * incremental-dump.cc (dump_incremental_inputs): New.
10906         (main): Use dump_incremental_inputs.
10907
10908 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10909
10910         PR gold/10893
10911         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10912         checking elfcpp::STT_FUNC.
10913         (Target_i386::Relocate::relocate): Likewise.
10914         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10915
10916         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10917         symbols from shared libraries into normal FUNC symbols.
10918
10919         * symtab.h (Symbol): Add is_func and use it.
10920
10921 2009-12-05  Doug Kwan  <dougkwan@google.com>
10922
10923         * arm.cc (Target_arm::arm_info): Initialize new fields
10924         attributes_section and attributes_vendor.
10925         * i386.cc (Target_i386::i386_info): Same.
10926         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10927         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10928         fields attributes_section and attributes_vendor.
10929         * sparc.cc (Target_sparc::sparc_info): Same.
10930         * target.h (Target::attributes_section, Target::attributes_vendor,
10931         Target::is_attributes_section, Target::attribute_arg_type,
10932         Target::attributes_order): New method definitions.
10933         (Target::Target_info::attributes_section,
10934         Target::Target_info::attributes_vendor): New fields.
10935         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10936         virtual method definitions.
10937         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10938         attributes_section and attributes_vendor.
10939         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10940
10941 2009-12-05  Doug Kwan  <dougkwan@google.com>
10942
10943         * arm.cc: Update comments about interworking and stub generation.
10944         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10945         considered as non-PIC.
10946         (Arm_relocate_functions::base_abs): Fix formatting.
10947         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10948         of function to use GOT entry address instead of offset.
10949         (Target_arm::Scan::global): Issue an error if a symbol would need a
10950         PLT does not get one because it is untyped.  Remove code to create
10951         dynamic symbols for relative branches.
10952         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10953         takes unsigned integer instead of boolean.
10954
10955 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10956
10957         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10958         (two_file_test_LDADD): Likewise.
10959         (common_test_1_LDADD): Likewise.
10960         (exception_test_LDADD) Likewise.
10961         (weak_test_LDADD): Likewise.
10962         (many_sections_test_LDADD): Likewise.
10963         (initpri1_LDADD): Likewise.
10964         (script_test_1_LDADD): Likewise.
10965         (script_test_2_LDADD): Likewise.
10966         (justsyms_LDADD): Likewise.
10967         (binary_test_LDADD): Likewise.
10968         (large_LDADD): Likewise.
10969         * testsuite/Makefile.in: Regenerated.
10970
10971 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10972
10973         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10974         (Symbol_table::override_with_special): Likewise.
10975         (Symbol_table::add_from_object): Likewise.
10976
10977 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10978
10979         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10980         Don't set the data_offset twice.
10981
10982 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10983
10984         * testsuite/Makefile.in: Regenerate.
10985
10986 2009-12-03  Doug Kwan  <dougkwan@google.com>
10987
10988         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10989         (Target_arm::do_finalize_sections): Add parameter for symbol table
10990         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10991         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10992         parameter for symbol table pointer.
10993         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10994         an additional parameter for a pointer to symbol table.
10995         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10996         parameter for a symbol table pointer.
10997         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10998         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10999         Ditto.
11000         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
11001         parameter for a symbol table pointer.
11002
11003 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
11004
11005         * incremental.cc (Incremental_inputs_header)
11006         (Incremental_inputs_header_write, Incremental_inputs_entry)
11007         (Incremental_inputs_entry_write): Move ...
11008         * incremental.h (Incremental_inputs_header)
11009         (Incremental_inputs_header_write, Incremental_inputs_entry)
11010         (Incremental_inputs_entry_write): here.
11011
11012 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11013
11014         * incremental.cc (make_sized_incremental_binary): Set the target.
11015         Error if it is incompatible.
11016         * output.h (Output_file): Add filename method.
11017
11018 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11019
11020         * incremental.cc (Incremental_inputs_entry): Remove unused argument
11021         from the get_* methods.
11022
11023 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11024
11025         * incremental-dump.cc (main): Check that the offeset of a script is 0.
11026         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
11027         Write 0 for the data_offset of scripts.
11028
11029 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
11030
11031         * testsuite/Makefile.am: Add the incremental_test.sh test.
11032         * testsuite/incremental_test.sh: New.
11033         * testsuite/incremental_test_1.c: New.
11034         * testsuite/incremental_test_2.c: New.
11035
11036 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11037
11038         * incremental-dump.cc (main): Fix typos.
11039
11040 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11041
11042         PR gold/11025
11043         * incremental-dump.cc (main): Use llu to print 64 bit values.
11044
11045 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11046             H.J. Lu  <hongjiu.lu@intel.com>
11047
11048         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11049         $(LIBDL).
11050         (incremental_dump_LDADD): Likewise.
11051         * Makefile.in: Regenerated.
11052
11053 2009-11-25  Doug Kwan  <dougkwan@google.com>
11054
11055         Revert:
11056
11057         2009-11-25  Doug Kwan  <dougkwan@google.com>
11058
11059                 * arm.cc (Target_arm::Target_arm): Move method definition
11060                 outside of class definition.  Add code to handle
11061                 --target1-rel, --target1-abs and --target2= options.
11062                 (Target_arm::get_reloc_reloc_type): Change method to be
11063                 non-static and const.
11064                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11065                 New data member declaration.
11066                 (Target_arm::Scan::local, Target_arm::Scan::global,
11067                 Target_arm::Relocate::relocate,
11068                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11069                 Adjust call to Target_arm::get_real_reloc_type.
11070                 (Target_arm::get_real_reloc_type): Use command line options
11071                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11072                 * options.h (--target1-rel, --target1-abs, --target2): New
11073                 ARM-only options.
11074
11075 2009-11-25  Doug Kwan  <dougkwan@google.com>
11076
11077         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11078         class definition.  Add code to handle --target1-rel, --target1-abs
11079         and --target2= options.
11080         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11081         and const.
11082         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11083         member declaration.
11084         (Target_arm::Scan::local, Target_arm::Scan::global,
11085         Target_arm::Relocate::relocate,
11086         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11087         call to Target_arm::get_real_reloc_type.
11088         (Target_arm::get_real_reloc_type): Use command line options to
11089         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11090         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11091         options.
11092
11093 2009-11-25  Doug Kwan  <dougkwan@google.com>
11094
11095         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11096         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11097         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11098         formatting.
11099         (Arm_relocate_functions::thm_call): Replace body with a call to
11100         Arm_relocate_functions::thumb_branch_common.
11101         (Arm_relocate_functions::thm_jump24,
11102         Arm_relocate_functions::thm_xpc22): New method definitions.
11103         (Arm_relocate_functions::thumb_branch_common): New method definition.
11104         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11105         operator.
11106         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11107         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11108
11109 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11110
11111         * Makefile.am: Build incremental-dump
11112         * Makefile.in: Regenerate.
11113         * incremental-dump.cc: New.
11114         * incremental.cc (Incremental_inputs_header_data,
11115         Incremental_inputs_entry_data): Move to incremental.h
11116         * incremental.h: (Incremental_inputs_header_data,
11117         Incremental_inputs_entry_data): Move from incremental.cc
11118
11119 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11120
11121         * incremental.cc (Incremental_inputs_header,
11122         Incremental_inputs_header_write, Incremental_inputs_entry,
11123         Incremental_inputs_entry_write): Add a typedef with the data type.
11124
11125 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11126
11127         * incremental.cc (Incremental_inputs_header,
11128         Incremental_inputs_header_write, Incremental_inputs_entry,
11129         Incremental_inputs_entry_write): Update comment about which
11130         type has the filed descriptions.
11131
11132 2009-11-15  Doug Kwan  <dougkwan@google.com>
11133
11134         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11135         (Arm_relocate_functions::arm_branch_common): Change method defintion
11136         in class definition to a method declaration and update list of formal
11137         parameters.
11138         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11139         Arm_relocation_functions::jump24): Adjust call to
11140         Arm_relocate_functions::arm_branch_common.  Update list of formal
11141         parameters.
11142         (Arm_relocate_functions::xpc25): New method definition.
11143         (Arm_relocate_functions::arm_branch_common): Move method defintion
11144         out from class definition.  Use stubs for mode-switching and extending
11145         branch ranges.
11146         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11147         specially.  Change code to enable use of stubs in ARM branches.
11148
11149 2009-11-10  Doug Kwan  <dougkwan@google.com>
11150
11151         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11152         in method declaration.
11153         (Target_arm::relocate_stub): New method declaration.
11154         (Target_arm::default_target): Change to return a pointer instead of
11155         a const reference.
11156         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11157         Target_arm::default_target.
11158         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11159         method definition.
11160         (Target_arm::relocate_section): Adjust view.
11161         (Target_arm::relocate_stub): New method definition.
11162
11163 2009-11-10  Doug Kwan  <dougkwan@google.com>
11164
11165         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11166         a format warning.
11167         * incremental.cc (open_incremental_binary): Initialized local
11168         variables to avoid warnings.
11169         * object.cc (make_elf_object): Ditto.
11170         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11171         a format warning.
11172
11173 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11174
11175         PR gold/10930
11176         * testsuite/plugin_test.c: Include "config.h".
11177
11178 2009-11-09  Doug Kwan  <dougkwan@google.com>
11179
11180         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11181         (arm_symbol_value): Remove.
11182         (Arm_relocate_functions::arm_branch_common,
11183         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11184         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11185         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11186         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11187         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11188         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11189         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11190         Arm_relocate_functions::thm_mobw_abs_nc,
11191         Arm_relocate_functions::thm_mov_abs,
11192         Arm_relocate_functions::movw_prel_nc,
11193         Arm_relocate_functions::thm_movt_abs,
11194         Arm_relocate_functions::movt_prel,
11195         Arm_relocate_functions::thm_movw_prel_nc,
11196         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11197         (Target_arm::Relocate::relocate): Only decompose address into two
11198         parts if relocation type uses the thumb-bit and pass the actual
11199         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11200         calls to methods in Arm_relocate_functions for this change.
11201
11202 2009-11-08  Ian Lance Taylor  <iant@google.com>
11203
11204         PR 10925
11205         * reloc.cc: Instantiate
11206         Sized_relobj::initialize_input_to_output_maps and
11207         Sized_relobj:free_input_to_output_maps.
11208
11209 2009-11-06  Ian Lance Taylor  <iant@google.com>
11210
11211         PR 10876
11212         * defstd.cc (in_segment): Set only_if_ref true for "end".
11213
11214 2009-11-06  Doug Kwan  <dougkwan@google.com>
11215
11216         * arm.cc (class Reloc_stub): Correct a comment.
11217         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11218         (Target_arm::scan_section_for_stubs): New method declaration.
11219         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11220         Change methods from private to protected.
11221         (Target_arm::do_may_relax): New method definition.
11222         (Target_arm::do_relax, Target_arm::group_sections,
11223         Target_arm::scan_reloc_for_stub,
11224         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11225         (Target_arm::arm_input_section_map_): New data member declaration.
11226         (Target_arm::scan_reloc_for_stub,
11227         Target_arm::scan_reloc_section_for_stubs,
11228         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11229         Target_arm::do_relax): New method definitions.
11230
11231 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11232
11233         * configure.ac: Check for (struct stat)::st_mtim
11234         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11235         * config.in: Regenerate.
11236         * configure: Regenerate.
11237
11238 2009-11-05  Ian Lance Taylor  <iant@google.com>
11239
11240         PR 10910
11241         * output.cc (Output_segment::add_output_section): Add missing
11242         return statement.
11243
11244 2009-11-04  Ian Lance Taylor  <iant@google.com>
11245
11246         PR 10880
11247         * object.h (class Object): Add is_needed and set_is_needed
11248         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11249         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11250         defined in a dynamic object and referenced by a regular object,
11251         set is_needed for the dynamic object.
11252         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11253         if the file is marked with as_needed and it is not needed.
11254
11255 2009-11-04  Ian Lance Taylor  <iant@google.com>
11256
11257         PR 10887
11258         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11259         tags if data is discarded by linker script.
11260         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11261         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11262         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11263         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11264
11265 2009-11-04  Ian Lance Taylor  <iant@google.com>
11266
11267         * layout.cc (Layout::get_output_section): Add is_interp and
11268         is_dynamic_linker_section parameters.  Change all callers.
11269         (Layout::choose_output_section): Likewise.
11270         (Layout::make_output_section): Likewise.
11271         (Layout::add_output_section_data): Add is_dynamic_linker_section
11272         parameter.  Change all callers.
11273         * layout.h (class Layout): Update declarations.
11274         * output.h (class Output_section): Add is_interp, set_is_interp,
11275         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11276         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11277         generate_code_fills_at_write_ to a bitfield.
11278         * output.cc (Output_section::Output_sections): Initialize new
11279         fields.
11280         (Output_segment::add_output_section): Add do_sort parameter.
11281         Change all callers.
11282
11283 2009-11-03  Ian Lance Taylor  <iant@google.com>
11284
11285         PR 10860
11286         * options.h (class General_options): Add --warn-common.
11287         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11288         merging two common symbols.
11289         (Symbol_table::should_override): Handle --warn-common when merging
11290         a common symbol with a defined symbol.  Use report_resolve_problem
11291         for multiple definitions.
11292         (Symbol_table::report_resolve_problem): New function.
11293         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11294
11295 2009-11-03  Doug Kwan  <dougkwan@google.com>
11296
11297         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11298         stub_factory_.
11299         (Target_arm::stub_factory): New method definition.
11300         (Target_arm::new_arm_input_section,
11301         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11302         Target_arm::reloc_uses_thumb_bit): New method declarations.
11303         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11304         New type definitions.
11305         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11306         member declarations.
11307         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11308         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11309         New method definitions.
11310
11311 2009-11-03  Ian Lance Taylor  <iant@google.com>
11312
11313         * options.h (class General_options): Add --warn_constructors.
11314
11315 2009-11-03  Ian Lance Taylor  <iant@google.com>
11316
11317         PR 10893
11318         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11319         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11320
11321 2009-11-03  Ian Lance Taylor  <iant@google.com>
11322
11323         PR 10895
11324         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11325         --msgid-bugs-address.
11326         (install-pdf): New target.
11327         (install-data_yes): Look up one directory to find mkinstalldirs.
11328
11329 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11330
11331         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11332         tree.
11333
11334 2009-10-30  Doug Kwan  <dougkwan@google.com>
11335
11336         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11337
11338 2009-10-30  Doug Kwan  <dougkwan@google.com>
11339
11340         * arm.cc (Stub_addend_reader): New struct template definition
11341         and partial specializations.
11342         (Stub_addend_reader::operator()): New method definition for a
11343         partially specialized template.
11344
11345 2009-10-30  Doug Kwan  <dougkwan@google.com>
11346
11347         * arm.cc (Arm_relobj::processor_specific_flags): New method
11348         definition.
11349         (Arm_relobj::do_read_symbols): New method declaration.
11350         (Arm_relobj::processor_specific_flags_): New data member declaration.
11351         (Arm_dynobj): New class definition.
11352         (Target_arm::do_finalize_sections): Add input_objects parameter.
11353         (Target_arm::do_adjust_elf_header): New method declaration.
11354         (Target_arm::are_eabi_versions_compatible,
11355         (Target_arm::merge_processor_specific_flags): New method declaration.
11356         (Target_arm::do_make_elf_object): New overloaded method definitions
11357         and declaration.
11358         (Arm_relobj::do_read_symbols): New method definition.
11359         (Arm_dynobj::do_read_symbols): Ditto.
11360         (Target_arm::do_finalize_sections): Add input_objects parameters.
11361         Merge processor-specific flags from all input objects.
11362         (Target_arm::are_eabi_versions_compatible,
11363         Target_arm::merge_processor_specific_flags,
11364         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11365         New method definitions.
11366         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11367         Input_objects pointer type parameter.
11368         * layout.cc (Layout::finalize): Pass input objects to target's.
11369         finalize_sections function.
11370         * output.cc (Output_file_header::do_sized_write): Set ELF file
11371         header's processor-specific flags.
11372         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11373         Input_objects pointer type parameter.
11374         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11375         * target.h (Input_objects): New forward class declaration.
11376         (Target::processor_specific_flags,
11377         Target::are_processor_specific_flags_sect): New method definitions.
11378         (Target::finalize_sections): Add input_objects parameter.
11379         (Target::Target): Initialize processor_specific_flags_ and
11380         are_processor_specific_flags_set_.
11381         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11382         parameter.
11383         (Target::set_processor_specific_flags): New method definition.
11384         (Target::processor_specific_flags_,
11385         Target::are_processor_specific_flags_set_): New data member
11386         declarations.
11387         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11388         Input_objects pointer type parameter.
11389
11390 2009-10-30  Doug Kwan  <dougkwan@google.com>
11391
11392         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11393
11394 2009-10-28  Ian Lance Taylor  <iant@google.com>
11395
11396         * object.h (class Relobj): Drop options parameter from
11397         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11398         do_scan_relocs, do_relocate.  Change all callers.
11399         (class Sized_relobj): Drop options parameters from
11400         do_gc_process_relocs, do_scan_relocs, do_relocate,
11401         do_relocate_sections, relocate_sections, emit_relocs_scan,
11402         emit_relocs_scan_reltype.  Change all callers.
11403         (struct Relocate_info): Remove options field and all references to
11404         it.
11405         * reloc.h (class Read_relocs): Remove options constructor
11406         parameter and options_ field.  Change all callers.
11407         (class Gc_process_relocs, class Scan_relocs): Likewise.
11408         (class Relocate_task): Likewise.
11409         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11410         all callers.
11411         (scan_relocatable_relocs): Likewise.
11412         * target.h (class Sized_target): Remove options parameter from
11413         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11414         all callers.
11415         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11416         callers.
11417         * arm.cc: Update functions to remove options parameters.
11418         * i386.cc: Likewise.
11419         * powerpc.cc: Likewise.
11420         * sparc.cc: Likewise.
11421         * x86_64.cc: Likewise.
11422         * testsuite/testfile.cc: Likewise.
11423
11424 2009-10-28  Doug Kwan  <dougkwan@google.com>
11425
11426         * arm.cc (Arm_relobj): New class definition.
11427         (Arm_relobj::scan_sections_for_stubs,
11428         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11429         New method definitions.
11430
11431 2009-10-28  Cary Coutant  <ccoutant@google.com>
11432
11433         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11434         (Plugin::cleanup_done_): New member.
11435         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11436         (Plugin_manager::cleanup_done_): Remove.
11437         (Plugin_manager::add_input_file): Edit error message.
11438         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11439         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11440
11441 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11442
11443         * fileread.cc: (File_read::View::~View): Use the new
11444         data_ownership_ filed.
11445         (File_read::~File_read): Dispose the new whole_file_view_.
11446         (File_read::open): Mmap the whole file if needed.
11447         (File_read::open): Use whole_file_view_ instead of contents_.
11448         (File_read::find_view): Use whole_file_view_ if applicable.
11449         (File_read::do_read): Use whole_file_view_ instead of contents_.
11450         (File_read::make_view): Use whole_file_view_ instead of contents_,
11451         update File_read::View::View call.
11452         (File_read::find_or_make_view): Update File_read::View::View
11453         call.
11454         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11455         remove contents_
11456         (File_read::View::Data_ownership): New enum.
11457         (File_read::View::View): Replace bool mapped_ with Data_ownership
11458         argument.
11459         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11460         (File_read::View::data_ownership_): New field.
11461         (File_read::contents_): Remove (replaced by whole_file_view_).
11462         (File_read::whole_file_view_): New field.
11463         * options.h (class General_options): Add --keep-files-mapped.
11464
11465 2009-10-27  Cary Coutant  <ccoutant@google.com>
11466
11467         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11468         * testsuite/Makefile.am (plugin_test_5): New test case.
11469         * testsuite/Makefile.in: Regenerate.
11470
11471 2009-10-25  Doug Kwan  <dougkwan@google.com>
11472
11473         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11474         from private to protected to allow access by child class.
11475         (Sized_relobj::do_relocate_sections): New method declaration.
11476         (Sized_relobj::relocate_sections): Virtualize.
11477         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11478         Sized_relobj::relocate_sections.  Instantiate template explicitly
11479         for different target sizes and endianity.
11480
11481 2009-10-24  Doug Kwan  <dougkwan@google.com>
11482
11483         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11484         (Arm_input_section::as_arm_input_section): New method.
11485         (Arm_output_section): New class definition.
11486         (Arm_output_section::create_stub_group,
11487         Arm_output_section::group_sections): New method definitions.
11488
11489 2009-10-22  Doug Kwan  <dougkwan@google.com>
11490
11491         * arm.cc (Arm_input_section): New class definition.
11492         (Arm_input_section::init, Arm_input_section:do_write,
11493         Arm_input_section::set_final_data_size,
11494         Arm_input_section::do_reset_address_and_file_offset): New method
11495         definitions.
11496
11497 2009-10-21  Doug Kwan  <dougkwan@google.com>
11498
11499         * arm.cc (Stub_table, Arm_input_section): New forward class
11500         declarations.
11501         (Stub_table): New class defintion.
11502         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11503         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11504         New method definition.
11505
11506 2009-10-21  Doug Kwan  <dougkwan@google.com>
11507
11508         * arm.cc: Update copyright comments.
11509         (Target_arm): New forward class template declaration.
11510         (Arm_address): New type.
11511         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11512         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11513         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11514         constants.
11515         (Insn_template): Same.
11516         (DEF_STUBS): New macro.
11517         (Stub_type): New enum type.
11518         (Stub_template): New class definition.
11519         (Stub): Same.
11520         (Reloc_stub): Same.
11521         (Stub_factory): Same.
11522         (Target_arm::Target_arm): Initialize may_use_blx_ and
11523         should_force_pic_veneer_.
11524         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11525         Target_arm::should_force_pic_veneer,
11526         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11527         Target_arm::using_thumb_only, Target_arm:;default_target): New
11528         method defintions.
11529         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11530         New data member declarations.
11531         (Insn_template::size, Insn_template::alignment): New method defintions.
11532         (Stub_template::Stub_template): New method definition.
11533         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11534         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11535         (Stub_factory::Stub_factory): New method definition.
11536         * gold.h (string_hash): New template.
11537         * output.h (Input_section_specifier::hash_value): Use
11538         gold::string_hash.
11539         (Input_section_specifier::string_hash): Remove.
11540         * stringpool.cc (Stringpool_template::string_hash): Use
11541         gold::string_hash.
11542
11543 2009-10-20  Doug Kwan  <dougkwan@google.com>
11544
11545         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11546         symbols of relaxed input sections.
11547         * output.h (Output_section::find_relaxed_input_section): Make
11548         method public.
11549
11550 2009-10-16  Doug Kwan  <dougkwan@google.com>
11551
11552         * dynobj.cc (Versions::Versions): Initialize version_script_.
11553         Only insert base version symbol definition for a shared object
11554         if version script defines any version versions.
11555         (Versions::define_base_version): New method definition.
11556         (Versions::add_def): Check that base version is not needed.
11557         (Versions::add_need): Define base version lazily.
11558         * dynobj.h (Versions::define_base_version): New method declaration.
11559         (Versions::needs_base_version_): New data member declaration.
11560         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11561         (check_DATA): Add no_version_test.stdout.
11562         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11563         New make rules.
11564         * testsuite/Makefile.in: Regenerate.
11565         * testsuite/no_version_test.c: New file.
11566         * testsuite/no_version_test.sh: Ditto.
11567
11568 2009-10-16  Doug Kwan  <dougkwan@google.com>
11569
11570         * expression.cc (class Segment_start_expression): New class definition.
11571         (Segment_start_expression::value): New method definition.
11572         (script_exp_function_segment_start): Return a new
11573         Segment_start_expression.
11574         * gold/script-c.h (script_saw_segment_start_expression): New function
11575         prototype.
11576         * script-sections.cc (Script_sections::Script_sections): Initialize
11577         SAW_SEGMENT_START_EXPRESSION_ to false.
11578         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11579         and -Tbbs options to specify section addresses if given in
11580         command line and no SEGMENT_START expression is seen in a script.
11581         * script-sections.h (Script_sections::saw_segment_start_expression,
11582         Script_sections::set_saw_segment_start_expression): New method
11583         definition.
11584         (Script_sections::saw_segment_start_expression_): New data member
11585         declaration.
11586         * script.cc (script_saw_segment_start_expression): New function.
11587         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11588         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11589         script_test_7.sh and script_test_8.sh.
11590         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11591         script_test_8.stdout.
11592         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11593         (script_test_6, script_test_6.stdout, script_test_7,
11594         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11595         * Makefile.in: Regenerate.
11596         * testsuite/script_test_6.sh: New file.
11597         * testsuite/script_test_6.t: Same.
11598         * testsuite/script_test_7.sh: Same.
11599         * testsuite/script_test_7.t: Same.
11600         * testsuite/script_test_8.sh: Same.
11601
11602 2009-10-16  Doug Kwan  <dougkwan@google.com>
11603
11604         * output.cc (Output_segment::set_section_list_address): Cast
11605         expressions to unsigned long long type to avoid format warnings.
11606
11607 2009-10-15  Ian Lance Taylor  <iant@google.com>
11608
11609         * script.cc (Script_options::add_symbol_assignment): Always add a
11610         dot assignment to script_sections_.
11611         * script-sections.cc (Script_sections::add_dot_assignment):
11612         Initialize if necessary.
11613
11614         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11615         program headers with no load segment if there is a linker script.
11616
11617         * layout.cc (Layout::set_segment_offsets): Align the file offset
11618         to the segment aligment for -N or -n with no load segment.
11619         * output.cc (Output_segment::add_output_section): Don't crash if
11620         the first section is a TLS section.
11621         (Output_segment::set_section_list_addresses): Print an error
11622         message if the address moves backward in a linker script.
11623         * script-sections.cc
11624         (Output_section_element_input::set_section_addresses): Don't
11625         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11626         (Orphan_output_section::set_section_addresses): Likewise.
11627
11628 2009-10-15  Doug Kwan  <dougkwan@google.com>
11629
11630         * layout.cc (Layout::finish_dynamic_section): Generate tags
11631         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11632         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11633         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11634
11635 2009-10-14  Ian Lance Taylor  <iant@google.com>
11636
11637         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11638         fields.
11639         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11640         data_shdr fields of relinfo.
11641         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11642         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11643         R_386_TLS_LDO_32, adjust based on section flags.
11644         (Target_i386::Relocate::fix_up_ldo): Remove.
11645
11646 2009-10-13  Ian Lance Taylor  <iant@google.com>
11647
11648         Add support for -pie.
11649         * options.h (class General_options): Add -pie and
11650         --pic-executable.
11651         (General_options::output_is_position_independent): Test -pie.
11652         (General_options::output_is_executable): Return true if not shared
11653         and not relocatable.
11654         (General_options::output_is_pie): Remove.
11655         * options.cc (General_options::finalize): Reject incompatible uses
11656         of -pie.
11657         * gold.cc (queue_middle_tasks): A -pie link is not static.
11658         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11659         * symtab.cc (Symbol::final_value_is_known): Return false if
11660         output_is_position_independent.
11661         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11662         output_is_position_independent.
11663         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11664         output_is_position_independent.
11665         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11666         output_is_position_independent.
11667         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11668         two_file_pie_test.
11669         (basic_pie_test.o, basic_pie_test): New targets.
11670         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11671         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11672         (two_file_pie_test): New target.
11673         * testsuite/Makefile.in: Rebuild.
11674         * README: Remove note saying that -pie is not supported.
11675
11676 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11677
11678         * options.h (class General_options): Add -init and -fini.
11679         * layout.cc (Layout::finish_dynamic_section): Emit
11680         given init and fini functions.
11681
11682 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11683
11684         * gc.h (gc_process_relocs): Check if icf is enabled using new
11685         function.
11686         * gold.cc (queue_initial_tasks): Likewise.
11687         (queue_middle_tasks): Likewise.
11688         * object.cc (do_layout): Likewise.
11689         * symtab.cc (is_section_folded): Likewise.
11690         * main.cc (main): Likewise.
11691         * reloc.cc (Read_relocs::run): Likewise.
11692         (Sized_relobj::do_scan_relocs): Likewise.
11693         * icf.cc (is_function_ctor_or_dtor): New function.
11694         (Icf::find_identical_sections): Check if function is ctor or dtor when
11695         safe icf is chosen.
11696         * options.h (General_options::icf): Change option to be an enum.
11697         (Icf_status): New enum.
11698         (icf_enabled): New method.
11699         (icf_safe_folding): New method.
11700         (set_icf_status): New method.
11701         (icf_status_): New variable.
11702         * (options.cc) (General_options::finalize): Set icf_status_.
11703         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11704         icf_test and icf_keep_unique_test to use the --icf enum flag.
11705         * testsuite/icf_safe_test.sh: New file.
11706         * testsuite/icf_safe_test.cc: New file.
11707
11708 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11709
11710         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11711         includes to gc.h and icf.h.
11712         * arm.cc: Include gc.h.
11713         * gold.cc: Likewise.
11714         * i386.cc: Likewise.
11715         * powerpc.cc: Likewise.
11716         * sparc.cc: Likewise.
11717         * x86_64.cc: Likewise.
11718         * gc.h: Include icf.h.
11719
11720 2009-10-11  Ian Lance Taylor  <iant@google.com>
11721
11722         * plugin.cc: Include "gold.h" before other header files.
11723
11724 2009-10-10  Chris Demetriou  <cgd@google.com>
11725
11726         * options.h (Input_file_argument::Input_file_type): New enum.
11727         (Input_file_argument::is_lib_): Replace with...
11728         (Input_file_argument::type_): New member.
11729         (Input_file_argument::Input_file_argument): Take Input_file_type
11730         'type' rather than boolean 'is_lib' as second argument.
11731         (Input_file_argument::is_lib): Use type_.
11732         (Input_file_argument::is_searched_file): New function.
11733         (Input_file_argument::may_need_search): Handle is_searched_file.
11734         * options.cc (General_options::parse_library): Support -l:filename.
11735         (General_options::parse_just_symbols): Update for Input_file_argument
11736         changes.
11737         (Command_line::process): Likewise.
11738         * archive.cc (Archive::get_file_and_offset): Likewise.
11739         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11740         * script.cc (read_script_file, script_add_file): Likewise.
11741         * fileread.cc (Input_file::Input_file): Likewise.
11742         (Input_file::will_search_for): Handle is_searched_file.
11743         (Input_file::open): Likewise.
11744         * readsyms.cc (Read_symbols::get_name): Likewise.
11745         * testsuite/Makefile.am (searched_file_test): New test.
11746         * testsuite/Makefile.in: Regenerate.
11747         * testsuite/searched_file_test.cc: New file.
11748         * testsuite/searched_file_test_lib.cc: New file.
11749
11750 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11751             Ian Lance Taylor  <iant@google.com>
11752
11753         * descriptor.cc: Include <cstdio> and "binary-io.h".
11754         (Descriptors::open): Open the files in binary mode always.
11755         * script.cc (Lex::get_token): Treat \r as whitespace.
11756
11757 2009-10-09  Ian Lance Taylor  <iant@google.com>
11758
11759         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11760
11761 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11762             Ian Lance Taylor  <iant@google.com>
11763
11764         * configure.ac: Check for readv function also.
11765         * fileread.cc (readv): Define if not HAVE_READV.
11766         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11767         does not exist.
11768         * config.in: Regenerate.
11769         * configure: Regenerate.
11770
11771 2009-10-09  Doug Kwan  <dougkwan@google.com>
11772
11773         * layout.cc (Layout::make_output_section): Call target hook to make
11774         ordinary output section.
11775         (Layout::finalize): Adjust parameter list of call the
11776         Target::may_relax().
11777         * layout.h (class Layout::section_list): New method.
11778         * merge.h (Output_merge_base::entsize): Change visibility to public.
11779         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11780         New methods.
11781         (Output_merge_string::do_is_string): New method.
11782         * object.cc (Sized_relobj::do_setup): renamed from
11783         Sized_relobj::set_up.
11784         * object.h (Sized_relobj::adjust_shndx,
11785         Sized_relobj::initializ_input_to_output_maps,
11786         Sized_relobj::free_input_to_output_maps): Change visibilities to
11787         protected.
11788         (Sized_relobj::setup): Virtualize.
11789         (Sized_relobj::do_setup): New method declaration.
11790         (Sized_relobj::invalidate_section_offset,
11791         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11792         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11793         * options.cc (parse_int): New function.
11794         * options.h (parse_int): New declaration.
11795         (DEFINE_int): New macro.
11796         (stub_group_size): New option.
11797         * output.cc (Output_section::Output_section): Initialize memebers
11798         merge_section_map_, merge_section_by_properties_map_,
11799         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11800         (Output_section::add_input_section): Handled deferred code-fill
11801         generation and remove an old comment.
11802         (Output_section::add_relaxed_input_section): New method definition.
11803         (Output_section::add_merge_input_section): Use merge section by
11804         properties map to speed to search.  Update merge section maps
11805         as appropriate.
11806         (Output_section::build_relaxation_map): New method definition.
11807         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11808         Same.
11809         (Output_section::relax_input_section): Renamed to
11810         Output_section::convert_input_sections_to_relaxed_sections and change
11811         interface to take a vector of pointers to relaxed sections.
11812         (Output_section::find_merge_section,
11813         Output_section::find_relaxed_input_section): New method definitions.
11814         (Output_section::is_input_address_mapped,
11815         Output_section::output_offset, Output_section::output_address):
11816         Use output section data maps to speed up searching.
11817         (Output_section::find_starting_output_address): Add comments.
11818         (Output_section::do_write,
11819         Output_section::write_to_postprocessing_buffer): Do code-fill
11820         generation as appropriate.
11821         (Output_section::get_input_sections): Invalidate relaxed input section
11822         map.
11823         (Output_section::restore_states): Adjust type of checkpoint .
11824         Invalidate relaxed input section map.
11825         * output.h (Output_merge_base): New class declaration.
11826         (Input_section_specifier): New class defintion.
11827         (class Output_relaxed_input_section) Change base class to
11828         Output_section_data_build.
11829         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11830         base class initializer.
11831         (Output_section::add_relaxed_input_section): New method declaration.
11832         (Output_section::Input_section): Change visibility to protected.
11833         (Output_section::Input_section::relobj,
11834         Output_section::Input_section::shndx): Handle relaxed input sections.
11835         Output_section::input_sections) Change visibility to protected.  Also
11836         define overload to return a non-const pointer.
11837         (Output_section::Merge_section_properties): New class defintion.
11838         (Output_section::Merge_section_by_properties_map,
11839         Output_section::Output_section_data_by_input_section_map,
11840         Output_section::Relaxation_map): New types.
11841         (Output_section::relax_input_section): Rename method to
11842         Output_section::convert_input_sections_to_relaxed_sections and change
11843         interface to take a vector of relaxed section pointers.
11844         (Output_section::find_merge_section,
11845         Output_section::find_relaxed_input_section,
11846         Output_section::build_relaxation_map,
11847         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11848         New method declarations.
11849         (Output_section::merge_section_map_
11850         Output_section::merge_section_by_properties_map_,
11851         Output_section::relaxed_input_section_map_,
11852         Output_section::is_relaxed_input_section_map_valid_,
11853         Output_section::generate_code_fills_at_write_): New data members.
11854         * script-sections.cc
11855         (Output_section_element_input::set_section_addresses): Call
11856         current_data_size and addralign methods of relaxed input sections.
11857         (Orphan_output_section::set_section_addresses): Call current_data_size
11858         and addralign methods of relaxed input sections.
11859         * symtab.cc (Symbol_table::compute_final_value): Extract template
11860         from the body of Symbol_table::sized_finalize_symbol.
11861         (Symbol_table::sized_finalized_symbol): Call
11862         Symbol_table::compute_final_value.
11863         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11864         (Symbol_table::compute_final_value): New templated method declaration.
11865         * target.cc (Target::do_make_output_section): New method defintion.
11866         * target.h (Target::make_output_section): New method declaration.
11867         (Target::relax): Add more parameters for input objects, symbol table
11868         and layout.  Adjust call to do_relax.
11869         (Target::do_make_output_section): New method declaration.
11870         (Target::do_relax): Add parameters for input objects, symbol table
11871         and layout.
11872
11873 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11874
11875         * pread.c: Include stdio.h.
11876
11877 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11878
11879         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11880         defined.
11881
11882 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11883
11884         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11885         Change read_shndx type to unsigned int.
11886         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11887         int.
11888         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11889         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11890         Change read_shndx type to unsigned int.
11891         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11892         int.
11893         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11894         * layout.cc (Layout::create_symtab_sections): Cast the result of
11895         local_symcount * symsize to off_t in the gold_assert.
11896
11897 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11898
11899         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11900         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11901         R_ARM_BASE_ABS.
11902         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11903         (Arm_relocate_functions::thm_abs5): New function.
11904         (Arm_relocate_functions::abs12): New function.
11905         (Arm_relocate_functions::abs16): New function.
11906         (Arm_relocate_functions::base_abs): New function.
11907         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11908         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11909         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11910         R_ARM_BASE_ABS.
11911         (Scan::global): Likewise.
11912         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11913         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11914         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11915         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11916         R_ARM_BASE_ABS.
11917
11918 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11919
11920         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11921         (Arm_relocate_functions::movt_prel): New function.
11922         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11923         (Arm_relocate_functions::thm_movt_prel): New function.
11924         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11925         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11926         (Scan::global, Relocate::relocate): Likewise.
11927         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11928
11929 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11930
11931         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11932         Incremental_checker.
11933         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11934         unsigned int.
11935         (class Incremental_inputs_header): New class.
11936         (Incremental_inputs_header_writer): Edit comment.
11937         (Incremental_inputs_entry): New class.
11938         (Incremental_inputs_entry_writer): Edit comment.
11939         (Sized_incremental_binary::do_find_incremental_inputs_section):
11940         Add *strtab_shndx parameter, fill it.
11941         (Sized_incremental_binary::do_check_inputs): New method.
11942         (Incremental_checker::can_incrementally_link_output_file): Use
11943         Sized_incremental_binary::check_inputs.
11944         (Incremental_inputs::report_command_line): Save command line in
11945         command_line_.
11946         * incremental.h:
11947         (Incremental_binary::find_incremental_inputs_section): New
11948         method.
11949         (Incremental_binary::do_find_incremental_inputs_section): Add
11950         strtab_shndx parameter.
11951         (Incremental_binary::do_check_inputs): New pure virtual method.
11952         (Sized_incremental_binary::do_check_inputs): Declare.
11953         (Incremental_checker::Incremental_checker): Add incremental_inputs
11954         parameter, use it to initialize incremental_inputs_.
11955         (Incremental_checker::incremental_inputs_): New field.
11956         (Incremental_checker::command_line): New method.
11957         (Incremental_checker::inputs): New method.
11958         (Incremental_checker::command_line_): New field.
11959
11960 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11961
11962         * incremental.cc: Include <cstdarg> and "target-select.h".
11963         (vexplain_no_incremental): New function.
11964         (explain_no_incremental): New function.
11965         (Incremental_binary::error): New method.
11966         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11967         method.
11968         (make_sized_incremental_binary): New function.
11969         (open_incremental_binary): New function.
11970         (can_incrementally_link_file): Add checks if output is ELF and has
11971         inputs section.
11972         * incremental.h: Include "elfcpp_file.h" and "output.h".
11973         (Incremental_binary): New class.
11974         (Sized_incremental_binary): New class.
11975         (open_incremental_binary): Declare.
11976         * object.cc (is_elf_object): Use
11977         elfcpp::Elf_recognizer::is_elf_file.
11978         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11979         * output.h (Output_file::filesize): New method.
11980
11981 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11982
11983         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11984         New function.
11985         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11986         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11987         function.
11988         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11989         function.
11990         (Arm_relocate_functions::movw_abs_nc): New function.
11991         (Arm_relocate_functions::movt_abs): New function.
11992         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11993         (Arm_relocate_functions::thm_movt_abs): New function.
11994         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11995         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11996         (Scan::global): Likewise.
11997         (Relocate::relocate): Likewise.
11998         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11999
12000 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12001
12002         * arm.cc (Arm_relocate_functions::got_prel) New function.
12003         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
12004         (Relocate::relocate): Likewise.
12005         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
12006
12007 2009-10-06  Ian Lance Taylor  <iant@google.com>
12008
12009         * options.h (class General_options): Define
12010         split_stack_adjust_size parameter.
12011         * object.h (class Object): Add uses_split_stack_ and
12012         has_no_split_stack_ fields.  Add uses_split_stack and
12013         has_no_split_stack accessor functions.  Declare
12014         handle_split_stack_section.
12015         (class Reloc_symbol_changes): Define.
12016         (class Sized_relobj): Define Function_offsets.  Declare
12017         split_stack_adjust, split_stack_adjust_reltype, and
12018         find_functions.
12019         * object.cc (Object::handle_split_stack_section): New function.
12020         (Sized_relobj::do_layout): Call handle_split_stack_section.
12021         * dynobj.cc (Sized_dynobj::do_layout): Call
12022         handle_split_stack_section.
12023         * reloc.cc (Sized_relobj::relocate_sections): Call
12024         split_stack_adjust for executable sections in split_stack
12025         objects.  Pass reloc_map to relocate_section.
12026         (Sized_relobj::split_stack_adjust): New function.
12027         (Sized_relobj::split_stack_adjust_reltype): New function.
12028         (Sized_relobj::find_functions): New function.
12029         * target-reloc.h: Include "object.h".
12030         (relocate_section): Add reloc_symbol_changes parameter.  Change
12031         all callers.
12032         * target.h (class Target): Add calls_non_split method.  Declare
12033         do_calls_non_split virtual method.  Declare match_view and
12034         set_view_to_nop.
12035         * target.cc: Include "elfcpp.h".
12036         (Target::do_calls_non_split): New function.
12037         (Target::match_view): New function.
12038         (Target::set_view_to_nop): New function.
12039         * gold.cc (queue_middle_tasks): Give an error if mixing
12040         split-stack and non-split-stack objects with -r.
12041         * i386.cc (Target_i386::relocate_section): Add
12042         reloc_symbol_changes parameter.
12043         (Target_i386::do_calls_non_split): New function.
12044         * x86_64.cc (Target_x86_64::relocate_section): Add
12045         reloc_symbol_changes parameter.
12046         (Target_x86_64::do_calls_non_split): New function.
12047         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12048         parameter.
12049         * powerpc.cc (Target_powerpc::relocate_section): Add
12050         reloc_symbol_changes parameter.
12051         * sparc.cc (Target_sparc::relocate_section): Add
12052         reloc_symbol_changes parameter.
12053         * configure.ac: Call AM_CONDITIONAL for the default target.
12054         * configure: Rebuild.
12055         * testsuite/Makefile.am (TEST_AS): New variable.
12056         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12057         (check_DATA): Add split_i386 and split_x86_64 files.
12058         (SPLIT_DEFSYMS): Define.
12059         (split_i386_[1234n].o): New targets.
12060         (split_i386_[124]): New targets.
12061         (split_i386_[1234r].stdout): New targets.
12062         (split_x86_64_[1234n].o): New targets.
12063         (split_x86_64_[124]): New targets.
12064         (split_x86_64_[1234r].stdout): New targets.
12065         (MOSTLYCLEANFILES): Add new executables.
12066         * testsuite/split_i386.sh: New file.
12067         * testsuite/split_x86_64.sh: New file.
12068         * testsuite/split_i386_1.s: New file.
12069         * testsuite/split_i386_2.s: New file.
12070         * testsuite/split_i386_3.s: New file.
12071         * testsuite/split_i386_4.s: New file.
12072         * testsuite/split_i386_n.s: New file.
12073         * testsuite/split_x86_64_1.s: New file.
12074         * testsuite/split_x86_64_2.s: New file.
12075         * testsuite/split_x86_64_3.s: New file.
12076         * testsuite/split_x86_64_4.s: New file.
12077         * testsuite/split_x86_64_n.s: New file.
12078         * testsuite/testfile.cc (Target_test): Update relocation_section
12079         function.
12080         * testsuite/Makefile.in: Rebuild.
12081
12082 2009-10-06  Ian Lance Taylor  <iant@google.com>
12083
12084         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12085         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12086         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12087         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12088         the address on ldo_addrs_.
12089         (Target_i386::Relocate::fix_up_ldo): New function.
12090
12091 2009-10-06   Rafael Espindola  <espindola@google.com>
12092
12093         * plugin.cc (add_input_library): New.
12094         (Plugin::load): Add add_input_library to tv.
12095         (Plugin_manager::add_input_file): Add the is_lib argument.
12096         (add_input_file): Update call to Plugin_manager::add_input_file.
12097         (add_input_library): New.
12098         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12099
12100 2009-09-30  Doug Kwan  <dougkwan@google.com>
12101
12102         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12103         symbol and call Symbol::may_need_copy_reloc to determine if
12104         a copy reloc is needed.
12105         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12106         nocopyreloc is given in command line.
12107         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12108         given in command line.
12109         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12110         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12111         of the removed Target_i386::may_need_copy_reloc.
12112         * options.h (copyreloc): New option with default value false.
12113         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12114         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12115         instead of the removed Target_powerpc::may_need_copy_reloc.
12116         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12117         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12118         instead of the removed Target_sparc::may_need_copy_reloc.
12119         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12120         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12121         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12122         instead of the removed Target_x86_64::may_need_copy_reloc.
12123
12124 2009-09-30  Ian Lance Taylor  <iant@google.com>
12125
12126         * object.h (class Object): Remove target_ field, and target,
12127         sized_target, and set_target methods.
12128         (Object::sized_target): Remove.
12129         (class Sized_relobj): Update declarations.  Remove sized_target.
12130         * object.cc (Sized_relobj::setup): Remove target parameter.
12131         Change all callers.
12132         (Input_objects::add_object): Don't do anything with the target.
12133         (make_elf_sized_object): Add punconfigured parameter.  Change all
12134         callers.  Set or test parameter target.
12135         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12136         Change all callers.
12137         * parameters.cc (Parameters::set_target): Change parameter type to
12138         be non-const.
12139         (Parameters::default_target): Remove.
12140         (set_parameters_target): Change parameter type to be non-const.
12141         (parameters_force_valid_target): New function.
12142         (parameters_clear_target): New function.
12143         * parameters.h (class Parameters): Update declarations.  Remove
12144         default_target method.  Add sized_target and clear_target
12145         methods.  Change target_ to be non-const.
12146         (set_parameters_target): Update declaration.
12147         (parameters_force_valid_target): Declare.
12148         (parameters_clear_target): Declare.
12149         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12150         as NULL if we aren't searching.
12151         (Add_symbols::run): Don't check for compatible target.
12152         * fileread.cc (Input_file::open_binary): Call
12153         parameters_force_valid_target.
12154         * gold.cc (queue_middle_tasks): Likewise.
12155         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12156         set_target on object.
12157         * dynobj.h (class Sized_dynobj): Update declarations.
12158         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12159         make_elf_object returns NULL.
12160         (Archive::include_member): Don't check whether object target is
12161         compatible.
12162         * output.cc (Output_section::add_input_section): Get target from
12163         parameters.
12164         (Output_section::relax_input_section): Likewise.
12165         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12166         parameters.
12167         (Sized_relobj::do_scan_relocs): Likewise.
12168         (Sized_relobj::relocate_sections): Likewise.
12169         * resolve.cc (Symbol_table::resolve): Likewise.
12170         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12171         parameter.  Change all callers.
12172         (Symbol_table::add_from_object): Get target from parameters.
12173         (Symbol_table::add_from_relobj): Don't check object target.
12174         (Symbol_table::add_from_dynobj): Likewise.
12175         (Symbol_table::define_special_symbol): Get target from
12176         parameters.
12177         * symtab.h (class Symbol_table): Update declaration.
12178         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12179         parameter.  Change all callers.  Clear parameter target.
12180         (Binary_test): Test target here.
12181         * testsuite/object_unittest.cc (gold_testsuite): Remove
12182         target_test_pointer parameter.  Change all callers.
12183         (Object_test): Test target here.
12184
12185 2009-09-26  Ian Lance Taylor  <iant@google.com>
12186
12187         * testsuite/initpri1.c: Don't try to use constructor priorities if
12188         compiling with gcc before 4.3.
12189
12190 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12191
12192         * testsuite/retain_symbols_file_test.sh (check_present): Change
12193         output file name to retain_symbols_file_test.stdout.
12194         (check_absent): Likewise.
12195
12196 2009-09-18  Craig Silverstein  <csilvers@google.com>
12197
12198         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12199         * options.cc: Include <cerrno> and <fstream>.
12200         (General_options::finalize): Parse -retain-symbols-file tag.
12201         * options.h: New flag.
12202         (General_options): New method should_retain_symbol, new
12203         variable symbols_to_retain.
12204         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12205         should_retain_symbol map.
12206         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12207         * testsuite/Makefile.in: Regenerate.
12208         * testsuite/retain_symbols_file_test.sh: New file.
12209
12210 2009-09-18  Nick Clifton  <nickc@redhat.com>
12211
12212         * po/es.po: Updated Spanish translation.
12213
12214 2009-09-17  Doug Kwan  <dougkwan@google.com>
12215
12216         * debug.h (DEBUG_RELAXATION): New constant.
12217         (DEBUG_ALL): Add DEBUG_RELAXATION.
12218         (debug_string_to_enum): Add relaxation debug option.
12219         * layout.cc
12220         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12221         Layout::Relaxation_debug_check::read_sections,
12222         Layout::Relaxation_debug_check::read_sections): New method definitions.
12223         (Layout::Layout): Initialize data members
12224         record_output_section_data_from_scrips_,
12225         script_output_section_data_list_ and relaxation_debug_check_.
12226         (Layout::save_segments, Layout::restore_segments,
12227         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12228         Layout::relaxation_loop_body): New method definitions.
12229         (Layout::finalize): Support relaxation.  Move section layout code to
12230         Layout::relaxation_loop_body.
12231         (Layout::set_asection_address_from_script): Move code for orphan
12232         section placement out.
12233         (Layout::place_orphan_sections_in_script): New method definition.
12234         * layout.h (Output_segment_headers, Output_file_header):
12235         New forward class declarations.
12236         (Layout::~Layout): Define.
12237         (Layout::new_output_section_data_from_script): New method definition.
12238         (Layout::place_orphan_sections_in_script): New method declaration.
12239         (Layout::Segment_states): New type declaration.
12240         (Layout::save_segments, Layout::restore_segments,
12241         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12242         Layout::relaxation_loop_body): New method declarations.
12243         (Layout::Output_section_data_list): New type declaration.
12244         (Layout::Relaxation_debug_check): New class definition.
12245         (Layout::record_output_section_data_from_script_,
12246         Layout::script_output_section_data_list_, Layout::segment_states_,
12247         Layout::relaxation_debug_check_): New data members.
12248         * output.cc: (Output_section_headers::do_size): New method definition.
12249         (Output_section_headers::Output_section_headers): Move size
12250         computation to Output_section_headers::do_size.
12251         (Output_segment_headers::do_size): New method definition.
12252         (Output_file_header::Output_file_header): Move size computation to
12253         Output_file_header::do_size and call it.
12254         (Output_file_header::do_size): New method definition.
12255         (Output_data_group::Output_data_group): Adjust call to
12256         Output_section_data.
12257         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12258         (Output_symtab_xindex::do_write): Add array bound check.
12259         (Output_section::Input_section::print_to_mapfile): Handle
12260         RELAXED_INPUT_SECTION_CODE.
12261         (Output_section::Output_section): Initialize data member checkpoint_.
12262         (Output_section::~Output_section): Delete checkpoint object pointed
12263         by checkpoint_.
12264         (Output_section::add_input_section): Always add an Input_section if
12265         relaxing.
12266         (Output_section::add_merge_input_section): Add assert.
12267         (Output_section::relax_input_section): New method definition.
12268         (Output_section::set_final_data_size): Set load address to zero for
12269         an unallocated section.
12270         (Output_section::do_address_and_file_offset_have_reset_values):
12271         New method definition.
12272         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12273         Handle relaxed input section.
12274         (Output_section::sort_attached_input_sections): Checkpoint input
12275         section list lazily.
12276         (Output_section::get_input_sections): Change type of input_sections to
12277         list of Simple_input_section pointers.  Checkpoint input section list
12278         lazily.  Also handle relaxed input sections.
12279         (Output_section::add_input_section_for_script): Take a reference to
12280         a Simple_input_section object instead of Relobj pointer and section
12281         index as parameter.  Handle relaxed input sections.
12282         (Output_section::save_states, Output_section::restore_states): New
12283         method definitions.
12284         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12285         (Output_data::is_data_size_fixed): New method definition.
12286         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12287         if it is fixed.
12288         (Output_data::address_and_file_offset_have_reset_values): New method
12289         definition.
12290         (Output_data::do_address_and_file_offset_have_reset_values): New method
12291         definition.
12292         (Output_data::set_data_size): Check that data size is not fixed.
12293         (Output_data::fix_data_size): New method definition.
12294         (Output_data::is_data_size_fixed_): New data member.
12295         (Output_section_headers::set_final_data_size): New method definition.
12296         (Output_section_headers::do_size): New method declaration.
12297         (Output_segment_headers::set_final_data_size): New method definition.
12298         (Output_segment_headers::do_size): New method declaration.
12299         (Output_file_header::set_final_data_size)::New method definition.
12300         (Output_file_header::do_size)::New method declaration.
12301         (Output_section_data::Output_section_data): Add new parameter
12302         is_data_size_fixed and use it to fix data size.
12303         (Output_data_const::Output_data_const): Adjust call to base class
12304         constructor and fix data size.
12305         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12306         base class constructor and fix data size.
12307         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12308         base class constructor and fix data size.
12309         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12310         class constructor and fix data size.
12311         (Output_data_group::set_final_data_size): New method definition.
12312         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12313         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12314         class constructor and fix data size.
12315         (Output_relaxed_input_section): New class definition.
12316         (Output_section::Simple_input_section): New class definition.
12317         (Output_section::get_input_sections): Adjust parameter list.
12318         (Output_section::add_input_section_for_script): Same.
12319         (Output_section::save_states, Output_section::restore_states,
12320         Output_section::do_address_and_file_offset_have_reset_values,
12321         (Output_section::Input_section::Input_section): Handle
12322         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12323         Output_relaxed_input_section.
12324         (Output_section::Input_section::is_input_section,
12325         Output_section::Input_section::set_output_section): Handle relaxed
12326         input section.
12327         (Output_section::Input_section::is_relaxed_input_section,
12328         Output_section::Input_section::output_section_data,
12329         Output_section::Input_section::relaxed_input_section): New method
12330         definitions.
12331         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12332         value.
12333         (Output_section::Input_section::u1_): Update comments.
12334         (Output_section::Input_section::u2_): Add new union member poris.
12335         (Output_section::Checkpoint_output_section): New classs definition.
12336         (Output_section::relax_input_section): New method declaration.
12337         (Output_section::checkpoint_): New data member.
12338         (Output_segment): Update comments.
12339         (Output_segment::Output_segment): Un-privatize copy constructor.
12340         (Output_segment::operator=): Un-privatize.
12341         * script-sections.cc (Output_section_element::Input_section_list):
12342         Change element type to Output_section::Simple_input_section.
12343         (Output_section_element_dot_assignment::set_section_addresses):
12344         Register output section data for relaxation clean up.
12345         (Output_data_exression::Output_data_expression): Adjust call to base
12346         constructor to fix data size.
12347         (Output_section_element_data::set_section_addresses): Register
12348         Output_data_expression object for relaxation clean up.
12349         (struct Input_section_info): Replace Relobj pointer and section index
12350         pair with Output_section::Simple_input_section and Convert struct to a
12351         class.
12352         (Input_section_sorter::operator()): Adjust access to
12353         Input_section_info data member to use accessors.
12354         (Output_section_element_input::set_section_addresses): Use layout
12355         parameter.  Adjust code to use Output_section::Simple_input_section
12356         and Input_secction_info classes.  Register filler for relaxation
12357         clean up.
12358         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12359         and section index pair with Output_section::Simple_input_section
12360         class.  Adjust code accordingly.
12361         (Phdrs_element::release_segment): New method definition.
12362         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12363         segment list.
12364         (Script_sections::release_segments): New method definition.
12365         * gold/script-sections.h (Script_sections::release_segments): New
12366         method declaration.
12367         * gold/target.h (Target::may_relax, Target::relax,
12368         Target::do_may_relax, Target::do_relax): New method definitions.
12369
12370 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12371
12372         * arm.cc (has_signed_unsigned_overflow): New function.
12373         (Arm_relocate_functions::abs8): New function.
12374         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12375         (Target_arm::Scan::global): Likewise.
12376         (Target_arm::relocate::relocate): Likewise.
12377         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12378         Likewise.
12379
12380 2009-09-16  Cary Coutant  <ccoutant@google.com>
12381
12382         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12383         * testsuite/Makefile.in: Regenerate.
12384
12385 2009-09-11  Nick Clifton  <nickc@redhat.com>
12386
12387         * po/gold.pot: Updated by the Translation project.
12388
12389 2009-09-08  Cary Coutant  <ccoutant@google.com>
12390
12391         * output.cc (Output_file::open): Add execute permission to empty file.
12392         * testsuite/Makefile.am (permission_test): New test.
12393         * testsuite/Makefile.in: Regenerate.
12394
12395 2009-09-02  Ian Lance Taylor  <iant@google.com>
12396
12397         * output.cc (Output_file::resize): Call map_no_anonymous rather
12398         than map.
12399
12400 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12401
12402         * gold.cc: Include "incremental.h".
12403         (queue_initial_tasks): Call Incremental_checker methods.
12404         * incremental.cc: Include "output.h".
12405         (Incremental_checker::can_incrementally_link_output_file): New
12406         method.
12407         * incremental.h (Incremental_checker): New class.
12408
12409         * output.cc (Output_file::open_for_modification): New method.
12410         (Output_file::map_anonymous): Changed return type to bool.  Record
12411         map in base_ field.
12412         (Output_file::map_no_anonymous): New method, broken out of map.
12413         (Output_file::map): Use map_no_anonymous and map_anonymous.
12414         * output.h (class Output_file): Update declarations.
12415
12416 2009-08-24  Cary Coutant  <ccoutant@google.com>
12417
12418         * options.h (Command_line::Pre_options): New class.
12419         (Command_line::pre_options): New member.
12420         * options.cc (gold::options::ready_to_register): New variable.
12421         (One_option::register_option): Do nothing if not registering options.
12422         Assert if same short option registered twice.
12423         (General_options::General_options): Turn off option registration when
12424         done constructing.
12425         (Command_line::Pre_options::Pre_options): New constructor.
12426
12427 2009-08-24  Cary Coutant  <ccoutant@google.com>
12428
12429         * options.h (General_options::no_keep_memory): Remove incorrect
12430         short option.
12431
12432 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12433
12434         * Makefile.am (am__skiplex, am__skipyacc): New.
12435         * Makefile.in: Regenerate.
12436
12437 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12438
12439         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12440         (INCLUDES): ... this.
12441         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12442         (AM_CPPFLAGS): Renamed from ...
12443         (INCLUDE): ... this.
12444         * Makefile.in, testsuite/Makefile.in: Regenerate.
12445
12446         * Makefile.in: Regenerate.
12447         * aclocal.m4: Likewise.
12448         * config.in: Likewise.
12449         * configure: Likewise.
12450         * testsuite/Makefile.in: Likewise.
12451
12452         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12453         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12454         * Makefile.in: Regenerate.
12455         * testsuite/Makefile.in: Regenerate.
12456
12457 2009-08-19  Cary Coutant  <ccoutant@google.com>
12458
12459         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12460         symbols in shared libraries overridden by hidden or internal symbols
12461         in the main program.
12462
12463 2009-08-19  Chris Demetriou  <cgd@google.com>
12464
12465         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12466         checking source file names in error messages.
12467
12468 2009-08-18  Doug Kwan  <dougkwan@google.com>
12469
12470         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12471         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12472         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12473         an elfcpp::Ehdr as parameter.
12474         * object.cc (Object::set_target): Remove the version that looks up
12475         a target and sets it.
12476         (Sized_relobj::setup): Take a Target object instead of
12477         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12478         (make_elf_sized_object): Find target and ask target to
12479         make an ELF object.
12480         * object.h: (Object::set_target): Remove the version that looks up
12481         a target and sets it.
12482         (Sized_relobj::setup): Take a Target object instead of
12483         an elfcpp:Ehdr as parameter.
12484         * target.cc: Include dynobj.h.
12485         (Target::do_make_elf_object_implementation): New.
12486         (Target::do_make_elf_object): New.
12487         * target.h (Target::make_elf_object): New template declaration.
12488         (Target::do_make_elf_object): New method declarations.
12489         (Target::do_make_elf_object_implementation): New template declaration.
12490
12491 2009-08-14  Ian Lance Taylor  <iant@google.com>
12492
12493         * gold.h (FUNCTION_NAME): Define.
12494         (gold_unreachable): Use FUNCTION_NAME.
12495
12496 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12497
12498         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12499         symbol in the --keep-unique list is not found.
12500
12501 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12502
12503         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12504         been maked as --keep-unique.
12505         (Icf::unfold_section): New function.
12506         * icf.h (Icf::unfold_section): New function.
12507         * options.h (General_options::keep_unique): New option.
12508         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12509         * testsuite/Makefile.in: Regenerate.
12510         * testsuite/icf_keep_unique_test.sh: New file.
12511         * testsuite/icf_keep_unique_test.cc: New file.
12512
12513 2009-08-12  Cary Coutant  <ccoutant@google.com>
12514
12515         PR 10471
12516         * resolve.cc (Symbol_table::resolve): Check for references from
12517         dynamic objects to hidden and internal symbols.
12518         * testsuite/Makefile.am (hidden_test.sh): New test.
12519         * testsuite/Makefile.in: Regenerate.
12520         * testsuite/hidden_test.sh: New script.
12521         * testsuite/hidden_test_1.c: New test source.
12522         * testsuite/hidden_test_main.c: New test source.
12523
12524 2009-08-11  Doug Kwan  <dougkwan@google.com>
12525
12526         * arm.cc: Update comments.
12527         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12528         segment to locate the .ARM.exidx section if present.
12529
12530 2009-08-09  Doug Kwan  <dougkwan@google.com>
12531
12532         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12533         patch.
12534
12535 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12536         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12537         compiler warnings.
12538
12539 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12540
12541         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12542         valid tls_segment only for non-debug-section relocations.
12543         * testsuite/Makefile.am: Add gc_tls_test.
12544         * testsuite/Makefile.in: Regenerate.
12545         * testsuite/gc_tls_test.cc: New file.
12546         * testsuite/gc_tls_test.sh: New file.
12547
12548 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12549
12550         * icf.cc: New file.
12551         * icf.h: New file.
12552         * Makefile.am (CCFILES): Add icf.cc.
12553         (HFILES): Add icf.h
12554         * Makefile.in: Regenerate.
12555         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12556         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12557         section, symbol and addend information for the relocs.
12558         * gold.cc (queue_middle_tasks): Call identical code folding.
12559         * gold.h: Add defines for multimap.
12560         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12561         to the call of finalize_local_symbols.
12562         * main.cc (main): Create object of class Icf.
12563         * object.cc (Sized_relobj::do_layout): Allow this function to be
12564         called twice during icf.
12565         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12566         to sections marked as identical by icf.
12567         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12568         when available.
12569         (Sized_relobj::do_section_entsize): New function.
12570         * object.h (Object::section_entsize): New function.
12571         (Object::do_section_entsize): New pure virtual function.
12572         (Relobj::finalize_local_symbols): Add new parameter.
12573         (Relobj::do_section_entsize): New function.
12574         * options.h (General_options::icf): New option.
12575         (General_options::icf_iterations): New option.
12576         (General_options::print_icf_sections): New option.
12577         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12578         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12579         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12580         icf.
12581         * symtab.cc (Symbol_table::is_section_folded): New function.
12582         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12583         to sections marked as identical by icf.
12584         * symtab.h (Symbol_table::set_icf): New function.
12585         (Symbol_table::icf): New function.
12586         (Symbol_table::is_section_folded): New function.
12587         (Symbol_table::icf_): New data member.
12588         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12589         * testsuite/Makefile.am: Add commands to build icf_test.
12590         * testsuite/Makefile.in: Regenerate.
12591         * testsuite/icf_test.sh: New file.
12592         * testsuite/icf_test.cc: New file.
12593
12594 2009-07-24  Chris Demetriou  <cgd@google.com>
12595
12596         * layout.cc (is_compressible_debug_section): Fix incorrect
12597         comment about compressed section names.
12598
12599 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12600
12601         PR 10419
12602         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12603
12604 2009-07-16  Ian Lance Taylor  <iant@google.com>
12605
12606         PR 10400
12607         * layout.h: #include <map>.
12608         (class Kept_section): Change from struct to class.  Add accessors
12609         and setters.  Add section size to Comdat_group mapping.  Change
12610         Comdat_group to std::map.  Add is_comdat_ field.  Add
12611         linkonce_size field in union.
12612         (class Layout): Update declaration of find_or_add_kept_section.
12613         Don't declare find_kept_object.
12614         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12615         parameter.  Add object, shndx, is_comdat, and is_group_name
12616         parameters.  Change all callers.  Adjust for new Kept_section.
12617         (Layout::find_kept_object): Remove.
12618         * object.cc (Sized_relobj::include_section_group): Update use of
12619         Kept_section.  Rename secnum to shndx.  Only record
12620         Kept_comdat_section if sections are the same size.
12621         (Sized_relobj::include_linkonce_section): Update use of
12622         Kept_section.  Only record Kept_comdat_section if sections are the
12623         same size.  Set size of linkonce section.
12624         (Sized_relobj::map_to_kept_section): Update call to
12625         get_kept_comdat_section.
12626         * object.h (class Sized_relobj): Rename fields in
12627         Kept_comdat_section to drop trailing underscores; change object
12628         field to Relobj*.  Change Kept_comdat_section_table to store
12629         struct rather than pointer.
12630         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12631         Add kept_object and kept_shndx parameters.  Change all callers.
12632         (Sized_relobj::get_kept_comdat_section): Change return type to
12633         bool.  Add kept_object and kept_shndx parameters.  Change all
12634         callers.
12635         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12636         Layout::find_or_add_kept_section.
12637
12638 2009-07-09  Ian Lance Taylor  <iant@google.com>
12639
12640         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12641         Reserve space in the hash table.
12642
12643 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12644
12645         * fileread.cc (File_read::get_mtime): New method.
12646         * fileread.h (Timespec): New structure.
12647         (File_read::get_mtime): New method.
12648         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12649         Renamed from timestamp_nsec.
12650         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12651         Elf_Xword.
12652         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12653         timestamp_nsec.
12654         (Incremental_inputs::report_archive): Save mtime; style fix.
12655         (Incremental_inputs::report_obejct): Save mtime; style fix.
12656         (Incremental_inputs::report_script): Save mtime; style fix.
12657         (Incremental_inputs::finalize_inputs): Style fix.
12658         (Incremental_inputs::finalize): Style fix.
12659         (Incremental_inputs::create_input_section_data): Store inputs
12660         mtime.
12661         * incremental.h (Incremental_inputs::report_script): Add mtime
12662         argument.
12663         (Incremental_inputs::Input_info::Input_info): Intialize only one
12664         union member.
12665         (Incremental_inputs::Input_info::archive): Move to nameless
12666         union.
12667         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12668         (Incremental_inputs::Input_info::script): Move to nameless union.
12669         (Incremental_inputs::mtime): New field.
12670         * script.cc (read_input_script): Pass file mtime to
12671         Incremental_input.
12672         * script.h (Script_info::inputs): Style fix.
12673
12674 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12675
12676         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12677         instead of 32.
12678
12679 2009-06-24  Ian Lance Taylor  <iant@google.com>
12680
12681         PR 10156
12682         * layout.cc (Layout::choose_output_section): If we find an
12683         existing section, update the flags.
12684         (Layout::create_notes): New function, broken out of
12685         Layout::finalize.
12686         (Layout::finalize): Don't create note sections.
12687         (Layout::create_note): Don't crash if linker script discards
12688         section.
12689         (Layout::create_gold_note): Likewise.
12690         (Layout::create_build_id): Likewise.  Don't set
12691         after_input_sections on the section.
12692         (Layout::create_executable_stack_info): Remove target parameter.
12693         Change caller.
12694         * layout.h (class Layout): Declare create_notes.  Update
12695         declaration of create_executable_stack_info.
12696         * gold.cc (queue_middle_tasks): Call create_notes.
12697         * output.cc (Output_section::update_flags_for_input_section): Move
12698         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12699         invalid.
12700         * output.h (Output_data::mark_address_invalid): New function.
12701         (class Output_section): Only declare, not define,
12702         update_flags_for_input_section.  Remove set_flags.
12703
12704 2009-06-24  Ian Lance Taylor  <iant@google.com>
12705
12706         * script-sections.cc (Output_section_definition::
12707         set_section_addresses): Rename shadowing local load_address to
12708         laddr.
12709
12710 2009-06-24  Ian Lance Taylor  <iant@google.com>
12711
12712         PR 10244
12713         * reloc.cc (relocate_sections): Skip empty relocation sections.
12714
12715 2009-06-23  Ian Lance Taylor  <iant@google.com>
12716
12717         PR 10156
12718         * layout.cc (Layout::create_note): Use choose_output_section
12719         rather than make_output_section.
12720
12721 2009-06-23  Ian Lance Taylor  <iant@google.com>
12722
12723         PR 10237
12724         * options.cc (General_options::parse_V): Set printed_version_.
12725         (General_options::General_options): Initialize printed_version_.
12726         * options.h (class General_options): Add printed_version_ field.
12727         * gold.cc (queue_initial_tasks): If there are no input files,
12728         don't give a fatal error if we printed the version information.
12729         (queue_middle_tasks): If using -r with a shared object, give a
12730         fatal error rather than an ordinary error.
12731
12732 2009-06-23  Ian Lance Taylor  <iant@google.com>
12733
12734         PR 10219
12735         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12736         (Layout::make_output_section): Set have_stabstr_section_ if we see
12737         a .stab*str section.
12738         (Layout::finalize): Call link_stabs_sections.
12739         (Layout::link_stabs_sections): New file.
12740         * layout.h (class Layout): Add have_stabstr_section_ field.
12741         Declare link_stabs_sections.
12742
12743 2009-06-23  Doug Kwan  <dougkwan@google.com>
12744
12745         * Makefile.am (libgold_a_LIBADD): New.
12746         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12747         * Makefile.in: Regenerate.
12748         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12749         * configure: Regenerate.
12750         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12751         * fileread.cc: Include sys/state.h
12752         * gold.h: Declare memmem and strndup if found missing.
12753         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12754
12755 2009-06-23  Ian Lance Taylor  <iant@google.com>
12756
12757         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12758         * configure: Rebuild.
12759
12760 2009-06-23  Ian Lance Taylor  <iant@google.com>
12761
12762         PR 10147
12763         * object.cc (Object::section_contents): Don't try to get a view if
12764         the section has length zero.
12765         (Object::handle_gnu_warning_section): If the section is empty, use
12766         the name of the section as the warning.
12767
12768 2009-06-23  Ian Lance Taylor  <iant@google.com>
12769
12770         PR 10133
12771         * stringpool.h (class Stringpool_template): Add optimize_ field.
12772         (Stringpool_template::set_optimize): New function.
12773         * stringpool.cc (Stringpool_template::Stringpool_template):
12774         Initialize optimize_ field.
12775         (Stringpool_template::set_string_offsets): Test local optimize
12776         fild rather than parameter.
12777         * layout.cc (Layout::Layout): Call set_optimize on the section
12778         name stringpool.
12779
12780 2009-06-22  Ian Lance Taylor  <iant@google.com>
12781
12782         PR 10030
12783         * yyscript.y: Parse TARGET.
12784         * script.cc (script_set_target): New function.
12785         * script-c.h (script_set_target): Declare.
12786         * options.cc (General_options::string_to_object_format): Rename
12787         from string_to_object_format in anonymous namespace.  Change
12788         callers.
12789         * options.h (class General_options): Declare
12790         string_to_object_format.
12791
12792 2009-06-22  Ian Lance Taylor  <iant@google.com>
12793
12794         * script-sections.cc (Script_sections::create_segments): Don't put
12795         program headers in a PT_LOAD segment if -n or -N.
12796
12797 2009-06-22  Ian Lance Taylor  <iant@google.com>
12798
12799         PR 10141
12800         * options.h (class General_options): Add -z lazy and -z now.  Sort
12801         -z options into alphabetical order.
12802         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12803
12804 2009-06-21  Ian Lance Taylor  <iant@google.com>
12805
12806         * layout.cc (Layout::make_output_section): Call
12807         Target::new_output_section.
12808         (Layout::attach_allocated_section_to_segment): Put large section
12809         sections in a separate load segment with the large segment flag
12810         set.
12811         (Layout::segment_precedes): Sort large data segments after other
12812         load segments.
12813         (align_file_offset): New static function.
12814         (Layout::set_segment_offsets): Use align_file_offset.
12815         * output.h (class Output_section): Add is_small_section_ and
12816         is_large_section_ fields.
12817         (Output_section::is_small_section): New function.
12818         (Output_section::set_is_small_section):  New function.
12819         (Output_section::is_large_section): New function.
12820         (Output_section::set_is_large_section): New function.
12821         (Output_section::is_large_data_section): New function.
12822         (class Output_segment): Add is_large_data_segment_ field.
12823         (Output_segment::is_large_data_segment): New function.
12824         (Output_segment::set_is_large_data_segment): New function.
12825         * output.cc (Output_section::Output_section): Initialize new
12826         fields.
12827         (Output_segment::Output_segment): Likewise.
12828         (Output_segment::add_output_section): Add assertion that large
12829         data sections always go in large data segments.  Force small data
12830         sections to the end of the list of data sections.  Force small BSS
12831         sections to the start of the list of BSS sections.  For large BSS
12832         sections to the end of the list of BSS sections.
12833         * symtab.h (class Symbol): Declare is_common_shndx.
12834         (Symbol::is_defined): Check Symbol::is_common_shndx.
12835         (Symbol::is_common): Likewise.
12836         (class Symbol_table): Define enum Commons_section_type.  Update
12837         declarations.  Add small_commons_ and large_commons_ fields.
12838         * symtab.cc (Symbol::is_common_shndx): New function.
12839         (Symbol_table::Symbol_table): Initialize new fields.
12840         (Symbol_table::add_from_object): Put small and large common
12841         symbols in the right list.
12842         (Symbol_table::sized_finalized_symbol): Check
12843         Symbol::is_common_shndx.
12844         (Symbol_table::sized_write_globals): Likewise.
12845         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12846         common symbol lists.  Don't call do_allocate_commons_list if the
12847         list is empty.
12848         (Symbol_table::do_allocate_commons_list): Remove is_tls
12849         parameter.  Add comons_section_type parameter.  Change all
12850         callers.  Handle small and large common symbols.
12851         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12852         Symbol::is_common_shndx.
12853         * resolve.cc (symbol_to_bits): Likewise.
12854         * target.h (Target::small_common_shndx): New function.
12855         (Target::small_common_section_flags): New function.
12856         (Target::large_common_shndx): New function.
12857         (Target::large_common_section_flags): New function.
12858         (Target::new_output_section): New function.
12859         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12860         small_common_section_flags, and large_common_section_flags
12861         fields.
12862         (Target::do_new_output_section): New virtual function.
12863         * arm.cc (Target_arm::arm_info): Initialize new fields.
12864         * i386.cc (Target_i386::i386_info): Likewise.
12865         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12866         Likewise.
12867         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12868         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12869         (Target_x86_64::do_new_output_section): New function.
12870         * configure.ac: Define conditional MCMODEL_MEDIUM.
12871         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12872         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12873         (large_LDFLAGS): Define.
12874         * testsuite/large.c: New file.
12875         * testsuite/testfile.cc (Target_test::test_target_info):
12876         Initialize new fields.
12877         * configure, testsuite/Makefile.in: Rebuild.
12878
12879 2009-06-05  Doug Kwan  <dougkwan@google.com>
12880
12881         * Makefile.am (CCFILES): Add target.cc.
12882         * Makefile.in: Regenerate.
12883         * i386.cc (class Target_i386): Define new virtual method to
12884         override do_is_local_label_name in parent.
12885         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12886         local symbols if --discard-locals or -X is given.
12887         * options.h (class General_options): Declare new options
12888         '--discard-locals' and '-X' for discarding locals.
12889         * target.h (class Target): Define new methods is_local_label_name.
12890         Declare new virtual method do_is_local_label_name.
12891         * target.cc: New file.
12892         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12893         (check_SCRIPTS): Add discard_locals_test.sh.
12894         (check_DATA): Add discard_local_tests.syms.
12895         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12896         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12897         * testsuite/Makefile.in: Regenerate.
12898         * testsuite/discard_locals_test.c: New file.
12899         * testsuite/discard_locals_test.sh: Same.
12900
12901 2009-06-05  Doug Kwan  <dougkwan@google.com>
12902
12903         * object.cc (Sized_relobj::Sized_relobj): Initialize
12904         discarded_eh_frame_shndx_ to -1U.
12905         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12906         section.
12907         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12908         a discarded .eh_frame section.
12909         (Sized_relobj::do_finalize_local_symbols): Ditto.
12910         * object.h (class Sized_relobj): Declare new member
12911         discarded_eh_frame_shndx_.
12912         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12913         (local_labels_test.o, local_labels_test): New rules.
12914         * testsuite/Makefile.in: Regenerate.
12915
12916 2009-06-04  Doug Kwan  <dougkwan@google.com>
12917
12918         * layout.cc (Layout::section_name_mapping): Add mapping for
12919         special ARM sections.
12920
12921 2009-06-03  Doug Kwan  <dougkwan@google.com>
12922
12923         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12924         (utils::has_overflow): Same.
12925
12926 2009-06-03  Ian Lance Taylor  <iant@google.com>
12927
12928         * layout.cc (Layout::section_name_mapping): New array, replacing
12929         Layout::linkonce_mapping.
12930         (Layout::section_name_mapping_count): New variable, replacing
12931         Layout::linkonce_mapping_count.
12932         (Layout::linkonce_output_name): Remove.
12933         (Layout::output_section_name): Rewrite.
12934         * layout.h (class Layout): Rename Linkonce_mapping to
12935         Section_name_mapping, linkonce_mapping to section_name_mapping,
12936         linkonce_mapping_count to section_name_mapping_count.  Don't
12937         declare linkonce_output_name.
12938
12939 2009-06-03  Doug Kwan  <dougkwan@google.com>
12940
12941         * gold/arm.cc (namespace utils): New.
12942         (Target_arm::reloc_is_non_pic): Define new method.
12943         (class Arm_relocate_functions): New.
12944         (Target_arm::Relocate::relocate): Handle relocation types used by
12945         Android.
12946
12947 2009-06-03  Ian Lance Taylor  <iant@google.com>
12948
12949         * arm.cc (Target_arm::scan::global): Use || instead of |.
12950
12951 2009-06-02  Doug Kwan  <dougkwan@google.com>
12952
12953         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12954         issued_non_pic_error_.
12955         (class Target_arm::Scan): Declare new method check_non_pic.
12956         Define new method symbol_needs_plt_entry.
12957         Declare new data member issued_non_pic_error_.
12958         (class Target_arm::Relocate): Declare new method
12959         should_apply_static_reloc.
12960         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12961         (Target_arm::Scan::check_non_pic): Define new method.
12962         (Target_arm::Scan::local): Handle a small subset of reloc types used
12963         by Android.
12964         (Target_arm::Scan::local): Same.
12965         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12966
12967 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12968
12969         * incremental.cc (Incremental_inputs::report_command_line): Filter
12970         out --incremental-* options.
12971
12972 2009-05-29  Doug Kwan  <dougkwan@google.com>
12973
12974         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12975         template class.
12976         (class Target_arm): Update comment.
12977         (Target_arm::Target_arm): Initialize new data members GOT_,
12978         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12979         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12980         and Target_arm::rel_dyn_section.
12981         Declare new_enum Target_arm::Got_type.
12982         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12983         and DYNBSS_.
12984         Update commments for member do_dynsym_value.
12985         (Target_arm::got_size, Target_arm::plt_section,
12986         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12987         new methods inside class defintion.
12988         (Target_arm::got_section): Define new method.
12989         (Target_arm::rel_dyn_section): Same.
12990         (Output_data_plt_arm): New template class.
12991         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12992         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12993         (Output_data_plt_arm::add_entry): Same.
12994         (Output_data_plt_arm::first_plt_entry): Define new
12995         static data member for PLT instruction template.
12996         (Output_data_plt_arm::plt_entry): Same.
12997         (Output_data_plt_arm::do_write): Define new method.
12998         (Target_arm::make_plt_entry): Same.
12999         (Target_arm::do_finalize_sections): Same.
13000         (Target_arm::do_dynsym_value): Same.
13001
13002 2009-05-28  Doug Kwan  <dougkwan@google.com>
13003
13004         * Makefile.am (TARGETSOURCES): Add arm.cc.
13005         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
13006         * Makefile.in: Regenerate.
13007         * arm.cc: New file.
13008         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
13009
13010 2009-05-26  Doug Kwan  <dougkwan@google.com>
13011
13012         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
13013         (General_options::check_excluded_libs): Strip off directories in
13014         archive name before matching like GNU ld does.
13015         * testsuite/Makefile.am (MOSTLYCLEANFILES,
13016         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
13017         (exclude_libs_test_LDFLAGS): Add linker option
13018         -Wl,--exclude-libs,libexclude_libs_test_3
13019         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
13020         an explicit archive without using -l.
13021         (alt/libexclude_libs_test_3.a): New make rule.
13022         * testsuite/Makefile.in: Regenerate.
13023         * testsuite/exclude_libs_test.c : Declare lib3_default().
13024         (main): Call it.
13025         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
13026         * exclude_libs_test_3.c: New file.
13027
13028 2009-05-26  Nick Clifton  <nickc@redhat.com>
13029
13030         * po/id.po: New Indonesian translation.
13031         * po/gold.pot: Updated template file.
13032
13033 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13034
13035         * testsuite/Makefile.am: Add -ffunction-sections to compile
13036         gc_comdat_test files.  Add -Wl,--gc-sections to build
13037         gc_comdat_test.
13038         * testsuite/Makefile.in: Regenerate.
13039         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13040
13041 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13042
13043         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13044         kept comdat section was garbage collected.
13045         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13046         * testsuite/Makefile.in: Regenerate.
13047         * testsuite/gc_comdat_test.sh: New file.
13048         * testsuite/gc_comdat_test_1.cc: New file.
13049         * testsuite/gc_comdat_test_2.cc: New file.
13050
13051 2009-05-19  Doug Kwan  <dougkwan@google.com>
13052
13053         * archive.cc (Archive::Archive): Move constructor from archive.h
13054         to here.  Initialize no_export_.
13055         (Archive::get_elf_object_for_member): Set no_export flag of object.
13056         * archive.h (Archive::Archive): Move constructor body to
13057         archive.cc.
13058         (Archive::no_export): New method.
13059         (Archive::no_export_): New field.
13060         * object.h (Object::Object): Initialize no_export_ to false.
13061         (Object::no_export, Object::set_no_export): New methods.
13062         (Object::no_export_): New field.
13063         * options.cc (General_options::parse_exclude_libs): New method.
13064         (General_options::check_excluded_libs) Same.
13065         * options.h (exclude_libs): New option.
13066         (General_options::check_excluded_libs): New method declaration.
13067         (General_options::excluded_libs_): New field.
13068         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13069         default or protected visibility if an object has no-export flag set.
13070         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13071         (check_SCRIPTS): Add exclude_libs_test.sh.
13072         (check_DATA): Add exclude_libs_test.syms.
13073         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13074         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13075         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13076         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13077         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13078         libexclude_libs_test_2.a): New rules.
13079         * testsuite/Makefile.in: Regenerate.
13080         * testsuite/exclude_libs_test.c: New file.
13081         * testsuite/exclude_libs_test.sh: Ditto.
13082         * testsuite/exclude_libs_test_1.c: Ditto.
13083         * testsuite/exclude_libs_test_2.c: Ditto.
13084
13085 2009-05-15  Ian Lance Taylor  <iant@google.com>
13086
13087         * configure.ac: Check for declarations for cases where libiberty.h
13088         checks HAVE_DECL_xxx.
13089         * configure, config.in: Rebuild.
13090
13091 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13092
13093         * gold.h (Incremental_argument_list): Remove (invalid) forward
13094         declaration.
13095         * incremental.cc (Incremental_inputs::report_achive): New method.
13096         (Incremental_inputs::report_object): New method.
13097         (Incremental_inputs::report_script): New method.
13098         (Incremental_inputs::finalize_inputs): New method.
13099         (Incremental_inputs::finalize): Call finalize_inputs().
13100         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13101         Create inputs entries.
13102         * incremental.h (Incremental_input_type): New enum.
13103         (Incremental_inputs::Incremental_input): Initialize new fields.
13104         (Incremental_inputs::report_inputs): New method.
13105         (Incremental_inputs::report_achive): New method.
13106         (Incremental_inputs::report_object): New method.
13107         (Incremental_inputs::report_script): New method.
13108         (Incremental_inputs::finalize_inputs): New method.
13109         (Incremental_inputs::Input_info): New struct.
13110         (Incremental_inputs::Input_info_map): New typedef.
13111         (Incremental_inputs::lock_): New field.
13112         (Incremental_inputs::Inputs_): New field.
13113         (Incremental_inputs::Inputs_map): New field.
13114         * main.cc (main): Call Incremental_input::report_inputs.
13115         * options.h (Input_argument_list): Typedef moved from
13116         Input_arguments.
13117         (Input_file_group::Files): Remove, use ::Input_argument_list.
13118         (Input_file_group::Input_argument_list): Remove, use
13119         ::Input_argument_list.
13120         * plugin.cc (Plugin_manager::add_input_file): Add error in
13121         incremental build.
13122         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13123         functions.
13124         * script.cc (read_input_script): Call
13125         Incremental_input::report_script.
13126         * script.h (Script_info): New class.
13127
13128 2009-04-27  Ian Lance Taylor  <iant@google.com>
13129
13130         * x86_64.cc (do_adjust_output_section): Set entsize to
13131         plt_entry_size.
13132
13133 2009-04-23  Elliott Hughes  <enh@google.com>
13134
13135         * output.cc (Output_file::close): After short writes, continue
13136         writing from the correct offset in the buffer being written.
13137
13138 2009-04-23  Chris Demetriou  <cgd@google.com>
13139
13140         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13141         * configure: Regenerate.
13142         * config.in: Regenerate.
13143         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13144         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13145
13146 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13147
13148         * incremental.cc (Incremental_inputs_header_data): Renamed from
13149         Incremental_input_header_data.
13150         (Incremental_inputs_header_data::data_size): New field.
13151         (Incremental_inputs_header_data::put_input_file_count): Renamed
13152         from input_file_count.
13153         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13154         from command_line_offset.
13155         (Incremental_inputs_header_data::put_reserved): Renamed from
13156         put_reserved.
13157         (Incremental_inputs_entry_data): Renamed from
13158         Incremental_input_entry_data.
13159         (Incremental_inputs_entry_data::data_size): New field.
13160         (Incremental_inputs::report_command_line): New method.
13161         (Incremental_inputs::finalize): New method.
13162         (Incremental_inputs::create_incremental_inputs_data): New method.
13163         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13164         * incremental.h: New file.
13165         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13166         (Layout::finalize): Create incremental inputs section in
13167         incremental builds.
13168         (Layout::create_incremental_info_sections): New method.
13169         * layout.h (Layout::incremental_inputs): New method.
13170         (Layout::create_incremental_info_sections): New method.
13171         (Layout::incremental_inputs_): New field.
13172         * main.cc (main): Notify Incremental_input of the command line.
13173
13174 2009-04-01  Ian Lance Taylor  <iant@google.com>
13175             Mikolaj Zalewski  <mikolajz@google.com>
13176
13177         * gold.h (reserve_unordered_map): Define, three versions, one for
13178         each version of Unordered_map.
13179         * layout.cc (Layout::Layout): Remove options parameter.  Add
13180         number_of_input_files parameter.  Don't initialize options_.
13181         Initialize number_of_input_files_ and resized_signatures_.  Move
13182         sections_are_attached_.
13183         (Layout::layout_group): Reserve space for group_signatures_.
13184         (Layout::find_or_add_kept_section): Change name parameter to be a
13185         reference.  Resize signatures_ map when it gets large enough.
13186         (Layout::layout_eh_frame): Use parameters->options() instead of
13187         this->options_.
13188         (Layout::make_output_section): Likewise.
13189         (Layout::attach_allocated_section_to_segment): Likewise.
13190         (Layout::finalize, Layout::create_executable_stack): Likewise.
13191         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13192         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13193         * layout.h (class Layout): Update declarations.  Remove options_
13194         field.  Add number_of_input_files_ and resized_signatures_
13195         fields.  Move sections_are_attached_ field.
13196         * main.cc (main): Pass number of input files to Layout
13197         constructor.  Don't pass options.
13198
13199 2009-03-30  Ian Lance Taylor  <iant@google.com>
13200
13201         * ffsll.c (ffsll): Correct implementation.
13202
13203 2009-03-27  Ian Lance Taylor  <iant@google.com>
13204
13205         * ffsll.c: New file.
13206         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13207         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13208         * ftruncate.c (ftruncate): Declare before definition.
13209         * mremap.c (mremap): Likewise.
13210         * pread.c (pread): Likewise.
13211         * configure, Makefile.in, config.in: Rebuild.
13212
13213         * mremap.c: New file.
13214         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13215         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13216         (mremap): Declare if HAVE_MREMAP is not defined.
13217         * configure, Makefile.in, config.in: Rebuild.
13218
13219 2009-03-27  Cary Coutant  <ccoutant@google.com>
13220
13221         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13222         position independent.
13223         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13224         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13225
13226 2009-03-24  Cary Coutant  <ccoutant@google.com>
13227
13228         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13229         an executable.
13230         (needs_dynamic_reloc): Likewise.
13231
13232 2009-03-24  Ian Lance Taylor  <iant@google.com>
13233
13234         * yyscript.y (file_cmd): Recognize EXTERN.
13235         (extern_name_list, extern_name_list_body): New nonterminals.
13236         * script.cc (script_add_extern): Define.
13237         * script-c.h (script_add_extern): Declare.
13238
13239 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13240
13241         * object.cc (is_elf_object): Define.
13242         * object.h (is_elf_object): Declare.
13243         * archive.cc (Archive::get_elf_object_for_member): Call
13244         is_elf_object.
13245         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13246
13247 2009-03-24  Elliott Hughes  <enh@google.com>
13248
13249         * output.cc (Output_file::map_anonymous): Define.
13250         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13251         try an anonymous one.  Report the size if the mmap fails.
13252         * output.h (class Output_file): Declare map_anonymous.
13253
13254 2009-03-24  Ian Lance Taylor  <iant@google.com>
13255
13256         * target-select.cc (instantiate_target): Don't acquire the lock if
13257         the instantiated_target_ field has already been set.
13258
13259 2009-03-23  Ian Lance Taylor  <iant@google.com>
13260
13261         * gold-threads.h (class Initialize_lock): Define.
13262         * gold-threads.cc (class Initialize_lock_once): Define.
13263         (initialize_lock_control): New static variable.
13264         (initialize_lock_pointer): New static variable.
13265         (initialize_lock_once): New static function.
13266         (Initialize_lock::Initialize_lock): Define.
13267         (Initialize_lock::initialize): Define.
13268         * target-select.h: Include "gold-threads.h".
13269         (class Target_selector): Add lock_ and initialize_lock_ fields.
13270         Don't define instantiate_target, just declare it.
13271         * target-select.cc (Target_selector::Target_selector): Initialize
13272         new fields.
13273         (Target_selector::instantiate_target): Define.
13274         * descriptors.h: Include "gold-threads.h".
13275         (class Descriptors): Add initialize_lock_ field.
13276         * descriptors.cc (Descriptors::Descriptors): Initialize new
13277         field.
13278         (Descriptors::open): Use initialize_lock_ field
13279         * errors.h (class Errors): Add initialize_lock_ field.
13280         * errors.cc (Errors::Errors): Initialize new field.
13281         (Errors::initialize_lock): Use initialize_lock_ field.
13282         * powerpc.cc (class Target_selector_powerpc): Remove
13283         instantiated_target_ field.  In do_recognize call
13284         instantiate_target rather than do_instantiate_target.  In
13285         do_instantiate_target just allocate a new target.
13286         * sparc.cc (class Target_selector_sparc): Likewise.
13287
13288         * freebsd.h: New file.
13289         * i386.cc: Include "freebsd.h".
13290         (Target_i386): Derive from Target_freebsd rather than
13291         Sized_target.
13292         (Target_selector_i386): Derive from Target_selector_freebsd rather
13293         than Target_selector.
13294         * x86_64.cc: Include "freebsd.h".
13295         (Target_x86_64): Derive from Target_freebsd rather than
13296         Sized_target.
13297         (Target_selector_x86_64): Derive from Target_selector_freebsd
13298         rather than Target_selector.
13299         * target.h (class Target): Add adjust_elf_header and
13300         do_adjust_elf_header.
13301         * output.cc (Output_file_header:: do_sized_write): Call target
13302         adjust_elf_header routine.
13303         * configure.tgt: Set targ_osabi.
13304         * configure.ac: Define GOLD_DEFAULT_OSABI.
13305         * parameters.cc (Parameters::default_target): Pass
13306         GOLD_DEFAULT_OSABI to select_target.
13307         * target-select.h (class Target_selector): Make instantiate_target
13308         protected rather than private.
13309         * Makefile.am (HFILES): Add freebsd.h.
13310         * configure, Makefile.in, config.in: Rebuild.
13311
13312         * merge.cc (do_add_input_section): Correct pend value.  Change
13313         message about last entry not being null terminated from error to
13314         warning.
13315
13316 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13317
13318         * incremental.cc: New file.
13319         * Makefile.am (CCFILES): Add incremental.cc.
13320         * Makefile.in: Rebuild.
13321
13322 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13323
13324         * layout.cc (Layout::output_section_name): Preserve names
13325         of '.note.' sections.
13326
13327 2009-03-19  Ian Lance Taylor  <iant@google.com>
13328
13329         * descriptors.cc (Descriptors::open): Check that the options are
13330         valid before using them.
13331
13332 2009-03-18  Ian Lance Taylor  <iant@google.com>
13333
13334         * script-sections.h: Include <list>.
13335         (class Script_sections): Change Sections_elements from std::vector
13336         to std::list.  Typedef public Elements_iterator.  Add
13337         orphan_section_placement_, data_segment_align_start_, and
13338         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13339         field.
13340         * script-sections.cc (class Orphan_section_placement): New class.
13341         (class Sections_element): Add virtual functions is_relro and
13342         orphan_section_init.  Remove virtual function place_orphan_here.
13343         (class Output_section_definition): Add is_relro and
13344         orphan_section_init.  Remove place_orphan_here.
13345         (class Orphan_output_section): Likewise.
13346         (Script_sections::Script_sections): Update for field changes.
13347         (Script_sections::data_segment_align): Set saw_data_segment_align_
13348         and data_segment_align_start_, not data_segment_align_index.
13349         (Script_sections::data_segment_relro_end): Check
13350         saw_data_segment_align_.  Use data_segment_align_start_ rather
13351         than data_segment_align_index_.
13352         (Script_sections::place_orphan): Rewrite to use
13353         Orphan_section_placement.
13354
13355 2009-03-17  Ian Lance Taylor  <iant@google.com>
13356
13357         * archive.cc (Archive::add_symbols): Check for a version attached
13358         to the symbol name in the archive map.
13359         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13360         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13361         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13362         (ver_test_11.a): New target.
13363         * testsuite/Makefile.in: Rebuild.
13364
13365         * configure.ac: Check for chsize and posix_fallocate.  Replace
13366         ftruncate.
13367         * ftruncate.c: New file, from gnulib.
13368         * output.cc (posix_fallocate): Define dummy version if not
13369         HAVE_POSIX_FALLOCATE.
13370         (Output_file::map): Call posix_fallocate rather than lseek and
13371         write.
13372         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13373         * configure, Makefile.in, config.in: Rebuild.
13374
13375 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13376
13377         * layout.h (Layout::create_note): Add section_name parameter.
13378         * layout.cc (Layout::create_note): Likewise.
13379         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13380
13381 2009-03-17  Ian Lance Taylor  <iant@google.com>
13382
13383         * descriptors.cc: Include "options.h".
13384         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13385         (Descriptors::open): Always use O_CLOEXEC when opening a new
13386         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13387         then set FD_CLOEXEC.
13388
13389         * sparc.cc (class Target_sparc): Add has_got_section.
13390         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13391         make sure we have a GOT section.
13392
13393         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13394         (Target_sparc::Scan::local): Likewise.
13395         (Target_sparc::Scan::global): Likewise.
13396         (Target_sparc::Relocate::relocate): Likewise.
13397         (Target_sparc::Relocate::relocate_tls): Likewise.
13398
13399         * symtab.cc (Symbol_table::define_default_version): New function,
13400         broken out of add_from_object.
13401         (Symbol_table::add_from_object): Call define_default_version.
13402         (Symbol_table::define_special_symbol): Add resolve_oldsym
13403         parameter.  Change all callers.  If the version for a symbol comes
13404         from a version script, resolve it with the symbol with the same
13405         name with no version.  Also add the symbol without a version if
13406         appropriate.
13407         (do_define_in_output_data): If resolving with oldsym, don't delete
13408         sym.
13409         (do_define_in_output_segment): Likewise.
13410         (do_define_as_constant): Likewise.
13411         * symtab.h (class Symbol_table): Update declarations.
13412
13413 2009-03-13  Ian Lance Taylor  <iant@google.com>
13414
13415         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13416         (Read_symbols::requeue): New function.
13417         (Read_symbols::do_read_symbols): If make_elf_object fails because
13418         the target type is not configured, and the file was searched for,
13419         issue a warning and retry with the next directory.
13420         (Add_symbols::run): If the file has an incompatible format, and
13421         it was searched for, requeue the Read_symbols task.  On error,
13422         release the object.
13423         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13424         dirindex parameter to constructor.  Change all callers.  Declare
13425         incompatible_warning and requeue.
13426         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13427         input_argument_ and input_group_ fields.  Add them to
13428         constructor.  Change all callers.
13429         (class Read_script): Add dirindex_ field.  Add it to constructor.
13430         Change all callers.
13431         * archive.cc (Archive::setup): Remove input_objects parameter.
13432         Change all callers.
13433         (Archive::get_file_and_offset): Likewise.
13434         (Archive::read_all_symbols): Likewise.
13435         (Archive::read_symbols): Likewise.
13436         (Archive::get_elf_object_for_member): Remove input_objects
13437         parameter.  Add punconfigured parameter.  Change all callers.
13438         (Archive::add_symbols): Change return type to bool.  Check return
13439         value of include_member.
13440         (Archive::include_all_members): Likewise.
13441         (Archive::include_member): Change return type to bool.  Return
13442         false if first included object has incompatible target.  Set
13443         included_member_ field.
13444         (Add_archive_symbols::run): If add_symbols returns false, requeue
13445         Read_symbols task.
13446         * archive.h (class Archive): Add included_member_ field.
13447         Initialize it in constructor.  Add input_file and searched_for
13448         methods.  Update declarations.
13449         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13450         input_argument_ fields.  Add them to constructor.  Change all
13451         callers.
13452         * script.cc: Include "target-select.h".
13453         (class Parser_closure): Add skip_on_incompatible_target_ and
13454         found_incompatible_target_ fields.  Add
13455         skip_on_incompatible_target parameter to constructor.  Change all
13456         callers.  Add methods skip_on_incompatible_target,
13457         clear_skip_on_incompatible_target, found_incompatible_target, and
13458         set_found_incompatible_target.
13459         (read_input_script): Add dirindex parameter.  Change all callers.
13460         If parser finds an incompatible target, requeue Read_symbols
13461         task.
13462         (script_set_symbol): Clear skip_on_incompatible_target in
13463         closure.
13464         (script_add_assertion, script_parse_option): Likewise.
13465         (script_start_sections, script_add_phdr): Likewise.
13466         (script_check_output_format): New function.
13467         * script.h (read_input_script): Update declaration.
13468         * script-c.h (script_check_output_format): Declare.
13469         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13470         (ignore_cmd): Remove OUTPUT_FORMAT.
13471         * fileread.cc (Input_file::Input_file): Add explicit this.
13472         (Input_file::will_search_for): New function.
13473         (Input_file::open): Add pindex parameter.  Change all callers.
13474         * fileread.h (class Input_file): Add input_file_argument method.
13475         Declare will_search_for.  Update declarations.
13476         * object.cc (make_elf_object): Add punconfigured parameter.
13477         Change all callers.
13478         * object.h (class Object): Make input_file public.  Add
13479         searched_for method.
13480         (make_elf_object): Update declaration.
13481         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13482         restart search.
13483         * dirsearch.h (class Dirsearch): Update declaration.
13484         * options.h (class General_options): Add --warn-search-mismatch.
13485         * parameters.cc (Parameters::is_compatible_target): New function.
13486         * parameters.h (class Parameters): Declare is_compatible_target.
13487         * workqueue.cc (Workqueue::add_blocker): New function.
13488         * workqueue.h (class Workqueue): Declare add_blocker.
13489
13490         * fileread.cc (Input_file::open): Remove options parameter.
13491         Change all callers.
13492         (Input_file::open_binary): Likewise.
13493         * script.cc (read_input_script): Likewise.
13494         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13495         options parameter from constructor.  Change all callers.
13496         (class Read_script): Likewise.
13497         * fileread.h (class Input_file): Update declarations.
13498         * script.h (read_input_script): Update declaration.
13499
13500 2009-03-10  Nick Clifton  <nickc@redhat.com>
13501
13502         * po/es.po: New Spanish translation.
13503
13504 2009-03-06  Cary Coutant  <ccoutant@google.com>
13505
13506         * options.cc (parse_short_option): Keep dash_z from registering itself.
13507
13508 2009-03-03  Ian Lance Taylor  <iant@google.com>
13509
13510         PR 9918
13511         * target-reloc.h (relocate_section): Pass output_section to
13512         relocate.
13513         * i386.cc (Target_i386::should_apply_static_reloc): Add
13514         output_section parameter.  Change all callers.
13515         (Target_i386::Relocate::relocate): Add output_section parameter.
13516         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13517         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13518         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13519         * testsuite/two_file_shared.sh: New script.
13520         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13521         (check_DATA): Add two_file_shared.dbg.
13522         (two_file_shared.dbg): New target.
13523         * testsuite/Makefile.in: Rebuild.
13524
13525 2009-03-01  Ian Lance Taylor  <iant@google.com>
13526
13527         * configure.ac: Check for byteswap.h.
13528         * configure: Rebuild.
13529         * config.in: Rebuild.
13530
13531 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13532
13533         * layout.cc (Layout::find_or_add_kept_section): New function.
13534         (Layout::add_comdat): Removed.
13535         * layout.h (struct Kept_section): Move out of class Layout.
13536         Remove trailing underscores from field names.  Add group_sections
13537         field.  Rename group_ field to is_group.  Change all uses.
13538         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13539         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13540         comdat_groups_ field.
13541         (Sized_relobj::include_section_group): Use
13542         find_or_add_kept_section and Kept_section::group_sections.
13543         (Sized_relobj::include_linkonce_section): Likewise.
13544         * object.cc (class Sized_relobj): Don't define Comdat_group or
13545         Comdat_group_table.  Remove find_comdat_group and
13546         add_comdat_group.  Remove comdat_groups_ field.
13547         * plugin.cc (include_comdat_group): Use
13548         Layout::find_or_add_kept_section.
13549
13550 2009-02-28  Ian Lance Taylor  <iant@google.com>
13551
13552         * README: --gc-sections and map files are now supported.  Document
13553         some build requirements.
13554
13555         PR 6992
13556         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13557         relocatable link set the value of the section symbol to zero.
13558         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13559         relocatable link don't include the section address in the local
13560         symbol value.
13561
13562 2009-02-27  Ian Lance Taylor  <iant@google.com>
13563
13564         PR 6811
13565         * options.h (class Search_directory): Add is_system_directory.
13566         (class General_options): Declare is_in_system_directory.
13567         * options.cc (get_relative_sysroot): Make static.
13568         (get_default_sysroot): Make static.
13569         (General_optoins::is_in_system_directory): New function.
13570         * fileread.cc (Input_file::is_in_system_directory): New function.
13571         * fileread.h (class Input_file): Declare is_in_system_directory.
13572         * object.h (class Object): Add is_in_system_directory.
13573         (class Input_objects): Remove system_library_directory_ field.
13574         * object.cc (Input_objects::add_object): Don't set
13575         system_library_directory_.
13576         (input_objects::found_in_system_library_directory): Remove.
13577         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13578         parameter.  Change all callers.
13579         (Symbol_table::sized_write_globals): Likewise.
13580         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13581         Call Object::is_in_system_directory.
13582         * symtab.h (class Symbol_table): Update declarations.
13583
13584         PR 5990
13585         * descriptors.h (Open_descriptor): Add is_on_stack field.
13586         * descriptors.cc (Descriptors::open): If the descriptor is on the
13587         top of the stack, remove it.  Initialize is_on_stack field.
13588         (Descriptors::release): Only add pod to stack if it is not on the
13589         stack already.
13590         (Descriptors::close_some_descriptor): Clear stack_next and
13591         is_on_stack fields.
13592
13593         PR 7091
13594         * output.cc (Output_section::find_starting_output_address): Rename
13595         from starting_output_address; add PADDR parameter; change return
13596         type.
13597         * output.h (class Output_section): Declare
13598         find_starting_output_address instead of starting_output_address.
13599         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13600         section symbol for which we can't find a merge section.
13601
13602         PR 9836
13603         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13604         hidden or internal, force the symbol to be local.
13605         * resolve.cc (Symbol::override_visibility): Define.
13606         (Symbol::override_base): Use override_visibility.
13607         (Symbol_table::resolve): Likewise.
13608         (Symbol::override_base_with_special): Likewise.
13609         (Symbol_table::override_with_special): If the visibility is hidden
13610         or internal, force the symbol to be local.
13611         * symtab.h (class Symbol): Add set_visibility and
13612         override_visibility.
13613         * testsuite/ver_test_1.sh: New file.
13614         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13615         (check_DATA): Add ver_test_1.syms.
13616         (ver_test_1.syms): New target.
13617         * testsuite/Makefile.in: Rebuild.
13618
13619 2009-02-25  Cary Coutant  <ccoutant@google.com>
13620
13621         * layout.cc (Layout::choose_output_section): Don't rename sections
13622         when using a linker script that has a SECTIONS clause.
13623         * Makefile.in: Regenerate.
13624
13625         * testsuite/Makefile.am (script_test_5.sh): New test case.
13626         * testsuite/Makefile.in: Regenerate.
13627         * testsuite/script_test_5.cc: New file.
13628         * testsuite/script_test_5.sh: New file.
13629         * testsuite/script_test_5.t: New file.
13630
13631 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13632
13633         * archive.cc (Archive::include_member): Update calls to add_symbols.
13634         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13635         the Layout argument.
13636         * dynobj.h (do_add_symbols): Add the Layout argument.
13637         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13638         Layout argument.
13639         * object.h (Object::add_symbols): Add the Layout argument.
13640         (Object::do_add_symbols): Add the Layout argument.
13641         (Sized_relobj::do_add_symbols): Add the Layout argument.
13642         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13643         Unify the two versions.
13644         (Add_plugin_symbols): Remove.
13645         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13646         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13647         (Add_plugin_symbols): Remove.
13648         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13649         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13650         (Add_symbols::run): Make it work with Pulginobj.
13651
13652 2009-02-06  Ian Lance Taylor  <iant@google.com>
13653
13654         * object.cc (Sized_relobj::do_layout): Make info message start
13655         with lower case letter.
13656
13657 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13658
13659         * binary.cc: Fix file comment.
13660
13661         * options.h (enum Incremental_disposition): Define.
13662         (class General_options): Add new options: --incremental,
13663         --incremental_changed, --incremental_unchanged,
13664         --incremental_unknown.  Add incremental_disposition_ and
13665         implicit_incremental_ fields.
13666         (General_options::incremental_disposition): New function.
13667         (class Position_dependent_options): Add incremental_disposition
13668         option.
13669         (Position_dependent_options::copy_from_options): Set incremental
13670         dispositions.
13671         * options.cc (General_options::parse_incremental_changed): New
13672         function.
13673         (General_options::parse_incremental_unchanged): New function.
13674         (General_options::parse_incremental_unknown): New function.
13675         (General_options::General_options): Initialize new fields
13676         incremental_disposition_ and implicit_incremental_.
13677         (General_options::finalize): Check for uasge of --incremental-*
13678         without --incremental.
13679
13680 2009-02-06  Chris Demetriou  <cgd@google.com>
13681
13682         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13683         pointer and to report location as the file name associated with
13684         the symbol.
13685         (gold_undefined_symbol_at_location): New function to replace the
13686         old gold_undefined_symbol functionality.
13687         * target-reloc.h (relocate_section): Update to use
13688         gold_undefined_symbol_at_location.
13689         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13690         Call gold_undefined_symbol function rather than gold_error.
13691         * errors.h (Errors::undefined_symbol): Take location as a
13692         string, rather than calculating it from a relocation.
13693         * errors.cc (Errors::fatal): Print "fatal error:" before the
13694         formatted message.
13695         (Errors::error, Errors::error_at_location): Print "error: "
13696         before the formatted message.
13697         (Errors::undefined_symbol): Take location as a string, rather
13698         than calculating it from a relocation.
13699         (gold_undefined_symbol_at_location): New function akin to
13700         old gold_undefined_symbol, calculates location from relocation.
13701         (gold_undefined_symbol): Change to take only a Symbol pointer
13702         and to report location as the file name associated with the symbol.
13703         * testsuite/debug_msg.sh: Update for changed error messages.
13704         * testsuite/undef_symbol.sh: Likewise.
13705
13706 2009-02-04  Duncan Sands  <baldrick@free.fr>
13707
13708         PR 9812
13709         * reduced_debug_output.h
13710         (Output_reduced_debug_abbrev_section::failed): Use format for
13711         gold_warning.
13712         (Output_reduced_debug_info_section::faild): Likewise.
13713
13714 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13715
13716         * script.cc (Lazy_demangler): New class.
13717         (Version_script_info::get_symbol_version_helper): Demangle a
13718         symbol only once.
13719
13720 2009-01-29  Cary Coutant  <ccoutant@google.com>
13721
13722         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13723         to __tls_get_addr.
13724         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13725
13726 2009-01-28  Ian Lance Taylor  <iant@google.com>
13727
13728         * version.cc (version_string): Bump to 1.9.
13729
13730         * gold.h: Include <cstring> and <stdint.h>.
13731         * version.cc: Include <cstdio>.
13732         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13733         warning.
13734         * reduced_debug_output.cc (insert_into_vector): Rename from
13735         Insert_into_vector; change all callers.  Use Swap_unaligned to
13736         avoid aliasing issue; remove union since it is unnecessary.
13737
13738 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13739
13740         * Makefile.am (CCFILES): Add gc.cc.
13741         (HFILES): Add gc.h.
13742         * Makefile.in: Regenerate.
13743         * gold.cc (Gc_runner): New class.
13744         (queue_initial_tasks): Call garbage collection related tasks
13745         when corresponding options are invoked.
13746         (queue_middle_gc_tasks): New function.
13747         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13748         processed early before laying out sections during garbage collection.
13749         * gold.h (queue_middle_gc_tasks): New function.
13750         (is_prefix_of): Move from "layout.cc".
13751         * i386.cc (Target_i386::gc_process_relocs): New function.
13752         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13753         * main.cc (main): Create object of class "Garbage_collection".
13754         * object.cc (Relobj::copy_symbols_data): New function.
13755         (Relobj::is_section_name_included): New function.
13756         (Sized_relobj::do_layout): Allow this function to be called twice
13757         during garbage collection and defer layout of section during the
13758         first call.
13759         * object.h (Relobj::get_symbols_data): New function.
13760         (Relobj::is_section_name_included): New function.
13761         (Relobj::copy_symbols_data): New function.
13762         (Relobj::set_symbols_data): New function.
13763         (Relobj::get_relocs_data): New function.
13764         (Relobj::set_relocs_data): New function.
13765         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13766         (Relobj::gc_process_relocs): New function.
13767         (Relobj::do_gc_process_relocs): New pure virtual function.
13768         (Relobj::sd_): New data member.
13769         (Sized_relobj::is_output_section_offset_invalid): New function.
13770         (Sized_relobj::do_gc_process_relocs): New function.
13771         * options.h (General_options::gc_sections): Modify to not be a no-op.
13772         (General_options::print_gc_sections): New option.
13773         * plugin.cc (Plugin_finish::run): Remove function call to
13774         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13775         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13776         * reloc.cc (Read_relocs::run): Add task to process relocs and
13777         determine unreferenced sections when doing garbage collection.
13778         (Gc_process_relocs): New class.
13779         (Sized_relobj::do_gc_process_relocs): New function.
13780         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13781         sections that are garbage collected.
13782         * reloc.h (Gc_process_relocs): New class.
13783         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13784         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13785         symbols whose corresponding sections are garbage collected.
13786         (Symbol_table::Symbol_table): Add new parameter for the garbage
13787         collection object.
13788         (Symbol_table::gc_mark_undef_symbols): New function.
13789         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13790         (Symbol_table::gc_mark_dyn_syms): New function.
13791         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13792         as garbage.
13793         (Symbol_table::add_from_object): Likewise.
13794         (Symbol_table::add_from_relobj): When building shared objects, do not
13795         treat externally visible symbols as garbage.
13796         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13797         table information for static and relocatable links.
13798         * symtab.h (Symbol_table::set_gc): New function.
13799         (Symbol_table::gc): New function.
13800         (Symbol_table::gc_mark_undef_symbols): New function.
13801         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13802         (Symbol_table::gc_mark_dyn_syms): New function.
13803         (Symbol_table::gc_): New data member.
13804         * target.h (Sized_target::gc_process_relocs): New pure virtual
13805         function.
13806         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13807         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13808
13809 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13810
13811         * options.h (General_options::gc_sections): Define as a no-op for now.
13812         (General_options::no_keep_memory): Ditto.
13813         (General_options::Bshareable): Define.
13814         * options.cc (General_options::finalize): Honor -Bshareable.
13815
13816 2009-01-20  Andreas Schwab  <schwab@suse.de>
13817
13818         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13819         read the value in the contents, since we don't use it.  Use the
13820         template endianness when writing.
13821         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13822
13823 2009-01-19  Andreas Schwab  <schwab@suse.de>
13824
13825         * configure.tgt (powerpc64-*): Fix targ_obj.
13826
13827 2009-01-15  Ian Lance Taylor  <iant@google.com>
13828
13829         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13830         local symbols when stripping all symbols.
13831
13832 2009-01-14  Cary Coutant  <ccoutant@google.com>
13833
13834         * output.cc (Output_reloc): Add explicit instantiations.
13835
13836 2009-01-14  Cary Coutant  <ccoutant@google.com>
13837
13838         * archive.cc (Archive::get_elf_object_for_member): Remove call
13839         to File_read::claim_for_plugin.
13840         * descriptors.cc (Descriptors::open): Remove reference to
13841         is_claimed.
13842         (Descriptors::claim_for_plugin): Remove.
13843         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13844         (Descriptors::is_claimed): Remove.
13845         (claim_descriptor_for_plugin): Remove.
13846         * fileread.cc (File_read::claim_for_plugin): Remove.
13847         * fileread.h (File_read::claim_for_plugin): Remove.
13848         (File_read::descriptor): Reopen descriptor if necessary.
13849         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13850         (Plugin_manager::all_symbols_read): Add task parameter. Change
13851         all callers.
13852         (Plugin_manager::get_input_file): New function.
13853         (Plugin_manager::release_input_file): New function.
13854         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13855         corresponding data member.
13856         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13857         and pass to base constructor. Change all callers.
13858         (get_input_file, release_input_file): New functions.
13859         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13860         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13861         (Plugin_manager::all_symbols_read): Add task parameter.
13862         (Plugin_manager::get_input_file): New function.
13863         (Plugin_manager::release_input_file): New function.
13864         (Plugin_manager::task_): New data member.
13865         (Pluginobj::Pluginobj): Add filesize parameter.
13866         (Pluginobj::filename): New function.
13867         (Pluginobj::descriptor): New function.
13868         (Pluginobj::filesize): New function.
13869         (Pluginobj::filesize_): New data member.
13870         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13871         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13872         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13873
13874         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13875         with archive libraries.
13876         * testsuite/Makefile.in: Regenerate.
13877         * testsuite/plugin_test.c (struct sym_info): New type.
13878         (get_input_file, release_input_file): New static variables.
13879         (onload): Capture new transfer vector entries.
13880         (claim_file_hook): Stop reading at end of file according to filesize.
13881         Factor out parsing of readelf output into separate function.
13882         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13883         APIs and get the source file name from the symbol table.  Convert
13884         source file name to corresponding object file name.  Print info
13885         message when adding new input files.
13886         (parse_readelf_line): New function.
13887         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13888         * testsuite/plugin_test_2.sh: Likewise.
13889         * testsuite/plugin_test_3.sh: Likewise.
13890         * testsuite/plugin_test_4.sh: New test case.
13891
13892 2009-01-07  Ian Lance Taylor  <iant@google.com>
13893
13894         * version.cc (version_string): Bump to 1.8.
13895
13896 2008-12-23  Cary Coutant  <ccoutant@google.com>
13897
13898         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13899         * plugin.cc (Plugin_manager::finish): Rename as
13900         layout_deferred_objects.  Move cleanup to separate function.
13901         (Plugin_manager::cleanup): New function.
13902         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13903         separately.
13904         * plugin.h (Plugin_manager::finish): Rename as
13905         layout_deferred_objects.
13906         (Plugin_manager::cleanup): New function.
13907         (Plugin_manager::cleanup_done): New field.
13908
13909 2008-12-23  Cary Coutant  <ccoutant@google.com>
13910
13911         * plugin.cc (is_visible_from_outside): New function.
13912         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13913         so we don't return "IR only" status for exported symbols or -r links.
13914
13915         * testsuite/Makefile.am (plugin_test_3): New test case.
13916         * testsuite/Makefile.in: Regenerate.
13917         * testsuite/plugin_test_3.sh: New file.
13918
13919 2008-12-22  Cary Coutant  <ccoutant@google.com>
13920
13921         * object.cc (Sized_relobj::layout_section): New function.
13922         (Sized_relobj::do_layout): Defer layout of input sections until after
13923         plugin has provided replacement files.
13924         (Sized_relobj::do_layout_deferred_sections): New function.
13925         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13926         (Relobj::layout_deferred_sections): New function.
13927         (Relobj::do_layout_deferred_sections): New function.
13928         (Sized_relobj::do_layout_deferred_sections): New function.
13929         (Sized_relobj::layout_section): New function.
13930         (Sized_relobj::Deferred_layout): New structure.
13931         (Sized_relobj::deferred_layout_): New field.
13932         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13933         Change all callers.  Layout deferred sections.
13934         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13935         references.
13936         (Plugin_hook::run): Move code from do_plugin_hook inline.
13937         (Plugin_hook::do_plugin_hook): Remove.
13938         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13939         (Plugin_manager::finish): Renamed, was cleanup.
13940         (Plugin_manager::should_defer_layout): New function.
13941         (Plugin_manager::add_deferred_layout_object): New function.
13942         (Plugin_manager::Deferred_layout_list): New type.
13943         (Plugin_manager::deferred_layout_objects_): New field.
13944         (Plugin_hook::do_plugin_hook): Remove.
13945
13946 2008-12-17  Ian Lance Taylor  <iant@google.com>
13947
13948         * options.h (class General_options): Add --no case for
13949         --export-dynamic.
13950
13951 2008-12-16  Cary Coutant  <ccoutant@google.com>
13952
13953         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13954         vector.
13955         (Plugin_manager::claim_file): Create plugin object even if
13956         plugin did not call the add_symbols callback.
13957         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13958         asking for more symbols than were added.
13959         * testsuite/Makefile.am (plugin_test_1): Add test case with
13960         no global symbols.
13961         (empty.syms): New target.
13962         * testsuite/Makefile.in: Regenerate.
13963         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13964         message. Don't call add_symbols if no globals.
13965         (all_symbols_read_hook): Don't provide replacement for empty
13966         claimed file.
13967
13968 2008-12-12  Ian Lance Taylor  <iant@google.com>
13969
13970         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13971         r_type == 0 for a local symbol with r_sym == 0.
13972         (scan_relocatable_relocs): Pass r_sym to
13973         local_non_section_strategy.
13974         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13975         r_sym parameter.
13976
13977         * configure.ac: Update test for TLS descriptors: they are
13978         supported as of glibc 2.9.
13979         * configure: Rebuild.
13980
13981 2008-12-11  Ian Lance Taylor  <iant@google.com>
13982
13983         PR 7091
13984         * target-reloc.h (Default_scan_relocatable_relocs): For each
13985         function, map r_type == 0 to RELOC_DISCARD.
13986
13987 2008-12-10  Cary Coutant  <ccoutant@google.com>
13988
13989         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13990         object to override a kept COMDAT group from a plugin object.
13991
13992 2008-12-09  Ian Lance Taylor  <iant@google.com>
13993
13994         PR 7088
13995         * yyscript.y (file_cmd): Handle INPUT.
13996
13997         * testsuite/initpri1.c: Change all declarations to be full
13998         prototypes by adding void, to avoid compiler warnings.
13999
14000 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
14001
14002         * options.cc (General_options::parse_plugin_opt): New.
14003         (General_options::add_plugin): The argument now is just the filename.
14004         (General_options::add_plugin_option): New.
14005         * options.h (plugin_opt): New.
14006         (add_plugin): Change argument name.
14007         (add_plugin_option): New.
14008         * plugin.cc (Plugin::load): Don't parse the plugin option.
14009         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
14010         (Plugin::add_option): New.
14011         (Plugin::args_): Change type.
14012         (Plugin::filename_): New.
14013         (Plugin_manager::add_plugin_option): New.
14014         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
14015         * testsuite/Makefile.in: Regenerate.
14016
14017 2008-12-05  Cary Coutant  <ccoutant@google.com>
14018
14019         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
14020         Handle --strip-lto-sections option.
14021         * options.h (strip_lto_sections): New option.
14022
14023 2008-12-01  Cary Coutant  <ccoutant@google.com>
14024
14025         * plugin.cc (ld_plugin_message): Change format parameter to const.
14026         Fix mismatch between new[] and delete.
14027
14028 2008-11-14  Cary Coutant  <ccoutant@google.com>
14029
14030         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
14031         instead of -1U.
14032
14033 2008-11-05  Craig Silverstein  <csilvers@google.com>
14034
14035         * options.cc (General_options::parse_dynamic_list): New function.
14036         * options.h (General_options): New flags dynamic_list,
14037         dynamic_list_data, dynamic_list_cpp_new, and
14038         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14039         (General_options::in_dynamic_list): New function.
14040         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14041         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14042         (Lex::can_continue_name): Likewise.
14043         (yylex): Likewise.
14044         (read_script_file): New parameter script_options.
14045         (read_dynamic_list): New function.
14046         (Script_options::define_dynamic_list): New function.
14047         (dynamic_list_keyword_parsecodes): New variable.
14048         (dynamic_list_keywords): New variable.
14049         * script.h (Script_options::define_dynamic_list): New function
14050         prototype.
14051         (read_dynamic_list): New function prototype.
14052         * symtab.cc (strprefix): New macro.
14053         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14054         dynamic_list_data, dynamic_list_cpp_new, and
14055         dynamic_list_cpp_typeinfo.
14056         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14057         (dynamic_list_expr): New rule.
14058         (dynamic_list_nodes): Likewise.
14059         (dynamic_list_node): Likewise.
14060         * testsuite/Makefile.am (dynamic_list): New test.
14061         * testsuite/Makefile.in: Regenerated.
14062         * testsuite/dynamic_list.t: New file.
14063         * testsuite/dynamic_list.sh: New file.
14064
14065 2008-11-05  Craig Silverstein  <csilvers@google.com>
14066
14067         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14068         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14069         (t11_last): Likewise.
14070         * testsuite/ver_test_6.c (main): Likewise.
14071
14072 2008-10-07  Cary Coutant  <ccoutant@google.com>
14073
14074         * options.c (General_options::finalize): Add check for -static and
14075         -shared.
14076         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14077         is not empty.
14078
14079 2008-10-02  Cary Coutant  <ccoutant@google.com>
14080
14081         * plugin.cc (make_sized_plugin_object): Fix conditional
14082         compilation to work when not all targets are enabled.
14083
14084 2008-09-29  Cary Coutant  <ccoutant@google.com>
14085
14086         * archive.cc (Archive::get_file_and_offset): Use filename instead
14087         of name to get library path.
14088         (Archive::include_member): Unlock external member of a thin archive.
14089
14090         * testsuite/Makefile.am (TEST_AR): New variable.
14091         (thin_archive_test_1): New test.
14092         (thin_archive_test_2): New test.
14093         * testsuite/Makefile.in: Regenerate.
14094         * testsuite/thin_archive_main.cc: New file.
14095         * testsuite/thin_archive_test_1.cc: New file.
14096         * testsuite/thin_archive_test_2.cc: New file.
14097         * testsuite/thin_archive_test_3.cc: New file.
14098         * testsuite/thin_archive_test_4.cc: New file.
14099
14100 2008-09-29  Cary Coutant  <ccoutant@google.com>
14101
14102         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14103         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14104         instead of -1U.
14105         (Sized_relobj::do_finalize_local_symbols): Likewise.
14106         (Sized_relobj::map_to_kept_section): Likewise.
14107         * object.h (Sized_relobj::invalid_address): New constant.
14108         (Sized_relobj::do_output_section_offset): Check for invalid_address
14109         and return -1ULL.
14110         * output.cc (Output_reloc::local_section_offset): Use constant
14111         invalid_address instead of -1U.
14112         (Output_reloc::get_address): Likewise.
14113         (Output_section::output_address): Change -1U to -1ULL.
14114         * output.h (Output_reloc::invalid_address): New constant.
14115         * reloc.cc (Sized_relobj::write_sections): Use constant
14116         invalid_address instead of -1U.
14117         (Sized_relobj::relocate_sections): Likewise.
14118         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14119         values for merge sections.
14120         * target-reloc.h (relocate_for_relocatable): Use constant
14121         invalid_address instead of -1U.
14122
14123 2008-09-19  Cary Coutant  <ccoutant@google.com>
14124
14125         Add plugin functionality for link-time optimization (LTO).
14126         * configure.ac (plugins): Add --enable-plugins option.
14127         * configure: Regenerate.
14128         * config.in: Regenerate.
14129         * Makefile.am (LIBDL): New variable.
14130         (CCFILES): Add plugin.cc.
14131         (HFILES): Add plugin.h.
14132         (ldadd_var): Add LIBDL.
14133         * Makefile.in: Regenerate.
14134
14135         * archive.cc: Include "plugin.h".
14136         (Archive::setup): Don't preread archive symbols when using a plugin.
14137         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14138         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14139         files.
14140         (Archive::include_member): Add symbols from plugin objects.
14141         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14142         * descriptors.cc (Descriptors::open): Check for file descriptors
14143         abandoned by plugins.
14144         (Descriptors::claim_for_plugin): New function.
14145         * descriptors.h (Descriptors::claim_for_plugin): New function.
14146         (Open_descriptor::is_claimed): New field.
14147         (claim_descriptor_for_plugin): New function.
14148         * fileread.cc (File_read::claim_for_plugin): New function.
14149         * fileread.h (File_read::claim_for_plugin): New function.
14150         (File_read::descriptor): New function.
14151         * gold.cc: Include "plugin.h".
14152         (queue_initial_tasks): Add task to call plugin hooks for generating
14153         new object files.
14154         * main.cc: Include "plugin.h".
14155         (main): Load plugin libraries.
14156         * object.h (Pluginobj): Declare.
14157         (Object::pluginobj): New function.
14158         (Object::do_pluginobj): New function.
14159         (Object::set_target): New function.
14160         * options.cc: Include "plugin.h".
14161         (General_options::parse_plugin): New function.
14162         (General_options::General_options): Initialize plugins_ field.
14163         (General_options::add_plugin): New function.
14164         * options.h (Plugin_manager): Declare.
14165         (General_options): Add --plugin option.
14166         (General_options::has_plugins): New function.
14167         (General_options::plugins): New function.
14168         (General_options::add_plugin): New function.
14169         (General_options::plugins_): New field.
14170         * plugin.cc: New file.
14171         * plugin.h: New file.
14172         * readsyms.cc: Include "plugin.h".
14173         (Read_symbols::do_read_symbols): Check for archive before checking
14174         for ELF file.  Call plugin hooks to claim files.
14175         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14176         from a real object file; force override when processing replacement
14177         files.
14178         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14179         (Symbol::init_base_object): Likewise.
14180         (Symbol::init_base_output_data): Likewise.
14181         (Symbol::init_base_output_segment): Likewise.
14182         (Symbol::init_base_constant): Likewise.
14183         (Symbol::init_base_undefined): Likewise.
14184         (Symbol::output_section): Assert that object is not a plugin.
14185         (Symbol_table::add_from_pluginobj): New function.
14186         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14187         undefined.
14188         (Symbol_table::sized_write_globals): Likewise.
14189         (Symbol_table::add_from_pluginobj): Instantiate template.
14190         * symtab.h (Sized_pluginobj): Declare.
14191         (Symbol::in_real_elf): New function.
14192         (Symbol::set_in_real_elf): New function.
14193         (Symbol::in_real_elf_): New field.
14194         (Symbol_table::add_from_pluginobj): New function.
14195
14196         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14197         (LIBDL): New variable.
14198         (LDADD): Add LIBDL.
14199         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14200         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14201         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14202         (MOSTLYCLEANFILES): Likewise.
14203         * testsuite/Makefile.in: Regenerate.
14204         * testsuite/plugin_test.c: New file.
14205         * testsuite/plugin_test_1.sh: New file.
14206         * testsuite/plugin_test_2.sh: New file.
14207
14208 2008-09-16  Ian Lance Taylor  <iant@google.com>
14209
14210         * target-reloc.h (relocate_section): Check whether a symbol is
14211         defined by the ABI before reporting an undefined symbol error.
14212         * target.h (Target::is_defined_by_abi): Make parameter const.
14213         (Target::do_is_defined_by_abi): Likewise.
14214         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14215         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14216         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14217         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14218         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14219         * testsuite/Makefile.in: Rebuild.
14220
14221         * fileread.cc (make_view): Add casts to avoid warning.
14222
14223 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14224
14225         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14226         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14227
14228 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14229
14230         * options.h (General_options::output_is_executable): New.
14231         (General_options::output_is_pie): New.
14232         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14233         for shared libraries.
14234         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14235
14236 2008-09-11  Chris Demetriou  <cgd@google.com>
14237
14238         * options.h (origin): New -z option.
14239         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14240         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14241         in DT_FLAGS_1.
14242
14243 2008-09-05  Cary Coutant  <ccoutant@google.com>
14244
14245         * fileread.cc (File_read::make_view): Add check for attempt to map
14246         beyond end of file.
14247
14248 2008-09-05  Cary Coutant  <ccoutant@google.com>
14249
14250         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14251         explicit instantiations.
14252
14253 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14254
14255         PR gold/6858
14256         * options.cc (General_options::finalize): Allow undefined symbols
14257         in shlibs if linking -shared.
14258
14259         PR gold/6859
14260         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14261         symbols as not needing a dynsym entry.
14262
14263 2008-08-20  Craig Silverstein  <csilvers@google.com>
14264
14265         * fileread.cc (File_read::open): Do not lock the file unless it
14266         was successfully opened.
14267
14268 2008-08-14  Cary Coutant  <ccoutant@google.com>
14269
14270         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14271         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14272         * testsuite/tls_test.cc (struct int128): 128-bit struct
14273         for testing TLS relocs with non-zero addend.
14274         (v12): New TLS variable.
14275         (t12): New test.
14276         (t_last): Add check for v12.
14277         * testsuite/tls_test.h (t12): New function.
14278         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14279
14280 2008-08-13  Ian Lance Taylor  <iant@google.com>
14281
14282         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14283         set tls_segment_ or relro_segment_.
14284         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14285         when appropriate.
14286         * output.h (Output_section::clear_is_relro): New function.
14287         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14288         sections specially even when output_data_ is empty.
14289         (Output_segment::maximum_alignment): When first section is relro,
14290         only force alignment for PT_LOAD segments.
14291         * script.cc (script_data_segment_align): New function.
14292         (script_data_segment_relro_end): New function.
14293         * script-c.h (script_data_segment_align): Declare.
14294         (script_data_segment_relro_end): Declare.
14295         * script-sections.h (class Script_sections): Declare
14296         data_segment_align and data_segment_relro_end.  Add fields
14297         segment_align_index_ and saw_relro_end_.
14298         * script-sections.cc (class Sections_element): Add set_is_relro
14299         virtual function.  Add new bool* parameter to place_orphan_here.
14300         Add get_output_section virtual function.
14301         (class Output_section_definition): Add set_is_relro.  Add new
14302         bool* parameter to place_orphan_here.  Add get_output_section.
14303         Add is_relro_ field.
14304         (Output_section_definition::Output_section_definition): Initialize
14305         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14306         and is_relro_ fields.
14307         (Output_section_definition::place_orphan_here): Add is_relro
14308         parameter.
14309         (Output_section_definition::set_section_addresses): Set relro for
14310         output section.
14311         (Output_section_definition::alternate_constraint): Likewise.
14312         (class Orphan_output_section): Add new bool* parameter to
14313         place_orphan_here.  Add get_output_section.
14314         (Orphan_output_section::place_orphan_here): Add is_relro
14315         parameter.
14316         (Script_sections::Script_sections): Initialize
14317         data_segment_align_index_ and saw_relro_end_.
14318         (Script_sections::data_segment_align): New function.
14319         (Script_sections::data_segment_relro_end): New function.
14320         (Script_sections::place_orphan): Set or clear is_relro.
14321         (Script_sections::set_section_addresses): Force alignment of first
14322         TLS section.
14323         * yyscript.y (exp): Call script_data_segment_align and
14324         script_data_segment_relro_end.
14325         * testsuite/relro_script_test.t: New file.
14326         * testsuite/relro_test.cc (using_script): Declare.
14327         (t1, t2): Test using_script.
14328         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14329         (relro_script_test_SOURCES): Define.
14330         (relro_script_test_DEPENDENCIES): Define.
14331         (relro_script_test_LDFLAGS): Define.
14332         (relro_script_test_LDADD): Define.
14333         (relro_script_test.so): New target.
14334         * testsuite/Makefile.in: Rebuild.
14335
14336 2008-08-06  Cary Coutant <ccoutant@google.com>
14337
14338         * archive.cc (Archive::total_archives, Archive::total_members)
14339         (Archive::total_members_loaded): New variables.
14340         (Archive::setup): Add parameter.  Add option to preread
14341         archive symbols.
14342         (Archive::read_armap): Add counter.
14343         (Archive::get_file_and_offset): New function.
14344         (Archive::get_elf_object_for_member): New function.
14345         (Archive::read_all_symbols): New function.
14346         (Archive::read_symbols): New function.
14347         (Archive::add_symbols): Add counters.
14348         (Archive::include_all_members): Use armap to find members if it's
14349         already built.
14350         (Archive::include_member): Skip reading symbols if already read.
14351         Factored code into Archive::get_file_and_offset and
14352         Archive::get_elf_object_for_member.  Changed call to
14353         Mapfile::report_include_archive_member.
14354         (Archive::print_stats): New function.
14355         * archive.h: Declare Object and Read_symbols_data classes.
14356         (Archive::Archive): Add initializers for new members.
14357         (Archive::setup): Add parameter.
14358         (Archive::print_stats): New function.
14359         (Archive::total_archives, Archive::total_members)
14360         (Archive::total_members_loaded): New variables.
14361         (Archive::get_file_and_offset): New function.
14362         (Archive::get_elf_object_for_member): New function.
14363         (Archive::read_all_symbols): New function.
14364         (Archive::read_symbols): New function.
14365         (Archive::Archive_member): New class.
14366         (Archive::members_): New member.
14367         (Archive::num_members_): New member.
14368         * main.cc: Include archive.h.
14369         (main): Call Archive::print_stats.
14370         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14371         archive parameter; member_name is now the fully-decorated name.
14372         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14373         * options.h: (General_options): Add --preread-archive-symbols option.
14374         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14375         Archive::setup.
14376
14377 2008-08-04  Ian Lance Taylor  <iant@google.com>
14378
14379         * symtab.h (Symbol::use_plt_offset): New function.
14380         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14381         * powerpc.cc (Relocate::relocate): Likewise.
14382         * sparc.cc (Relocate::relocate): Likewise.
14383         * x86_64.cc (Relocate::relocate): Likewise.
14384         * testsuite/weak_plt.sh: New test.
14385         * testsuite/weak_plt_main.cc: New test.
14386         * testsuite/weak_plt_shared.cc: New test.
14387         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14388         (check_PROGRAMS): Add weak_plt.
14389         (check_DATA): Add weak_plt_shared.so.
14390         (weak_plt_main_pic.o, weak_plt): New targets.
14391         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14392         * testsuite/Makefile.in: Rebuild.
14393
14394         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14395         gcctestdir/ld.
14396         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14397         * testsuite/Makefile.in: Rebuild.
14398
14399 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14400
14401         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14402         * Makefile.in: Regenerate.
14403         * po/POTFILES.in: Regenerate.
14404
14405 2008-07-29  Ian Lance Taylor  <iant@google.com>
14406
14407         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14408         symbols before other symbols.
14409         * testsuite/script_test_2.cc (test_addr): Declare.
14410         (test_addr_alias): Declare.
14411         (main): Check that test_addr and test_addr_alias have the right
14412         values.
14413         * testsuite/script_test_2.t: Define test_addr_alias and
14414         test_addr.
14415
14416 2008-07-24  Ian Lance Taylor  <iant@google.com>
14417
14418         PR 5990
14419         * descriptors.cc: New file.
14420         * descriptors.h: New file.
14421         * gold-threads.h (class Hold_optional_lock): New class.
14422         * fileread.cc: Include "descriptors.h".
14423         (File_read::~File_read): Release descriptor rather than closing
14424         it.
14425         (File_read::open) [file]: Call open_descriptor rather than open.
14426         Set is_descriptor_opened_.
14427         (File_read::open) [memory]: Assert that descriptor is not open.
14428         (File_read::reopen_descriptor): New function.
14429         (File_read::release): Release descriptor.
14430         (File_read::do_read): Make non-const.  Reopen descriptor.
14431         (File_read::read): Make non-const.
14432         (File_read::make_view): Reopen descriptor.
14433         (File_read::do_readv): Likewise.
14434         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14435         Update declarations.
14436         * layout.cc: Include "descriptors.h".
14437         (Layout::create_build_id): Use open_descriptor rather than open.
14438         * output.cc: Include "descriptors.h".
14439         (Output_file::open): Use open_descriptor rather than open.
14440         * archive.cc (Archive::const_iterator): Change Archive to be
14441         non-const.
14442         (Archive::begin, Archive::end): Make non-const.
14443         (Archive::count_members): Likewise.
14444         * archive.h (class Archive): Update declarations.
14445         * object.h (Object::read): Make non-const.
14446         * Makefile.am (CCFILES): Add descriptors.cc.
14447         (HFILES): Add descriptors.h.
14448         * Makefile.in: Rebuild.
14449
14450         PR 6716
14451         * gold.h: Always include <clocale>.  Add Solaris workarounds
14452         following code in binutils/sysdep.h.
14453
14454         PR 6048
14455         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14456         this->eh_frame_hdr_ is NULL before using it.
14457
14458         * dynobj.cc (Versions::Versions): Update comment.
14459
14460         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14461         the base version name.
14462
14463         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14464         array size plus one.
14465         (Stringpool_template::set_string_offsets): Subtract one from key
14466         before using it as an array index.
14467         (Stringpool_template::get_offset_with_length): Likewise.
14468         (Stringpool_template::write_to_buffer): Likewise.
14469         * stringpool.h (Stringpool_template::get_offset_from_key):
14470         Likewise.
14471
14472 2008-07-23  Ian Lance Taylor  <iant@google.com>
14473
14474         PR 6658
14475         * object.h (Merged_symbol_value::value): Do our best to handle a
14476         negative addend.
14477
14478         PR 6647
14479         * script.cc (Version_script_info::get_versions): Don't add empty
14480         version tag to return value.
14481         (Version_script_info::get_symbol_version_helper): Change return
14482         type to bool.  Add pversion parameter.  Change all callers.
14483         (script_register_vers_node): Don't require a non-NULL tag.
14484         * script.h (class Version_script_info): Update declarations.
14485         (Version_script_info::get_symbol_version): Change return type to
14486         bool.  Add version parameter.  Change all callers.
14487         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14488         handling.  Handle an empty version from a version script.
14489         (Symbol_table::define_special_symbol): Likewise.
14490         * testsuite/ver_test_10.script: New file.
14491         * testsuite/ver_test_10.sh: New file.
14492         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14493         (check_DATA): Add ver_test_10.syms.
14494         (ver_test_10.syms, ver_test_10.so): New target.
14495         * testsuite/Makefile.in: Rebuild.
14496
14497 2008-07-23  Simon Baldwin  <simonb@google.com>
14498
14499         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14500         to zero for undefined symbols from dynamic libraries.
14501
14502 2008-07-23  Ian Lance Taylor  <iant@google.com>
14503
14504         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14505         Change all callers.
14506         * symtab.h (class Symbol_table): Update declaration.
14507         * testsuite/ver_test_9.cc: New file.
14508         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14509         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14510         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14511         (ver_test_9.so, ver_test_9.o): New targets.
14512         * testsuite/Makefile.in: Rebuild.
14513
14514 2008-07-22  Ian Lance Taylor  <iant@google.com>
14515
14516         * options.h (class General_options): Define --check-sections.
14517         * layout.cc (Layout::set_segment_offsets): Handle
14518         --check-sections.
14519
14520         * options.h (class General_options): Define -n/--nmagic and
14521         -N/--omagic.
14522         * options.cc (General_options::finalize): For -n/--nmagic or
14523         -N/--omagic, set -static.
14524         * layout.cc (Layout::attach_allocated_section_to_segment): If
14525         -N/--omagic, don't put read-only and read-write sections in
14526         different segments.
14527         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14528         finding a read-only segment.
14529         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14530         don't set the minimum segment alignment to the common page size,
14531         and don't set the file offset to the address modulo the page size.
14532         * script-sections.cc (Script_sections::create_segments): If
14533         -n/--omagic, don't put read-only and read-write sections in
14534         different segments.
14535
14536         * cref.cc: New file.
14537         * cref.h: New file.
14538         * options.h (class General_options): Add --print-symbol-counts.
14539         * main.cc (main): Issue defined symbol report if requested.
14540         * archive.cc (Archive::interpret_header): Make into a const member
14541         function.
14542         (Archive::add_symbols): Call Input_objects::archive_start and
14543         archive_stop.
14544         (Archive::const_iterator): Define new class.
14545         (Archive::begin, Archive::end): New functions.
14546         (Archive::include_all_members): Rewrite to use iterator.
14547         (Archive::count_members): New function.
14548         * archive.h (class Archive): Update declarations.
14549         (Archive::filename): New function.
14550         * object.cc: Include "cref.h".
14551         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14552         (Sized_relobj::do_get_global_symbol_counts): New function.
14553         (Input_objects::add_object): Add object to cross-referencer.
14554         (Input_objects::archive_start): New function.
14555         (Input_objects::archive_stop): New function.
14556         (Input_objects::print_symbol_counts): New function.
14557         * object.h: Declare Cref and Archive.
14558         (Object::get_global_symbol_counts): New function.
14559         (Object::do_get_global_symbol_counts): New pure virtual function.
14560         (class Sized_relobj): Add defined_count_ field.  Update
14561         declarations.
14562         (class Input_objects): Add cref_ field.  Update constructor.
14563         Update declarations.
14564         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14565         defined_count_.
14566         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14567         symbol counts.
14568         (Sized_dynobj::do_get_global_symbol_counts): New function.
14569         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14570         defined_count_.  Update declarations.  Define Symbols typedef.
14571         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14572         parameter.  Change all callers.
14573         (Symbol_table::add_from_dynobj): Add sympointers and defined
14574         parameters.  Change all callers.
14575         * symtab.h (class Symbol_table): Update declarations.
14576         * Makefile.am (CCFILES): Add cref.cc.
14577         (HFILES): Add cref.h.
14578         * Makefile.in: Rebuild.
14579
14580 2008-07-22  Simon Baldwin  <simonb@google.com>
14581
14582         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14583         to zero when writing undefined symbols.
14584
14585 2008-07-22  Ian Lance Taylor  <iant@google.com>
14586
14587         * output.cc (Output_section::add_input_section): Don't try to
14588         merge empty merge sections.
14589
14590 2008-07-21  Craig Silverstein  <csilvers@google.com>
14591
14592         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14593         Include symbol version in error message.
14594
14595 2008-07-20  Chris Demetriou  <cgd@google.com>
14596
14597         * configure.ac (gold_cv_c_random_seed): New configured variable.
14598         (RANDOM_SEED_CFLAGS): New substituted variable.
14599         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14600         * configure: Rebuild.
14601         * Makefile.in: Likewise.
14602         * testsuite/Makefile.in: Likewise.
14603
14604 2008-07-18  Ian Lance Taylor  <iant@google.com>
14605
14606         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14607         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14608         * testsuite/ver_test_main.cc (main): Call t4.
14609         (t4, t4_2a): Define.
14610         * testsuite/ver_test_2.cc (t4_2): Define.
14611         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14612         * testsuite/ver_test_4.cc (t4_2a): Define.
14613         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14614         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14615
14616 2008-07-17  Ian Lance Taylor  <iant@google.com>
14617
14618         * dynobj.cc (Versions::add_def): If we give an error about a
14619         missing version, go ahead and create the version anyhow.
14620
14621 2008-07-10  Ian Lance Taylor  <iant@google.com>
14622
14623         Handle output sections with more than 0x7fffffff bytes.
14624         * object.h (class Relobj): Change map_to_output_ to
14625         output_sections_, and just keep a section pointer.  Change all
14626         uses.  Move comdat group support to Sized_relobj.
14627         (Relobj::is_section_specially_mapped): Remove.
14628         (Relobj::output_section): Remove poff parameter.  Change all
14629         callers.
14630         (Relobj::output_section_offset): New function.
14631         (Relobj::set_section_offset): Rewrite.
14632         (Relobj::map_to_output): Remove.
14633         (Relobj::output_sections): New function.
14634         (Relobj::do_output_section_offset): New pure virtual function.
14635         (Relobj::do_set_section_offset): Likewise.
14636         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14637         group support from Relobj.  Update declarations.
14638         (Sized_relobj::get_output_section_offset): New function.
14639         (Sized_relobj::do_output_section_offset): New function.
14640         (Sized_relobj::do_set_section_offset): New function.
14641         * object.cc (Relobj::output_section_address): Remove.
14642         (Sized_relobj::Sized_relobj): Initialize new fields.
14643         (Sized_relobj::include_section_group): Cast find_kept_object to
14644         Sized_relobj.
14645         (Sized_relobj::include_linkonce_section): Likewise.
14646         (Sized_relobj::do_layout): Use separate arrays for output section
14647         and output offset.
14648         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14649         output_sections.
14650         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14651         output_sections and section_offsets.
14652         (Sized_relobj::write_local_symbols): Likewise.
14653         (map_to_kept_section): Compute output address directly.
14654         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14655         output_sections and section_offsets.
14656         (Sized_relobj::write_sections): Likewise.
14657         (Sized_relobj::relocate_sections): Likewise.
14658         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14659         * output.h (class Output_reloc): Update declarations.  Change
14660         u2_.relobj to Sized_relobj*.
14661         (class Output_data_reloc): Change add functions to use
14662         Sized_relobj*.
14663         * output.cc (Output_reloc::Output_reloc): Change relobj to
14664         Sized_relobj*.
14665         (Output_reloc::local_section_offset): Change return type to
14666         Elf_Addr.  Use get_output_section_offset.
14667         (Output_reloc::get_address): Likewise.
14668         (Output_section::is_input_address_mapped): Don't call
14669         is_section_specially_mapped.
14670         (Output_section::output_offset): Likewise.
14671         (Output_section::output_address): Likewise.
14672         (Output_section::starting_output_address): Likewise.
14673         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14674         parameter to Sized_relobj*.
14675         (Copy_relocs::need_copy_reloc): Likewise.
14676         (Copy_relocs::save): Likewise.
14677         * copy-relocs.h (class Copy_relocs): Update declarations.
14678         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14679         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14680         * target-reloc.h (relocate_for_relocatable): Change
14681         offset_in_output_section type to Elf_Addr.  Change code that uses
14682         it as well.
14683         * layout.cc (Layout::layout): Always set *off.
14684         * mapfile.cc (Mapfile::print_input_section): Use
14685         output_section_offset.
14686         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14687         Sized_relobj*.
14688         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14689         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14690         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14691
14692 2008-07-03  Ian Lance Taylor  <iant@google.com>
14693
14694         * layout.cc (Layout::include_section): Do not discard unrecognized
14695         SHT_STRTAB sections.
14696
14697 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14698
14699         * script.cc (Lex::can_continue_name): Make '?' allowable in
14700         version-script names.
14701         * testsuite/version_script.map: Change glob pattern to use '?'
14702
14703 2008-06-30  Manish Singh  <yosh@gimp.org>
14704
14705         PR 6585
14706         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14707         Correct typo.
14708
14709 2008-06-30  Ian Lance Taylor  <iant@google.com>
14710
14711         PR 6660
14712         PR 6682
14713         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14714         versions]: Don't try to read the value in the contents, since we
14715         don't use it.  Use the template endianness when writing.
14716
14717 2008-06-25  Cary Coutant  <ccoutant@google.com>
14718
14719         * fileread.cc (File_read::make_view): Assert on zero-length view.
14720         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14721         symbol table when there are no symbols to read.
14722
14723 2008-06-23  Craig Silverstein  <csilvers@google.com>
14724
14725         * version.cc (version_string): Bump to 1.7
14726
14727 2008-06-18  Craig Silverstein  <csilvers@google.com>
14728
14729         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14730         constant 0xFFFF to type Valtype.
14731         (Powerpc_relocate_functions::rel16_ha): Likewise.
14732
14733 2008-06-17  Ian Lance Taylor  <iant@google.com>
14734
14735         * output.h (Output_section::Input_section): Initialize p2align_ to
14736         zero for Output_section_data constructors.
14737         (Output_section::Input_section::addralign): If not an input
14738         section, return the alignment of the Output_section_data.
14739         * testsuite/copy_test.cc: New file.
14740         * testsuite/copy_test_1.cc: New file.
14741         * testsuite/copy_test_2.cc: New file.
14742         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14743         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14744         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14745         (copy_test_1_pic.o, copy_test_1.so): New targets.
14746         (copy_test_2_pic.o, copy_test_2.so): New targets.
14747         * testsuite/Makefile.in: Rebuild.
14748
14749         * script-sections.cc (Script_sections::place_orphan): Initialize
14750         local variable exact.
14751
14752 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14753
14754         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14755
14756 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14757             David S. Miller  <davem@davemloft.net>
14758
14759         * powerpc.cc: New file.
14760         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14761         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14762         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14763         * Makefile.in: Rebuild.
14764
14765 2008-06-09  Ian Lance Taylor  <iant@google.com>
14766
14767         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14768         <exception>.
14769         (throwing, orig_terminate): New static variables.
14770         (terminate_handler): New static function.
14771         (t2): Set terminate handler.
14772
14773 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14774
14775         PR 6584
14776         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14777         alignment.
14778
14779 2008-05-30  Cary Coutant  <ccoutant@google.com>
14780
14781         * archive.cc (Archive::include_all_members) Correct to step
14782         over symbol table and extended name table in thin archives.
14783
14784 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14785
14786         PR 6407
14787         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14788         calculation.
14789
14790 2008-05-28  Caleb Howe  <cshowe@google.com>
14791
14792         * reduced_debug_output.cc: New file.
14793         * reduced_debug_output.h: New file.
14794         * options.h (class General_options): Add --strip-debug-non-line.
14795         * options.cc (General_options::finalize): Add strip_debug_non_line
14796         to the strip heirarchy.
14797         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14798         fields.
14799         * layout.cc: Include "reduced_debug_output.h".
14800         (Layout::Layout): Initialize new fields.
14801         (line_only_debug_sections): New static array.
14802         (is_lines_only_debug_sections): New static inline function.
14803         (Layout::include_section): Handle --strip-debug-non-line.
14804         (Layout::make_output_section): If --strip-debug-non-line, build
14805         new output sections for .debug_abbrev and .debug_info.
14806         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14807         gold.  Warn about possible overflow.
14808         (read_signed_LEB_128): Likewise.
14809         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14810         (read_signed_LEB_128): Declare.
14811         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14812         (HFILES): Add reduced_debug_output.h.
14813         * Makefile.in: Rebuild.
14814
14815 2008-05-21  Ian Lance Taylor  <iant@google.com>
14816
14817         * mapfile.cc: New file.
14818         * mapfile.h: New file.
14819         * options.h (class General_options): Add -M/--print-map and -Map.
14820         * options.cc (General_options::finalize): Make -M equivalent to
14821         -Map -.
14822         * main.cc: Include <cstdio> and "mapfile.h".
14823         (main): Open mapfile if requested.
14824         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14825         constructor.  Change caller.
14826         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14827         (queue_middle_tasks): Likewise.
14828         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14829         declarations.
14830         * archive.cc: Include "mapfile.h".
14831         (Archive::add_symbols): Add mapfile parameter.  Change all
14832         callers.  Pass mapfile, symbol, and reason to include_member.
14833         (Archive::include_all_members): Add mapfile parameter.  Change all
14834         callers.
14835         (Archive::include_member): Add mapfile, sym, and why parameters.
14836         Change all callers.  Report inclusion to map file.
14837         * archive.h: Include "fileread.h".
14838         (class Archive): Update declarations.
14839         (Archive::file): New const method.
14840         (class Add_archive_symbols): Add mapfile_ field.  Update
14841         constructor.  Change all callers.
14842         * readsyms.h (class Read_symbols): Likewise.
14843         (class Finish_group): Likewise.
14844         (class Read_script): Likewise.
14845         * common.cc: Include "mapfile.h".
14846         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14847         all callers.
14848         (Symbol_table::do_allocate_commons): Likewise.
14849         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14850         symbol allocation to mapfile.
14851         * common.h (class Allocate_commons_task): Add mapfile_ field.
14852         Update constructor.  Change all callers.
14853         * symtab.h (class Symbol_table): Update declarations.
14854         * layout.cc: Include "mapfile.h".
14855         (Layout_task_runner::run): Print information to mapfile.
14856         (Layout::create_gold_note): Change Output_data_fixed_space to
14857         Output_data_zero_fill.
14858         (Layout::create_build_id): Likewise.
14859         (Layout::print_to_mapfile): New function.
14860         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14861         constructor.  Change caller.
14862         (class Layout): Declare print_to_mapfile.
14863         * output.cc (Output_section::Input_section::print_to_mapfile): New
14864         function.
14865         (Output_section::add_input_section): If producing a map, always
14866         add to input_sections_ list.
14867         (Output_section::do_print_to_mapfile): New function.
14868         (Output_segment::print_sections_to_mapfile): New function.
14869         (Output_segment::print_section_list_to_mapfile): New function.
14870         * output.h: Include "mapfile.h".
14871         (Output_data::print_to_mapfile): New function.
14872         (Output_data::do_print_to_mapfile): New virtual function.
14873         (Output_segment_headers::do_print_to_mapfile): New function.
14874         (Output_file_header::do_print_to_mapfile): New function.
14875         (Output_data_const::do_print_to_mapfile): New function.
14876         (class Output_data_const_buffer): Add map_name_ field.  Update
14877         constructor.  Change all callers.  Add do_print_to_mapfile
14878         function.
14879         (class Output_data_fixed_space): Likewise.
14880         (class Output_data_space): Likewise.
14881         (class Output_data_zero_fill): New class.
14882         (Output_data_strtab::do_print_to_mapfile): New function.
14883         (Output_data_reloc_base::do_print_to_mapfile): New function.
14884         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14885         (Output_data_group::do_print_to_mapfile): New function.
14886         (Output_data_got::do_print_to_mapfile): New function.
14887         (Output_data_dynamic::do_print_to_mapfile): New function.
14888         (Output_symtab_xindex::do_print_to_mapfile): New function.
14889         (class Output_section): Declare do_print_to_mapflie.  Declare
14890         print_to_mapfile in Input_section.
14891         (class Output_segment): Declare new functions.
14892         * object.h (Sized_relobj::symbol_count): New function.
14893         * script-sections.cc
14894         (Output_section_element_dot_assignment::set_section_addresses):
14895         Change Output_data_fixed_space to Output_data_zero_fill.
14896         (Output_data_expression::do_print_to_mapfile): New function.
14897         * script.cc (read_input_script): Add mapfile parameter.  Change
14898         all callers.
14899         * script.h (read_input_script): Update declaration.
14900         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14901         (Eh_frame::do_print_to_mapfile): New function.
14902         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14903         (Output_merge_string::do_print_to_mapfile): New function.
14904         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14905         function.
14906         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14907         function.
14908         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14909         function.
14910         * Makefile.am (CCFILES): Add mapfile.cc.
14911         (HFILES): Add mapfile.h.
14912         * Makefile.in: Rebuild.
14913
14914 2008-05-19  Ian Lance Taylor  <iant@google.com>
14915
14916         * options.h (class General_options): Add -z relro.
14917         * layout.cc (Layout::Layout): Initialize relro_segment_.
14918         (Layout::add_output_section_data): Return the output section.
14919         (Layout::make_output_section): Rcognize relro sections and mark
14920         them appropriately.
14921         (Layout::attach_allocated_section_to_segment): Put relro sections
14922         in a PT_GNU_RELRO segment.
14923         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14924         section as relro.
14925         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14926         PT_TLS segments.
14927         (Layout::linkonce_mapping): Map d.rel.ro.local to
14928         .data.rel.ro.local.
14929         (Layout::output_section_name): Us .data.rel.ro.local for any
14930         section which begins with that.
14931         * layout.h (class Layout): Update add_output_section_data
14932         declaration.  Add relro_segment_ field.
14933         * output.cc (Output_section::Output_section): Initialize is_relro_
14934         and is_relro_local_ fields.
14935         (Output_segment::add_output_section): Group relro sections.
14936         (Output_segment::is_first_section_relro): New function.
14937         (Output_segment::maximum_alignment): If there is a relro section,
14938         align the segment to the common page size.
14939         (Output_segment::set_section_addresses): Track whether we are
14940         looking at relro sections.  If the last section is a relro
14941         section, align to the common page size.
14942         (Output_segment::set_section_list_addresses): Add in_relro
14943         parameter.  Change all callers.  Align to the page size when
14944         moving from relro to non-relro section.
14945         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14946         segment.
14947         * output.h (class Output_section): Add is_relro_ and
14948         is_relro_local_ fields.
14949         (Output_section::is_relro): New function.
14950         (Output_section::set_is_relro): New function.
14951         (Output_section::is_relro_local): New function.
14952         (Output_section::set_is_relro_local): New function.
14953         (class Output_segment): Update declarations.
14954         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14955         * sparc.cc (Target_sparc::got_section): Likewise.
14956         * x86_64.cc (Target_x86_64::got_section): Likewise.
14957         * testsuite/relro_test_main.cc: New file.
14958         * testsuite/relro_test.cc: New file.
14959         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14960         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14961         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14962         (relro_test.so, relro_test_pic.o): New targets.
14963         * testsuite/Makefile.in: Rebuild.
14964
14965 2008-05-16  Ian Lance Taylor  <iant@google.com>
14966
14967         * output.cc (Output_segment::add_output_section): Remove front
14968         parameter.
14969         * output.h (class Output_segment): Remove
14970         add_initial_output_section and overloaded add_output_section.
14971         Update declaration of remaining add_output_section.
14972         * layout.cc (Layout::create_interp): Call add_output_section
14973         rather than add_initial_output_section.
14974         (Layout::finish_dynamic_section): Likewise.
14975
14976         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14977         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14978         know the dynamic type.
14979         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14980         field.  Initialize it in constructor.
14981         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14982         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14983         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14984         reloc.
14985
14986         * output.cc (Output_reloc::get_address): Change return type to
14987         Elf_Addr.
14988         * output.h (class Output_reloc): Update get_address declaration.
14989         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14990         for section addresses.
14991
14992 2008-05-09  Ian Lance Taylor  <iant@google.com>
14993
14994         PR 6493
14995         * gold.cc (gold_nomem): Use return value of write.
14996
14997 2008-05-08  Ian Lance Taylor  <iant@google.com>
14998
14999         * symtab.c (Symbol::init_base_output_data): Add version
15000         parameter.  Change all callers.
15001         (Symbol::init_base_output_segment): Likewise.
15002         (Symbol::init_base_constant): Likewise.
15003         (Symbol::init_base_undefined): Likewise.
15004         (Sized_symbol::init_output_data): Likewise.
15005         (Sized_symbol::init_output_segment): Likewise.
15006         (Sized_symbol::init_constant): Likewise.
15007         (Sized_symbol::init_undefined): Likewise.
15008         (Symbol_table::do_define_in_output_data): If the new symbol has a
15009         version, mark it as the default.
15010         (Symbol_table::do_define_in_output_segment): Likewise.
15011         (Symbol_table::do_define_as_constant): Likewise.
15012         * symtab.h (class Symbol): Update declarations.
15013         (class Sized_symbol): Likewise.
15014         * resolve.cc (Symbol::override_version): New function.
15015         (Symbol::override_base): Call override_version.
15016         (Symbol::override_base_with_special): Likewise.
15017         * testsuite/ver_script_8.script: New file.
15018         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
15019         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
15020         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
15021         (ver_test_8_1.so, ver_test_8_2.so): New targets.
15022
15023 2008-05-06  Ian Lance Taylor  <iant@google.com>
15024
15025         PR 6049
15026         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
15027         functions.
15028         (class General_options): Remove existing --undefined, and add
15029         --no-undefined instead.  Add new --undefined as synonym for -u.
15030         * archive.cc (Archive::add_symbols): Check whether symbol was
15031         named with -u.
15032         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15033         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15034         all uses.  Add IS_UNDEFINED.  Update declarations to split
15035         different versions of init_base.  Declare init_base_undefined.
15036         (Symbol::is_defined): Handle IS_UNDEFINED.
15037         (Symbol::is_undefined): Likewise.
15038         (Symbol::is_weak_undefined): Call is_undefined.
15039         (Symbol::is_absolute): Handle IS_CONSTANT.
15040         (class Sized_symbol): Update declarations to split different
15041         versions of init.  Declare init_undefined.
15042         (class Symbol_table): Declare new functions.
15043         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15044         Change all callers.
15045         (Symbol::init_base_output_data): Likewise.
15046         (Symbol::init_base_output_segment): Likewise.
15047         (Symbol::init_base_constant): Likewise.
15048         (Symbol::init_base_undefined): New function.
15049         (Sized_symbol::init_object): Rename from init.  Change all
15050         callers.
15051         (Sized_symbol::init_output_data): Likewise.
15052         (Sized_symbol::init_output_segment): Likewise.
15053         (Sized_symbol::init_constant): Likewise.
15054         (Sized_symbol::init_undefined): New function.
15055         (Symbol_table::add_undefined_symbols_from_command_line): New
15056         function.
15057         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15058         function.
15059         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15060         (Symbol::output_section): Likewise.
15061         (Symbol::set_output_section): Likewise.
15062         (Symbol_table::sized_finalize_symbol): Likewise.
15063         (Symbol_table::sized_write_globals): Likewise.
15064         * resolve.cc (Symbol_table::should_override): Likewise.
15065         (Symbol::override_base_with_special): Likewise.
15066
15067         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15068         symbol, change it to have default visibility.
15069         * testsuite/protected_1.cc: New file.
15070         * testsuite/protected_2.cc: New file.
15071         * testsuite/protected_3.cc: New file.
15072         * testsuite/protected_main_1.cc: New file.
15073         * testsuite/protected_main_2.cc: New file.
15074         * testsuite/protected_main_3.cc: New file.
15075         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15076         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15077         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15078         (protected_1.so): New target.
15079         (protected_1_pic.o, protected_2_pic.o): New targets.
15080         (protected_3_pic.o): New target.
15081         (check_PROGRAMS): Add protected_2.
15082         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15083         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15084         * testsuite/Makefile.in: Rebuild.
15085
15086         * options.h (DEFINE_var): Add set_user_set_##varname__.
15087         (DEFINE_bool_alias): New macro.
15088         (class General_options): Define -Bstatic using DEFINE_bool_alias
15089         rather than DEFINE_special.  Add --undefined as an alias for -z
15090         defs.
15091         * options.cc (General_options::parse_Bstatic): Remove.
15092
15093         * options.h (class General_options): Add --fatal-warnings.
15094         * main.cc (main): Implement --fatal-warnings.
15095         * errors.h (Errors::warning_count): New function.
15096
15097         * options.h (class General_options): Add -Bsymbolic-functions.
15098         * symtab.h (Symbol::is_preemptible): Check for
15099         -Bsymbolic-functions.
15100
15101 2008-05-05  Ian Lance Taylor  <iant@google.com>
15102
15103         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15104         as noVARNAME rather than no-VARNAME.
15105         (class General_options): Add option -z combreloc.
15106         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15107         get_address.
15108         (Output_reloc::sort_before) [SHT_REL]: New function.
15109         (Output_reloc::sort_before) [SHT_RELA]: New function.
15110         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15111         Sort_relocs_comparison.
15112         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15113         parameter.  Change all callers.
15114         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15115         sort_relocs parameter.  Change all callers.
15116         * output.cc (Output_reloc::get_address): New function, broken out
15117         of write_rel.
15118         (Output_reloc::write_rel): Call it.
15119         (Output_reloc::compare): New function.
15120         (Output_data_reloc_base::do_write): Optionally sort relocs.
15121
15122         * configure.ac: If targ_extra_obj is set, link it in.
15123         * configure.tgt: Initialize all variables.
15124         (x86_64*): Set targ_extra_obj and targ_extra_size.
15125         * configure: Rebuild.
15126
15127         * object.cc (Sized_relobj::include_section_group): Adjust section
15128         indexes read from group data.  Build vector to pass to
15129         layout_group.
15130         * layout.cc (Layout::layout_group): Add flags and shndxes
15131         parameters.  Remove contents parameter.  Change caller.  Update
15132         explicit instantiations.
15133         * layout.h (class Layout): Update layout_group declaration.
15134         * output.cc (Output_data_group::Output_data_group): Add flags and
15135         input_shndxes parameters.  Remove contents parameter.  Change
15136         caller.
15137         (Output_data_group::do_write): Change input_sections_ to
15138         input_shndxes_.
15139         * output.h (class Output_data_group): Update constructor
15140         declaration.  Rename input_sections_ to input_shndxes_.
15141         * testsuite/many_sections_test.cc: Add template.
15142
15143 2008-04-30  Cary Coutant  <ccoutant@google.com>
15144
15145         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15146
15147         * layout.cc (Layout::include_section): Refactored check for debug
15148         info section.
15149         (Layout::add_comdat): Add new parameters.  Change type
15150         of signature parameter.  Add object and shndx to signatures table.
15151         (Layout::find_kept_object): New function.
15152         * layout.h: Include <cstring>.
15153         (Layout::is_debug_info_section): New function.
15154         (Layout::add_comdat): Add new parameters.
15155         (Layout::find_kept_object): New function.
15156         (Layout::Kept_section): New struct.
15157         (Layout::Signatures): Change type of map range.
15158         * object.cc (Relobj::output_section_address): New function.
15159         (Sized_relobj::include_section_group): Add new parameters.  Change
15160         calls to Layout::add_comdat.  Change to build table of kept comdat
15161         groups and table mapping discarded sections to kept sections.
15162         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15163         (Sized_relobj::do_layout): Change calls to include_section_group and
15164         include_linkonce_section.
15165         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15166         value to zero when section is discarded.
15167         (Sized_relobj::map_to_kept_section): New function.
15168         * object.h (Relobj::output_section_address): New function.
15169         (Relobj::Comdat_group): New type.
15170         (Relobj::find_comdat_group): New function.
15171         (Relobj::Comdat_group_table): New type.
15172         (Relobj::Kept_comdat_section): New type.
15173         (Relobj::Kept_comdat_section_table): New type.
15174         (Relobj::add_comdat_group): New function.
15175         (Relobj::set_kept_comdat_section): New function.
15176         (Relobj::get_kept_comdat_section): New function.
15177         (Relobj::comdat_groups_): New field.
15178         (Relobj::kept_comdat_sections_): New field.
15179         (Symbol_value::input_value): Update comment.
15180         (Sized_relobj::map_to_kept_section) New function.
15181         (Sized_relobj::include_linkonce_section): Add new parameter.
15182         * target-reloc.h (Comdat_behavior): New type.
15183         (get_comdat_behavior): New function.
15184         (relocate_section): Add code to map a discarded section to the
15185         corresponding kept section when applying a relocation.
15186
15187 2008-04-30  Craig Silverstein  <csilvers@google.com>
15188
15189         * dwarf_reader.cc (next_generation_count): New static var.
15190         (Addr2line_cache_entry): New struct.
15191         (addr2line_cache): New static var.
15192         (Dwarf_line_info::one_addr2line): Added caching.
15193         (Dwarf_line_info::clear_addr2line_cache): New function.
15194         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15195         cache-size parameter.
15196         (Dwarf_line_info::one_addr2line_cache): New function.
15197         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15198         new cache-size argument to one_addr2line(), and clear cache.
15199
15200 2008-04-28  Cary Coutant  <ccoutant@google.com>
15201
15202         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15203         R_386_PC8 relocations.
15204
15205 2008-04-23  Ian Lance Taylor  <iant@google.com>
15206
15207         * object.cc (Sized_relobj::include_section_group): Check for
15208         invalid section group.
15209
15210         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15211         header size.
15212
15213         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15214         than read for file header.
15215         * archive.cc (Archive::include_member): Likewise.
15216
15217 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15218
15219         * aclocal.m4: Regenerate.
15220         * configure: Regenerate.
15221
15222 2008-04-19  Ian Lance Taylor  <iant@google.com>
15223
15224         * version.cc (version_string): Bump to 1.6.
15225
15226         * testsuite/Makefile.am (many_sections_r_test): New target.
15227         (many_sections_r_test_SOURCES): Remove.
15228         (many_sections_r_test_DEPENDENCIES): Remove.
15229         (many_sections_r_test_LDFLAGS): Remove.
15230         (many_sections_r_test_LDADD): Remove.
15231
15232         * object.cc (Sized_relobj::do_add_symbols): Always pass
15233         local_symbol_count_ to add_from_relobj.
15234
15235         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15236         every thousand variables.
15237         * testsuite/Makefile.in: Rebuild.
15238
15239         * object.cc (Xindex::initialize_symtab_xindex): New function.
15240         (Xindex::read_symtab_xindex): New function.
15241         (Xindex::sym_xindex_to_shndx): New function.
15242         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15243         available.
15244         (Sized_relobj::do_initialize_xindex): New function.
15245         (Sized_relobj::do_read_symbols): Adjust section links.
15246         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15247         parameter.  Change all callers.
15248         (Sized_relobj::include_section_group): Adjust section links and
15249         symbol section indexes.
15250         (Sized_relobj::do_layout): Adjust section links.
15251         (Sized_relobj::do_count_local_symbols): Adjust section links and
15252         symbol section indexes.
15253         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15254         ordinary and special symbols.
15255         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15256         dynsym_xindex parameters.  Change all callers.  Adjust section
15257         links.  Use SHN_XINDEX when needed.
15258         (Sized_relobj::get_symbol_location_info): Adjust section links.
15259         Don't get fooled by special symbols.
15260         * object.h (class Xindex): Define.
15261         (class Object): Add xindex_ parameter.  Declare virtual functoin
15262         do_initialize_xindex.
15263         (Object::adjust_sym_shndx): New function.
15264         (Object::set_xindex): New protected function.
15265         (class Symbol_value): Add is_ordinary_shndx_ field.
15266         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15267         (Symbol_value::value): Assert ordinary section.
15268         (Symbol_value::initialize_input_to_output_map): Likewise.
15269         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15270         Change all callers.
15271         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15272         all callers.
15273         (class Sized_relobj): Update declarations.
15274         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15275         parameter.  Change all callers.
15276         (Sized_relobj::adjust_shndx): New function.
15277         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15278         field.
15279         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15280         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15281         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15282         (Sized_dynobj::read_dynsym_section): Adjust section links.
15283         (Sized_dynobj::read_dynamic): Likewise.
15284         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15285         section links.
15286         (Sized_dynobj::do_initialize_xindex): New function.
15287         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15288         do_initialize_xindex.
15289         (Sized_dynobj::adjust_shndx): New function.
15290         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15291         dynsym_xindex_ fields.
15292         (Layout::finalize): Add a call to set_section_indexes before
15293         creating the symtab sections.
15294         (Layout::set_section_indexes): Don't do anything if the section
15295         already has a section index.
15296         (Layout::create_symtab_sections): Add shnum parameter.  Change
15297         caller.  Create .symtab_shndx section if needed.
15298         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15299         caller.
15300         (Layout::allocated_output_section_count): New function.
15301         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15302         needed.
15303         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15304         fields.  Update declarations.
15305         (Layout::symtab_xindex): New function.
15306         (Layout::dynsym_xindex): New function.
15307         (class Write_symbols_task): Add layout_ field.
15308         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15309         Change caller.
15310         * output.cc (Output_section_headers::Output_section_headers): Add
15311         shstrtab_section parameter.  Change all callers.
15312         (Output_section_headers::do_sized_write): Store overflow values
15313         for section count and section string table section index in
15314         section header zero.
15315         (Output_file_header::do_sized_write): Check for overflow of
15316         section count and section string table section index.
15317         (Output_symtab_xindex::do_write): New function.
15318         (Output_symtab_xindex::endian_do_write): New function.
15319         * output.h (class Output_section_headers): Add shstrtab_section_.
15320         Update declarations.
15321         (class Output_symtab_xindex): Define.
15322         (Output_section::has_out_shndx): New function.
15323         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15324         field.
15325         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15326         Change all callers.
15327         (Sized_symbol::init): Likewise.
15328         (Symbol::output_section): Check for ordinary symbol.
15329         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15330         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15331         callers.
15332         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15333         Change all callers.  Simplify handling of symbols from sections
15334         not included in the link.
15335         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15336         distinction.
15337         (Weak_alias_sorter::operator()): Assert that symbols are
15338         ordinary.
15339         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15340         distinction.
15341         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15342         parameters.  Change all callers.
15343         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15344         symbol distinction.  Use SHN_XINDEX when needed.
15345         (Symbol_table::write_section_symbol): Add symtab_xindex
15346         parameter.  Change all callers.
15347         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15348         SHN_XINDEX when needed.
15349         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15350         declarations.
15351         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15352         (Symbol::is_defined): Check is_ordinary.
15353         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15354         (Symbol::is_absolute, Symbol::is_common): Likewise.
15355         (class Sized_symbol): Update declarations.
15356         (class Symbol_table): Update declarations.
15357         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15358         parameters.  Change all callers.
15359         (Sized_symbol::override): Likewise.
15360         (Symbol_table::override): Likewise.
15361         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15362         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15363         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15364         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15365         to be in an ordinary section.
15366         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15367         object and is_ordinary parameters.  Change all callers.
15368         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15369         Change all callers.  Don't add undefined or non-ordinary symbols
15370         to reloc_map_.
15371         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15372         Change all callers.
15373         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15374         declarations.
15375         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15376         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15377         (Sized_relobj::relocate_sections): Likewise.
15378         * target-reloc.h (scan_relocs): Adjust section symbol index.
15379         (scan_relocatable_relocs): Likewise.
15380         * i386.cc (Scan::local): Check for ordinary symbols.
15381         * sparc.cc (Scan::local): Likewise.
15382         * x86_64.cc (Scan::local): Likewise.
15383         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15384         to symbol_section_and_value.
15385         * testsuite/many_sections_test.cc: New file.
15386         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15387         (check_PROGRAMS): Add many_sections_test.
15388         (many_sections_test_SOURCES): Define.
15389         (many_sections_test_DEPENDENCIES): Define.
15390         (many_sections_test_LDFLAGS): Define.
15391         (BUILT_SOURCES): Add many_sections_define.h.
15392         (many_sections_define.h): New target.
15393         (BUILT_SOURCES): Add many_sections_check.h.
15394         (many_sections_check.h): New target.
15395         (check_PROGRAMS): Add many_sections_r_test.
15396         (many_sections_r_test_SOURCES): Define.
15397         (many_sections_r_test_DEPENDENCIES): Define.
15398         (many_sections_r_test_LDFLAGS): Define.
15399         (many_sections_r_test_LDADD): Define.
15400         (many_sections_r_test.o): New target.
15401         * testsuite/Makefile.in: Rebuild.
15402
15403 2008-04-17  Cary Coutant  <ccoutant@google.com>
15404
15405         * errors.cc (Errors::info): New function.
15406         (gold_info): New function.
15407         * errors.h (Errors::info): New function.
15408         * gold.h (gold_info): New function.
15409         * object.cc (Input_objects::add_object): Print trace output.
15410         * options.cc (options::parse_set): New function.
15411         (General_options::parse_wrap): Deleted.
15412         (General_options::General_options): Deleted initializer.
15413         * options.h (options::String_set): New typedef.
15414         (options::parse_set): New function.
15415         (DEFINE_set): New macro.
15416         (General_options::wrap): Changed to use DEFINE_set. Changed
15417         callers of any_wrap_symbols and is_wrap_symbol.
15418         (General_options::trace, General_options::trace_symbol):
15419         New options.
15420         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15421         (General_options::wrap_symbols_): Deleted.
15422         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15423
15424 2008-04-17  David S. Miller  <davem@davemloft.net>
15425
15426         * options.cc (General_options::parse_V): New function.
15427         * options.h: Add entries for -V and -Qy.
15428
15429 2008-04-17  Ian Lance Taylor  <iant@google.com>
15430
15431         * common.cc (Symbol_table::allocate_commons): Remove options
15432         parameter.  Change caller.
15433         (Symbol_table::do_allocate_commons): Remove options parameter.
15434         Change caller.  Just call do_allocate_commons_list twice.
15435         (Symbol_table::do_allocate_commons_list): New function, broken out
15436         of do_allocate_commons.
15437         * common.h (class Allocate_commons_task): Remove options_ field.
15438         Update constructor.
15439         * symtab.cc (Symbol_table::Symbol_table): Initialize
15440         tls_commons_.
15441         (Symbol_table::add_from_object): Put TLS common symbols on
15442         tls_commons_ list.
15443         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15444         which are IN_OUTPUT_DATA.
15445         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15446         allocate_commons and do_allocate_commons declarations.  Declare
15447         do_allocate_commons_list.
15448         * gold.cc (queue_middle_tasks): Update creation of
15449         Allocate_commons_task to not pass options.
15450         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15451         (TLS_TEST_C_FLAGS): New variable.
15452         (tls_test_c_pic.o): New target.
15453         (tls_test_shared.so): Link in tls_test_c_pic.o.
15454         (tls_test_c_pic_ie.o): New target.
15455         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15456         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15457         (tls_test_c.o): New target.
15458         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15459         (tls_pic_test_LDADD): Likewise.
15460         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15461         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15462         (tls_test_c_gnu2.o): New target.
15463         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15464         tls_test_c_gnu2.o.
15465         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15466         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15467         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15468         * testsuite/tls_test.cc: Include "config.h".
15469         (t_last): Call t11_last.
15470         * testsuite/tls_test.h (t11, t11_last): Declare.
15471         * testsuite/tls_test_c.c: New file.
15472         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15473         * configure.ac: Check for OpenMP support.
15474         * configure, config.in, Makefile.in: Rebuild.
15475         * testsuite/Makefile.in: Rebuild.
15476
15477 2008-04-16  Cary Coutant  <ccoutant@google.com>
15478
15479         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15480         (Target_i386::tls_base_symbol_defined_): New field.
15481         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15482         (Target_i386::Scan::global): Likewise.
15483         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15484         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15485         (Target_x86_64::tls_base_symbol_defined_): New field.
15486         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15487         (Target_x86_64::Scan::global): Likewise.
15488
15489 2008-04-16  Cary Coutant  <ccoutant@google.com>
15490
15491         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15492         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15493         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15494         building shared libraries.
15495         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15496         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15497         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15498         * testsuite/Makefile.in: Rebuild.
15499         * testsuite/weak_undef.h: New file.
15500         * testsuite/weak_undef_file1.cc: Add extra test cases.
15501         * testsuite/weak_undef_file2.cc: Likewise.
15502         * testsuite/weak_undef_test.cc: Likewise.
15503
15504 2008-04-16  David S. Miller  <davem@davemloft.net>
15505
15506         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15507         Add issued_non_pic_error_ field.  Declare check_non_pic.
15508         (Target_sparc::Scan::check_non_pic): New function.
15509         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15510         (Target_sparc::Scan::global): Likewise.
15511
15512         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15513         * configure: Rebuild.
15514
15515         * options.h (DEFINE_enable): New macro.
15516         (new_dtags): New enable option.
15517         (initfirst, interpose, loadfltr, nodefaultlib,
15518         nodelete, nodlopen, nodump): New -z options.
15519         * layout.cc (Layout:finish_dynamic_section): If new
15520         dtags enabled, emit DT_RUNPATH.  Also, emit a
15521         DT_FLAGS_1 containing any specified -z flags.
15522
15523 2008-04-16  Ian Lance Taylor  <iant@google.com>
15524
15525         * copy-relocs.cc: New file.
15526         * copy-relocs.h: New file.
15527         * reloc.cc: Remove Copy_relocs code.
15528         * reloc.h: Likewise.
15529         * reloc-types.h (struct Reloc_types) [both versions]: Add
15530         get_reloc_addend_noerror.
15531         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15532         variants of add_global which take an addend which must be zero.
15533         * i386.cc: Include "copy-relocs.h".
15534         (class Target_i386): Change type of copy_relocs_ to variable,
15535         update initializer.
15536         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15537         Change all callers.
15538         (Target_i386::do_finalize_sections): Change handling of
15539         copy_relocs_.
15540         * sparc.cc: Include "copy-relocs.h".
15541         (class Target_sparc): Change type of copy_relocs_ to variable,
15542         update initializer.
15543         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15544         Change all callers.
15545         (Target_sparc::do_finalize_sections): Change handling of
15546         copy_relocs_.
15547         * x86_64.cc: Include "copy-relocs.h".
15548         (class Target_x86_64): Change type of copy_relocs_ to variable,
15549         update initializer.
15550         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15551         class.  Change all callers.
15552         (Target_x86_64::do_finalize_sections): Change handling of
15553         copy_relocs_.
15554         * Makefile.am (CCFILES): Add copy-relocs.cc.
15555         (HFILES): Add copy-relocs.h.
15556
15557         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15558
15559         * testsuite/script_test_4.sh: Permit leading zeroes.
15560
15561 2008-04-15  Ian Lance Taylor  <iant@google.com>
15562
15563         * script-sections.cc (Script_sections::create_segments): Use
15564         header_size_adjustment even when there is enough room for the
15565         headers.
15566         * testsuite/script_test_4.sh: New file.
15567         * testsuite/script_test_4.t: New file.
15568         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15569         (check_DATA): Add script_test_4.stdout.
15570         (MOSTLYCLEANFILES): Likewise.
15571         (script_test_4): New target.
15572         (script_test_4.stdout): New target.
15573         * testsuite/Makefile.in: Rebuild.
15574
15575         * sparc.cc: Add definitions for Output_data_plt_sparc class
15576         constants.
15577
15578 2008-04-14  David S. Miller  <davem@davemloft.net>
15579
15580         * sparc.cc: New file.
15581         * Makefile.am (TARGETSOURCES): Add sparc.cc
15582         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15583         * configure.tgt: Document targ_extra_size and
15584         targ_extra_big_endian.  Add entries for sparc-* and
15585         sparc64-*.
15586         * configure.ac: Handle targ_extra_size and
15587         targ_extra_big_endian.
15588         * Makefile.in: Rebuild.
15589         * configure: Likewise.
15590         * po/POTFILES.in: Likewise.
15591         * po/gold.pot: Likewise.
15592
15593 2008-04-14  Ian Lance Taylor  <iant@google.com>
15594
15595         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15596         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15597         in the name/type/flags to section mapping.  Don't call
15598         allocate_output_section.
15599         (Layout::choose_output_section): Change parameter from adjust_name
15600         to is_input_section.  Don't permit input sections after sections
15601         are attached to segments.  Don't call allocate_output_section.
15602         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15603         not write_enable_output_section.
15604         (Layout::make_output_section): Don't push to
15605         unattached_section_list_ nor call attach_to_segment.  Call
15606         attach_section_to_segment if sections are attached.
15607         (Layout::attach_sections_to_segments): New function.
15608         (Layout::attach_section_to_segment): New function.
15609         (Layout::attach_allocated_section_to_segment): Rename from
15610         attach_to_segment.  Remove flags parameter.
15611         (Layout::allocate_output_section): Remove function.
15612         (Layout::write_enable_output_section): Remove function.
15613         * layout.h (class Layout): Update for above changes.  Add new
15614         field sections_are_attached_.
15615         * output.h (Output_section::update_flags_for_input_section): New
15616         function.
15617         * output.cc (Output_section::add_input_section): Call
15618         update_flags_for_input_section.
15619         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15620
15621 2008-04-11  Cary Coutant  <ccoutant@google.com>
15622
15623         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15624         thought unnecessary.
15625         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15626
15627 2008-04-11  Ian Lance Taylor  <iant@google.com>
15628
15629         * output.h (class Output_section_data): Remove inline definition
15630         of set_addralign.
15631         * output.cc (Output_section_data::set_addralign): New function.
15632
15633 2008-04-11  Cary Coutant  <ccoutant@google.com>
15634
15635         Add support for TLS descriptors for i386 and x86_64.
15636         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15637         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15638         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15639         GOT_TYPE_TLS_DESC.
15640         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15641         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15642         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15643         relocations.
15644         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15645         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15646         Fix problem with initial-exec relocations.
15647         (Target_i386::Relocate::relocate_tls): Likewise.
15648         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15649         relaxation.
15650         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15651         support for section-plus-offset dynamic table entries.
15652         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15653         (Output_data_dynamic::Dynamic_entry): Add support for
15654         section-plus-offset dynamic table entries.
15655         (Output_data_dynamic::Classification): Likewise.
15656         (Output_data_dynamic::classification_): Renamed offset_.
15657         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15658         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15659         (Target_x86_64::make_plt_section): New function.
15660         (Target_x86_64::reserve_tlsdesc_entries): New function.
15661         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15662         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15663         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15664         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15665         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15666         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15667         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15668         add extra PLT entry for TLS descriptors.
15669         (Output_data_plt_x86_64::got_): New field.
15670         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15671         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15672         fields.
15673         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15674         descriptors.
15675         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15676         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15677         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15678         R_386_TLS_DESC_CALL relocations.
15679         (Target_x86_64::Scan::global): Likewise.
15680         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15681         for TLS descriptors.
15682         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15683         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15684         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15685         GD-to-IE relaxation.
15686         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15687         and TLS_DESCRIPTORS.
15688         * Makefile.in: Rebuild.
15689         * configure: Rebuild.
15690         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15691         (tls_test_shared2.so): New target.
15692         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15693         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15694         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15695         (tls_shared_gd_to_ie_test_LDADD): New variable.
15696         (tls_shared_gnu2_gd_to_ie_test): New target.
15697         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15698         New targets.
15699         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15700         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15701         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15702         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15703         (tls_shared_gnu2_test): New target.
15704         (tls_test_gnu2_shared.so): New target.
15705         (tls_shared_gnu2_test_SOURCES): New variable.
15706         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15707         (tls_shared_gnu2_test_LDFLAGS): New variable.
15708         (tls_shared_gnu2_test_LDADD): New variable.
15709         * testsuite/Makefile.in: Rebuild.
15710         * testsuite/Makefile.
15711
15712 2008-04-11  Ian Lance Taylor  <iant@google.com>
15713
15714         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15715         justsyms.t.
15716         * testsuite/Makefile.in: Rebuild.
15717
15718         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15719         long.
15720         * testsuite/script_test_2.cc (main): Adjust test.
15721
15722 2008-04-11  David S. Miller  <davem@davemloft.net>
15723             Ian Lance Taylor  <iant@google.com>
15724
15725         * options.h (General_options): Add entries for '-Y' and
15726         '-relax'.
15727         * options.cc (General_options:finalize): If -Y was used, add those
15728         entries to the library path instead of the default "/lib" and
15729         "/usr/lib".
15730
15731 2008-04-11  David S. Miller  <davem@davemloft.net>
15732
15733         * testsuite/justsyms.t: Start at 0x100.
15734         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15735         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15736         long.
15737         * testsuite/script_test_2.cc: Adjust string and section length
15738         checks.
15739
15740 2008-04-09  Ian Lance Taylor  <iant@google.com>
15741
15742         PR gold/5996
15743         * script-sections.cc (Sections_element::allocate_to_segment): Add
15744         orphan parameter.
15745         (Output_section_definition::allocate_to_segment): Likewise.
15746         (Orphan_output_section::allocate_to_segment): Likewise.
15747         (Script_sections::attach_sections_using_phdrs_clause): Don't
15748         propagate non-PT_LOAD segments to orphan sections.
15749         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15750         readelf rather than objdump.
15751         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15752         .interp section and PT_INTERP segment are the same size.
15753         * testsuite/Makefile.in: Rebuild.
15754
15755         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15756         aliases for symbols defined in the same object.
15757         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15758         (weak_alias_test_SOURCES): New variable.
15759         (weak_alias_test_DEPENDENCIES): New variable.
15760         (weak_alias_test_LDFLAGS): New variable.
15761         (weak_alias_test_LDADD): New variable.
15762         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15763         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15764         (weak_alias_test_3.o): New target.
15765         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15766         * testsuite/weak_alias_test_main.cc: New file.
15767         * testsuite/weak_alias_test_1.cc: New file.
15768         * testsuite/weak_alias_test_2.cc: New file.
15769         * testsuite/weak_alias_test_3.cc: New file.
15770
15771 2008-04-08  Ian Lance Taylor  <iant@google.com>
15772
15773         * options.h (class General_options): Add --noinhibit-exec option.
15774         * main.cc (main): Check --noinhibit-exec.
15775
15776         * options.h (class General_options): Define --wrap as a special
15777         option.  Add wrap_symbols_ field.
15778         (General_options::any_wrap_symbols): New function.
15779         (General_options::is_wrap_symbol): New function.
15780         * options.cc (General_options::parse_wrap): New function.
15781         (General_options::General_options): Initialize wrap_symbols_.
15782         * symtab.cc (Symbol_table::wrap_symbol): New function.
15783         (Symbol_table::add_from_object): Handle --wrap.
15784         * symtab.h (class Symbol_table): Declare wrap_symbol.
15785         * target.h (Target::wrap_char): New function.
15786         (Target::Target_info): Add wrap_char field.
15787         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15788         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15789         * testsuite/testfile.cc (Target_test::test_target_info):
15790         Likewise.
15791
15792         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15793         there is one.
15794
15795         * layout.h (class Layout): Add added_eh_frame_data_ field.
15796         * layout.cc (Layout::Layout): Initialize new field.
15797         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15798         output section until we find a section we merged successfully.
15799         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15800         that the size be non-zero.
15801
15802         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15803         qualifier.
15804
15805 2008-04-08  Craig Silverstein  <csilvers@google.com>
15806
15807         * configure.ac: Export new conditional variable HAVE_ZLIB.
15808         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15809         on HAVE_ZLIB.
15810         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15811         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15812
15813 2008-04-07  Ian Lance Taylor  <iant@google.com>
15814
15815         * version.cc (version_string): Set to "1.5".
15816
15817         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15818         Add issued_non_pic_error_ field.  Declare check_non_pic.
15819         (Target_x86_64::Scan::check_non_pic): New function.
15820         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15821         (Target_x86_64::Scan::global): Likewise.
15822
15823         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15824         addend parameter.  Change caller.  Handle merge sections.
15825         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15826         Address to Addend.  Don't add in the result of
15827         local_section_offset, pass down the addend and use the returned
15828         value.
15829         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15830         Update declarations of local_section_offset and symbol_value.
15831         * testsuite/two_file_test_1.cc (t18): New function.
15832         * testsuite/two_file_test_2.cc (f18): New function.
15833         * testsuite/two_file_test_main.cc (main): Call t18.
15834         * testsuite/two_file_test.h (t18, f18): Declare.
15835
15836         * configure.ac: Don't test for objdump, c++filt, or readelf.
15837         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15838         conditionals.
15839         (TEST_READELF): New variable.
15840         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15841         (check_PROGRAMS): Add two_file_strip_test.
15842         (two_file_strip_test): New target.
15843         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15844         (two_file_same_shared_strip_test_SOURCES): New variable.
15845         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15846         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15847         (two_file_same_shared_strip_test_LDADD): New variable.
15848         (two_file_shared_strip.so): New target.
15849         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15850         (ver_test_5.syms, ver_test_7.syms): Likewise.
15851         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15852         (strip_test_3.stdout): Use TEST_OBJDUMP.
15853         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15854
15855 2008-04-04  Cary Coutant  <ccoutant@google.com>
15856
15857         * symtab.h (Symbol::is_weak_undefined): New function.
15858         (Symbol::is_strong_undefined): New function.
15859         (Symbol::is_absolute): New function.
15860         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15861         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15862         absolute symbols.
15863         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15864         (weak_undef_test): New target.
15865         * testsuite/Makefile.in: Rebuild.
15866         * testsuite/weak_undef_file1.cc: New file.
15867         * testsuite/weak_undef_file2.cc: New file.
15868         * testsuite/weak_undef_test.cc: New file.
15869
15870 2008-04-03  Craig Silverstein  <csilvers@google.com>
15871
15872         * compressed_output.h (class Output_compressed_section): Use
15873         unsigned buffer.
15874         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15875         add zlib header.
15876         (zlib_compressed_suffix): Removed.
15877         (Output_compressed_section::set_final_data_size): Use unsigned
15878         buffers.
15879         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15880         Fix linker invocation.
15881         (flagstest_o_specialfile_and_compress_debug_sections):
15882         Likewise.
15883         * testsuite/Makefile.in: Regenerated.
15884
15885 2008-04-02  David S. Miller  <davem@davemloft.net>
15886
15887         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15888         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15889
15890 2008-04-02  Craig Silverstein  <csilvers@google.com>
15891
15892         * TODO: New file.
15893
15894 2008-04-02  Ian Lance Taylor  <iant@google.com>
15895
15896         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15897         parameters.  Update for new key type to views_.  Change all
15898         callers.
15899         (File_read::read): Adjust for byteshift in returned view.
15900         (File_read::add_view): New function, broken out of
15901         find_and_make_view.
15902         (File_read::make_view): New function, broken out of
15903         find_and_make_view.
15904         (File_read::find_or_make_view): Add offset and aligned
15905         parameters.  Rewrite accordingly.  Change all callers.
15906         (File_read::get_view): Add offset and aligned parameters.  Adjust
15907         for byteshift in return value.
15908         (File_read::get_lasting_view): Likewise.
15909         * fileread.h (class File_read): Update declarations.
15910         (class File_read::View): Add byteshift_ field.  Add byteshift to
15911         constructor.  Add byteshift method.
15912         * archive.h (Archive::clear_uncached_views): New function.
15913         (Archive::get_view): Add aligned parameter.  Change all callers.
15914         * object.h (Object::get_view): Add aligned parameter.  Change all
15915         callers.
15916         (Object::get_lasting_view): Likewise.
15917
15918         * fileread.cc (File_read::release): Don't call clear_views if
15919         there are multiple objects.
15920         * fileread.h (File_read::clear_uncached_views): New function.
15921         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15922         on the archive.
15923
15924 2008-03-31  Cary Coutant  <ccoutant@google.com>
15925
15926         Add thin archive support.
15927         * archive.cc (Archive::armagt): New const.
15928         (Archive::setup): Remove task parameter and calls to unlock.
15929         (Archive::unlock_nested_archives): New function.
15930         (Archive::read_header): Add nested_off parameter. Change
15931         all callers.
15932         (Archive::interpret_header): Likewise.
15933         (Archive::include_all_members): Change to handle thin
15934         archives.
15935         (Archive::include_member): Likewise.
15936         * archive.h (Archive::Archive): Add new parameters and
15937         initializers.
15938         (Archive::armagt): New const.
15939         (Archive::setup): Remove task parameter.
15940         (Archive::unlock_nested_archives): New function.
15941         (Archive::read_header): Add nested_off parameter.
15942         (Archive::interpret_header): Likewise.
15943         (Archive::Nested_archive_table): New typedef.
15944         (Archive::is_thin_archive_): New field.
15945         (Archive::nested_archives_): New field.
15946         (Archive::options_): New field.
15947         (Archive::dirpath_): New field.
15948         (Archive::task_): New field.
15949         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15950         for thin archives.  Pass additional parameters to
15951         Archive::Archive.  Unlock the archive file after calling
15952         Archive::setup.
15953
15954 2008-03-29  Ian Lance Taylor  <iant@google.com>
15955
15956         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15957         version symbol to be local.
15958         * testsuite/ver_test_4.sh: New file.
15959         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15960         (check_DATA): Add ver_test_4.syms.
15961         (ver_test_4.syms): New target.
15962         * testsuite/Makefile.in: Rebuild.
15963
15964         * output.cc
15965         (Output_section::Input_section_sort_entry::has_priority): New
15966         function.
15967         (Output_section::Input_section_sort_entry::match_file_name): New
15968         function.
15969         (Output_section::Input_section_sort_entry::match_section_name):
15970         Remove.
15971         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15972         Remove.
15973         (Output_section::Input_section_sort_entry::match_section_file):
15974         Remove.
15975         (Output_section::Input_section_sort_compare::operator()): Rewrite
15976         using new Input_section_sort_entry functions.  Sort crtbegin and
15977         crtend first.  Sort sections with no priority before sections with
15978         a priority.
15979         * testsuite/initpri1.c (d3): Check j != 4.
15980         (cd5): New constructor/destructor function.
15981         (main): Check j != 2.
15982
15983         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15984         new symbol when resolving, don't call set_is_default.
15985         * testsuite/ver_test_7.cc: New file.
15986         * testsuite/ver_test_7.sh: New file.
15987         * testsuite/Makefile.am (ver_test_7.so): New target.
15988         (ver_test_7.o): New target.
15989         (check_SCRIPTS): Add ver_test_7.sh.
15990         (check_DATA): Add ver_test_7.syms.
15991         (ver_test_7.syms): New target.
15992
15993 2008-03-28  Ian Lance Taylor  <iant@google.com>
15994
15995         * layout.cc (Layout::layout): If we see an input section with a
15996         name that needs sorting, set the must_sort flag for the output
15997         section.
15998         (Layout::make_output_section): If the name of the output section
15999         indicates that it might require sorting, set the may_sort flag.
16000         * output.h (Output_section::may_sort_attached_input_sections): New
16001         function.
16002         (Output_section::set_may_sort_attached_input_sections): New
16003         function.
16004         (Output_section::must_sort_attached_input_sections): New
16005         function.
16006         (Output_section::set_must_sort_attached_input_sections): New
16007         function.
16008         (class Output_section): Declare Input_section_sort_entry.  Define
16009         Input_section_sort_compare.  Declare
16010         sort_attached_input_sections.  Add new fields:
16011         may_sort_attached_input_sections_,
16012         must_sort_attached_input_sections_,
16013         attached_input_sections_are_sorted_.
16014         * output.cc (Output_section::Output_section): Initialize new
16015         fields.
16016         (Output_section::add_input_section): Add an entry to
16017         input_sections_ if may_sort or must_sort are true.
16018         (Output_section::set_final_data_size): Call
16019         sort_attached_input_sections if necessary.
16020         (Output_section::Input_section_sort_entry): Define new class.
16021         (Output_section::Input_section_sort_compare::operator()): New
16022         function.
16023         (Output_section::sort_attached_input_sections): New function.
16024         * configure.ac: Check whether the compiler supports constructor
16025         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
16026         * testsuite/initpri1.c: New file.
16027         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
16028         CONSTRUCTOR_PRIORITY.
16029         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
16030         (initpri1_LDFLAGS): New variable.
16031         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
16032
16033 2008-03-27  Ian Lance Taylor  <iant@google.com>
16034
16035         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16036         * testsuite/common_test_1.c: New file.
16037         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16038         (common_test_1_SOURCES): New variable.
16039         (common_test_1_DEPENDENCIES): New variable.
16040         (common_test_1_LDFLAGS): New variable.
16041
16042         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16043         and commons_ correctly when NAME/VERSION does not override
16044         NAME/NULL.
16045         * testsuite/ver_test_6.c: New file.
16046         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16047         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16048         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16049
16050 2008-03-26  Ian Lance Taylor  <iant@google.com>
16051
16052         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16053         of an undefined symbol from a version script.
16054         * testsuite/Makefile.am (ver_test_5.so): New target.
16055         (ver_test_5.o): New target.
16056         (check_SCRIPTS): Add ver_test_5.sh.
16057         (check_DATA): Add ver_test_5.syms.
16058         (ver_test_5.syms): New target.
16059         * testsuite/ver_test_5.cc: New file.
16060         * testsuite/ver_test_5.script: New file.
16061         * testsuite/ver_test_5.sh: New file.
16062         * Makefile.in, testsuite/Makefile.in: Rebuild.
16063
16064         PR gold/5986
16065         Fix problems building gold with gcc 4.3.0.
16066         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16067         (gold_error_at_location, gold_warning_at_location): Use it.
16068         * configure.ac: Check whether we can compile and use a template
16069         function with a printf attribute.
16070         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16071         when jumping over bytes.
16072         * object.cc: Instantiate Object::read_section_data.
16073         * debug.h: Include <cstring>
16074         * dwarf_reader.cc: Include <algorithm>
16075         * main.cc: Include <cstring>.
16076         * options.cc: Include <cstring>.
16077         * output.cc: Include <cstring>.
16078         * script.cc: Include <cstring>.
16079         * script.h: Include <string>.
16080         * symtab.cc: Include <cstring> and <algorithm>.
16081         * target-select.cc: Include <cstring>.
16082         * version.cc: Include <string>.
16083         * testsuite/testmain.cc: Include <cstdlib>.
16084         * configure, config.in: Rebuild.
16085
16086 2008-03-25  Ian Lance Taylor  <iant@google.com>
16087
16088         * options.cc: Include "../bfd/bfdver.h".
16089         (options::help): Print bug reporting address.
16090
16091         * version.cc (print_version): Adjust output for current value of
16092         BFD_VERSION_STRING.
16093
16094         * NEWS: New file.
16095
16096         * options.cc (options::help): Print list of supported targets.
16097         * target-select.h: Include <vector>.
16098         (class Target_selector): Make machine_, size_, and is_big_endian_
16099         fields const.  Add bfd_name_ and instantiated_target_ fields.
16100         (Target_selector::Target_selector): Add bfd_name parameter.
16101         (Target_selector::recognize): Make non-virtual, call
16102         do_recognize.
16103         (Target_selector::recognize_by_name): Make non-virtual, call
16104         do_recognize_by_name.
16105         (Target_selector::supported_names): New function.
16106         (Target_selector::bfd_name): New function.
16107         (Target_selector::do_instantiate_target): New pure virtual
16108         function.
16109         (Target_selector::do_recognize): New virtual function.
16110         (Target_selector::do_recognize_by_name): New virtual function.
16111         (Target_selector::instantiate_target): New private function.
16112         (supported_target_names): Declare.
16113         * target-select.cc (Target_selector::Target_selector): Update for
16114         new parameter and fields.
16115         (select_target_by_name): Check that the name matches before
16116         calling recognize_by_name.
16117         (supported_target_names): New function.
16118         * i386.cc (class Target_selector_i386): Update Target_selector
16119         constructor call.  Remove recognize and recognize_by_name.  Add
16120         do_instantiate_target.
16121         * x86_64.cc (class Target_selector_x86_64): Likewise.
16122         * testsuite/testfile.cc (class Target_selector_test): Update for
16123         changes to Target_selector.
16124
16125         * README: Rewrite, with some notes on unsupported features.
16126
16127 2008-03-24  Cary Coutant  <ccoutant@google.com>
16128
16129         * i386.cc (Target_i386::Got_type): New enum declaration.
16130         (Target_i386::Scan::local): Updated callers of Output_data_got
16131         member functions.
16132         (Target_i386::Scan::global): Likewise.
16133         (Target_i386::Relocate::relocate): Likewise.
16134         (Target_i386::Relocate::relocate_tls): Likewise.
16135         * object.h (Got_offset_list): New class.
16136         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16137         (Sized_relobj::local_got_offset): Likewise.
16138         (Sized_relobj::set_local_got_offset): Likewise.
16139         (Sized_relobj::local_has_tls_got_offset): Removed.
16140         (Sized_relobj::local_tls_got_offset): Removed.
16141         (Sized_relobj::set_local_tls_got_offset): Removed.
16142         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16143         * output.cc (Output_data_got::add_global): Added got_type parameter.
16144         (Output_data_got::add_global_with_rel): Likewise.
16145         (Output_data_got::add_global_with_rela): Likewise.
16146         (Output_data_got::add_global_pair_with_rel): New function.
16147         (Output_data_got::add_global_pair_with_rela): New function.
16148         (Output_data_got::add_local): Added got_type parameter.
16149         (Output_data_got::add_local_with_rel): Likewise.
16150         (Output_data_got::add_local_with_rela): Likewise.
16151         (Output_data_got::add_local_pair_with_rel): New function.
16152         (Output_data_got::add_local_pair_with_rela): New function.
16153         (Output_data_got::add_global_tls): Removed.
16154         (Output_data_got::add_global_tls_with_rel): Removed.
16155         (Output_data_got::add_global_tls_with_rela): Removed.
16156         (Output_data_got::add_local_tls): Removed.
16157         (Output_data_got::add_local_tls_with_rel): Removed.
16158         (Output_data_got::add_local_tls_with_rela): Removed.
16159         * output.h (Output_data_got::add_global): Added got_type parameter.
16160         (Output_data_got::add_global_with_rel): Likewise.
16161         (Output_data_got::add_global_with_rela): Likewise.
16162         (Output_data_got::add_global_pair_with_rel): New function.
16163         (Output_data_got::add_global_pair_with_rela): New function.
16164         (Output_data_got::add_local): Added got_type parameter.
16165         (Output_data_got::add_local_with_rel): Likewise.
16166         (Output_data_got::add_local_with_rela): Likewise.
16167         (Output_data_got::add_local_pair_with_rel): New function.
16168         (Output_data_got::add_local_pair_with_rela): New function.
16169         (Output_data_got::add_global_tls): Removed.
16170         (Output_data_got::add_global_tls_with_rel): Removed.
16171         (Output_data_got::add_global_tls_with_rela): Removed.
16172         (Output_data_got::add_local_tls): Removed.
16173         (Output_data_got::add_local_tls_with_rel): Removed.
16174         (Output_data_got::add_local_tls_with_rela): Removed.
16175         * resolve.cc (Symbol::override_base_with_special): Removed
16176         reference to has_got_offset_ field.
16177         * symtab.cc (Symbol::init_fields): Replaced initialization
16178         of got_offset_ with got_offsets_.  Removed initialization
16179         of has_got_offset_
16180         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16181         (Symbol::got_offset): Likewise.
16182         (Symbol::set_got_offset): Likewise.
16183         (Symbol::has_tls_got_offset): Removed.
16184         (Symbol::tls_got_offset): Removed.
16185         (Symbol::set_tls_got_offset): Removed.
16186         (Symbol::got_offset_): Removed.
16187         (Symbol::tls_mod_got_offset_): Removed.
16188         (Symbol::tls_pair_got_offset_): Removed.
16189         (Symbol::got_offsets_): New field.
16190         (Symbol::has_got_offset): Removed.
16191         (Symbol::has_tls_mod_got_offset): Removed.
16192         (Symbol::has_tls_pair_got_offset): Removed.
16193         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16194         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16195         member functions.
16196         (Target_x86_64::Scan::global): Likewise.
16197         (Target_x86_64::Relocate::relocate): Likewise.
16198         (Target_x86_64::Relocate::relocate_tls): Likewise.
16199
16200 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16201
16202         * yyscript.y: Fix spelling error in comment.
16203
16204 2008-03-24  Ian Lance Taylor  <iant@google.com>
16205
16206         * options.h (class General_options): Define build_id option.
16207         * layout.h (class Layout): Declare write_build_id, create_note,
16208         create_build_id.  Add build_id_note_ member.
16209         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16210         "libiberty.h", "md5.h", "sha1.h".
16211         (Layout::Layout): Initialize eh_frame_data_,
16212         eh_frame_hdr_section_, and build_id_note_.
16213         (Layout::finalize): Call create_build_id.
16214         (Layout::create_note): New function, broken out of
16215         Layout::create_gold_note.
16216         (Layout::create_gold_note): Call create_note.
16217         (Layout::create_build_id): New function.
16218         (Layout::write_build_id): New function.
16219         (Close_task_runner::run): Call write_build_id.
16220
16221         * x86_64.cc: Correct license to GPLv3.
16222
16223 2008-03-23  Ian Lance Taylor  <iant@google.com>
16224
16225         * options.cc: Include "demangle.h".
16226         (parse_optional_string): New function.
16227         (parse_long_option): Handle takes_optional_argument.
16228         (parse_short_option): Update dash_z initializer.  Handle
16229         takes_optional_argument.
16230         (General_options::General_options): Initialize do_demangle_.
16231         (General_options::finalize): Set do_demangle_.  Handle demangling
16232         style.
16233         * options.h (parse_optional_string): Declare.
16234         (struct One_option): Add optional_arg field.  Update constructor.
16235         Update call constructor calls.  Add takes_optional_argument
16236         function.
16237         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16238         (DEFINE_optional_string): Define.
16239         (General_options::demangle): Change from DEFINE_bool to
16240         DEFINE_optional_string.
16241         (General_options::no_demangle): New function.
16242         (General_options::do_demangle): New function.
16243         (General_options::set_do_demangle): New function.
16244         (General_options::execstack_status_): Move definition to end of
16245         class definition.
16246         (General_options::static_): Likewise.
16247         (General_options::do_demangle_): New field.
16248         * object.cc (big_endian>::get_symbol_location_info): Call
16249         Options::do_demangle, not Options::demangle.
16250         * symtab.cc (demangle): Likewise.
16251
16252 2008-03-22  Ian Lance Taylor  <iant@google.com>
16253
16254         * gold.h: Include <cstddef> and <sys/types.h>
16255         * options.h: Include <cstring>.
16256
16257 2008-03-21  Ian Lance Taylor  <iant@google.com>
16258
16259         * Added source code to GNU binutils.
16260 \f
16261 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16262
16263 Copying and distribution of this file, with or without modification,
16264 are permitted in any medium without royalty provided the copyright
16265 notice and this notice are preserved.
16266
16267 Local Variables:
16268 mode: change-log
16269 left-margin: 8
16270 fill-column: 74
16271 version-control: never
16272 End: