Automatic date update in version.in
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-11-26  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Stub_control::set_output_and_owner): New function.
4         (Target_powerpc::group_sections): Use it.
5
6 2014-11-25  Cary Coutant  <ccoutant@google.com>
7
8         PR gold/17639
9         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
10         (Sized_relobj_file::do_layout): Handle deferred sections properly
11         during GC pass 1. Don't add reloc sections to deferred list twice.
12         * object.h (Sized_relobj_file::is_deferred_layout): New function.
13         (Sized_relobj_file::is_deferred_layout_): New data member.
14
15 2014-11-21  Alan Modra  <amodra@gmail.com>
16
17         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
18         for undefined weaks.
19
20 2014-11-20  Alan Modra  <amodra@gmail.com>
21
22         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
23         from --stub-group-size parameter divided by 1024.
24         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
25         template parameter.  Update all uses.
26         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
27         has_stub_value.  Set for long branches.  Don't report overflow for
28         branch to undefined weak symbols.  Print info message on
29         overflowing branch to stub.
30
31 2014-11-20  Alan Modra  <amodra@gmail.com>
32
33         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
34
35 2014-10-28  Alan Modra  <amodra@gmail.com>
36
37         Apply trunk patches
38         2014-10-22  Alan Modra  <amodra@gmail.com>
39         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
40         thread_starter.
41
42 2014-09-30  Cary Coutant  <ccoutant@google.com>
43
44         PR gold/17432
45         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
46
47 2014-09-30  Kito Cheng  <kito@0xlab.org>
48
49         PR gold/13597
50         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
51         hash table before sysv-style hash table.
52
53 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
54
55         * options.h (--pic-executable): Add negative to alias to -no-pie.
56
57 2014-09-26  Cary Coutant  <ccoutant@google.com>
58
59         PR gold/16773
60         * object.cc (Sized_relobj_file): Compute value of section symbols
61         for TLS sections the same as TLS symbols.
62
63 2014-09-25  Cary Coutant  <ccoutant@google.com>
64
65         PR gold/17432
66         * resolve.cc (Symbol_table::resolve): Override common placeholder
67         symbols, but adjust sizes.
68         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
69         symbols to common lists.
70
71 2014-09-24  Alan Modra  <amodra@gmail.com>
72
73         * po/POTFILES.in: Regenerate.
74
75 2014-09-23  Taiju Tsuiki  <tzik@google.com>
76             Cary Coutant  <ccoutant@google.com>
77
78         PR gold/14860
79         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
80         on input_sections_blocker.
81         * layout.cc (Write_sections_task::locks): Unblock
82         input_sections_blocker_.
83         * layout.h (Write_sections_task::Write_sections_task): Add
84         input_sections_blocker.
85         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
86         to DEPENDENCIES.
87         * testsuite/Makefile.in: Regenerate.
88
89 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
90
91         * testsuite/Makefile.am (plugin_test_10): New test.
92         * testsuite/Makefile.in: Regenerate
93         * testsuite/plugin_common_test_2.c (c1): Align to 8.
94         * testsuite/plugin_test_10.sh: New file.
95
96 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
97
98         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
99         * resolve.cc (Symbol_table::resolve): Don't override common symbols
100         during the replacement phase.
101
102 2014-09-17  Han Shen  <shenhan@google.com>
103             Jing Yu  <jingyu@google.com>
104
105         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
106         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
107         * aarch64.cc (Target_aarch64): Add data members
108         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
109         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
110         constructor.
111         (Target_aarch64::do_reloc_symbol_index): New method.
112         (Target_aarch64::do_reloc_addend): New method.
113         (Target_aarch64::add_tlsdesc_info): New method.
114         (Target_aarch64::do_dynsym_value): New method.
115         (Target_aarch64::do_make_data_plt): Add new parameters: got,
116         got_irelative. Pass them to Output_data_plt_aarch64_standard.
117         (Target_aarch64::make_data_plt): Add new parameters: got,
118         got_irelative. Pass them to do_make_data_plt.
119         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
120         (Target_aarch64::Relocate:tls_gd_to_le): New method.
121         (Target_aarch64::Relocate:tls_ie_to_le): New method.
122         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
123         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
124         (Target_aarch64::got_tlsdesc_section): New method.
125         (Target_aarch64::make_local_ifunc_plt_entry): New method.
126         (Target_aarch64::define_tls_base_symbol): New method.
127         (Target_aarch64::reserve_tlsdesc_entries): New method.
128         (Target_aarch64::got_mod_index_entry): New method.
129         (Target_aarch64::rela_tlsdesc_section): New method.
130         (Target_aarch64::rela_irelative_section): New method.
131         (Target_aarch64::Tlsdesc_info): New struct.
132         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
133         relocations and tlsdesc relocations.
134         (Target_aarch64::optimize_tls_reloc): Implement method.
135         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
136         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
137         in constructor.
138         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
139         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
140         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
141         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
142         (Output_data_plt_aarch64::rela_tlsdesc): New method.
143         (Output_data_plt_aarch64::rela_irelative): New method.
144         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
145         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
146         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
147         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
148         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
149         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
150         (Output_data_plt_aarch64_standard): New member variables:
151         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
152         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
153         New parameter: got, got_irelative.
154         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
155         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
156         (Output_data_plt_aarch64::do_write): Replace got_address with
157         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
158         (AArch64_relocate_functions::update_movnz): New method.
159         (AArch64_relocate_functions): Correct format.
160         (AArch64_relocate_functions::movnz): New method.
161         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
162         before the switch. Add new cases to switch.
163         Check ie_to_le relaxation on tlsie relocations. Add code handling
164         tlsgd tlsdesc cases.
165         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
166         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
167         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
168         Call reloc_name_in_error_message to print unsupported reloc.
169         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
170         make_data_plt.
171         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
172         relocs. Fill in some more dynamic tags.
173         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
174         Skip call tls_get_addr when tlsgd is relaxed.
175         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
176         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
177         tlsdesc->ie relaxation.
178
179 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
180
181         * mips.cc (Target_mips_nacl): New class.
182         (Target_selector_mips_nacl): New class.
183         (target_selector_mips32): Rename from target_selector_mips32be and use
184         Target_selector_mips_nacl instead of Target_selector_mips.
185         (target_selector_mips32el): Rename from target_selector_mips32 and use
186         Target_selector_mips_nacl instead of Target_selector_mips.
187         (target_selector_mips64): Rename from target_selector_mips64be and use
188         Target_selector_mips_nacl instead of Target_selector_mips.
189         (target_selector_mips64el): Rename from target_selector_mips64 and use
190         Target_selector_mips_nacl instead of Target_selector_mips.
191         (Target_mips::mips_info): Add const attribute.
192
193 2014-09-02  Cary Coutant  <ccoutant@google.com>
194
195         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
196         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
197         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
198         (Sized_incr_dynobj::do_section_name): Likewise.
199         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
200         (Sized_incr_dynobj::do_section_name): Likewise.
201         * object.h (Object::section_name): Likewise.
202         (Object::do_section_name): Likewise.
203         (Sized_relobj_file::do_section_name): Likewise.
204         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
205         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
206
207 2014-09-02  Cary Coutant  <ccoutant@google.com>
208
209         PR gold/17005
210         * ehframe.cc (Fde::write): Add output_offset parameter.
211         (Cie::write): Likewise.
212         (Eh_frame::set_final_data_size): Account for offset within output
213         section.
214         (Eh_frame::do_sized_write): Likewise.
215         * ehframe.h (Fde::write): Add output_offset parameter.
216         (Cie::write): Likewise.
217         * output.cc (Output_section::Input_section_sort_entry): Remove
218         section_has_name_; add output_section_name parameter. Use
219         output section name for non-input sections.
220         (Output_section::Input_section_sort_entry::section_has_name): Remove.
221         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
222         (Output_section::Input_section_sort_compare): Remove logic for
223         sections without names.
224         (Output_section::Input_section_sort_init_fini_compare): Likewise.
225         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
226         Likewise.
227         (Output_section::Input_section_sort_section_name_compare): Likewise.
228
229 2014-08-29 Han Shen <shenhan@google.com>
230            Jing Yu <jingyu@google.com>
231
232         * aarch64-reloc-property.cc
233         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
234         reference reloc property in the table.
235         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
236         3 other entries.
237         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
238         2 new overloaded methods.
239         (Output_data_got_aarch64::do_write): Add code to write out
240         static relocs.
241         (class Output_data_got_aarch64::Static_reloc): New class to wrap
242         static relocs.
243         (Output_data_got_aarch64::static_relocs): New vector to
244         hold static relocs.
245         (Target_aarch64::TCB_SIZE): New const static memeber.
246         (Target_aarch64::tcb_size): New method.
247         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
248         (Target_aarch64::Relocate::relocate_tls): New method.
249         (Target_aarch64::Scan::local): Add code handling new reloc types.
250         (Target_aarch64::Scan::global): Add code handling new reloc types.
251
252 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
253
254         * options.h (-no-pie): Add option.
255
256 2014-08-08  Jing Yu  <jingyu@google.com>
257             Han Shen  <shenhan@google.com>
258
259         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
260         (DEFFILES): add aarch64-reloc.def.
261         (TARGETSOURCES): Add aarch64-reloc-property.cc.
262         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
263         * Makefile.in: Regenerate.
264         * aarch64-reloc-property.cc: New file.
265         * aarch64-reloc-property.h: New file.
266         * aarch64-reloc.def: New file.
267         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
268         with tab to make the format consistent.
269         (Output_data_got_aarch64::symbol_table_): New method.
270         (Target_aarch64::do_plt_address_for_global): New method.
271         (Target_aarch64::do_plt_address_for_local): New method.
272         (Target_aarch64::do_select_as_default_target): New method.
273         (Target_aarch64::do_make_data_plt): New method.
274         (Target_aarch64::make_data_plt): New method.
275         (Output_data_plt_aarch64::has_irelative_section): New method.
276         (Output_data_plt_aarch64::address_for_global): New method.
277         (Output_data_plt_aarch64::address_for_local): New method.
278         (Output_data_plt_aarch64::irelative_rel_): New parameter.
279         (Output_data_plt_aarch64::add_entry): Implement contents.
280         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
281         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
282         the got_pov entry to plt0.
283         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
284         Implement contents.
285         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
286         (AArch64_howto): New struct.
287         (aarch64_howto[]): New static const array.
288         (AArch64_relocate_functions): New class.
289         (Target_aarch64::Scan::get_reference_flags): Remove method.
290         (Target_aarch64::Scan::local): Implement to support a few relocations.
291         (Target_aarch64::Scan::global): Implement to support a few relocations.
292         (Target_aarch64::make_plt_section): Implement contents.
293         (Target_aarch64::make_plt_entry): Implement contents.
294         (Target_aarch64::do_finalize_sections): Implement contents.
295         (Target_aarch64::Relocate::relocate): Implement a few relocations.
296         (Target_aarch64::relocate_section): Implement contents.
297
298 2014-08-06  Alan Modra  <amodra@gmail.com>
299
300         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
301
302 2014-08-06  Alan Modra  <amodra@gmail.com>
303
304         PR 13227
305         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
306
307 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
308
309         * object.cc (Relobj::is_section_name_included): Add
310         ".rodata.nptl_version" to not garbage collect this section.
311
312 2014-07-08  Cary Coutant  <ccoutant@google.com>
313
314         * expression.cc (struct Expression::Expression_eval_info): Add
315         new fields type_pointer, vis_pointer, and nonvis_pointer.
316         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
317         nonvis_pointer parameters. Adjust all calls.
318         (Symbol_expression::value): Update type, visibility, and nonvis bits
319         in caller.
320         * script.cc (Symbol_assignment::sized_finalize): Update type,
321         visibility, and remaining st_other bits for new symbol.
322         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
323         vis_pointer, and nonvis_pointer parameters.
324         * symtab.h (Symbol::set_type): New method.
325
326         * testsuite/Makefile.am (defsym_test): New test.
327         * testsuite/Makefile.in: Regenerate.
328         * testsuite/defsym_test.c: New file.
329         * testsuite/defsym_test.sh: New file.
330
331 2014-07-08  Cary Coutant  <ccoutant@google.com>
332
333         PR gold/15639
334         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
335         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
336         (Sized_dynobj::base_read_symbols): ...new method.
337         * object.h (Sized_relobj_file::base_read_symbols): New method.
338         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
339         (Sized_relobj_file::base_read_symbols): ...new method.
340         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
341         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
342         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
343
344 2014-07-04  Alan Modra  <amodra@gmail.com>
345
346         * po/POTFILES.in: Regenerate.
347
348 2014-07-02  Jing Yu  <jingyu@google.com>
349
350         * aarch64.cc: New file
351         * Makefile.am (TARGETSOURCES): Add aarch64.cc
352         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
353         * Makefile.in: Regenerate.
354         * configure.tgt: Add entries for aarch64*.
355         * configure.ac:  Likewise.
356         * configure: Likewise.
357
358 2014-06-27  Alan Modra  <amodra@gmail.com>
359
360         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
361
362 2014-06-24  Cary Coutant  <ccoutant@google.com>
363
364         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
365         sections.
366         (Dwo_file::sized_read_unit_index): Likewise.
367
368 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
369
370         * mips.cc: New file.
371         * Makefile.am (TARGETSOURCES): Add mips.cc
372         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
373         * configure.tgt: Add entries for mips*.
374         * configure.ac: Likewise.
375         * Makefile.in: Regenerate.
376         * configure: Likewise.
377
378 2014-06-09  Cary Coutant  <ccoutant@google.com>
379
380         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
381         unit_length is within section bounds.
382
383 2014-06-09  Cary Coutant  <ccoutant@google.com>
384
385         PR gold/16980
386         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
387         map.
388
389 2014-06-07  Alan Modra  <amodra@gmail.com>
390
391         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
392
393 2014-06-06  Cary Coutant  <ccoutant@google.com>
394
395         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
396         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
397         (Dwarf_pubnames_table::read_header): Likewise.
398         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
399         .debug_gnu_pubtypes.
400
401 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
402
403         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
404         * Makefile.in, configure: Regenerate.
405
406 2014-06-03  Alan Modra  <amodra@gmail.com>
407
408         * powerpc.cc (addis_12_2): Define.
409         (Stub_table::do_write): Support fusion on ELFv2 stubs.
410
411 2014-06-03  Alan Modra  <amodra@gmail.com>
412
413         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
414         st_other output.
415
416 2014-06-02  Alan Modra  <amodra@gmail.com>
417
418         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
419         Only ignore relocs on ELFv1.
420         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
421
422 2014-05-30  Cary Coutant  <ccoutant@google.com>
423
424         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
425         * testsuite/Makefile.in: Regenerate.
426         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
427
428 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
429
430         PR gold/16945
431         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
432         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
433
434 2014-05-15  Alan Modra  <amodra@gmail.com>
435
436         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
437         Compare FDE contents with DW_CFA_nop rather than 0.
438
439 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
440
441         * symtab.h (may_need_copy_reloc): Remove check for position independent
442         code.
443         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
444         position independence before pc absolute may_need_copy_reloc call.
445         Add check for executable output befor pc relative may_need_copy_reloc
446         call.
447         * i386.cc: Ditto.
448         * arm.cc: Ditto.
449         * sparc.cc: Ditto.
450         * tilegx.cc: Ditto.
451         * powerpc.cc: Add check for no position independence before
452         may_need_copy_reloc calls.
453         * testsuite/pie_copyrelocs_test.cc: New file.
454         * testsuite/pie_copyrelocs_shared_test.cc: New file.
455         * Makefile.am (pie_copyrelocs_test): New test.
456         * Makefile.in: Regenerate.
457
458 2014-05-08  Martin Liška  <mliska@suse.cz>
459
460         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
461
462 2014-05-06  Cary Coutant  <ccoutant@google.com>
463
464         PR gold/16900
465         * i386.cc (Output_data_got_plt_i386): New class.
466         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
467         parameter. Change all callers.
468         (Output_data_plt_i386::layout_): Remove.
469         (Output_data_plt_i386::got_plt_): Change type.
470         (Target_i386::got_plt_): Change type. Change all references.
471         (Target_i386::got_section): Create instance of new class.
472         (Output_data_got_plt_i386::do_write): New function.
473         * x86_64.cc (Output_data_got_plt_x86_64): New class.
474         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
475         parameter. Change all callers.
476         (Output_data_plt_x86_64::layout_): Remove.
477         (Output_data_plt_x86_64::got_plt_): Change type.
478         (Target_x86_64::got_plt_): Change type. Change all references.
479         (Target_x86_64::got_section): Create instance of new class.
480         (Output_data_got_plt_x86_64::do_write): New function.
481         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
482         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
483         class.
484
485 2014-05-05  Cary Coutant  <ccoutant@google.com>
486
487         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
488         if we have pubnames/pubtypes.
489
490 2014-05-02  Cary Coutant  <ccoutant@google.com>
491
492         * defstd.cc (in_segment): Define __ehdr_start here...
493         * layout.cc (Layout::finalize): ...Instead of here.  Set the
494         output segment when known.
495         * resolve.cc (Symbol::override_base_with_special): Remember
496         the original binding.
497         * symtab.cc (Symbol::set_output_segment): New function.
498         (Symbol::set_undefined): New function.
499         * symtab.h (Symbol::is_weak_undefined): Check original undef
500         binding.
501         (Symbol::is_strong_undefined): New function.
502         (Symbol::set_output_segment): New function.
503         (Symbol::set_undefined): New function.
504         * target-reloc.h (is_strong_undefined): Remove.
505         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
506         Check for hidden undefs.
507         (relocate_section): Call Symbol::is_strong_undefined.
508
509         * testsuite/Makefile.am (ehdr_start_test_1)
510         (ehdr_start_test_2, ehdr_start_test_3)
511         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
512         * testsuite/Makefile.in: Regenerate.
513         * testsuite/ehdr_start_def.cc: New source file.
514         * testsuite/ehdr_start_test.cc: New source file.
515         * testsuite/ehdr_start_test.t: New linker script.
516         * testsuite/ehdr_start_test_4.sh: New shell script.
517
518 2014-04-23  Cary Coutant  <ccoutant@google.com>
519
520         PR gold/16870
521         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
522
523 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
524
525         * layout.cc (Layout::include_section): Allow a target to decide
526         whether to include a section.
527         * target.h (Target::should_include_section): New function.
528         (Target::do_should_include_section): New function.
529
530 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
531
532         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
533         inline into ...
534         (Copy_relocs::emit): ... here.
535         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
536         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
537         (Copy_reloc_entry::entries_): Change from private to protected.
538
539 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
540
541         * icf.cc (get_section_contents): Replace copies of reloc
542         vectors with const references.
543
544 2014-04-02  Cary Coutant  <ccoutant@google.com>
545
546         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
547         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
548         * configure: Regenerate.
549         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
550         -fno-use-linker-plugin.
551         (LINK1, CXXLINK1): Add it to the link command.
552         * testsuite/Makefile.in: Regenerate.
553
554 2014-03-12  Alan Modra  <amodra@gmail.com>
555
556         * Makefile.in: Regenerate.
557
558 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
559
560         * symtab.h (Symbol::set_nonvis): New function.
561
562 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
563
564         * symtab.cc (Sized_symbol<32>::init_output_data):
565         Instantiate the template.
566         (Sized_symbol<64>::init_output_data): Likewise.
567
568 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
569
570         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
571         adjust dynamic symbol value.
572         * target.h (Target::adjust_dyn_symbol): New function.
573         (Target::do_adjust_dyn_symbol): New function.
574
575 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
576
577         * output.cc (Output_data_dynamic::Dynamic_entry::write):
578         Get the value of DYNAMIC_CUSTOM dynamic entry.
579         * output.h (Output_data_dynamic::add_custom): New function.
580         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
581         dynamic entry.
582         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
583         * target.h (Target::dynamic_tag_custom_value): New function.
584         (Target::do_dynamic_tag_custom_value): New function.
585
586 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
587
588         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
589         dynsym indexes.
590         * target.h (Target::has_custom_set_dynsym_indexes): New function.
591         (Target::do_has_custom_set_dynsym_indexes): New function.
592         (Target::set_dynsym_indexes): New function.
593         (Target::do_set_dynsym_indexes): New function.
594
595 2014-03-07  Alan Modra  <amodra@gmail.com>
596
597         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
598         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
599         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
600         (Powerpc_relocate_functions::has_overflow_bitfield,
601         overflowed): Use the above.
602         (Target_powerpc::Relocate::relocate): Correct overflow checking
603         for a number of relocations.  Modify overflow test for 16-bit
604         fields in instructions to signed/unsigned according to whether
605         the field takes a signed or unsigned value.
606
607 2014-03-05  Alan Modra  <amodra@gmail.com>
608
609         Update copyright years.
610
611 2014-03-05  Alan Modra  <amodra@gmail.com>
612
613         * powerpc.cc (Target_powerpc::Scan::local, global): Support
614         R_PPC64_ADDR64_LOCAL.
615         (Target_powerpc::Relocate::relocate): Likewise.
616
617 2014-03-03  Alan Modra  <amodra@gmail.com>
618
619         * dwp.cc (print_version): Update copyright year to current.
620
621 2014-02-10  Alan Modra  <amodra@gmail.com>
622
623         * po/gold.pot: Regenerate.
624
625 2014-02-06  Cary Coutant  <ccoutant@google.com>
626
627         Fix problem where -u is ignored when a weak undef is seen.
628
629         * archive.cc (Library_base::should_include_member): Reorder
630         code to check for -u option if a weak undef has already been seen.
631         * testsuite/Makefile.am (weak_undef_test_2): New test case.
632         * testsuite/Makefile.in: Regenerate.
633         * testsuite/weak_undef_file3.cc: New file.
634         * testsuite/weak_undef_file4.cc: New file.
635         * testsuite/weak_undef_test_2.cc: New file.
636
637 2014-02-05  Cary Coutant  <ccoutant@google.com>
638
639         Fix issues with gold undefined symbol diagnostics.
640
641         PR binutils/15435
642         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
643         check to here.
644         * target-reloc.h (is_strong_undefined): New function.
645         (relocate_section): Move undef vtable symbol check from here.
646         Check for is_strong_undefined.
647
648 2014-02-05  Cary Coutant  <ccoutant@google.com>
649
650         Fix problems with the --dynamic-list option.
651
652         PR gold/13577
653         * options.cc (General_options::parse_dynamic_list):
654         Set have_dynamic_list_.
655         (General_options::General_options): Initialize have_dynamic_list_.
656         (General_options::finalize): Turn off -Bsymbolic and
657         -Bsymbolic-functions if --dynamic-list provided.
658         * options.h (General_options::have_dynamic_list): New function.
659         (General_options::have_dynamic_list_): New data member.
660         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
661         correctly.
662
663         PR gold/16530
664         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
665         in --dynamic-list, mark it.
666
667         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
668         (dynamic_list_2): New test case.
669         * testsuite/Makefile.in: Regenerate.
670         * testsuite/dynamic_list_2.cc: New file.
671         * testsuite/dynamic_list_2.t: New file.
672         * testsuite/dynamic_list_lib1.cc: New file.
673         * testsuite/dynamic_list_lib2.cc: New file.
674         * testsuite/gc_dynamic_list_test.c: New file.
675         * testsuite/gc_dynamic_list_test.sh: New file.
676         * testsuite/gc_dynamic_list_test.t: New file.
677
678 2014-01-28  Cary Coutant  <ccoutant@google.com>
679
680         Add .gdb_index version 7 support.
681
682         * gold/dwarf_reader.cc: include <utility> (for make_pair).
683         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
684         debug sections.
685         (Dwarf_ranges_table::read_ranges_table): Likewise.
686         (Dwarf_pubnames_table::read_section): Check for GNU-style
687         sections, and for compressed debug sections.
688         (Dwarf_pubnames_table::read_header): Compute end address of table.
689         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
690         for end of list by offset, not by offset == 0.
691         (Dwarf_info_reader::do_read_string_table): Check for compressed
692         debug sections.
693         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
694         Initialize new data members.
695         (Dwarf_pubnames_table::next_name): return flag_byte.
696         (Dwarf_pubnames_table::end_of_table_): New data member.
697         (Dwarf_pubnames_table::is_gnu_style_): New data member.
698         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
699         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
700         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
701         read skeleton type unit DIEs.
702         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
703         (Gdb_index::do_write): Write flag_byte.
704         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
705         (Gdb_index::Cu_vector): Store flags along with cu indexes.
706         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
707         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
708
709 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
710
711         * version.cc (print_version): Update copyright year to 2014.
712
713 2013-12-19  Dimitry Andric  <dimitry@andric.com>
714
715         * stringpool.cc (Stringpool_template::reserve): Add
716         HAVE_UNORDERED_MAP case.
717         * stringpool.cc (Stringpool_template::print_stats): Likewise.
718
719 2013-12-18  Cary Coutant  <ccoutant@google.com>
720
721         * configure.ac: Check for <unordered_set> and <unordered_map>.
722         * config.in: Regenerate.
723         * configure: Regenerate.
724         * system.h: Use <unordered_set> and <unordered_map> if available.
725
726 2013-12-10  Roland McGrath  <mcgrathr@google.com>
727
728         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
729         with $(INSTALL_PROGRAM_ENV).
730         * Makefile.in: Regenerate.
731
732 2013-11-22  Cary Coutant  <ccoutant@google.com>
733
734         * configure.ac: Add check for which library is needed for
735         dlopen.
736         * configure: Regenerate.
737
738 2013-11-22  Cary Coutant  <ccoutant@google.com>
739
740         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
741         assembler.
742         * testsuite/Makefile.in: Regenerate.
743
744 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
745
746         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
747         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
748         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
749         (Target_x86_64<size>::Scan::local): Likewise.
750         (Target_x86_64<size>::Scan::global): Likewise.
751         (Target_x86_64<size>::Relocate::relocate): Likewise.
752         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
753         Likewise.
754         (Target_x86_64<size>::Scan::check_non_pic(): Handle
755         R_X86_64_PC32_BND.
756
757         * testsuite/Makefile.am (check_PROGRAMS): Add
758         exception_x86_64_bnd_test.
759         (exception_x86_64_bnd_test_SOURCES): New macro.
760         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
761         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
762         (exception_x86_64_bnd_test_LDADD): Likewise.
763         (exception_x86_64_bnd_1.o): New rule.
764         (exception_x86_64_bnd_2.o): Likewise.
765         * testsuite/Makefile.in: Regenerated.
766
767 2013-11-15  Alan Modra  <amodra@gmail.com>
768
769         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
770         accessor.
771         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
772         Only call ppc64_local_entry_offset for 64-bit.  Restrict
773         symval_for_branch lookup to ELFv1.
774         (Stub_table::add_plt_call_entry): Use unsigned int off.
775         (Output_data_glink::Address, invalid_address): New.
776         (Output_data_glink::add_eh_frame): Move out of line.  Add
777         support for ELFv2.
778         (Output_data_glink::add_global_entry, find_global_entry,
779         global_entry_address): New functions.
780         (Output_data_glink::global_entry_stubs_, end_branch_table_,
781         ge_size): New variables.
782         (Output_data_glink::set_final_data_size): Add global entry
783         stub sizing.
784         (Output_data_glink::do_write): Write global entry stubs.
785         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
786         parameter.  Return true for ELFv2.  Adjust callers.
787         (Target_powerpc::Scan::local, global): Restrict opd lookup to
788         ELFv1.  Similarly for ifunc and dynamic relocation processing
789         specific to ELFv1.  Recognize that symbols are defined on
790         their plt entries for ELFv2.
791         (Target_powerpc::symval_for_branch): Assert if called for
792         ELFv2 or ppc32.
793         (Target_powerpc::Relocate::relocate): Use global entry plt
794         stub for symbol value if such exists on ELFv2.
795         (Target_powerpc::Relocate::relocate): Don't call
796         symval_for_branch when ELFv2.  Do adjust for local entry
797         offset when ELFv2.
798         (Target_powerpc::do_dynsym_value): Set symbols to global entry
799         plt stub for ELFv2.
800         (Target_powerpc::do_plt_address_for_global): Similarly.
801
802 2013-11-14  Cary Coutant  <ccoutant@google.com>
803
804         Revert patch -- this did not fix the problem, and there is
805         no race there.
806
807         2013-11-14  Cary Coutant  <ccoutant@google.com>
808
809             PR gold/14860
810             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
811             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
812             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
813             updating fde_offsets_.
814             (Eh_frame_hdr::lock_): New data member.
815
816 2013-11-14  Cary Coutant  <ccoutant@google.com>
817
818         * dwp.cc (Dwo_file_entry): New type.
819         (File_list): Use Dwo_file_entry.
820         (Dwo_file::verify): New function.
821         (Dwo_file::verify_dwo_list): New function.
822         (Dwo_file::sized_verify_dwo_list): New function.
823         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
824         list.
825         (Dwp_options): New enum type.
826         (dwp_options): Add --verify-only.
827         (usage): Likewise.
828         (main): Likewise.
829         * dwp.h (gold_info): Add declaration.
830
831 2013-11-14  Cary Coutant  <ccoutant@google.com>
832
833         PR gold/14860
834         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
835         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
836         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
837         updating fde_offsets_.
838         (Eh_frame_hdr::lock_): New data member.
839
840 2013-11-06  Cary Coutant  <ccoutant@google.com>
841
842         PR gold/15758
843         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
844         before reloc sections.
845
846 2013-11-04  Alan Modra  <amodra@gmail.com>
847
848         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
849         (Symbol::needs_dynamic_reloc): Test new flag.
850         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
851         (Target_powerpc::Scan::get_reference_flags): Add target param.
852         Return FUNC_DESC_ABI for 64-bit ELFv1.
853         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
854         call.
855         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
856         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
857
858 2013-10-31  Cary Coutant  <ccoutant@google.com>
859
860         Restore support for dwp v2 DWARF package file format.
861
862         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
863         tu_length parameter.  Adjust all callers.
864         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
865         * dwp.cc: Include dwarf.h.
866         (Section_bounds): New struct type.
867         (Unit_set): New struct type.
868         (Dwo_file::Dwo_file): Initialize new data member.
869         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
870         Combine and rename to...
871         (Dwo_file::read_unit_index): ...this.
872         (Dwo_file::sized_read_compunit_index)
873         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
874         (Dwo_file::sized_read_unit_index): ...this.
875         (Dwo_file::copy_section): Remove section_name, is_str_offsets
876         parameters; add section_id parameter.
877         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
878         (Dwo_file::add_unit_set): ...this.
879         (Dwo_file::shndx_map_): Remove.
880         (Dwo_file::sect_offsets_): New data member.
881         (Dwp_output_file::Dwp_output_file): Initialize new data members.
882         (Dwp_output_file::add_section): Rename to...
883         (Dwp_output_file::add_contribution): ...this.
884         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
885         (Dwp_output_file::add_tu_set): Likewise.
886         (Dwp_output_file::Contribution): New type.
887         (Dwp_output_file::Section::contributions): New data member.
888         (Dwp_output_file::Cu_or_tu_set): Remove.
889         (Dwp_output_file::Section::Section): New ctor.
890         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
891         (Dwp_output_file::Dwp_index::Section_table): New type.
892         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
893         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
894         parameter.
895         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
896         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
897         (Dwp_output_file::Dwp_index::section_table): New member function.
898         (Dwp_output_file::Dwp_index::section_table_end): New member function.
899         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
900         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
901         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
902         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
903         (Dwp_output_file::Dwp_index::section_table_): New data member.
904         (Dwp_output_file::Dwp_index::section_mask_): New data member.
905         (Dwp_output_file::add_output_section): New member function.
906         (Dwp_output_file::write_new_section): New member function.
907         (Dwp_output_file::write_contributions): New member function.
908         (Dwp_output_file::section_id_map_): New data member.
909         (class Dwo_id_info_reader): Remove.
910         (class Unit_reader): New class.
911         (get_dwarf_section_name): New function.
912         (Dwo_file::read_executable): Adjust initializations of class data.
913         (Dwo_file::read): Add support for v2 package file format.
914         (Dwo_file::read_unit_index): Likewise.
915         (Dwo_file::sized_read_unit_index): Likewise.
916         (Dwo_file::copy_section): Likewise.
917         (Dwo_file::add_unit_set): Likewise.
918         (Dwp_output_file::add_output_section): Likewise.
919         (Dwp_output_file::add_contribution): Likewise.
920         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
921         for empty slot.
922         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
923         file format.
924         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
925         slot.
926         (Dwp_output_file::initialize): Remove unused function.
927         (Dwp_output_file::finalize): Add support for v2 package file format.
928         (Dwp_output_file::write_index): Likewise.
929         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
930         function prototype.
931
932 2013-10-31  Cary Coutant  <ccoutant@google.com>
933
934         * configure.ac: Fix check for -fmerge-constants.
935         * configure.ac: Regenerate.
936
937 2013-10-30  Roland McGrath  <mcgrathr@google.com>
938
939         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
940         Correct 9-byte nop sequence to match what the assembler generates.
941
942 2013-10-30  Alan Modra  <amodra@gmail.com>
943
944         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
945         ppc64_local_entry_offset, ppc64_local_entry_offset,
946         do_read_symbols): New functions.
947         (Powerpc_relobj::e_flags_, st_other_): New vars.
948         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
949         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
950         (Powerpc_relobj::e_flags_): New var.
951         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
952         and adjust for ELFv2.
953         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
954         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
955         (Powerpc_dynobj::do_find_special_sections): Likewise.
956         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
957         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
958         to ELFv2 local entry.
959         (Target_powerpc::do_relax): No thread safe barriers needed for
960         ELFv2.
961         (Output_data_plt_powerpc::initial_plt_entry_size_,
962         plt_entry_size): Delete.  Replace all uses with
963         first_plt_entry_offset() and plt_entry_size().
964         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
965         reserved_size parm.  Update callers.
966         (Output_data_plt_powerpc::entry_count): Update.
967         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
968         and use Target_powerpc::first_plt_entry_offset().
969         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
970         rename to plt_entry_size.
971         (Output_data_plt_powerpc::add_ifunc_entry,
972         add_local_ifunc_entry): Adjust reloc for ELFv2.
973         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
974         (glink_eh_frame_fde_64v2): New.
975         (Stub_table::plt_call_size): Support ELFv2 sizing.
976         (Output_data_glink::add_eh_frame): Use the new FDE.
977         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
978         (Stub_table::do_write): Write ELFv2 stubs and glink.
979         (Target_powerpc::Relocate::relocate): Replaces nop after call
980         with ld 2,24(1) and adjust local offset destination for ELFv2.
981
982 2013-10-30  Alan Modra  <amodra@gmail.com>
983
984         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
985         (Target_powerpc::Scan::global, local): Likewise.
986         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
987         on all ppc64 @h and @ha relocs.
988
989 2013-10-14  Alan Modra  <amodra@gmail.com>
990
991         * output.h (Output_data_got::add_constant): Tidy.
992         (Output_data_got::add_constant_pair): New function.
993         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
994         methods used so as to first call reserve_ent().
995
996 2013-10-11  Roland McGrath  <mcgrathr@google.com>
997
998         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
999         add_got_entry and add_got_entry_pair.
1000
1001         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1002         (HAVE_PUBNAMES): Likewise.
1003         * configure: Regenerate.
1004
1005         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1006         * testsuite/Makefile.in: Regenerate.
1007
1008         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1009         Remove const from declaration.
1010         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1011         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1012         * output.h (Output_file_header): Remove const from member target_
1013         and corresponding constructor argument.
1014         * output.cc (Output_file_header::Output_file_header): Update prototype.
1015         (Output_file_header::do_sized_write): Use this->target_ in place
1016         of parameters()->target().
1017
1018         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1019
1020         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1021         * configure: Regenerate.
1022         * Makefile.in: Regenerate.
1023         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1024         * testsuite/merge_string_literals_2.c: Likewise.
1025         * testsuite/Makefile.am
1026         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1027         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1028         literal -fmerge-constants.
1029         * testsuite/Makefile.in: Regenerate.
1030
1031         * i386.cc (Target_i386): Remove unused member dynbss_.
1032         * arm.cc (Target_arm): Likewise.
1033         * powerpc.cc (Target_powerpc): Likewise.
1034         * sparc.cc (Target_sparc): Likewise.
1035         * tilegx.cc (Target_tilegx): Likewise.
1036         * x86_64.cc (Target_x86_64): Likewise.
1037         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1038         type_signature_, type_offset_.
1039         * plugin.h (Plugin_hook): Remove unused member layout_.
1040         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1041         mapfile_.
1042         (Read_member): Remove unused members input_objects_, symtab_,
1043         mapfile_, layout_.
1044         (Check_library): Remove unused member symtab_.
1045         * archive.h (Lib_group): Remove unused member lib_.
1046         * archive.cc (Lib_group::Lib_group): Update initializer.
1047         * incremental.h (Incremental_binary): Remove unused member target_.
1048         (Incremental_script_entry): Removed unused member script_.
1049         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1050         * icf.h (Icf): Remove unused member num_tracked_relocs.
1051
1052         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1053         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1054         its only use.
1055         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1056
1057         * archive.h: Use struct rather than class for forward declaration
1058         of Read_symbols_data.
1059
1060 2013-10-07  Cary Coutant  <ccoutant@google.com>
1061
1062         PR gold/16010
1063         * testsuite/Makefile.am (icf_test): Fix dependencies.
1064         (icf_safe_test): Likewise.
1065         (icf_safe_so_test): Likewise.
1066         (large_symbol_alignment): Add empty _LDADD rule.
1067         * testsuite/Makefile.in: Regenerate.
1068
1069 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1070
1071         PR gold/15927
1072         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1073         relocation for R_X86_64_32 on x32.
1074
1075 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1076
1077         * output.cc (Output_segment::set_section_addresses): Take new
1078         Target* argument.  If target->isolate_execinstr() and the segment
1079         is executable and starts at a target->abi_pagesize() boundary,
1080         pad its end out to a target->abi_pagesize() boundary with code fill.
1081         * output.h (Output_segment::set_section_addresses): Update decl.
1082         * layout.h (Layout::check_output_data_for_reset_values): Take new
1083         argument RELAX_OUTPUTS.
1084         (Layout): New member relax_output_list_.
1085         (Layout::add_relax_output): New method.
1086         * layout.cc (Layout::Layout): Update constructor.
1087         (Layout::reset_relax_output): New method.
1088         (Layout::clean_up_after_relaxation): Call it.
1089         (Layout::prepare_for_relaxation): Update caller.
1090         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1091         Call reset_relax_output before re-processing segments for
1092         isolate_execinstr case.
1093         (Layout::write_data): Handle relax_output_list_.
1094         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1095         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1096
1097 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1098
1099         PR binutils/15834
1100         * object.h: Fix typos.
1101
1102 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1103
1104         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1105         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1106
1107 2013-08-07  Cary Coutant  <ccoutant@google.com>
1108
1109         Revert support for v2 DWP files:
1110
1111         2013-03-01  Cary Coutant  <ccoutant@google.com>
1112
1113             Add dwp support for v2 DWARF package file format.
1114             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1115             tu_length parameter.  Adjust all callers.
1116             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1117             * dwp.cc: Include dwarf.h.
1118             (Section_bounds): New struct type.
1119             (Unit_set): New struct type.
1120             (Dwo_file::Dwo_file): Initialize new data member.
1121             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1122             Combine and rename to...
1123             (Dwo_file::read_unit_index): ...this.
1124             (Dwo_file::sized_read_compunit_index)
1125             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1126             (Dwo_file::sized_read_unit_index): ...this.
1127             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1128             parameters; add section_id parameter.
1129             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1130             (Dwo_file::add_unit_set): ...this.
1131             (Dwo_file::shndx_map_): Remove.
1132             (Dwo_file::sect_offsets_): New data member.
1133             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1134             (Dwp_output_file::add_section): Rename to...
1135             (Dwp_output_file::add_contribution): ...this.
1136             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1137             (Dwp_output_file::add_tu_set): Likewise.
1138             (Dwp_output_file::Contribution): New type.
1139             (Dwp_output_file::Section::contributions): New data member.
1140             (Dwp_output_file::Cu_or_tu_set): Remove.
1141             (Dwp_output_file::Section::Section): New ctor.
1142             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1143             (Dwp_output_file::Dwp_index::Section_table): New type.
1144             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1145             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1146             parameter.
1147             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1148             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1149             (Dwp_output_file::Dwp_index::section_table): New member function.
1150             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1151             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1152             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1153             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1154             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1155             (Dwp_output_file::Dwp_index::section_table_): New data member.
1156             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1157             (Dwp_output_file::add_output_section): New member function.
1158             (Dwp_output_file::write_new_section): New member function.
1159             (Dwp_output_file::write_contributions): New member function.
1160             (Dwp_output_file::section_id_map_): New data member.
1161             (class Dwo_id_info_reader): Remove.
1162             (class Unit_reader): New class.
1163             (get_dwarf_section_name): New function.
1164             (Dwo_file::read_executable): Adjust initializations of class data.
1165             (Dwo_file::read): Add support for v2 package file format.
1166             (Dwo_file::read_unit_index): Likewise.
1167             (Dwo_file::sized_read_unit_index): Likewise.
1168             (Dwo_file::copy_section): Likewise.
1169             (Dwo_file::add_unit_set): Likewise.
1170             (Dwp_output_file::add_output_section): Likewise.
1171             (Dwp_output_file::add_contribution): Likewise.
1172             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1173             for empty slot.
1174             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1175             file format.
1176             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1177             slot.
1178             (Dwp_output_file::initialize): Remove unused function.
1179             (Dwp_output_file::finalize): Add support for v2 package file format.
1180             (Dwp_output_file::write_index): Likewise.
1181             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1182             function prototype.
1183
1184 2013-07-31  Cary Coutant  <ccoutant@google.com>
1185
1186         * object.cc (Sized_relobj::do_output_section_address): New function.
1187         (Sized_relobj): Instantiate explicitly.
1188         * object.h (Object::output_section_address): New function.
1189         (Object::do_output_section_address): New function.
1190         (Sized_relobj::do_output_section_address): New function.
1191         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1192
1193 2013-07-30  Cary Coutant  <ccoutant@google.com>
1194             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1195
1196         * parameters.cc (Parameters::entry): Return target-specific entry
1197         symbol name.
1198         * target.h (Target::entry_symbol_name): New function.
1199         (Target_info::entry_symbol_name): New data member.
1200
1201         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1202         * i386.cc (Target_i386::i386_info): Likewise.
1203         (Target_i386_nacl::i386_nacl_info): Likewise.
1204         * sparc.cc (Target_sparc::sparc_info): Likewise.
1205         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1206         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1207         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1208         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1209
1210 2013-07-22  Sterling Augustine  <saugustine@google.com>
1211
1212         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1213         Convert parameter shndx to local variable. Add parameters symtab
1214         and symtab_size.  Scan over section names.  Find relocation
1215         section corresponding to current section.  Create and initialize
1216         reloc_mapper_ and reloc_type_.
1217         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1218         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1219         cu_offset_.
1220         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1221         Initialize new fields unit_length_ and cu_offset_.
1222         (Dwarf_pubnames_table::read_section): Update prototype.
1223         (Dwarf_pubnames_table::cu_offset): New member function.
1224         (Dwarf_pubnames_table::subsection_size): Likewise.
1225         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1226         New fields.
1227         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1228         member functions public.
1229         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1230         Update comment.  Rework logic.  Move repeated parts to...
1231         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1232         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1233         pubtypes_table_, and stmt_list_offset.
1234         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1235         Gdb_index::find_pubtype_offset,
1236         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1237         (Gdb_index::pubnames_read): Update prototype and rework logic.
1238         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1239         Forward declare.
1240         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1241         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1242         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1243         Gdb_index::map_pubtable_to_dies):
1244         Declare functions.
1245         (Gdb_index::pubnames_read): Update declaration.
1246         (Gdb_index::Pubname_offset_map): New type.
1247         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1248         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1249         Gdb_index::stmt_list_offset): Declare.
1250         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1251         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1252         Gdb_index::pubtypes_offset_): Remove.
1253
1254 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1255
1256         * options.h (General_options): Add -Trodata-segment option.
1257         * parameters.cc (Parameters::check_rodata_segment): New function.
1258         (Parameters::set_target_once): Call it.
1259         * parameters.h (Parameters): Declare it (private member function).
1260         * layout.cc (load_seg_unusable_for_headers): New function, broken
1261         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1262         then validate rodata segment rather than text segment.
1263         (relaxation_loop_body): Call that.
1264         (is_text_segment): New function.  Don't admit a non-executable
1265         segment if TARGET->isolate_execinstr().
1266         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1267
1268 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1269
1270         PR gold/15070
1271         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1272         * nacl.h (Sniff_file::View::View): Request aligned view.
1273
1274 2013-07-11  Cary Coutant  <ccoutant@google.com>
1275
1276         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1277         correct BRLT entry size.
1278
1279 2013-07-03  Alan Modra  <amodra@gmail.com>
1280
1281         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1282         comment.
1283
1284 2013-07-01  Cary Coutant  <ccoutant@google.com>
1285
1286         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1287         reloc_type_.
1288         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1289         (Dwarf_ranges_table::lookup_reloc): New function.
1290         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1291         reloc_type_.
1292         (Dwarf_ranges_table::lookup_reloc): New function.
1293         (Dwarf_ranges_table::reloc_type_): New data member.
1294
1295 2013-06-27  Jing Yu  <jingyu@google.com>
1296
1297         PR gold/15662
1298         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1299         function.
1300         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1301         (Target_powerpc::do_relax): Call the above.
1302
1303 2013-06-27  Cary Coutant  <ccoutant@google.com>
1304
1305         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1306         on garbage collected .opd section.
1307
1308 2013-06-27  Alan Modra  <amodra@gmail.com>
1309
1310         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1311         is non-zero.
1312         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1313         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1314
1315 2013-06-14  Cary Coutant  <ccoutant@google.com>
1316
1317         * resolve.cc (Symbol::override_base): Don't override st_type
1318         from plugin placeholder symbols.
1319         (Symbol_table::resolve): Likewise.
1320         (Symbol_table::should_override): Don't complain about TLS mismatch
1321         if the TO symbol is a plugin placeholder.
1322         * testsuite/Makefile.am (plugin_test_tls): New test.
1323         * testsuite/Makefile.in: Regenerate.
1324         * testsuite/plugin_test_tls.sh: New test script.
1325         * testsuite/two_file_test_2_tls.cc: New test source.
1326         * testsuite/two_file_test_tls.cc: New test source.
1327
1328 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1329
1330         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1331         the maximum segment alignment is larger than the page size.
1332         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1333         correctly aligns the symbols with large alignemnt.
1334         * testsuite/Makefile.in: Regenerate.
1335         * testsuite/large_symbol_alignment.cc: New file.
1336
1337 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1338             Sriraman Tallam  <tmsriram@google.com>
1339
1340         * options.h (sort_section): New option.
1341         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1342         Rename from Input_section_sort_section_name_special_ordering_compare.
1343         (Input_section_sort_section_name_compare): New struct.
1344         * output.cc (Output_section::Input_section_sort_section_name_compare::
1345         operator()): New function.
1346         (Output_section::sort_attached_input_sections): Use new sort function
1347         for .text if --sort-section=name is specified.
1348         * layout.cc (Layout::make_output_section):
1349         Add sorting by name when --sort-section=name is specified.
1350         * testsuite/Makefile.am (text_section_grouping): Test option
1351         --sort-section=name.
1352         * testsuite/Makefile.in: Regenerate.
1353         * testsuite/section_sorting_name.cc: New file.
1354         * testsuite/section_sorting_name.sh: New file.
1355
1356 2013-05-21  Cary Coutant  <ccoutant@google.com>
1357
1358         * symtab.h (Symbol::is_cxx_vtable): New function.
1359         * target-reloc.h (relocate_section): Check for vtable symbol.
1360         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1361         * testsuite/Makefile.in: Regenerate.
1362         * testsuite/missing_key_func.cc: New test source.
1363         * testsuite/missing_key_func.sh: New test script.
1364
1365 2013-05-21  Cary Coutant  <ccoutant@google.com>
1366
1367         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1368         type of enclosing symbol.
1369         (Relocate_info::location): Check symbol type when describing symbol.
1370         * object.h (Symbol_location_info): Remove unused line_number;
1371         add enclosing_symbol_type.
1372         * testsuite/debug_msg.sh: Adjust expected output.
1373
1374 2013-05-13  Cary Coutant  <ccoutant@google.com>
1375
1376         * configure.ac: Export DEFAULT_TARGET.
1377         * configure: Regenerate.
1378         * Makefile.in: Regenerate.
1379         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1380         * testsuite/Makefile.in: Regenerate.
1381         * testsuite/debug_msg.sh: Delete duplicate tests.
1382         Don't check undef_int error message match for powerpc where the
1383         source file and line number aren't available.
1384
1385 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1386
1387         * options.h (General_options): Add --rosegment-gap option.
1388         * options.cc (finalize): --rosegment-gap implies --rosegment.
1389         * layout.cc (set_segment_offsets): Let user option override
1390         target->rosegment_gap().
1391
1392 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1393
1394         * options.h (General_options): Remove leading space from help
1395         messages for -nostdlib and --rosegment.
1396
1397 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1398
1399         PR ld/15365
1400         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1401
1402 2013-05-03  Alan Modra  <amodra@gmail.com>
1403
1404         * merge.cc (Output_merge_string::do_add_input_section): Correct
1405         scan for number of strings.  Rename vars to avoid shadowing.
1406         Include missing terminator in input_size_.
1407
1408 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1409
1410         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1411         Restore empty string handling.
1412
1413 2013-05-01  Cary Coutant  <ccoutant@google.com>
1414
1415         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1416         uninitialized warning.
1417
1418 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1419
1420         * output.cc (Output_section::add_merge_input_section): Allow
1421         to merge sections if the alignment is more than character size.
1422         * merge.h (Output_merge_string::Output_merge_string): Remove
1423         assert.
1424         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1425         only not-null strings. Check the alignment of strings.
1426         * stringpool.h
1427         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1428         alignment as the argument.
1429         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1430         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1431         Align non-zero length strings according to the addralign_.
1432         (Stringpool_template<Stringpool_char>::set_string_offsets):
1433         Updating offsets according to the given alignment.
1434         * testsuite/Makefile.am (text_section_grouping): Test if string
1435         literals are getting merged.
1436         * testsuite/Makefile.in: Regenerate.
1437         * testsuite/merge_string_literals_1.c: New file.
1438         * testsuite/merge_string_literals_2.c: Ditto.
1439         * testsuite/merge_string_literals.sh: Ditto.
1440
1441 2013-04-26  Ian Lance Taylor  <iant@google.com>
1442
1443         * target-reloc.h (relocate_section): If the reloc offset is out of
1444         range, pass VIEW as NULL to relocate.relocate.
1445         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1446         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1447         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1448         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1449         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1450         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1451
1452 2013-04-26  Geoff Pike  <gpike@chromium.org>
1453
1454         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1455         * layout.cc (Hash_task): New class.
1456         (Layout::queue_build_id_tasks): New function.
1457         (Layout::write_build_id): Handle single-thread portion of build ID
1458         computation.  (In some cases, all of it is single-threaded.)  Replace
1459         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1460         functionality in fewer lines of code.
1461         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1462         * options.h (General_options): make "--build-id" default to tree
1463         rather than sha1.  Add two new options related to --build-id=tree:
1464         --build-id-chunk-size-for-treehash and
1465         --build-id-min-file-size-for-treehash.
1466         * Makefile.am: add testing of --build-id=tree and related new options
1467         (these tests will be invoked by "make check").
1468         * Makefile.in: Regenerate.
1469
1470 2013-04-25  Alan Modra  <amodra@gmail.com>
1471
1472         * configure.tgt: Add powerpcle and powerpc64le.
1473
1474 2013-04-22  Alan Modra  <amodra@gmail.com>
1475
1476         PR gold/15355
1477         * layout.cc (Layout::segment_precedes): Allow more than one
1478         segment with the same type and flags.
1479
1480 2013-04-15  Cary Coutant  <ccoutant@google.com>
1481
1482         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1483         allocate space in file for BSS sections.
1484
1485 2013-04-15  Cary Coutant  <ccoutant@google.com>
1486
1487         * script-sections.cc (Orphan_output_section): Reset address
1488         to zero after each orphaned section for relocatable links.
1489
1490 2013-04-15  Cary Coutant  <ccoutant@google.com>
1491
1492         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1493         section starting address for relocatable link.
1494         * testsuite/Makefile.am (script_test_11): New test.
1495         * testsuite/Makefile.in: Regenerate.
1496         * testsuite/script_test_11.c: New source file.
1497         * testsuite/script_test_11.t: New linker script.
1498
1499 2013-04-13  Alan Modra  <amodra@gmail.com>
1500
1501         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1502         owner when sections are not adjacent and exceed group size.
1503         (Target_powerpc::group_sections): Handle corner case.
1504         (Target_powerpc::Branch_info::make_stub): Handle case where
1505         stub table doesn't exist due to branches in non-exec sections.
1506         (Target_powerpc::Relocate::relocate): Likewise.
1507
1508 2013-04-11  Alan Modra  <amodra@gmail.com>
1509
1510         PR gold/15354
1511         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1512         .branch_lt to match bfd ld.  Adjust comments throughout file.
1513
1514 2013-04-04  Ian Lance Taylor  <iant@google.com>
1515
1516         GCC PR c++/56840
1517         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1518         sections before checking whether they are included in the link.
1519
1520 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1521
1522         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1523         object before calling the plugin claim_file handler.  Pass the elf
1524         object of the archive to the plugin. Delete the elf object if the
1525         plugin claims the file.
1526
1527 2013-03-21  Alan Modra  <amodra@gmail.com>
1528
1529         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1530         segment when omagic.
1531
1532 2013-03-21  Alan Modra  <amodra@gmail.com>
1533
1534         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1535         comparison warning.
1536         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1537         uninitialized" warning.
1538
1539 2013-03-20  Alan Modra  <amodra@gmail.com>
1540
1541         * symtab.h (Symbol::clear_version): New function.
1542         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1543         is_needed by weak references.  Clear version for symbols defined
1544         in as-needed objects that are not needed.
1545
1546 2013-03-15  Alan Modra  <amodra@gmail.com>
1547
1548         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1549         static and public.  Add report_err param.  Return false for data refs.
1550         (Target_powerpc::rela_dyn_section): New overloaded function.
1551         (Target_powerpc::plt_, iplt_): Elucidate.
1552         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1553         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1554         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1555         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1556         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1557         push_branch and make_plt_entry for ifunc syms when
1558         reloc_needs_plt_for_ifunc.
1559         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1560         for ifunc unless reloc_needs_plt_for_ifunc.
1561
1562 2013-03-15  Alan Modra  <amodra@gmail.com>
1563
1564         * gc.h (gc_process_relocs): Don't look through function descriptors.
1565         * icf.cc (get_section_contents): Do so here instead.
1566
1567 2013-03-13  Alan Modra  <amodra@gmail.com>
1568
1569         * powerpc.cc (is_branch_reloc): Forward declare.
1570         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1571         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1572         false for 64-bit, true for 32-bit non-branch relocs.
1573         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1574         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1575         nm output.
1576         (icf_safe_test): Generate linker map file as well as nm output.
1577         (icf_safe_so_test): Likewise.
1578         * testsuite/Makefile.in: Regenerate.
1579         * testsuite/icf_test.sh: Parse linker map file to determine
1580         section folding.
1581         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1582         * testsuite/icf_safe_so_test.sh: Likewise.
1583         (X86_32_or_ARM_specific_safe_fold): Merge into..
1584         (arch_specific_safe_fold): ..this.
1585         (X86_64_specific_safe_fold): Delete unused function.
1586
1587 2013-03-12  Alan Modra  <amodra@gmail.com>
1588
1589         * gc.h (gc_process_relocs): Look through function descriptors
1590         to determine shndx, symvalue and addend used by ICF.  Tidy
1591         variable duplication.
1592
1593 2013-03-11  Alan Modra  <amodra@gmail.com>
1594
1595         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1596         * layout.cc (Layout_task_runner::run): ..to here.
1597         * symtab.h (struct Symbol_location): Extract from..
1598         (class Symbol_table): ..here.
1599         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1600         * target.h (class Target): Add function_location and
1601         do_function_location functions.
1602         (class Sized_target): Add do_function_location.
1603         * object.h (class Sized_relobj_file): Move find_shdr..
1604         (class Object): ..to here.
1605         * object.cc: Likewise.  Update to suit.  Instantiate.
1606         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1607         * powerpc.cc (class Powerpc_dynobj): New.
1608         (Target_powerpc::do_function_location): New function.
1609         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1610         (Powerpc_dynobj::do_read_symbols): New function.
1611         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1612
1613 2013-03-08  Ian Lance Taylor  <iant@google.com>
1614
1615         * options.cc (General_options::string_to_object_format): Accept
1616         "default".
1617
1618 2013-03-08  Alan Modra  <amodra@gmail.com>
1619
1620         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1621         pointer to Post_fde.
1622         (struct Post_fde): Move definition to here..
1623         * ehframe.cc (struct Post_fde): ..from here.
1624         (Cie::write): Don't alloc Post_fde.
1625         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1626
1627 2013-03-07  Alan Modra  <amodra@gmail.com>
1628
1629         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1630         relocation referencing .LC0.
1631         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1632
1633 2013-03-07  Alan Modra  <amodra@gmail.com>
1634
1635         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1636         always_inline.  Add assembly for powerpc to avoid GOT.
1637
1638 2013-03-07  Alan Modra  <amodra@gmail.com>
1639
1640         * testsuite/script_test_10.sh: Don't test .bss section
1641         header number.
1642
1643 2013-03-06  Alan Modra  <amodra@gmail.com>
1644
1645         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1646         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1647         all callers.  Handle folded sections.
1648         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1649         to Powerpc_relobj.
1650         (Global_symbol_visitor_opd::operator()): Likewise.
1651
1652 2013-03-04  Alan Modra  <amodra@gmail.com>
1653
1654         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1655         * testsuite/Makefile.in: Regenerate.
1656
1657 2013-03-01  Cary Coutant  <ccoutant@google.com>
1658
1659         Add dwp support for v2 DWARF package file format.
1660         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1661         tu_length parameter.  Adjust all callers.
1662         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1663         * dwp.cc: Include dwarf.h.
1664         (Section_bounds): New struct type.
1665         (Unit_set): New struct type.
1666         (Dwo_file::Dwo_file): Initialize new data member.
1667         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1668         Combine and rename to...
1669         (Dwo_file::read_unit_index): ...this.
1670         (Dwo_file::sized_read_compunit_index)
1671         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1672         (Dwo_file::sized_read_unit_index): ...this.
1673         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1674         parameters; add section_id parameter.
1675         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1676         (Dwo_file::add_unit_set): ...this.
1677         (Dwo_file::shndx_map_): Remove.
1678         (Dwo_file::sect_offsets_): New data member.
1679         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1680         (Dwp_output_file::add_section): Rename to...
1681         (Dwp_output_file::add_contribution): ...this.
1682         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1683         (Dwp_output_file::add_tu_set): Likewise.
1684         (Dwp_output_file::Contribution): New type.
1685         (Dwp_output_file::Section::contributions): New data member.
1686         (Dwp_output_file::Cu_or_tu_set): Remove.
1687         (Dwp_output_file::Section::Section): New ctor.
1688         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1689         (Dwp_output_file::Dwp_index::Section_table): New type.
1690         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1691         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1692         parameter.
1693         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1694         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1695         (Dwp_output_file::Dwp_index::section_table): New member function.
1696         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1697         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1698         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1699         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1700         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1701         (Dwp_output_file::Dwp_index::section_table_): New data member.
1702         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1703         (Dwp_output_file::add_output_section): New member function.
1704         (Dwp_output_file::write_new_section): New member function.
1705         (Dwp_output_file::write_contributions): New member function.
1706         (Dwp_output_file::section_id_map_): New data member.
1707         (class Dwo_id_info_reader): Remove.
1708         (class Unit_reader): New class.
1709         (get_dwarf_section_name): New function.
1710         (Dwo_file::read_executable): Adjust initializations of class data.
1711         (Dwo_file::read): Add support for v2 package file format.
1712         (Dwo_file::read_unit_index): Likewise.
1713         (Dwo_file::sized_read_unit_index): Likewise.
1714         (Dwo_file::copy_section): Likewise.
1715         (Dwo_file::add_unit_set): Likewise.
1716         (Dwp_output_file::add_output_section): Likewise.
1717         (Dwp_output_file::add_contribution): Likewise.
1718         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1719         for empty slot.
1720         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1721         file format.
1722         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1723         slot.
1724         (Dwp_output_file::initialize): Remove unused function.
1725         (Dwp_output_file::finalize): Add support for v2 package file format.
1726         (Dwp_output_file::write_index): Likewise.
1727         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1728         function prototype.
1729
1730 2013-03-01  Cary Coutant  <ccoutant@google.com>
1731
1732         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1733         function into class definition in header file.
1734         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1735         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1736         New function.
1737         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1738
1739 2013-02-28  Alan Modra  <amodra@gmail.com>
1740
1741         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1742         * target.cc (Target::do_plt_fde_location): New function.
1743         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1744         accessor function, and constructor param.
1745         (struct Post_fde, Post_fdes): Declare.
1746         (Cie::write): Add post_fdes param.
1747         * ehframe.cc (Fde::write): Use plt_fde_location.
1748         (struct Post_fde): Define.
1749         (Cie::write): Stash FDEs added post merge mapping.
1750         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1751         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1752         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1753         other FDEs.
1754         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1755         (Target_powerpc::has_glink): New function.
1756         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1757         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1758         glink_eh_frame_fde_32, default_fde): New data.
1759         (Stub_table::eh_frame_added_): New var.
1760         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1761         Make const.
1762         (Stub_table::add_eh_frame): New function.
1763         (Output_data_glink::add_eh_frame): New function.
1764         (Target_powerpc::make_glink_section): Call add_eh_frame.
1765
1766 2013-02-15  Ian Lance Taylor  <iant@google.com>
1767
1768         * options.h (DEFINE_uint64_alias): Define.
1769         (class General_options): Add -Ttext-segment as an alias for
1770         -Ttext.
1771
1772 2013-02-15  Alan Modra  <amodra@gmail.com>
1773
1774         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1775         (Stub_table::do_write): ..here, two places.
1776         (Stub_table::plt_call_size): Use it here too.
1777
1778 2013-02-11  Ian Lance Taylor  <iant@google.com>
1779
1780         * descriptors.cc (Descriptors::close_all): New function.
1781         * descriptors.h (class Descriptors): Declare close_all.
1782         (close_all_descriptors): New inline function.
1783         * plugin.cc: Include "descriptors.h".
1784         (Plugin_manager::cleanup): Call close_all_descriptors.
1785
1786 2013-02-06  Alan Modra  <amodra@gmail.com>
1787
1788         * README: Update coding style link.
1789
1790 2013-01-28  Cary Coutant  <ccoutant@google.com>
1791
1792         * dwp.cc (File_list): New typedef.
1793         (Dwo_name_info_reader): New class.
1794         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1795         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1796         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1797         (Dwo_file::read_executable): New function.
1798         (Dwo_file::read): Move common setup code to ...
1799         (Dwo_file::make_object): ... here.
1800         (dwp_options): Add --exec/-e.
1801         (usage): Likewise.
1802         (main): Likewise.
1803
1804 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1805
1806         * layout.cc (Layout::layout): Check for option text_reorder.
1807         (Layout::make_output_section): Ditto.
1808         * options.h (text_reorder): New option.
1809         * output.cc (Input_section_sort_compare): Remove special ordering
1810         of section names.
1811         (Output_section::
1812          Input_section_sort_section_name_special_ordering_compare::
1813          operator()): New function.
1814         (Output_section::sort_attached_input_sections): Use new sort function
1815         for .text.
1816         * output.h (Input_section_sort_section_name_special_ordering_compare):
1817         New struct.
1818         * testsuite/Makefile.am (text_section_grouping): Test option
1819         --no-text-reorder
1820         * testsuite/Makefile.in: Regenerate.
1821         * testsuite/text_section_grouping.sh: Check order of functions without
1822         default text reordering.
1823
1824 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1825
1826         * options.h (General_options): Change default to true for new_dtags.
1827
1828 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1829
1830         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1831         when enable_new_dtags is false.  Only add DT_RUNPATH when
1832         enable_new_dtags is true.
1833
1834 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1835
1836         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1837         used in declaration and definition consistent.
1838         (Target_powerpc::symval_for_branch): Ditto.
1839
1840 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1841
1842         * testsuite/plugin_final_layout.cc: Fix comment.
1843
1844 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1845
1846         * layout.cc (Layout::layout): Do not do default sorting for
1847         text sections when section ordering is specified.
1848         (make_output_section): Ditto.
1849         * testsuite/plugin_final_layout.cc: Name the function sections
1850         to catch reordering issues.
1851
1852 2013-01-15  Alan Modra  <amodra@gmail.com>
1853
1854         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1855         plt-thread-safe.
1856
1857 2013-01-15  Alan Modra  <amodra@gmail.com>
1858
1859         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1860         * testsuite/Makefile.in: Regenerate.
1861
1862 2013-01-14  Alan Modra  <amodra@gmail.com>
1863
1864         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1865         * testsuite/Makefile.in: Regenerate.
1866
1867 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1868
1869         PR bfd/14430
1870         Fix mingw gold build with plugins enabled
1871         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1872         * configure.ac: Export DLOPEN_LIBS and add headers check.
1873         * plugin.cc: Handle non-dlfcn case.
1874         * Makefile.in: Regenerate.
1875         * config.in: Regenerate.
1876         * configure: Regenerate.
1877         * testsuite/Makefile.in: Regenerate.
1878
1879 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1880
1881         * output.h (sort_attached_input_sections): Change to be public.
1882         * script-sections.cc
1883         (Output_section_definition::set_section_addresses): Sort
1884         attached input sections according to section order before linker
1885         script assigns section addresses.
1886         (Orphan_output_section::set_section_addresses): Sort
1887         attached input sections according to section order before linker
1888         script assigns section addresses.
1889         * Makefile.am (final_layout.sh): Use a simple linker script to
1890         check if section ordering still works.
1891         * Makefile.in: Regenerate.
1892
1893 2013-01-09  Ben Cheng  <bccheng@google.com>
1894
1895         * arm.cc (Target_arm::attributes_accept_div): New function.
1896         (Target_arm::attributes_forbid_div): New function.
1897         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1898         attribute using the same new functions as what bfd/elf32_arm.c
1899         does.
1900
1901 2013-01-07  Cary Coutant  <ccoutant@google.com>
1902
1903         PR gold/14993
1904         * output.cc (Output_section::add_input_section): For incremental
1905         updates, don't track input sections that are allocated from patch
1906         space.
1907
1908 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1909             Ian Lance Taylor  <iant@google.com>
1910
1911         PR gold/14897
1912         * configure.ac (--enable-ld): Removed.
1913         (install_as_default): Set to yes only for --enable-gold=default
1914         or --disable-ld.
1915         * configure: Regenerated.
1916
1917 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1918
1919         * options.h (General_options): Add -fuse-ld= for GCC linker
1920         option compatibility.
1921
1922 2013-01-04  Cary Coutant  <ccoutant@google.com>
1923
1924         * configure.ac: Fix typo restoring CXXFLAGS.
1925         * configure: Regenerate.
1926
1927 2013-01-04  Cary Coutant  <ccoutant@google.com>
1928
1929         * testsuite/Makefile.am (CXXLINK_S): New macro.
1930         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1931         * testsuite/Makefile.in: Regenerate.
1932
1933 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1934
1935         * version.cc (print_version): Update copyright year to 2013.
1936
1937 2012-12-20  Ian Lance Taylor  <iant@google.com>
1938
1939         * layout.cc (Layout::special_ordering_of_input_section): New
1940         function.
1941         (Layout::layout): If input section requires special ordering, must
1942         sort input sections.
1943         (Layout::make_output_section): May sort .text input sections.
1944         (Layout::is_section_name_prefix_grouped): Remove.
1945         * layout.h (class Layout): Declare
1946         special_ordering_of_input_section.  Don't declare
1947         is_section_name_prefix_grouped.
1948         * output.cc (Output_section::add_input_section): Revert last
1949         change.
1950         (Output_section::Input_section_sort::match_file_name): Don't crash
1951         if called on output section data.
1952         (Output_section::Input_section_sort_compare): Sort based on
1953         special ordering.
1954         (Output_section::Input_section_sort_section_order_index_compare):
1955         Revert last patch.
1956         (Output_section::sort_attached_input_sections): Likewise.
1957
1958 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1959
1960         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1961         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1962         * output.cc (Output_section::add_input_section): Check if section
1963         name contains special prefix.  Keep input sections to sort such
1964         sections.
1965         (Output_section::Input_section_sort_section_order_index_compare
1966          ::operator()): Group sections according to prefixes.
1967         (Output_section::sort_attached_input_sections): Add condition to
1968         Input_section_entry constructor call.
1969         * testsuite/Makefile.am (text_section_grouping): New test.
1970         * testsuite/Makefile.in: Regenerate.
1971         * testsuite/text_section_grouping.cc: New file.
1972         * testsuite/text_section_grouping.sh: New file.
1973
1974 2012-12-17  Nick Clifton  <nickc@redhat.com>
1975
1976         * Makefile.am: Add copyright notice.
1977         * NEWS: Likewise.
1978         * README: Likewise.
1979         * configure.ac: Likewise.
1980         * ftruncate.c: Likewise.
1981         * Makefile.in: Regenerate.
1982
1983 2012-12-14  Cary Coutant  <ccoutant@google.com>
1984
1985         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1986         --no-as-needed flag.
1987         (exception_separate_shared_12_test): Likewise.
1988         (incremental_copy_test): Likewise.
1989         * testsuite/Makefile.in: Regenerate.
1990
1991 2012-12-14  Cary Coutant  <ccoutant@google.com>
1992
1993         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1994         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1995
1996 2012-12-12  Alan Modra  <amodra@gmail.com>
1997
1998         * powerpc.cc (class Track_tls): New.
1999         (class Relocate, class Scan): Inherit Track_tls.
2000         (Target_powerpc::Scan::local, global): Track tls optimization
2001         and avoid creating plt entry for __tls_get_addr if all uses
2002         are optimized away.
2003         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2004
2005 2012-12-12  Alan Modra  <amodra@gmail.com>
2006
2007         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2008         Replace no_toc_optimize with toc_optimize.
2009         * output.h (Output_section::input_sections): Provide non-const variant.
2010         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2011         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2012         accessors.
2013         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2014         (class Sort_toc_sections): New.
2015         (Target_powerpc::do_finalize_sections): Sort toc sections.
2016         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2017
2018 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2019
2020         * testsuite/binary_unittest.cc (read_all): New function.
2021         (Sized_binary_test): Use it instead of ::read.
2022         * fileread.cc (do_read): Don't assume pread always reads the whole
2023         amount in a single call.
2024
2025 2012-12-10  Alan Modra  <amodra@gmail.com>
2026
2027         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2028         Set EM_PPC64 or EM_PPC here.
2029         (Target_selector_powerpc::do_recognize): Delete.
2030
2031 2012-12-10  Alan Modra  <amodra@gmail.com>
2032
2033         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2034         stub_table_.
2035         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2036
2037 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2038
2039         * testsuite/binary_unittest.cc (Sized_binary_test):
2040         Use open_descriptor rather than ::open.
2041
2042 2012-12-07  Alan Modra  <amodra@gmail.com>
2043
2044         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2045         typedef and invalid_address constant.
2046         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2047         instantiate constants.
2048
2049 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2050
2051         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2052         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2053         * aclocal.m4: Regenerate.
2054         * configure: Regenerate.
2055         * Makefile.in: Regenerate.
2056         * testsuite/Makefile.in: Regenerate.
2057
2058 2012-12-07  Alan Modra  <amodra@gmail.com>
2059
2060         * options.h (General_options): Add no_toc_optimize.
2061         * powerpc.cc (ok_lo_toc_insn): New function.
2062         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2063
2064 2012-12-06  Alan Modra  <amodra@gmail.com>
2065
2066         * options.h (General_options): Add plt_align, plt_static_chain,
2067         plt_thread_safe.  Update stub_group_size help text.
2068         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2069         for new plt_thread_safe_ var.
2070         (use_plt_offset): Correct comments.
2071         (Target_powerpc::do_relax): Look for thread creation symbols to
2072         determine default plt_thread_safe value.  Clear plt call stubs
2073         as well as branch stubs each iteration.
2074         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2075         insn constants.
2076         (l, hi, ha, write_insn): Move earlier.
2077         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2078         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2079         plt stubs too.
2080         (Stub_table::update_size): Adjust.
2081         (Stub_table::prev_size, set_prev_size): Delete.
2082         (Stub_table::stub_align): Let --plt-align affect result.
2083         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2084         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2085         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2086         (Stub_table::do_write): Support more stub variants.
2087
2088 2012-12-04  Alan Modra  <amodra@gmail.com>
2089
2090         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2091         (Target_powerpc::do_define_standard_symbols): New function.
2092
2093 2012-12-03  Alan Modra  <amodra@gmail.com>
2094
2095         * output.h: Formatting, whitespace.
2096
2097 2012-12-03  Alan Modra  <amodra@gmail.com>
2098
2099         * layout.h (Layout::get_executable_sections): Declare.
2100         * layout.cc (Layout::get_executable_sections): New function.
2101         * arm.cc (Target_arm::group_sections): Use it.
2102         (Arm_output_section::group_sections): Delete now redundant test.
2103         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2104         param to handle relative relocs.
2105         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2106         (Output_data_reloc::add_absolute): Adjust.
2107         (Output_data_reloc::add_relative): New function.
2108         (Output_data::reset_data_size): New function.
2109         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2110         (Output_section::set_addralign): New function.
2111         (Output_section::checkpoint_set_addralign): New function.
2112         (Output_section::clear_section_offsets_need_adjustment): New function.
2113         (Output_section::input_sections): Make public.
2114         * powerpc.cc (class Output_data_brlt_powerpc): New.
2115         (class Stub_table, class Stub_control): New.
2116         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2117         stub_table_, set_stub_table, stub_table): New vectors and accessor
2118         functions.
2119         (Target_powerpc::do_may_relax, do_relax, push_branch,
2120         new_stub_table, stub_tables, brlt_section, group_sections,
2121         add_branch_lookup_table, find_branch_lookup_table,
2122         write_branch_lookup_table, make_brlt_section): New functions.
2123         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2124         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2125         branch_info_): New vars.
2126         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2127         make call stubs here.
2128         (Output_data_glink): Remove all call stub handling from this class.
2129         (Target_powerpc::Scan::local, global): Save interesting branch
2130         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2131         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2132         functions on final link.
2133         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2134         Handle long branch destinations too.
2135         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2136         do_plt_address_for_local): Adjust lookup of plt call stubs.
2137
2138 2012-11-30  Alan Modra  <amodra@gmail.com>
2139
2140         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2141         relocs against protected symbols when building 32-bit shared libs.
2142
2143 2012-11-30  Alan Modra  <amodra@gmail.com>
2144
2145         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2146         param.  Call got_section() to make .got.  Update all callers
2147         and their callers and so on.
2148
2149 2012-11-30  Alan Modra  <amodra@gmail.com>
2150
2151         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2152         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2153         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2154         value if it already exists.
2155
2156 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2157
2158         PR gold/14858
2159         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2160
2161 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2162
2163         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2164         than bfc instruction for data sandboxing.
2165
2166 2012-11-08  Alan Modra  <amodra@gmail.com>
2167
2168         * po/POTFILES.in: Regenerate.
2169
2170 2012-11-05  Alan Modra  <amodra@gmail.com>
2171
2172         * configure.ac: Apply 2012-09-10 change to config.in here.
2173         * configure: Regenerate.
2174
2175 2012-11-05  Alan Modra  <amodra@gmail.com>
2176
2177         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2178         (struct Opd_ent): Use "Address" rather than "Offset".
2179         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2180         (Target_powerpc::got_section): Make public.
2181         (Target_powerpc::scan_relocs): Move code setting symbols..
2182         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2183         Create _SDA_BASE_ only when referenced.
2184
2185 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2186
2187         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2188         from last change.
2189
2190 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2191
2192         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2193         for offset_in_output_section parameter.
2194         (Sized_target::relocate_special_relocatable): Likewise.
2195         * arm.cc (Target_arm::relocate_relocs): Likewise.
2196         (Target_arm::relocate_special_relocatable): Likewise.
2197         * i386.cc (Target_i386::relocate_relocs): Likewise.
2198         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2199         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2200         * target-reloc.h (relocate_relocs): Likewise.
2201         * testsuite/testfile.cc (Target_test): Likewise.
2202         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2203         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2204
2205         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2206         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2207
2208         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2209         parameter, which is unused in the [!F_SETFD] case.
2210
2211         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2212         SYMNDX to off_t before comparing it to this->data_size().
2213         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2214         * incremental.cc (Output_section_incremental_inputs::do_write):
2215         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2216
2217         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2218
2219 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2220
2221         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2222         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2223         in EABI_VER5.
2224
2225 2012-10-29  Cary Coutant  <ccoutant@google.com>
2226
2227         * dwp.cc (usage): Add file and exit status parameters;
2228         add --help and --version options.
2229         (print_version): New function.
2230         (main): Add --help and --version options.
2231
2232 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2233
2234         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2235         final_layout_sequence.txt.
2236         * testsuite/Makefile.in: Regenerated.
2237
2238 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2239
2240         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2241         COMPILE generated by automake.
2242         (LINK1): Likewise.
2243         (CXXCOMPILE1): Likewise.
2244         (CXXLINK1): Likewise.
2245         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2246         (LINK): Likewise.
2247         (CXXCOMPILE): Likewise.
2248         (CXXLINK): Likewise.
2249         * testsuite/Makefile.in: Regenerated.
2250
2251 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2252
2253         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2254         on bad fwrite return.
2255
2256 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2257
2258         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2259         on val.
2260
2261 2012-10-23  Cary Coutant  <ccoutant@google.com>
2262
2263         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2264         * testsuite/Makefile.in: Regenerate.
2265         * testsuite/dwp_test.h: New source file.
2266         * testsuite/dwp_test_1.cc: New source file.
2267         * testsuite/dwp_test_1.s: New source file.
2268         * testsuite/dwp_test_1.sh: New source file.
2269         * testsuite/dwp_test_1b.cc: New source file.
2270         * testsuite/dwp_test_1b.s: New source file.
2271         * testsuite/dwp_test_2.cc: New source file.
2272         * testsuite/dwp_test_2.s: New source file.
2273         * testsuite/dwp_test_2.sh: New source file.
2274         * testsuite/dwp_test_main.cc: New source file.
2275         * testsuite/dwp_test_main.s: New source file.
2276
2277 2012-10-23  Cary Coutant  <ccoutant@google.com>
2278
2279         * dwp.h: New header file.
2280         * dwp.cc: New source file.
2281         * gold.h: Move shared declarations to system.h.
2282         * system.h: New header file.
2283         * Makefile.am: Add dwp.
2284         * Makefile.in: Regenerate.
2285
2286 2012-10-23  Cary Coutant  <ccoutant@google.com>
2287
2288         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2289         Dwarf_info_reader::read_from_pointer.
2290         (Dwarf_pubnames_table::read_header): Likewise.
2291         (Dwarf_pubnames_table::next_name): Likewise.
2292         (Dwarf_die::read_attributes): Likewise.
2293         (Dwarf_die::skip_attributes): Likewise.
2294         (Dwarf_info_reader::read_from_pointer): New function template.
2295         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2296         (Dwarf_pubnames_table): Likewise.
2297         (Dwarf_info_reader::read_from_pointer): New function template.
2298         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2299         Dwarf_pubnames_table ctor.
2300
2301 2012-10-23  Cary Coutant  <ccoutant@google.com>
2302
2303         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2304         abbrev_shndx.
2305         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2306         abbrev_shndx_.
2307         (Dwarf_info_reader::set_abbrev_shndx): New method.
2308         (Dwarf_info_reader::abbrev_shndx_): New data member.
2309
2310 2012-10-23  Cary Coutant  <ccoutant@google.com>
2311
2312         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2313         from object, not parameters.
2314         (Dwarf_info_reader::parse): Likewise.
2315         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2316         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2317         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2318         methods.
2319
2320 2012-10-23  Cary Coutant  <ccoutant@google.com>
2321
2322         * fileread.cc (Input_file::Input_file): New constructor.
2323         * fileread.h (class Input_file): Add new constructor.
2324
2325 2012-10-18  Alan Modra  <amodra@gmail.com>
2326
2327         PR gold/14727
2328         * object.cc (Relobj::is_section_name_included): Also match
2329         .sdata personality section.
2330
2331 2012-10-18  Alan Modra  <amodra@gmail.com>
2332
2333         * target-reloc.h (class Default_comdat_behavior): New, package up..
2334         (get_comdat_behaviour): ..this.
2335         (relocate_section): Add Relocate_comdat_behavior template arg,
2336         adjust code to suit.
2337         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2338         (Target_arm::scan_reloc_section): Likewise.
2339         * i386.cc (Target_i386::relocate_section): Likewise.
2340         * sparc.cc (Target_sparc::relocate_section): Likewise.
2341         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2342         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2343         * powerpc.cc (class Relocate_comdat_behavior): New.
2344         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2345         gold::relocate_section with new template arg.
2346
2347 2012-10-18  Alan Modra  <amodra@gmail.com>
2348
2349         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2350         dynamic relocs for GOT_TPREL got entries, without symbol if
2351         resolving locally.
2352         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2353         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2354         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2355
2356 2012-10-17  Alan Modra  <amodra@gmail.com>
2357
2358         PR gold/14726
2359         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2360
2361 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2362
2363         * layout.cc (Layout::include_section): Keep sections marked
2364         SHF_EXCLUDE when doing relocatable links.
2365
2366 2012-10-16  Alan Modra  <amodra@gmail.com>
2367
2368         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2369         (Target_powerpc::do_finalize_sections): Call it.
2370         (Output_data_save_res): New class and supporting functions.
2371         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2372         normal symbols defined in object files.
2373
2374 2012-10-12  Alan Modra  <amodra@gmail.com>
2375
2376         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2377         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2378         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2379         section if scan_opd_relocs not yet called.
2380         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2381
2382 2012-10-12  Alan Modra  <amodra@gmail.com>
2383
2384         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2385         add_local_ifunc_entry): Revert last change.
2386         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2387
2388 2012-10-05  Alan Modra  <amodra@gmail.com>
2389
2390         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2391         do_plt_address_for_global): New functions.
2392         (Output_data_got_powerpc::do_write): Don't segfault when linking
2393         statically.
2394         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2395         add_local_ifunc_entry): Return true on adding entry..
2396         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2397         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2398         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2399         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2400         set up symbols here.
2401         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2402         syms here.  Do so even when no .iplt.  Don't segfault when linking
2403         statically.
2404         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2405         new variants without reloc param.
2406         (Glink_sym_ent::Glink_sym_ent): Likewise.
2407         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2408         reloc when refs will resolve to plt call stub.
2409         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2410         R_PPC_PLTREL24 to resolve locally.
2411         (Target_powerpc::Scan::global): Correct ifunc handling.
2412         (Target_powerpc::Relocate::relocate): Correct local sym glink
2413         lookup.  Don't destroy "value" when we have a plt call stub,
2414         and when checking plt call validity.
2415         (Target_powerpc::do_dynsym_value): Simplify.
2416
2417 2012-10-05  Alan Modra  <amodra@gmail.com>
2418
2419         * i386.cc (Output_data_plt_i386::address_for_global,
2420         address_for_local): Add plt offset to returned value.  Adjust uses.
2421         * sparc.cc (Output_data_plt_sparc::address_for_global,
2422         address_for_local): Likewise.
2423         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2424         address_for_local): Likewise.
2425         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2426         address_for_local): Likewise.
2427         * target.h (Target::plt_address_for_global, plt_address_for_local):
2428         Update comment.
2429         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2430         (Output_data_got::Got_entry::write): Nor here.
2431         * output.h: Comment fix.
2432
2433 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2434
2435         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2436         global_offset_table_ value for larget got.
2437         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2438
2439 2012-09-29  Alan Modra  <amodra@gmail.com>
2440
2441         * powerpc.cc (Target_powerpc::iplt_): New output section.
2442         (Target_powerpc::iplt_section, make_iplt_section,
2443         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2444         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2445         Target_powerpc::plt_entry_count): Count iplt entries too.
2446         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2447         reloc section in constructor.  New params.
2448         (Target_powerpc::make_plt_section): Create reloc section here instead.
2449         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2450         functions.
2451         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2452         (Output_data_glink::add_entry, find_entry): New functions to
2453         deal with local syms.
2454         (Glink_sym_ent): Add support for local syms.
2455         (Output_data_glink::do_write): Handle ifunc plt entries.
2456         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2457         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2458         (Target_powerpc::Relocate::relocate): Likewise.
2459         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2460
2461 2012-09-25  Alan Modra  <amodra@gmail.com>
2462
2463         * object.h (Sized_relobj_file::adjust_local_symbol,
2464         do_adjust_local_symbol): New functions.
2465         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2466         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2467         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2468         and irregular opd entry spacing.
2469         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2470         (Global_symbol_visitor_opd): New functor.
2471         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2472         on deleted opd entries.
2473
2474 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2475
2476         * tilegx.cc: New file.
2477         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2478         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2479         * configure.tgt: Add entries for tilegx*.
2480         * configure.ac: Likewise.
2481         * Makefile.in: Rebuild.
2482         * configure: Likewise.
2483         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2484         tilegx.
2485
2486 2012-09-13  Alan Modra  <amodra@gmail.com>
2487
2488         * target-reloc.h (scan_relocs): Call scan.local for relocs
2489         against symbols in discarded sections.  Pass is_discarded
2490         param.
2491         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2492         Add is_discarded param.
2493         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2494         is_discarded to flag opd entry as discarded.  Don't emit dyn
2495         relocs on such entries.
2496         (Target_powerpc::Scan::global): Similarly detect and handle
2497         such opd entries.
2498         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2499         opd_ent_.  Update all uses.
2500         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2501         (Target_powerpc::relocate_section): Zero out discarded opd
2502         entry relocs.
2503
2504 2012-09-12  Ian Lance Taylor  <iant@google.com>
2505
2506         PR gold/14570
2507         * output.cc: Rename Output_data_got template parameter from size
2508         to got_size for all functions.  Compile all variants of
2509         Output_data_got.
2510         (Output_data_got::Got_entry::write): Correct use of size for
2511         symbol value.  Use local_is_tls rather than casting to
2512         Sized_relobj_file.
2513         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2514         (class Sized_relobj_file): Add do_local_is_tls.
2515         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2516
2517 2012-09-11  Alan Modra  <amodra@gmail.com>
2518
2519         PR gold/14566
2520         * layout.cc (Layout::set_segment_offsets): When using
2521         common-page-size alignment, ensure we are on a new max-page-size
2522         page.
2523         * output.cc (Output_segment::set_section_addresses): Use
2524         abi_pagesize, not common_pagesize for relro boundary.
2525         (Output_segment::set_offset): Likewise.
2526
2527 2012-09-11  Alan Modra  <amodra@gmail.com>
2528
2529         * output.h (Output_data_got::add_global_tls, add_local_tls,
2530         add_local_tls_pair): New functions.
2531         (Output_data_got::add_local_pair_with_rel): Remove second
2532         reloc param.  Expand comment.
2533         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2534         use_plt_or_tls_offset_, similarly for constructor param.
2535         (Output_data_got::Got_entry::write): Add got_index param.
2536         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2537         add_local_tls_pair): New functions.
2538         (Output_data_got::Got_entry::write): Handle tls symbols
2539         with use_plt_or_tls_offset_ set specially.
2540         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2541         (Output_data_got::do_write): Replace iterator with index, pass
2542         index to entry write function.
2543         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2544         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2545         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2546         call.
2547         * i386.cc (Target_i386::Scan::local): Likewise.
2548         * sparc.cc (Target_sparc::Scan::local): Likewise.
2549         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2550         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2551         do_tls_offset_for_global): New functions.
2552         (Target_powerpc::Scan::local): Correct TLS relocations and got
2553         entry values.
2554         (Target_powerpc::Scan::global): Don't emit unnecessary
2555         dynamic relocations on TLS GOT entries.
2556
2557 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2558
2559         * config.in: Disable sanity check for kfreebsd.
2560
2561 2012-09-10  Sterling Augustine  <saugustine@google.com>
2562
2563         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2564         (Gdb_index::pubtypes_read): New parameter.
2565         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2566         to calls.
2567         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2568         pubtypes_object_.
2569
2570 2012-09-09  Alan Modra  <amodra@gmail.com>
2571
2572         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2573         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2574         * gc.h (gc_process_relocs): Call target gc_add_reference.
2575         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2576         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2577         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2578         unnecessary cast.
2579         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2580         to cater for when we don't need code offset.  Update use.
2581         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2582         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2583         set_opd_valid): New functions.
2584         (Target_powerpc::do_gc_add_reference): New function.
2585         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2586         stashed refs.
2587         (Target_powerpc::do_gc_mark_symbol): New function.
2588
2589 2012-09-06  Cary Coutant  <ccoutant@google.com>
2590
2591         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2592         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2593         (Dwarf_die::skip_attributes): Likewise.
2594         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2595         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2596         (main): Call it.
2597         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2598
2599 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2600
2601         * testsuite/script_test_3.t: Add .got.plt output section
2602         statement.
2603         * testsuite/script_test_4.t: Likewise.
2604
2605 2012-09-05  Alan Modra  <amodra@gmail.com>
2606
2607         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2608         update all uses and lose "enum" when using type.
2609
2610 2012-09-05  Alan Modra  <amodra@gmail.com>
2611
2612         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2613         * configure: Regenerate.
2614         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2615         (plugin_final_layout.stdout): Likewise.
2616         (memory_test): Set page sizes to 0x1000.
2617         * testsuite/Makefile.in: Regenerate.
2618         * testsuite/discard_locals_test.sh: Add FIXME comment.
2619         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2620         * testsuite/pr14265.t: Add .got output section statement.
2621         * testsuite/script_test_2.t: Likewise.
2622         * testsuite/script_test_3.t: Likewise.
2623         * testsuite/script_test_4.t: Likewise.
2624         * testsuite/script_test_5.t: Likewise.
2625         * testsuite/script_test_6.t: Likewise.
2626         * testsuite/script_test_7.t: Likewise.
2627         * testsuite/script_test_9.t: Likewise.
2628
2629 2012-09-05  Alan Modra  <amodra@gmail.com>
2630
2631         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2632         (Powerpc_relocate_functions::Status): New typedef.
2633         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2634         (Target_powerpc::Scan::local): Handle REL64.
2635         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2636         for REL32 and REL64.
2637         (Target_powerpc::symval_for_branch): New function, extracted from..
2638         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2639         checks.  Report overflow errors.
2640
2641 2012-09-05  Alan Modra  <amodra@gmail.com>
2642
2643         * object.h (Sized_relobj_file::emit_relocs): Delete.
2644         (Sized_relobj_file::emit_relocs_reltype): Delete.
2645         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2646         relocate_relocs for --emit-relocs.
2647         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2648         * output.h: Update comment.
2649         (Output_segment::first_section): New function.
2650         (Output_segment::first_section_load_address): Use first_section.
2651         * output.cc (Output_segment::first_section): New function extracted..
2652         (Output_segment::first_section_load_address): ..from here.  Delete.
2653         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2654         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2655         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2656         adjust call to target.h function.
2657         * i386.cc (Target_i386): Likewise.
2658         * sparc.cc (Target_sparc): Likewise.
2659         * x86_64.cc (Target_x86_64): Likewise.
2660         * powerpc.cc (Target_powerpc): Likewise.
2661         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2662         first tls section has section symbol for optimised local dynamic
2663         output relocs.
2664         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2665         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2666         optimised tls code.
2667         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2668         Rename to relocate_relocs.  Update error message.
2669
2670 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2671
2672         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2673         --just-symbols.
2674
2675 2012-08-31  Alan Modra  <amodra@gmail.com>
2676
2677         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2678         (Powerpc_relobj::toc_base_offset): New stub function.
2679         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2680         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2681         (Target_powerpc::Relocate::enum skip_tls): New.
2682         (Target_powerpc::call_tls_get_addr_): New var.
2683         (Target_powerpc::is_branch_reloc): Move to file scope.
2684         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2685         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2686         New functions.
2687         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2688         (powerpc_info): Correct common_pagesize for ppc64.
2689         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2690         (Powerpc_relocate_functions): Add overflow check enums and functions.
2691         Add non-shift version of rela, rela_ua.  Delete all rel public
2692         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2693         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2694         addr16_ha3, addr14 functions.
2695         (Output_data_got_powerpc::add_constant_pair): New function.
2696         (Output_data_got_powerpc::got_base_offset): Likewise.
2697         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2698         (instruction constants): Sort, add some more.
2699         (Output_data_glink::do_write): Add and use Address typedef.  Use
2700         object->toc_base_offset() stub for 64-bit.
2701         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2702         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2703         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2704         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2705         Always treat .opd relocs as against locally defined symbol.
2706         Correct condition for RELATIVE relocs.
2707         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2708         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2709         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2710         calculations.  Handle TLS relocs, and more.  Add overflow
2711         checking and adjust for Powerpc_relocate_functions changes.
2712         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2713         Reinstate --emit-relocs code with FIXME.
2714
2715 2012-08-30  Alan Modra  <amodra@gmail.com>
2716
2717         * layout.cc (Layout::set_segment_offsets): Set p_align to
2718         abi_pagesize, not common_pagesize.
2719         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2720         to determine whether file header can go in segment.
2721
2722 2012-08-30  Alan Modra  <amodra@gmail.com>
2723
2724         * output.h (Output_reloc::Output_reloc <output section>): Add
2725         is_relative param.  Adjust calls.
2726         (Output_reloc::add_output_section_relative): New functions.
2727         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2728         is_relative.
2729         (Output_reloc::symbol_value): Handle SECTION_CODE.
2730
2731 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2732
2733         * gold.cc (queue_middle_tasks): Call layout again when unique
2734         segments for sections is desired.
2735         * layout.cc (Layout::Layout): Initialize new members.
2736         (Layout::get_output_section_flags): New function.
2737         (Layout::choose_output_section): Call get_output_section_flags.
2738         (Layout::layout): Make output section for mapping to a unique segment.
2739         (Layout::insert_section_segment_map): New function.
2740         (Layout::attach_allocated_section_to_segment): Make unique segment for
2741         output sections marked so.
2742         (Layout::segment_precedes): Check for unique segments when sorting.
2743         * layout.h (Layout::Unique_segment_info): New struct.
2744         (Layout::Section_segment_map): New typedef.
2745         (Layout::insert_section_segment_map): New function.
2746         (Layout::get_output_section_flags): New function.
2747         (Layout::is_unique_segment_for_sections_specified): New function.
2748         (Layout::set_unique_segment_for_sections_specified): New function.
2749         (Layout::unique_segment_for_sections_specified_): New member.
2750         (Layout::section_segment_map_): New member.
2751         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2752         Rename is_gc_pass_one to is_pass_one.
2753         Rename is_gc_pass_two to is_pass_two.
2754         Rename is_gc_or_icf to is_two_pass.
2755         Check for which pass based on whether symbols data is present.
2756         Make it two pass when unique segments for sections is desired.
2757         * output.cc (Output_section::Output_section): Initialize new
2758         members.
2759         * output.h (Output_section::is_unique_segment): New function.
2760         (Output_section::set_is_unique_segment): New function.
2761         (Output_section::is_unique_segment_): New member.
2762         (Output_section::extra_segment_flags): New function.
2763         (Output_section::set_extra_segment_flags): New function.
2764         (Output_section::extra_segment_flags_): New member.
2765         (Output_section::segment_alignment): New function.
2766         (Output_section::set_segment_alignment): New function.
2767         (Output_section::segment_alignment_): New member.
2768         (Output_segment::Output_segment): Initialize is_unique_segment_.
2769         (Output_segment::is_unique_segment): New function.
2770         (Output_segment::set_is_unique_segment): New function.
2771         (Output_segment::is_unique_segment_): New member.
2772         * plugin.cc (allow_unique_segment_for_sections): New function.
2773         (unique_segment_for_sections): New function.
2774         (Plugin::load): Add new functions to transfer vector.
2775         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2776         * Makefile.in: Regenerate.
2777         * testsuite/plugin_final_layout.sh: Check if unique segment
2778         functionality works.
2779         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2780         are available.
2781         (allow_unique_segment_for_sections): New global.
2782         (unique_segment_for_sections): New global.
2783         (claim_file_hook): Call allow_unique_segment_for_sections.
2784         (all_symbols_read_hook): Call unique_segment_for_sections.
2785
2786 2012-08-22  Cary Coutant  <ccoutant@google.com>
2787
2788         * layout.cc (Layout::include_section): Don't assert on GROUP
2789         sections with --emit-relocs.
2790
2791 2012-08-21  Cary Coutant  <ccoutant@google.com>
2792
2793         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2794         if --export-dynamic-symbol names an undef symbol.
2795
2796 2012-08-18  Alan Modra  <amodra@gmail.com>
2797
2798         * powerpc.cc: Formatting and white space.
2799         (Powerpc_relobj): Rename got2_section_ to special_.
2800         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2801         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2802         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2803         (Target_powerpc): Add Address typedef and invalid_address.  Use
2804         throughout.
2805         (Target_powerpc::is_branch_reloc): New function.
2806         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2807         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2808         for dst_mask, value and addend.
2809         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2810         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2811         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2812         uint16_t for 24-bit offset.  Use get_output_section_offset and
2813         check return.
2814         (Target_powerpc::Scan::local): Handle more relocs.
2815         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2816         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2817         Plug in toc restoring insn after plt calls.  Translate branches
2818         to function descriptor symbols to corresponding entry point.
2819         (Target_powerpc::relocate_for_relocatable): Check return from
2820         get_output_section_offset.
2821         * symtab.h: Comment typo.
2822
2823 2012-08-14  Ian Lance Taylor  <iant@google.com>
2824
2825         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2826         unsupported_relocal_local to call unsupported_reloc_global.
2827
2828 2012-08-14  Nick Clifton  <nickc@redhat.com>
2829
2830         PR ld/14265
2831         * script-sections.cc (Sections_element::output_section_name): Add
2832         keep return parameter.
2833         (Output_section_element::match_name): Add keep return parameter.
2834         Return the value of the keep_ member.
2835         * script-sections.h (class Output_section): Update
2836         output_section_name prototype.
2837         * layout.cc (Layout::keep_input_section): New public member
2838         function.
2839         (Layout::choose_output_section): Pass keep parameter to
2840         output_section_name.
2841         * layout.h (class Layout): Add keep_input_section.
2842         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2843         sections.
2844         * testsuite/Makefile.am: Add a test.
2845         * testsuite/Makefile.in: Regenerate.
2846         * testsuite/pr14265.c: Source file for the test.
2847         * testsuite/pr14265.t: Linker script for the test.
2848         * testsuite/pr14265.sh: Shell script for the test.
2849
2850 2012-08-14  Alan Modra  <amodra@gmail.com>
2851
2852         * target.h (Target::output_section_name): New function.
2853         (Target::do_output_section_name): New function.
2854         * layout.cc (Layout::choose_output_section): Call the above.
2855         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2856
2857 2012-08-14  Alan Modra  <amodra@gmail.com>
2858
2859         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2860         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2861         for replace_constant call.
2862         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2863         (Output_data_glink::do_print_to_mapfile): New function.
2864         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2865         (Target_powerpc::Relocate::relocate): Likewise.
2866
2867 2012-08-14  Alan Modra  <amodra@gmail.com>
2868
2869         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2870         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2871         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2872         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2873         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2874         here.
2875         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2876         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2877         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2878         here.
2879         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2880         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2881
2882 2012-08-12  Alan Modra  <amodra@gmail.com>
2883
2884         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2885         (glink insn constants): Use uint32_t.
2886         (Output_data_glink::add_entry): Use insert, not [] operator.
2887
2888 2012-08-11  Alan Modra  <amodra@gmail.com>
2889
2890         * object.h (Sized_relobj_file::find_shdr): New function.
2891         (Sized_relobj_file::find_special_sections): New function.
2892         * object.cc (Sized_relobj_file::find_shdr): New function.
2893         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2894         (Sized_relobj_file::find_special_sections): New function, split out..
2895         (Sized_relobj_file::do_read_symbols): ..from here.
2896         * output.h (Output_data_got::replace_constant): New function.
2897         (Output_data_got::num_entries): New function.
2898         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2899         (Output_data_got::got_offset): Protected rather than private.
2900         (Output_data_got::replace_got_entry): New function.
2901         * output.cc (Output_data_got::replace_got_entry): New function.
2902         * powerpc.cc (class Powerpc_relobj): New.
2903         (class Powerpc_relocate_functions): Delete all psymval variants or
2904         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2905         Implement _ha functions using corresponding _hi function.
2906         (Powerpc_relobj::find_special_sections): New function.
2907         (Target_powerpc::do_make_elf_object): New function.
2908         (class Output_data_got_powerpc): New.
2909         (class Output_data_glink): New.
2910         (class Powerpc_scan_relocatable_reloc): New.
2911         Many more changes througout file.
2912
2913 2012-08-09  Nick Clifton  <nickc@redhat.com>
2914
2915         * po/vi.po: Updated Vietnamese translation.
2916
2917 2012-08-07  Ian Lance Taylor  <iant@google.com>
2918
2919         * layout.cc (Layout::add_target_dynamic_tags): If
2920         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2921         plt_rel.
2922
2923 2012-07-30  Nick Clifton  <nickc@redhat.com>
2924
2925         * po/gold.pot: Updated template.
2926         * po/es.po: Updated Spanish translation.
2927
2928 2012-07-18  Cary Coutant  <ccoutant@google.com>
2929
2930         PR gold/14344
2931         * configure.ac: Add check for -gpubnames support.
2932         * configure: Regenerate.
2933         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2934         support; force -gno-pubnames.
2935         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2936         support.
2937         (gdb_index_test_4): New test.
2938         * testsuite/Makefile.in: Regenerate.
2939         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2940         * testsuite/gdb_index_test_2.sh: Likewise.
2941         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2942         * testsuite/gdb_index_test_4.sh: New script.
2943         * testsuite/gdb_index_test_comm.sh: New script with common code;
2944         don't look for space after colon.
2945
2946 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2947
2948         * gold.cc (queue_middle_tasks): Update function order only after
2949         deferred objects due to plugins are processed.
2950
2951 2012-07-11  Ian Lance Taylor  <iant@google.com>
2952
2953         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2954         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2955         (Target_arm::scan_reloc_for_stub): Likewise.
2956         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2957         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2958         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2959         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2960         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2961
2962 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2963             Ian Lance Taylor  <iant@google.com>
2964
2965         PR gold/14309
2966         * configure.ac: Test whether std::tr1::hash<off_t> works.
2967         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2968         needed.
2969         * output.h (class Output_fill): Add virtual destructor.
2970         * configure, config.in: Rebuild.
2971
2972 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2973
2974         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2975
2976 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2977
2978         * plugin.cc (Plugin::load): Handle position independent executables.
2979
2980 2012-06-06  Cary Coutant  <ccoutant@google.com>
2981
2982         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2983         add .debug_macro.
2984         (lines_only_debug_sections): Likewise.
2985         (gdb_fast_lookup_sections): New static array.
2986         (is_gdb_debug_section): Rename formal parameter.
2987         (is_lines_only_debug_section): Likewise.
2988         (is_gdb_fast_lookup_section): New function.
2989         (Layout::include_section): Check for ".zdebug_" prefix; pass
2990         section name suffix to is_gdb_debug_section, et al.; check for
2991         fast-lookup sections when building .gdb_index.
2992         * options.h (--strip-debug-gdb): Update GDB version number.
2993
2994 2012-06-06  Cary Coutant  <ccoutant@google.com>
2995
2996         * configure.ac: Add check for fallocate.
2997         * configure: Regenerate.
2998         * config.in: Regenerate.
2999
3000         * options.h (class General_options): Add --mmap-output-file and
3001         --posix-fallocate options.
3002         * output.cc: (posix_fallocate): Remove; replace with...
3003         (gold_fallocate): New function.
3004         (Output_file::map_no_anonymous): Call gold_fallocate.
3005         (Output_file::map): Check --mmap-output-file option.
3006
3007 2012-06-05  Jing Yu  <jingyu@google.com>
3008
3009         * gold.h (textdomain): Add do {} to empty while(0).
3010         (bindtextdomain): Likewise.
3011
3012 2012-06-04  Cary Coutant  <ccoutant@google.com>
3013
3014         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3015         has_dynsym_index.
3016
3017 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3018
3019         * symtab.cc (Symbol_table::define_special_symbol):
3020         Initialize *poldsym to prevent uninitialized variable errors.
3021
3022 2012-05-23  Cary Coutant  <ccoutant@google.com>
3023
3024         * layout.cc (Layout::section_name_mapping): Add rules to handle
3025         exact match on .data.rel.ro.local or .data.rel.ro.
3026         (Layout::output_section_name): Check for exact matches.
3027
3028 2012-05-23  Cary Coutant  <ccoutant@google.com>
3029
3030         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3031         more carefully.
3032
3033 2012-05-22  Cary Coutant  <ccoutant@google.com>
3034
3035         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3036         object before exporting symbol.
3037
3038 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3039
3040         * testsuite/tls_test.cc: Include "config.h" first.
3041         * testsuite/tls_test_c.c: Likewise.
3042
3043 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3044             Nick Clifton  <nickc@redhat.com>
3045
3046         PR 14072
3047         * configure.in: Add check that sysdep.h has been included before
3048         any system header files.
3049         * configure: Regenerate.
3050         * config.in: Regenerate.
3051
3052 2012-05-14  Cary Coutant  <ccoutant@google.com>
3053
3054         * layout.cc (Layout::make_output_section): Mark .tdata section
3055         as RELRO.
3056         * testsuite/relro_test.cc: Add a TLS variable.
3057
3058 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3059
3060         PR gold/14091
3061         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3062         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3063         R_X86_64_64.
3064
3065 2012-05-08  Cary Coutant  <ccoutant@google.com>
3066
3067         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3068         (lines_only_debug_sections): Likewise.
3069
3070 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3071
3072         * nacl.cc: New file.
3073         * nacl.h: New file.
3074         * Makefile.am (CCFILES, HFILES): Add them.
3075         * Makefile.in: Regenerate.
3076         * i386.cc (Output_data_plt_i386_nacl): New class.
3077         (Output_data_plt_i386_nacl_exec): New class.
3078         (Output_data_plt_i386_nacl_dyn): New class.
3079         (Target_i386_nacl): New class.
3080         (Target_selector_i386_nacl): New class.
3081         (target_selector_i386): Use it instead of Target_selector_i386.
3082         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3083         (Target_x86_64_nacl): New class.
3084         (Target_selector_x86_64_nacl): New class.
3085         (target_selector_x86_64, target_selector_x32): Use it instead of
3086         Target_selector_x86_64.
3087         * arm.cc (Output_data_plt_arm_nacl): New class.
3088         (Target_arm_nacl): New class.
3089         (Target_selector_arm_nacl): New class.
3090         (target_selector_arm, target_selector_armbe): Use it instead of
3091         Target_selector_arm.
3092
3093         * target-select.cc (select_target): Take new Input_file* and off_t
3094         arguments, pass them on to recognize method of selector.
3095         * object.cc (make_elf_sized_object): Update caller.
3096         * parameters.cc (parameters_force_valid_target): Likewise.
3097         * incremental.cc (make_sized_incremental_binary): Likewise.
3098         * target-select.h: Update decl.
3099         (Target_selector::recognize): Take new Input_file* argument,
3100         pass it on to do_recognize.
3101         (Target_selector::do_recognize): Take new Input_file* argument.
3102         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3103         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3104         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3105         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3106
3107         * target.h (Target::Target_info): New members isolate_execinstr
3108         and rosegment_gap.
3109         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3110         * arm.cc (Target_arm::arm_info): Update initializer.
3111         * i386.cc (Target_i386::i386_info): Likewise.
3112         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3113         * sparc.cc (Target_sparc::sparc_info): Likewise.
3114         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3115         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3116         * layout.cc (Layout::attach_allocated_section_to_segment):
3117         Take new const Target* argument.  If target->isolate_execinstr(), act
3118         like --rosegment.
3119         (Layout::find_first_load_seg): Take new const Target* argument;
3120         if target->isolate_execinstr(), reject PF_X segments.
3121         (Layout::relaxation_loop_body): Update caller.
3122         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3123         reset file offset to zero when we hit LOAD_SEG, and then do a second
3124         loop over the segments before LOAD_SEG to reassign offsets after
3125         addresses have been determined.  Handle target->rosegment_gap().
3126         (Layout::attach_section_to_segment): Take new const Target* argument;
3127         pass it to attach_allocated_section_to_segment.
3128         (Layout::make_output_section): Update caller.
3129         (Layout::attach_sections_to_segments): Take new const Target* argument;
3130         pass it to attach_section_to_segment.
3131         * gold.cc (queue_middle_tasks): Update caller.
3132         * layout.h (Layout): Update method decls with new arguments.
3133
3134         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3135         Target_info pointer to use.
3136         (Target_arm::do_make_data_plt): New virtual method.
3137         (Target_arm::make_data_plt): New method that calls it.
3138         (Target_arm::make_plt_entry): Use it.
3139         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3140         for the section alignment.
3141         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3142         method.
3143         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3144         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3145         method.
3146         (Output_data_plt_arm::get_plt_entry_size): Call it.
3147         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3148         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3149         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3150         method.
3151         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3152         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3153         method instead of sizeof(plt_entry).
3154         (Output_data_plt_arm::add_entry): Likewise.
3155         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3156         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3157         than static method.
3158         (Target_arm::plt_entry_size): Likewise.
3159         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3160         Move to ...
3161         (Output_data_plt_arm_standard): ... here, new class.
3162         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3163         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3164         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3165
3166         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3167         Take additional argument for the PLT entry size.
3168         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3169         Use get_plt_entry_size method rather than plt_entry_size variable.
3170         (Output_data_plt_x86_64::reserve_slot): Likewise.
3171         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3172         (Output_data_plt_x86_64::add_entry): Likewise.
3173         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3174         (Output_data_plt_x86_64::address_for_global): Likewise.
3175         (Output_data_plt_x86_64::address_for_local): Likewise.
3176         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3177         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3178         Make method non-static.
3179         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3180         method.
3181         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3182         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3183         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3184         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3185         virtual method.
3186         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3187         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3188         virtual method.
3189         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3190         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3191         virtual method.
3192         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3193         (Output_data_plt_x86_64::plt_entry_size)
3194         (Output_data_plt_x86_64::first_plt_entry)
3195         (Output_data_plt_x86_64::plt_entry)
3196         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3197         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3198         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3199         (Output_data_plt_x86_64_standard): ... here, new class.
3200         (Target_x86_64::Target_x86_64): Take optional argument for the
3201         Target_info pointer to use.
3202         (Target_x86_64::do_make_data_plt): New virtual method.
3203         (Target_x86_64::make_data_plt): New method to call it.
3204         (Target_x86_64::init_got_plt_for_update): Use that.
3205         Call this->plt_->add_eh_frame method here.
3206         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3207         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3208         rather than static method.
3209         (Target_x86_64::plt_entry_size): Likewise.
3210         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3211         rather than plt_entry_size variable.  Move guts of PLT filling to...
3212         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3213         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3214         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3215
3216         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3217         additional argument for the section alignment.
3218         Don't do add_eh_frame_for_plt here.
3219         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3220         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3221         variable.
3222         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3223         method.
3224         (Output_data_plt_i386::get_plt_entry_size): Call it.
3225         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3226         (Output_data_plt_i386::add_eh_frame): New method to call it.
3227         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3228         method.
3229         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3230         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3231         method.
3232         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3233         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3234         method instead of plt_entry_size.
3235         (Output_data_plt_i386::plt_entry_size)
3236         (Output_data_plt_i386::plt_eh_frame_fde_size)
3237         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3238         (Output_data_plt_i386_standard): ... here, new class.
3239         (Output_data_plt_i386_exec): New class.
3240         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3241         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3242         (Output_data_plt_i386::exec_plt_entry): Move to ...
3243         (Output_data_plt_i386_exec::plt_entry): ... here.
3244         (Output_data_plt_i386_dyn): New class.
3245         (Output_data_plt_i386::first_plt_entry): Move to ...
3246         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3247         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3248         (Output_data_plt_i386_dyn::plt_entry): ... here.
3249         (Target_i386::Target_i386): Take optional argument for the Target_info
3250         pointer to use.
3251         (Target_i386::do_make_data_plt): New virtual method.
3252         (Target_i386::make_data_plt): New method to call it.
3253         (Target_i386::make_plt_section): Use that.
3254         Call this->plt_->add_eh_frame method here.
3255         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3256         rather than plt_entry_size variable.
3257         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3258         (Output_data_plt_i386::address_for_local): Likewise.
3259         (Output_data_plt_i386::do_write): Likewise.
3260         Move guts of PLT filling to...
3261         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3262         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3263         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3264         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3265
3266 2012-05-01  Cary Coutant  <ccoutant@google.com>
3267
3268         * dwarf_reader.cc (Dwarf_die::read_attributes)
3269         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3270         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3271         * reduced_debug_output.cc
3272         (Output_reduced_debug_info_section::get_die_end): Remove
3273         DW_FORM_GNU_ref_index.  Add default case.
3274
3275 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3276
3277         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3278         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3279         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3280         DW_AT_high_pc as offset from DW_AT_low_pc.
3281
3282         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3283         * testsuite/Makefile.in: Regenerate.
3284         * testsuite/gdb_index_test_3.c: New test source file.
3285         * testsuite/gdb_index_test_3.sh: New test source file.
3286
3287 2012-04-25  Ian Lance Taylor  <iant@google.com>
3288
3289         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3290         pointer.
3291         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3292         as a class, not a struct.
3293         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3294         (Target_arm::apply_cortex_a8_workaround): Likewise.
3295         * gc.h: Declare Reloc_types as a struct, not a class.
3296         * object.h: Declare Symbols_data as a struct.
3297         * reloc.h: Declare Read_relocs_data as a struct.
3298         * target.h: Declare Relocate_info as a struct.
3299
3300 2012-04-24  David S. Miller  <davem@davemloft.net>
3301
3302         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3303         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3304         and R_SPARC_WPLT30.
3305
3306 2012-04-24  Cary Coutant  <ccoutant@google.com>
3307
3308         * incremental-dump.cc (find_input_containing_global): Replace
3309         magic number with symbolic constant.
3310         (dump_incremental_inputs): Update version number.
3311         * incremental.cc (Output_section_incremental_inputs): Update version
3312         number; import symbolic constants from Incremental_inputs_reader.
3313         (Incremental_inputs::create_data_sections): Align relocations
3314         section correctly for 64-bit targets.
3315         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3316         constants; add padding.
3317         (Output_section_incremental_inputs::write_header): Add assert for
3318         header_size.
3319         (Output_section_incremental_inputs::write_input_files): Add assert
3320         for input_entry_size.
3321         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3322         add assert for object_info_size, input_section_entry_size,
3323         global_sym_entry_size.
3324         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3325         for data structure sizes; use them.
3326         (Incremental_input_entry_reader): Import symbolic constants from
3327         Incremental_inputs_reader; use them.
3328
3329 2012-04-23  David S. Miller  <davem@davemloft.net>
3330
3331         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3332         and elf_flags_set_.
3333         (Target_sparc::Target_sparc): Initialize new fields.
3334         (Target_sparc::do_make_elf_object): New function.
3335         (Target_sparc::do_adjust_elf_header): New function.
3336
3337 2012-04-23  Cary Coutant  <ccoutant@google.com>
3338
3339         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3340         CU range table of gdb index.
3341
3342 2012-04-20  David S. Miller  <davem@davemloft.net>
3343
3344         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3345         instead of false.
3346
3347 2012-04-16  David S. Miller  <davem@davemloft.net>
3348
3349         * sparc.cc (Target_sparc::got_address): New function.
3350         (Sparc_relocate_functions::gdop_hix22): New function.
3351         (Sparc_relocate_functions::gdop_lox10): New function.
3352         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3353         relocs.
3354         (Target_sparc::Scan::local): Likewise if the global symbol is not
3355         preemptible and is not IFUNC.
3356         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3357         transformations for local and non-preemptible non-IFUNC global
3358         symbols.
3359
3360         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3361         writing out 64-bit part of ranges.
3362
3363         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3364         -fpic and -fpie respectively.
3365         * Makefile.in: Regenerate.
3366
3367         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3368         (Target_sparc::Target_sparc): Initialize new field.
3369         (Target_sparc::do_plt_section_for_global): New function.
3370         (Target_sparc::do_plt_section_for_local): New function.
3371         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3372         (Target_sparc::make_plt_section): New function, broken out of
3373         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3374         (Target_sparc::make_plt_entry): Call make_plt_section.
3375         (Target_sparc::make_local_ifunc_plt_entry): New function.
3376         (Target_sparc::rela_ifunc_section): New function.
3377         (Target_sparc::plt_section): Remove const.
3378         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3379         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3380         and ifunc_count_ fields.
3381         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3382         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3383         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3384         (Output_data_plt_sparc::rela_ifunc): New function.
3385         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3386         (Output_data_plt_sparc::has_ifunc_section): New function.
3387         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3388         (Output_data_plt_sparc::address_for_global): New function.
3389         (Output_data_plt_sparc::address_for_local): New function.
3390         (Output_data_plt_sparc::plt_index_to_offset): New function.
3391         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3392         and entry_count.
3393         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3394         entry_count.
3395         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3396         R_SPARC_JMP_IREL to switch.
3397         (Target_sparc::Scan::check_non_pic): Likewise.
3398         (Target_sparc::Scan::local): Handle IFUNC symbols.
3399         (Target_sparc::Scan::local): Likewise.
3400         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3401         and plt_address_for_local.
3402         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3403         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3404
3405         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3406         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3407         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3408         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3409         global relocs too.
3410         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3411         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3412         calls.
3413         * sparc.cc (Target_sparc::Scan::global): Likewise.
3414         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3415
3416 2012-04-16  Cary Coutant  <ccoutant@google.com>
3417
3418         * archive.cc (Library_base::should_include_member): Check for
3419         --export-dynamic-symbol.
3420         * options.h (class General_options): Add --export-dynamic-symbol.
3421         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3422         --export-dynamic-symbol.
3423         (Symbol_table::gc_mark_undef_symbols): Likewise.
3424         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3425
3426 2012-04-12  David S. Miller  <davem@davemloft.net>
3427
3428         * sparc.cc (Reloc::wdisp10): New relocation method.
3429         (Reloc::h34): Likewise.
3430         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3431         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3432         R_SPARC_WDISP10.
3433         (Target_sparc::Scan::local): Likewise.
3434         (Target_sparc::Scan::global): Likewise.
3435         (Target_sparc::Relocate::relocate): Likewise.
3436
3437 2012-04-09  Cary Coutant  <ccoutant@google.com>
3438
3439         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3440         low_pc == 0.
3441
3442 2012-04-06  Ian Lance Taylor  <iant@google.com>
3443
3444         * timer.cc: #include <unistd.h>.
3445
3446 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3447
3448         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3449         * config.in: Regenerate.
3450         * configure: Regenerate.
3451
3452 2012-04-05  Nick Clifton  <nickc@redhat.com>
3453
3454         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3455         (AM_LC_MESSAGES): Add.
3456         * aclocal.m4: Regenerate.
3457         * config.in: Regenerate.
3458         * configure: Regenerate.
3459
3460 2012-03-21  Cary Coutant  <ccoutant@google.com>
3461
3462         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3463         * Makefile.in: Regenerate.
3464         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3465         (Sized_elf_reloc_mapper::symbol_section): New function.
3466         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3467         (make_elf_reloc_mapper): New function.
3468         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3469         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3470         (Dwarf_abbrev_table::do_get_abbrev): New function.
3471         (Dwarf_ranges_table::read_ranges_table): New function.
3472         (Dwarf_ranges_table::read_range_list): New function.
3473         (Dwarf_pubnames_table::read_section): New function.
3474         (Dwarf_pubnames_table::read_header): New function.
3475         (Dwarf_pubnames_table::next_name): New function.
3476         (Dwarf_die::Dwarf_die): New function.
3477         (Dwarf_die::read_attributes): New function.
3478         (Dwarf_die::skip_attributes): New function.
3479         (Dwarf_die::set_name): New function.
3480         (Dwarf_die::set_linkage_name): New function.
3481         (Dwarf_die::attribute): New function.
3482         (Dwarf_die::string_attribute): New function.
3483         (Dwarf_die::int_attribute): New function.
3484         (Dwarf_die::uint_attribute): New function.
3485         (Dwarf_die::ref_attribute): New function.
3486         (Dwarf_die::child_offset): New function.
3487         (Dwarf_die::sibling_offset): New function.
3488         (Dwarf_info_reader::check_buffer): New function.
3489         (Dwarf_info_reader::parse): New function.
3490         (Dwarf_info_reader::do_parse): New function.
3491         (Dwarf_info_reader::do_read_string_table): New function.
3492         (Dwarf_info_reader::lookup_reloc): New function.
3493         (Dwarf_info_reader::get_string): New function.
3494         (Dwarf_info_reader::visit_compilation_unit): New function.
3495         (Dwarf_info_reader::visit_type_unit): New function.
3496         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3497         Sized_elf_reloc_mapper.
3498         (Sized_dwarf_line_info::symbol_section): Remove function.
3499         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3500         (Sized_dwarf_line_info::read_line_mappings): Remove object
3501         parameter, adjust callers.
3502         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3503         * dwarf_reader.h: Include <sys/types.h>.
3504         (class Track_relocs): Remove forward declaration.
3505         (class Elf_reloc_mapper): New class.
3506         (class Sized_elf_reloc_mapper): New class.
3507         (class Dwarf_abbrev_table): New class.
3508         (class Dwarf_range_list): New class.
3509         (class Dwarf_ranges_table): New class.
3510         (class Dwarf_pubnames_table): New class.
3511         (class Dwarf_die): New class.
3512         (class Dwarf_info_reader): New class.
3513         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3514         (Sized_dwarf_line_info::symbol_section): Remove member function.
3515         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3516         base class.
3517         * gdb-index.cc: New source file.
3518         * gdb-index.h: New source file.
3519         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3520         and .debug_types sections, call Layout::add_to_gdb_index.
3521         (Sized_relobj_incr::do_section_name): Implement.
3522         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3523         return type; Implement.
3524         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3525         return type.
3526         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3527         parameter list and return type.
3528         (Sized_incr_dynobj::do_section_contents): Likewise.
3529         * layout.cc: Include gdb-index.h.
3530         (Layout::Layout): Initialize gdb_index_data_.
3531         (Layout::init_fixed_output_section): Check for .gdb_index section.
3532         (Layout::add_to_gdb_index): New function. Instantiate.
3533         * layout.h: Add forward declaration for class Gdb_index.
3534         (Layout::add_to_gdb_index): New member function.
3535         (Layout::gdb_index_data_): New data member.
3536         * main.cc: Include gdb-index.h.
3537         (main): Print statistics for gdb index.
3538         * object.cc (Object::section_contents): Move code into
3539         do_section_contents.
3540         (need_decompressed_section): Check for sections needed when building
3541         gdb index.
3542         (build_compressed_section_map): Likewise.
3543         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3544         gdb index.
3545         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3546         sections; call Layout::add_to_gdb_index.
3547         (Sized_relobj_file::do_decompressed_section_contents): Call
3548         do_section_contents directly.
3549         * object.h (Object::do_section_contents): Adjust parameter list and
3550         return type.
3551         (Object::do_decompressed_section_contents): Call do_section_contents
3552         directly.
3553         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3554         return type.
3555         * options.h (class General_options): Add --gdb-index option.
3556         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3557         list and return type.
3558         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3559         * reloc.h (Track_relocs::checkpoint): New function.
3560         (Track_relocs::reset): New function.
3561
3562         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3563         New test cases.
3564         * testsuite/Makefile.in: Regenerate.
3565         * testsuite/gdb_index_test.cc: New test source file.
3566         * testsuite/gdb_index_test_1.sh: New test source file.
3567         * testsuite/gdb_index_test_2.sh: New test source file.
3568
3569 2012-03-19  Doug Kwan  <dougkwan@google.com>
3570
3571         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3572         (Target_arm::do_finalize_sections): Remove code which defines
3573         __exidx_start and __exidx_end.  Make symbol table parameter
3574         anonymous as it is not used.
3575         * gold.cc (queue_middle_tasks): Call target hook to define any
3576         target-specific symbols.
3577         * target.h (Target::define_standard_symbols): New method.
3578         (Target::do_define_standard_symbols): Same.
3579         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3580         * testsuite/Makefile.in: Regenerate.
3581         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3582         and __exidx_end.
3583         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3584         relocations are generated for __exidx_start and __exidx_end.
3585
3586 2012-03-16  Doug Kwan  <dougkwan@google.com>
3587
3588         * testsuite/Makefile.am: Disable test initpri3b.
3589         * testsuite/Makefile.in: Regenerate.
3590
3591 2012-03-15  Doug Kwan  <dougkwan@google.com>
3592
3593         * arm.cc (Target_arm::got_section): Make .got section read-only
3594         if -z now is given.
3595
3596 2012-03-15  Ian Lance Taylor  <iant@google.com>
3597
3598         PR gold/13850
3599         * layout.cc (Layout::make_output_section): Correctly mark
3600         SHT_INIT_ARRAY, et. al., as relro.
3601
3602 2012-03-14  Doug Kwan  <dougkwan@google.com>
3603
3604         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3605         dynamic relocations for protected symbols in shared objects.
3606
3607 2012-03-13  Ian Lance Taylor  <iant@google.com>
3608
3609         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3610         keep the larger alignment.
3611
3612 2012-03-12  Cary Coutant  <ccoutant@google.com>
3613
3614         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3615         handling of DW_LNE_define_file.
3616
3617 2012-03-12  Cary Coutant  <ccoutant@google.com>
3618
3619         * reduced_debug_output.cc
3620         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3621         codes to switch.
3622
3623 2012-02-29  Cary Coutant  <ccoutant@google.com>
3624
3625         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3626
3627 2012-02-29  Cary Coutant  <ccoutant@google.com>
3628
3629         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3630         Call Object::decompressed_section_contents.
3631         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3632         New dtor.
3633         (Sized_dwarf_line_info::buffer_start_): New data member.
3634         * merge.cc (Output_merge_data::do_add_input_section): Call
3635         Object::decompressed_section_contents.
3636         (Output_merge_string::do_add_input_section): Likewise.
3637         * object.cc (need_decompressed_section): New function.
3638         (build_compressed_section_map): Decompress sections needed later.
3639         (Sized_relobj_file::do_decompressed_section_contents): New function.
3640         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3641         * object.h (Object::decompressed_section_contents): New function.
3642         (Object::discard_decompressed_sections): New function.
3643         (Object::do_decompressed_section_contents): New function.
3644         (Object::do_discard_decompressed_sections): New function.
3645         (Compressed_section_info): New type.
3646         (Compressed_section_map): Include decompressed section contents.
3647         (Sized_relobj_file::do_decompressed_section_contents): New function.
3648         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3649
3650 2012-02-16  Cary Coutant  <ccoutant@google.com>
3651
3652         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3653         * testsuite/Makefile.in: Regenerate.
3654
3655 2012-02-14  Cary Coutant  <ccoutant@google.com>
3656
3657         * options.cc (General_options::finalize): Disallow -pie and -static.
3658
3659 2012-02-03  Doug Kwan  <dougkwan@google.com>
3660
3661         * arm.cc (Arm_relocate_functions::abs8,
3662         Arm_relocate_functions::abs16): Use
3663         Bits::has_signed_unsigned_overflow32.
3664         (Arm_relocate_functions::thm_abs8): Correct range of
3665         overflow check.
3666         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3667         in assertions.
3668
3669 2012-02-02  Doug Kwan  <dougkwan@google.com>
3670
3671         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3672         position independent outputs, not just shared objects.
3673
3674 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3675
3676         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3677         * configure: Regenerated.
3678
3679 2012-01-27  Ian Lance Taylor  <iant@google.com>
3680
3681         * reloc.h (Bits): New class with static functions, copied from
3682         namespace utils in arm.cc.
3683         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3684         instead.
3685
3686 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3687
3688         * incremental.cc (write_info_blocks): Correct relocation offset.
3689
3690 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3691
3692         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3693         (Relocate::tls_gd_to_le): Likewise.
3694
3695 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3696
3697         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3698
3699 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3700
3701         * configure.ac: Check if -mcmodel=medium works.
3702         * configure: Regenerated.
3703
3704 2012-01-24  Cary Coutant  <ccoutant@google.com>
3705
3706         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3707         definition and ...
3708         (read_unsigned_LEB_128_x): ... this new function.
3709         (read_signed_LEB_128): Replaced with inline definition and ...
3710         (read_signed_LEB_128_x): ... this new function.
3711         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3712         (read_unsigned_LEB_128): Add inline definition.
3713         (read_signed_LEB_128_x): New function.
3714         (read_signed_LEB_128): Add inline definition.
3715         * testsuite/Makefile.am (leb128_unittest): New unit test.
3716         * testsuite/Makefile.in: Regenerate.
3717         * testsuite/leb128_unittest.cc: New unit test.
3718
3719 2012-01-23  Ian Lance Taylor  <iant@google.com>
3720
3721         PR gold/13617
3722         * i386.cc (Target_i386::do_code_fill): When using a jmp
3723         instruction, pad with nop instructions.
3724         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3725
3726 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3727
3728         * x86_64.cc (gc_process_relocs): Add typename on types used in
3729         template.
3730         (scan_relocs): Likewise.
3731         (relocate_section): Likewise.
3732         (apply_relocation): Likewise.
3733
3734 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3735
3736         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3737         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3738         under x32.
3739
3740 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3741
3742         * x86_64.cc: Initial support for x32.
3743
3744 2012-01-03  Cary Coutant  <ccoutant@google.com>
3745
3746         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3747         Use abstract base class for GOT.
3748         * gold/output.h (class Output_data_got_base): New abstract base class.
3749         (class Output_data_got): Derive from new base class, adjust ctors.
3750         (Output_data_got::reserve_slot): Make virtual; rename to
3751         do_reserve_slot; Adjust callers.
3752         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3753         pointer to abstract base class.
3754         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3755
3756 2011-12-18  Ian Lance Taylor  <iant@google.com>
3757
3758         * object.h (Relobj::local_symbol_value): New function.
3759         (Relobj::local_plt_offset): New function.
3760         (Relobj::local_has_got_offset): New function.
3761         (Relobj::local_got_offset): New function.
3762         (Relobj::set_local_got_offset): New function.
3763         (Relobj::do_local_symbol_value): New pure virtual function.
3764         (Relobj::do_local_plt_offset): Likewise.
3765         (Relobj::do_local_has_got_offset): Likewise.
3766         (Relobj::do_local_got_offset): Likewise.
3767         (Relobj::do_set_local_got_offset): Likewise.
3768         (Sized_relobj::do_local_has_got_offset): Rename from
3769         local_has_got_offset.
3770         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3771         (Sized_relobj::do_set_local_got_offset): Rename from
3772         set_local_got_offset.
3773         (Sized_relobj_file::do_local_plt_offset): Rename from
3774         local_plt_offset.
3775         (Sized_relobj_file::do_local_symbol_value): New function.
3776         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3777         local_plt_offset.
3778         * output.cc (Output_data_got::Got_entry::write): Change object to
3779         Relobj.  Use local_symbol_value.
3780         (Output_data_got::add_global_with_rel): Change rel_dyn to
3781         Output_data_reloc_generic*.  Use add_global_generic.
3782         (Output_data_got::add_global_with_rela): Remove.  Change all
3783         callers to use add_global_with_rel.
3784         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3785         Output_data_reloc_generic*.  Use add_global_generic.
3786         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3787         callers to use add_global_pair_with_rel.
3788         (Output_data_got::add_local): Change object to Relobj*.
3789         (Output_data_got::add_local_plt): Likewise.
3790         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3791         change rel_dyn to Output_data_reloc_generic*.  Use
3792         add_local_generic.
3793         (Output_data_got::add_local_with_rela): Remove.  Change all
3794         callers to use all_local_with_rel.
3795         (Output_data_got::add_local_pair_with_rel): Change object to
3796         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3797         add_output_section_generic.
3798         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3799         callers to use add_local_pair_with_rel.
3800         (Output_data_got::reserve_local): Change object to Relobj*.
3801         * output.h: (class Output_data_reloc_generic): Add pure virtual
3802         declarations for add_global_generic, add_local_generic,
3803         add_output_section_generic.
3804         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3805         functions for Output_data_reloc_generic.  Update declarations for
3806         changes listed in output.cc.
3807         (class Output_data_got): Change template parameter to got_size.
3808         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3809         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3810         function.
3811         (Sized_relobj_incr::do_local_plt_offset): New function.
3812         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3813         add_global_generic.
3814
3815 2011-12-17  Cary Coutant  <ccoutant@google.com>
3816
3817         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3818         * resolve.cc (Symbol_table::resolve): Likewise.
3819         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3820         arrays.
3821         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3822
3823 2011-12-16  Ian Lance Taylor  <iant@google.com>
3824
3825         * output.h (Output_data_reloc_generic::add): Only call
3826         add_dynamic_reloc if this is a dynamic reloc section.
3827
3828 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3829
3830         PR gold/13505
3831         * target-reloc.h (apply_relocation): Replace <64, false> with
3832         <size, big_endian>.
3833
3834 2011-11-25  Nick Clifton  <nickc@redhat.com>
3835
3836         * po/it.po: New Italian translation.
3837
3838 2011-11-17  Sterling Augustine  <saugustine@google.com>
3839
3840         * script.cc (script_include_directive): Implement.
3841         (read_script_file): New local variables name and search_path. Update
3842         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3843         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3844         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3845
3846 2011-11-11  Sterling Augustine  <saugustine@google.com>
3847
3848         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3849         (file_or_sections_cmd): Likewise.
3850
3851 2011-11-11  Doug Kwan  <dougkwan@google.com>
3852
3853         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3854         if --just-symbols is given.
3855
3856 2011-11-10  Doug Kwan  <dougkwan@google.com>
3857
3858         PR gold/13362
3859         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3860         when processing data relocs.
3861         * reloc.h (Relocate_functions::rel_unaligned): New method.
3862         (Relocate_functions::pcrel_unaligned): Ditto.
3863         (Relocate_functions::rel32_unaligned): Ditto.
3864         (Relocate_functions::pcrel32_unaligned): Ditto.
3865
3866 2011-11-09  Doug Kwan  <dougkwan@google.com>
3867
3868         PR gold/13362
3869         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3870         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3871         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3872         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3873         (Relocate_functions::rel_unaligned): New.
3874         (Relocate_functions::rel32_unaligned): New.
3875         * target-reloc.h (relocate_for_relocatable): Add code to handle
3876         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3877         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3878         arm_unaligned_reloc_r): New targets.
3879         * testsuite/Makefile.in: Regenerate.
3880         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3881         linking.
3882
3883 2011-11-02  Ian Lance Taylor  <iant@google.com>
3884
3885         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3886         NATIVE_LINKER.
3887         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3888         * options.cc (General_options::finalize): Use library search path
3889         from configure script if specified.  If not native and no sysroot,
3890         only search TOOLLIBDIR.
3891         * options.h (Search_directory::Search_directory): Change name to
3892         const std::string&.
3893         (General_options::add_to_library_path_with_sysroot): Change arg to
3894         const std::string&.
3895         * configure, Makefile.in, config.in: Rebuild.
3896
3897 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3898
3899         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3900         we are working around the ARM1176 Erratum.
3901         * options.h (General_options::fix_arm1176): Add option.
3902         * testsuite/Makefile.am: Add testcases, and keep current ones
3903         working.
3904         * testsuite/Makefile.in: Regenerate.
3905         * testsuite/arm_fix_1176.s: New file.
3906         * testsuite/arm_fix_1176.sh: Likewise.
3907
3908 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3909
3910         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3911         may_use_blx_.
3912         (Target_arm::may_use_blx): Remove method.
3913         (Target_arm::set_may_use_blx): Likewise.
3914         (Target_arm::may_use_v4t_interworking): New method.
3915         (Target_arm::may_use_v5t_interworking): Likewise.
3916         (Target_arm::may_use_blx_): Remove member variable.
3917         (Arm_relocate_functions::arm_branch_common): Check for v5T
3918         interworking.
3919         (Arm_relocate_functions::thumb_branch_common): Likewise.
3920         (Reloc_stub::stub_type_for_reloc): Likewise.
3921         (Target_arm::do_finalize_sections): Correct interworking checks.
3922         * testsuite/Makefile.am: Add new tests.
3923         * testsuite/Makefile.in: Regenerate.
3924         * testsuite/arm_farcall_arm_arm.s: New test.
3925         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3926         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3927         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3928         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3929         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3930         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3931         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3932
3933 2011-10-31  Cary Coutant  <ccoutant@google.com>
3934
3935         PR gold/13023
3936         * expression.cc (Expression::eval_with_dot): Add
3937         is_section_dot_assignment parameter.
3938         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3939         absolute and assigning to dot within a section.
3940         * script-sections.cc
3941         (Output_section_element_assignment::set_section_addresses): Pass
3942         dot_section to set_if_absolute.
3943         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3944         as is_section_dot_assignment flag to eval_with_dot.
3945         (Output_section_element_dot_assignment::set_section_addresses):
3946         Likewise.
3947         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3948         parameter.  Also set value if relative to dot_section; set the
3949         symbol's output_section.
3950         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3951         parameter.  Adjust all callers.
3952         (Expression::eval_maybe_dot): Likewise.
3953         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3954         Adjust all callers.
3955         * testsuite/script_test_2.t: Test assignment of an absolute value
3956         to dot within an output section element.
3957
3958 2011-10-31  Cary Coutant  <ccoutant@google.com>
3959
3960         * options.h (class General_options): Add --[no-]gnu-unique options.
3961         * symtab.cc (Symbol_table::sized_write_globals): Convert
3962         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3963
3964 2011-10-31  Cary Coutant  <ccoutant@google.com>
3965
3966         PR gold/13359
3967         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3968         unnecessary assertion.
3969         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3970
3971 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3972
3973         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3974         gc_mark_symbol.
3975         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3976         gc_mark_symbol.
3977         Change to just keep the section associated with symbol.
3978         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3979         they are externally visible and --export-dynamic is turned on.
3980         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3981
3982 2011-10-19  Ian Lance Taylor  <iant@google.com>
3983
3984         PR gold/13163
3985         * script-sections.cc
3986         (Output_section_element_dot_assignment::needs_output_section): New
3987         function.
3988
3989 2011-10-19  Ian Lance Taylor  <iant@google.com>
3990
3991         PR gold/13204
3992         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3993         --section-start option was seen.
3994         * options.h (General_options::any_section_start): New function.
3995
3996 2011-10-18  David S. Miller  <davem@davemloft.net>
3997
3998         PR binutils/13301
3999         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4000         member to track relocation locations that have moved during TLS
4001         reloc optimizations.
4002         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4003         (Target_sparc::Relocate::relocate): Adjust view down by 4
4004         bytes if it matches reloc_adjust_addr_.
4005         (Target_sparc::Relocate::relocate_tls): Always move the
4006         __tls_get_addr call delay slot instruction forward 4 bytes when
4007         performing relaxation.
4008
4009 2011-10-18  Cary Coutant  <ccoutant@google.com>
4010
4011         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4012         (Output_file::map_no_anonymous): Check for non-zero
4013         return code from posix_fallocate.
4014
4015 2011-10-17  Cary Coutant  <ccoutant@google.com>
4016
4017         PR gold/13245
4018         * plugin.cc (is_visible_from_outside): Check for symbols
4019         referenced from dynamic objects.
4020         * resolve.cc (Symbol_table::resolve): Don't count references
4021         from dynamic objects as references from real ELF files.
4022         * testsuite/plugin_test_2.sh: Adjust expected result.
4023
4024 2011-10-17  Cary Coutant  <ccoutant@google.com>
4025
4026         * gold.cc: Include timer.h.
4027         (queue_middle_tasks): Stamp time.
4028         (queue_final_tasks): Likewise.
4029         * main.cc (main): Store timer in parameters.  Print timers
4030         for each pass.
4031         * parameters.cc (Parameters::Parameters): Initialize timer_.
4032         (Parameters::set_timer): New function.
4033         (set_parameters_timer): New function.
4034         * parameters.h (Parameters::set_timer): New function.
4035         (Parameters::timer): New function.
4036         (Parameters::timer_): New data member.
4037         (set_parameters_timer): New function.
4038         * timer.cc (Timer::stamp): New function.
4039         (Timer::get_pass_time): New function.
4040         * timer.h (Timer::stamp): New function.
4041         (Timer::get_pass_time): New function.
4042         (Timer::pass_times_): New data member.
4043
4044 2011-10-17  Cary Coutant  <ccoutant@google.com>
4045
4046         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4047         task for members of lib groups.
4048
4049 2011-10-17  Cary Coutant  <ccoutant@google.com>
4050
4051         PR gold/13288
4052         * fileread.cc (File_read::find_view): Add assert.
4053         (File_read::make_view): Move bounds check (replace with assert)...
4054         (File_read::find_or_make_view): ... to here.
4055
4056 2011-10-12  Cary Coutant  <ccoutant@google.com>
4057
4058         * output.cc (Output_file::open_base_file): Handle case where
4059         ::read returns less than requested size.
4060
4061 2011-10-10  Cary Coutant  <ccoutant@google.com>
4062
4063         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4064         Initialize defined_count_.
4065         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4066         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4067         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4068         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4069         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4070         * incremental.h (Sized_relobj_incr::defined_count_): New data
4071         member.
4072         (Sized_incr_dynobj::defined_count_): New data member.
4073         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4074         Return zeroes instead of internal error.
4075
4076 2011-10-10  Cary Coutant  <ccoutant@google.com>
4077
4078         PR gold/13249
4079         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4080         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4081         * output.h (class Output_reloc): Add use_plt_offset flag.
4082         (Output_reloc::type_): Adjust size of bit field.
4083         (Output_reloc::use_plt_offset_): New bit field.
4084         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4085         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4086         flag.  Adjust all callers.
4087         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4088         creating RELATIVE relocations.
4089
4090 2011-10-10  Nick Clifton  <nickc@redhat.com>
4091
4092         * po/es.po: Updated Spanish translation.
4093         * po/fi.po: Updated Finnish translation.
4094
4095 2011-10-03   Diego Novillo  <dnovillo@google.com>
4096
4097         * options.cc (parse_uint): Fix dereference of RETVAL.
4098
4099 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4100
4101         * layout.h (section_order_map_): New member.
4102         (get_section_order_map): New member function.
4103         * output.cc (Output_section::add_input_section): Check for patterns
4104         only when --section-ordering-file is specified.
4105         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4106         output_sections have been formed.
4107         * layout.cc (Layout_Layout): Initialize section_order_map_.
4108         * plugin.cc (update_section_order): Store order in order_map. Do not
4109         update the order.
4110         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4111         * testsuite/Makefile.in: Regenerate.
4112         * testsuite/plugin_section_order.c: New file.
4113         * testsuite/plugin_final_layout.cc: New file.
4114         * testsuite/plugin_final_layout.sh: New file.
4115
4116 2011-09-29  Cary Coutant  <ccoutant@google.com>
4117
4118         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4119         Check for NULL.
4120         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4121         symbols during incremental update.
4122         (Symbol_table::add_from_dynobj): Likewise.
4123
4124 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4125             Ian Lance Taylor  <iant@google.com>
4126
4127         * symtab.cc (Symbol_table::define_special_symbol): Always
4128         canonicalize version string.
4129
4130 2011-09-26  Cary Coutant  <ccoutant@google.com>
4131
4132         * gold.cc (queue_initial_tasks): Move option checks ...
4133         * options.cc (General_options::finalize): ... to here. Disable
4134         some options; make others fatal.
4135
4136 2011-09-26  Cary Coutant  <ccoutant@google.com>
4137
4138         gcc PR lto/47247
4139         * plugin.cc (get_symbols_v2): New function.
4140         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4141         (is_referenced_from_outside): New function.
4142         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4143         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4144         (get_symbols): Pass version parameter.
4145         (get_symbols_v2): New function.
4146         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4147         parameter.
4148         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4149         (onload): Add LDPT_GET_SYMBOLS_V2.
4150         (all_symbols_read_hook): Use get_symbols_v2; check for
4151         LDPR_PREVAILING_DEF_IRONLY_EXP.
4152         * testsuite/plugin_test_3.sh: Update expected results.
4153
4154 2011-09-23  Simon Baldwin  <simonb@google.com>
4155
4156         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4157         configuration options.
4158         * configure: Regenerate.
4159         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4160         * Makefile.in: Regenerate.
4161         * testsuite/Makefile.in: Regenerate.
4162
4163 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4164
4165         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4166
4167 2011-09-19  Cary Coutant  <ccoutant@google.com>
4168
4169         * incremental.cc (can_incremental_update): Fix typo in comment.
4170         * incremental.h (can_incremental_update): Likewise.
4171
4172 2011-09-18  Cary Coutant  <ccoutant@google.com>
4173
4174         * incremental.cc (can_incremental_update): New function.
4175         * incremental.h (can_incremental_update): New function.
4176         * layout.cc (Layout::init_fixed_output_section): Call it.
4177         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4178         * object.cc (Sized_relobj_file::do_layout): Call
4179         can_incremental_update.
4180
4181 2011-09-13  Cary Coutant  <ccoutant@google.com>
4182
4183         * configure.ac: Check for glibc support for gnu_indirect_function
4184         support with static linking, setting automake conditional
4185         IFUNC_STATIC.
4186         * Makefile.in: Regenerate.
4187         * configure: Regenerate.
4188
4189         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4190         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4191         for IFUNC_STATIC.
4192         * testsuite/Makefile.in: Regenerate.
4193
4194 2011-09-13  Cary Coutant  <ccoutant@google.com>
4195
4196         * incremental.cc (Sized_relobj_incr::do_layout): Call
4197         report_comdat_group for kept comdat sections.
4198         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4199         * testsuite/Makefile.in: Regenerate.
4200         * testsuite/incr_comdat_test_1.cc: New source file.
4201         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4202         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4203         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4204
4205 2011-09-13  Ian Lance Taylor  <iant@google.com>
4206
4207         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4208         variable external_symbols_offset.
4209
4210 2011-09-12  Ian Lance Taylor  <iant@google.com>
4211
4212         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4213         triggered if object has no symbols.
4214
4215 2011-09-09  David S. Miller  <davem@davemloft.net>
4216
4217         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4218         (Output_fill_debug_line::do_write): Likewise.
4219
4220 2011-08-29  Cary Coutant  <ccoutant@google.com>
4221
4222         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4223         casts to match formatting specs.
4224         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4225
4226 2011-08-26  Cary Coutant  <ccoutant@google.com>
4227
4228         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4229         remaining hole size when allocating.
4230         (Layout::make_output_section): Set fill methods for debug sections.
4231         * layout.h (Free_list::Free_list_node): Move from private to
4232         public.
4233         (Free_list::set_min_hole_size): New function.
4234         (Free_list::begin, Free_list::end): New functions.
4235         (Free_list::min_hole_): New data member.
4236         * output.cc: Include dwarf.h.
4237         (Output_fill_debug_info::do_minimum_hole_size): New function.
4238         (Output_fill_debug_info::do_write): New function.
4239         (Output_fill_debug_line::do_minimum_hole_size): New function.
4240         (Output_fill_debug_line::do_write): New function.
4241         (Output_section::Output_section): Initialize new data member.
4242         (Output_section::set_final_data_size): Ensure patch space is larger
4243         than minimum hole size.
4244         (Output_section::do_write): Fill holes in debug sections.
4245         * output.h (Output_fill): New class.
4246         (Output_fill_debug_info): New class.
4247         (Output_fill_debug_line): New class.
4248         (Output_section::set_free_space_fill): New function.
4249         (Output_section::free_space_fill_): New data member.
4250         * testsuite/Makefile.am (incremental_test_3): Add
4251         --incremental-patch option.
4252         (incremental_test_4): Likewise.
4253         (incremental_test_5): Likewise.
4254         (incremental_test_6): Likewise.
4255         (incremental_copy_test): Likewise.
4256         (incremental_common_test_1): Likewise.
4257         * testsuite/Makefile.in: Regenerate.
4258
4259 2011-08-26  Nick Clifton  <nickc@redhat.com>
4260
4261         * po/es.po: Updated Spanish translation.
4262
4263 2011-08-01  Cary Coutant  <ccoutant@google.com>
4264
4265         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4266         * gold/testsuite/Makefile.in: Regenerate.
4267         * gold/testsuite/justsyms_exec.c: New source file.
4268         * gold/testsuite/justsyms_lib.c: New source file.
4269
4270 2011-08-01  Cary Coutant  <ccoutant@google.com>
4271
4272         * layout.cc (Layout::set_segment_offsets): Don't realign text
4273         segment if -Ttext was specified.
4274         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4275         file type.
4276         * object.h (Sized_relobj_file::e_type): New function.
4277         (Sized_relobj_file::e_type_): New data member.
4278         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4279         base address for ET_EXEC files.
4280         * target.cc (Target::do_make_elf_object_implementation): Allow
4281         ET_EXEC files with --just-symbols option.
4282
4283 2011-07-28  Cary Coutant  <ccoutant@google.com>
4284
4285         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4286         Add thread_number parameter.
4287         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4288         * workqueue-threads.cc
4289         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4290         current thread if its thread number is greater than desired thread
4291         count.
4292         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4293         Add thread_number parameter.
4294         (Workqueue::should_cancel_thread): Likewise.
4295         (Workqueue::find_runnable_or_wait): Pass thread_number to
4296         should_cancel_thread.
4297         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4298         parameter.
4299
4300 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4301
4302         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4303         only after checking if it cannot be forced local.
4304         * symtab.h (is_externally_visible): Check if the symbol is not forced
4305         local.
4306
4307 2011-07-15  Ian Lance Taylor  <iant@google.com>
4308
4309         * options.h (class General_options): Add --print-output-format.
4310         Move -EL next to -EB, for  better --help output.
4311         * target-select.cc: Include <cstdio>, "options.h", and
4312         "parameters.h".
4313         (Target_selector::do_target_bfd_name): New function.
4314         (print_output_format): New function.
4315         * target-select.h (class Target_selector): Update declarations.
4316         (Target_selector::target_bfd_name): New function.
4317         (print_output_format): Declare.
4318         * main.cc: Include "target-select.h".
4319         (main): Handle --print-output-format.
4320         * gold.cc: Include "target-select.h".
4321         (queue_initial_tasks): Handle --print-output-format when there are
4322         no input files.
4323         * parameters.cc (parameters_force_valid_target): Give a better
4324         error message if -EB/-EL does not match target.
4325         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4326         function.
4327
4328 2011-07-15  Ian Lance Taylor  <iant@google.com>
4329
4330         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4331         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4332         (Output_data_plt_i386::do_write): Write address of .dynamic
4333         section to first entry in .got.plt section.
4334         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4335         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4336         Initialize layout_.
4337         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4338         section to first entry in .got.plt section.
4339         * layout.h (Layout::dynamic_section): New function.
4340
4341 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4342
4343         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4344         to claim_file call.
4345         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4346         input_section_position_, and input_section_glob_.
4347         (read_layout_from_file): Call function section_ordering_specified.
4348         * layout.h (is_section_ordering_specified): New function.
4349         (section_ordering_specified): New function.
4350         (section_ordering_specified_): New boolean member.
4351         * main.cc(main): Call load_plugins after layout object is defined.
4352         * output.cc (Output_section::add_input_section): Use
4353         function section_ordering_specified to check if section ordering is
4354         needed.
4355         * output.cc (Output_section::add_relaxed_input_section): Use
4356         function section_ordering_specified to check if section ordering is
4357         needed.
4358         (Output_section::update_section_layout): New function.
4359         (Output_section::sort_attached_input_sections): Check if input section
4360         must be reordered.
4361         * output.h (Output_section::update_section_layout): New function.
4362         * plugin.cc (get_section_count): New function.
4363         (get_section_type): New function.
4364         (get_section_name): New function.
4365         (get_section_contents): New function.
4366         (update_section_order): New function.
4367         (allow_section_ordering): New function.
4368         (Plugin::load): Add the new interfaces to the transfer vector.
4369         (Plugin_manager::load_plugins): New parameter.
4370         (Plugin_manager::all_symbols_read): New parameter.
4371         (Plugin_manager::claim_file): New parameter. Save the elf object for
4372         unclaimed objects.
4373         (Plugin_manager::get_elf_object): New function.
4374         (Plugin_manager::get_view): Change to directly use the bool to check
4375         if get_view is called from claim_file_hook.
4376         * plugin.h (input_objects): New function
4377         (Plugin__manager::load_plugins): New parameter.
4378         (Plugin_manager::claim_file): New parameter.
4379         (Plugin_manager::get_elf_object): New function.
4380         (Plugin_manager::in_claim_file_handler): New function.
4381         (Plugin_manager::in_claim_file_handler_): New member.
4382         (layout): New function.
4383         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4384         handler with an extra parameter. Make the elf object before calling
4385         claim_file handler.
4386         * testsuite/plugin_test.c (get_section_count): New function pointer.
4387         (get_section_type): New function pointer.
4388         (get_section_name): New function pointer.
4389         (get_section_contents): New function pointer.
4390         (update_section_order): New function pointer.
4391         (allow_section_ordering): New function pointer.
4392         (onload): Check if the new interfaces exist.
4393
4394 2011-07-13  Ian Lance Taylor  <iant@google.com>
4395
4396         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4397         relro section.
4398         * x86_64.cc (Target_x86_64::got_section): Likewise.
4399         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4400         (relro_now_test_SOURCES): New variable.
4401         (relro_now_test_DEPENDENCIES): New variable.
4402         (relro_now_test_LDFLAGS): New variable.
4403         (relro_now_test_LDADD): New variable.
4404         (relro_now_test.so): New target.
4405         * testsuite/Makefile.in: Rebuild.
4406
4407 2011-07-12  Ian Lance Taylor  <iant@google.com>
4408
4409         PR gold/12980
4410         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4411         GLOB_DAT relocation rather than a RELATIVE relocation for a
4412         protected symbol when creating a shared library.
4413         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4414         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4415         * testsuite/protected_main_1.cc (main): Test that protected
4416         function has same address.
4417
4418 2011-07-11  Ian Lance Taylor  <iant@google.com>
4419
4420         PR gold/12979
4421         * options.h (class General_options): Add -Bgroup.
4422         * options.cc (General_options::finalize): If -Bgroup is set,
4423         default to --unresolved-symbols=report-all.
4424         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4425         * target-reloc.h (issue_undefined_symbol_error): Handle
4426         --unresolved-symbols=report-all.
4427
4428 2011-07-08  Ian Lance Taylor  <iant@google.com>
4429
4430         PR gold/11985
4431         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4432         if linker script discards key sections.
4433         (Layout::create_dynamic_symtab): Likewise.
4434         (Layout::assign_local_dynsym_offsets): Likewise.
4435         (Layout::sized_create_version_sections): Likewise.
4436         (Layout::create_interp): Likewise.
4437         (Layout::finish_dynamic_section): Likewise.
4438         (Layout::set_dynamic_symbol_size): Likewise.
4439
4440 2011-07-08  Ian Lance Taylor  <iant@google.com>
4441
4442         PR gold/12386
4443         * options.h (class General_options): Add --unresolved-symbols.
4444         * target-reloc.h (issue_undefined_symbol_error): Check
4445         --unresolved-symbols.  Add comments.
4446
4447 2011-07-08  Ian Lance Taylor  <iant@google.com>
4448
4449         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4450         expression more complex.
4451
4452 2011-07-08  Ian Lance Taylor  <iant@google.com>
4453
4454         PR gold/11317
4455         * target-reloc.h (issue_undefined_symbol_error): New inline
4456         function, broken out of relocate_section.
4457         (relocate_section): Call issue_undefined_symbol_error.
4458         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4459         there is no TLS segment if we are about to issue an undefined
4460         symbol error.
4461         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4462
4463 2011-07-08  Ian Lance Taylor  <iant@google.com>
4464
4465         PR gold/12279
4466         * resolve.cc (Symbol_table::should_override): Add fromtype
4467         parameter.  Change all callers.  Give error when linking together
4468         TLS and non-TLS symbol.
4469         (Symbol_table::should_override_with_special): Add fromtype
4470         parameter.  Change all callers.
4471         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4472         there is no TLS segment if we have reported some errors.
4473         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4474
4475 2011-07-08  Ian Lance Taylor  <iant@google.com>
4476
4477         PR gold/12372
4478         * target.h (Target::plt_address_for_global): New function.
4479         (Target::plt_address_for_local): New function.
4480         (Target::plt_section_for_global): Remove.
4481         (Target::plt_section_for_local): Remove.
4482         (Target::do_plt_address_for_global): New virtual function.
4483         (Target::do_plt_address_for_local): New virtual function.
4484         (Target::do_plt_section_for_global): Remove.
4485         (Target::do_plt_section_for_local): Remove.
4486         (Target::register_global_plt_entry): Add Symbol_table and Layout
4487         parameters.
4488         * output.cc (Output_data_got::Got_entry::write): Use
4489         plt_address_for_global and plt_address_for_local.
4490         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4491         address of output section.
4492         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4493         got_irelative_, and irelative_count_ fields.  Update
4494         declarations.
4495         (Output_data_plt_i386::has_irelative_section): New function.
4496         (Output_data_plt_i386::entry_count): Add irelative_count_.
4497         (Output_data_plt_i386::set_final_data_size): Likewise.
4498         (class Target_i386): Add got_irelative_ and rel_irelative_
4499         fields.  Update declarations.
4500         (Target_i386::Target_i386): Initialize new fields.
4501         (Target_i386::do_plt_address_for_global): New function replacing
4502         do_plt_section_for_global.
4503         (Target_i386::do_plt_address_for_local): New function replacing
4504         do_plt_section_for_local.
4505         (Target_i386::got_section): Create got_irelative_.
4506         (Target_i386::rel_irelative_section): New function.
4507         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4508         fields.  Don't define __rel_iplt_{start,end}.
4509         (Output_data_plt_i386::add_entry): Add symtab and layout
4510         parameters.  Change all callers.  Use different PLT and GOT for
4511         IFUNC symbols.
4512         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4513         layout parameters.  Change all callers.  Use different PLT and
4514         GOT.
4515         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4516         (Output_data_plt_i386::rel_irelative): New function.
4517         (Output_data_plt_i386::address_for_global): New function.
4518         (Output_data_plt_i386::address_for_local): New function.
4519         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4520         IRELATIVE GOT when changing IFUNC GOT entries.
4521         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4522         reloc.
4523         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4524         if we didn't create an IRELATIVE GOT.
4525         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4526         plt_address_for_local.
4527         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4528         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4529         got_irelative_, and irelative_count_ fields.  Update
4530         declarations.
4531         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4532         Initialize new fields.  Remove symtab parameter.  Change all
4533         callers.
4534         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4535         irelative_count_.
4536         (Output_data_plt_x86_64::has_irelative_section): New function.
4537         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4538         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4539         fields.  Update declarations.
4540         (Target_x86_64::Target_x86_64): Initialize new fields.
4541         (Target_x86_64::do_plt_address_for_global): New function replacing
4542         do_plt_section_for_global.
4543         (Target_x86_64::do_plt_address_for_local): New function replacing
4544         do_plt_section_for_local.
4545         (Target_x86_64::got_section): Create got_irelative_.
4546         (Target_x86_64::rela_irelative_section): New function.
4547         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4548         all callers.  Don't create __rel_iplt_{start,end}.
4549         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4550         parameters.  Change all callers.  Use different PLT and GOT for
4551         IFUNC symbols.
4552         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4553         layout parameters.  Change all callers.  Use different PLT and
4554         GOT.
4555         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4556         parameters.  Change all callers.  Use different PLT and GOT for
4557         IFUNC symbols.
4558         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4559         (Output_data_plt_x86_64::rela_irelative): New function.
4560         (Output_data_plt_x86_64::address_for_global): New function.
4561         (Output_data_plt_x86_64::address_for_local): New function.
4562         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4563         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4564         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4565         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4566         parameters.
4567         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4568         reloc.
4569         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4570         symbols if we didn't create an IRELATIVE GOT.
4571         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4572         plt_address_for_local.
4573         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4574         * testsuite/ifuncvar1.c: New test file.
4575         * testsuite/ifuncvar2.c: New test file.
4576         * testsuite/ifuncvar3.c: New test file.
4577         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4578         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4579         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4580         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4581         * testsuite/Makefile.in: Rebuild.
4582
4583 2011-07-07  Cary Coutant  <ccoutant@google.com>
4584
4585         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4586         (two_file_test_1_ndebug.o): Likewise.
4587         (two_file_test_1b_ndebug.o): Likewise.
4588         (two_file_test_2_ndebug.o): Likewise.
4589         (two_file_test_main_ndebug.o): Likewise.
4590         (incremental_test_2): Link with no-debug versions.
4591
4592 2011-07-06  Cary Coutant  <ccoutant@google.com>
4593
4594         * gold/incremental.cc
4595         (Output_section_incremental_inputs::write_info_blocks): Check for
4596         hidden and internal symbols.
4597
4598 2011-07-06  Cary Coutant  <ccoutant@google.com>
4599
4600         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4601         Check disposition for startup file.
4602         (Incremental_inputs::report_command_line): Ignore
4603         --incremental-startup-unchanged option.
4604         * options.cc (General_options::parse_incremental_startup_unchanged):
4605         New function.
4606         (General_options::General_options): Initialize new data member.
4607         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4608         (General_options): Add --incremental-startup-unchanged option.
4609         (General_options::incremental_startup_disposition): New function.
4610         (General_options::incremental_startup_disposition_): New data member.
4611
4612 2011-07-06  Cary Coutant  <ccoutant@google.com>
4613
4614         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4615         input file index to Script_info ctor.
4616         (Sized_incremental_binary::do_file_has_changed): Find the
4617         command-line argument for files named in scripts.
4618         * incremental.h (Script_info::Script_info): New ctor
4619         with input file index.
4620         (Script_info::input_file_index): New function.
4621         (Script_info::input_file_index_): New data member.
4622         (Incremental_binary::get_library): Add const.
4623         (Incremental_binary::get_script_info): Add const.
4624         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4625         * testsuite/Makefile.am (incremental_test_5): New test case.
4626         (incremental_test_6): New test case.
4627         * testsuite/Makefile.in: Regenerate.
4628
4629 2011-07-06  Cary Coutant  <ccoutant@google.com>
4630
4631         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4632         debug output when command lines differ.
4633
4634 2011-07-06  Cary Coutant  <ccoutant@google.com>
4635
4636         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4637         --incremental-patch option.
4638         * layout.cc (Free_list::allocate): Extend allocation beyond original
4639         end if enabled.
4640         (Layout::make_output_section): Mark sections that should get
4641         patch space.
4642         * options.cc (parse_percent): New function.
4643         * options.h (parse_percent): New function.
4644         (DEFINE_percent): New macro.
4645         (General_options): Add --incremental-patch option.
4646         * output.cc (Output_section::Output_section): Initialize new data
4647         members.
4648         (Output_section::add_input_section): Print section name when out
4649         of patch space.
4650         (Output_section::add_output_section_data): Likewise.
4651         (Output_section::set_final_data_size): Add patch space when
4652         doing --incremental-full.
4653         (Output_section::do_reset_address_and_file_offset): Remove patch
4654         space.
4655         (Output_segment::set_section_list_addresses): Print debug output
4656         only if --incremental-update.
4657         * output.h (Output_section::set_is_patch_space_allowed): New function.
4658         (Output_section::is_patch_space_allowed_): New data member.
4659         (Output_section::patch_space_): New data member.
4660         * parameters.cc (Parameters::incremental_full): New function.
4661         * parameters.h (Parameters::incremental_full): New function
4662         * testsuite/Makefile.am (incremental_test_2): Add test for
4663         --incremental-patch option.
4664         * testsuite/Makefile.in: Regenerate.
4665         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4666         (t18): Remove function body.
4667
4668 2011-07-05  Doug Kwan  <dougkwan@google.com>
4669
4670         PR gold/12771
4671         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4672         Arm_Address type for relocation result.
4673         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4674         overflow check.
4675         (Arm_relocate_functions::abs32): Use unaligned access.
4676         (Arm_relocate_functions::rel32): Ditto.
4677         (Arm_relocate_functions::prel31): Ditto.
4678         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4679         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4680         static data relocations.
4681         * testsuite/Makefile.in: Regnerate.
4682         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4683
4684 2011-07-05  Ian Lance Taylor  <iant@google.com>
4685
4686         PR gold/12392
4687         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4688         symbols if necessary.
4689         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4690
4691 2011-07-05  Ian Lance Taylor  <iant@google.com>
4692
4693         PR gold/12952
4694         * resolve.cc (Symbol::override_base_with_special): Simply override
4695         version with special symbol version, ignoring previous version.
4696
4697 2011-07-05  Ian Lance Taylor  <iant@google.com>
4698
4699         * object.cc (Sized_relobj_file::include_section_group): Add
4700         information to comment about signature location.
4701
4702 2011-07-02  Ian Lance Taylor  <iant@google.com>
4703
4704         PR gold/12957
4705         * options.h (class General_options): Add -f and -F.
4706         * options.cc (General_options::finalize): Fatal error if -f/-F
4707         are used without -shared.
4708         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4709
4710 2011-07-02  Ian Lance Taylor  <iant@google.com>
4711
4712         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4713
4714 2011-07-01  Ian Lance Taylor  <iant@google.com>
4715
4716         PR gold/12525
4717         PR gold/12952
4718         * resolve.cc (Symbol::override_base_with_special): Don't override
4719         the version if the overriding symbol has a different name.
4720         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4721         all callers.  If we give an error about an undefined version,
4722         define the base version if necessary.
4723         * dynobj.h (class Versions): Update declaration.
4724         * testsuite/weak_alias_test_5.cc: New file.
4725         * testsuite/weak_alias_test.script: New file.
4726         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4727         and versioned_alias have the right value, and call t2.
4728         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4729         weak_alias_test_5.so.
4730         (weak_alias_test_LDADD): Likewise.
4731         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4732         * testsuite/Makefile.in: Rebuild.
4733
4734 2011-07-01  Ian Lance Taylor  <iant@google.com>
4735
4736         PR gold/12525
4737         * options.h (class General_options): Support -z notext.
4738         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4739         -Wl,-z,notext.
4740         (two_file_shared_nonpic.so): Likewise.
4741         (two_file_shared_mixed.so): Likewise.
4742         (two_file_shared_mixed_1.so): Likewise.
4743         (weak_undef_lib_nonpic.so): Likewise.
4744         (alt/weak_undef_lib_nonpic.so): Likewise.
4745         (tls_test_shared_nonpic.so): Likewise.
4746         * testsuite/Makefile.in: Rebuild.
4747
4748 2011-07-01  Ian Lance Taylor  <iant@google.com>
4749
4750         PR gold/12525
4751         * configure.ac: Test whether static linking works, setting
4752         the automake conditional HAVE_STATIC.
4753         * testsuite/Makefile.am: Disable tests using -static if
4754         HAVE_STATIC is not true.
4755         * configure, testsuite/Makefile.in: Rebuild.
4756
4757 2011-07-01  Ian Lance Taylor  <iant@google.com>
4758
4759         PR gold/12525
4760         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4761         Assert if we see DW_EH_PE_indirect.
4762         * target.h (Target::ehframe_datarel_base): New function.
4763         (Target::do_ehframe_datarel_base): New target function.
4764         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4765         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4766         function.
4767
4768 2011-07-01  Ian Lance Taylor  <iant@google.com>
4769
4770         PR gold/12571
4771         * options.h (class General_options): Add
4772         --ld-generated-unwind-info.
4773         * ehframe.cc (Fde::write): Add address parameter.  Change all
4774         callers.  If associated with PLT, fill in address and size.
4775         (Cie::set_output_offset): Only add merge mapping if there is an
4776         object.
4777         (Cie::write): Add address parameter.  Change all callers.
4778         (Eh_frame::add_ehframe_for_plt): New function.
4779         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4780         input_offset_ fields into union u_, with new plt field.
4781         (Fde::Fde): Adjust for new union field.
4782         (Fde::Fde) [Output_data version]: New constructor.
4783         (Fde::add_mapping): Only add merge mapping if there is an object.
4784         (class Cie): Update declarations.
4785         (class Eh_frame): Declare add_ehframe_for_plt.
4786         * layout.cc (Layout::layout_eh_frame): Break out code into
4787         make_eh_frame_section, and call it.
4788         (Layout::make_eh_frame_section): New function.
4789         (Layout::add_eh_frame_for_plt): New function.
4790         * layout.h (class Layout): Update declarations.
4791         * merge.cc (Merge_map::add_mapping): Add assertion.
4792         * i386.cc: Include "dwarf.h".
4793         (class Output_data_plt_i386): Make first_plt_entry,
4794         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4795         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4796         and plt_eh_frame_fde.
4797         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4798         boundary.  Call add_eh_frame_for_plt if appropriate.
4799         * x86_64.cc: Include "dwarf.h".
4800         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4801         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4802         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4803         and plt_eh_frame_fde.
4804         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4805         appropriate.
4806
4807 2011-06-29  Ian Lance Taylor  <iant@google.com>
4808
4809         PR gold/12629
4810         * object.cc (Sized_relobj_file::layout_section): Change shdr
4811         parameter to be const.
4812         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4813         out of do_layout.
4814         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4815         appropriate.  Call layout_eh_frame_section.
4816         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4817         sections.
4818         * object.h (class Sized_relobj_file): Update declarations.
4819
4820 2011-06-29  Ian Lance Taylor  <iant@google.com>
4821
4822         PR gold/12652
4823         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4824         modifier.
4825         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4826
4827 2011-06-29  Ian Lance Taylor  <iant@google.com>
4828
4829         PR gold/12675
4830         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4831         SHT_X86_64_UNWIND.
4832         * layout.cc (Layout::layout_eh_frame): Likewise.
4833
4834 2011-06-29  Ian Lance Taylor  <iant@google.com>
4835
4836         PR gold/12695
4837         * layout.cc (Layout::symtab_section_shndx): New function.
4838         * layout.h (class Layout): Declare symtab_section_shndx.
4839         * output.cc (Output_section::write_header): Call it.
4840
4841 2011-06-29  Ian Lance Taylor  <iant@google.com>
4842
4843         PR gold/12818
4844         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4845         symbols which are not used in a relocation.
4846
4847 2011-06-28  Ian Lance Taylor  <iant@google.com>
4848
4849         PR gold/12898
4850         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4851         script create indistinguishable segments.
4852         (Layout::set_segment_offsets): Use stable_sort when sorting
4853         segments.  Pass this to Compare_segments constructor.
4854         * layout.h (class Layout): Make segment_precedes non-static.
4855         (class Compare_segments): Change from struct to class.  Add
4856         layout_ field.  Add constructor.
4857         * script-sections.cc
4858         (Script_sections::attach_sections_using_phdrs_clause): Rename
4859         local orphan to is_orphan.  Don't report failure to put empty
4860         section in segment.  On attachment failure, report name of
4861         section, and attach to first PT_LOAD segment.
4862
4863 2011-06-28  Ian Lance Taylor  <iant@google.com>
4864
4865         PR gold/12934
4866         * target-select.cc (Target_selector::Target_selector): Add
4867         emulation parameter.  Change all callers.
4868         (select_target_by_bfd_name): Rename from select_target_by_name.
4869         Change all callers.
4870         (select_target_by_emulation): New function.
4871         (supported_emulation_names): New function.
4872         * target-select.h (class Target_selector): Add emulation_ field.
4873         Update declarations.
4874         (Target_selector::recognize_by_bfd_name): Rename from
4875         recognize_by_name.  Change all callers.
4876         (Target_selector::supported_bfd_names): Rename from
4877         supported_names.  Change all callers.
4878         (Target_selector::recognize_by_emulation): New function.
4879         (Target_selector::supported_emulations): New function.
4880         (Target_selector::emulation): New function.
4881         (Target_selector::do_recognize_by_bfd_name): Rename from
4882         do_recognize_by_name.  Change all callers.
4883         (Target_selector::do_supported_bfd_names): Rename from
4884         do_supported_names.  Change all callers.
4885         (Target_selector::do_recognize_by_emulation): New function.
4886         (Target_selector::do_supported_emulations): New function.
4887         (select_target_by_bfd_name): Change name in declaration.
4888         (select_target_by_emulation): Declare.
4889         (supported_emulation_names): Declare.
4890         * parameters.cc (parameters_force_valid_target): Try to find
4891         target based on emulation from -m option.
4892         * options.h (class General_options): Change doc string for -m.
4893         * options.cc (help): Print emulations.
4894         (General_options::parse_V): Likewise.
4895         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4896         Add emulation parameter.  Change all callers.
4897
4898 2011-06-28  Ian Lance Taylor  <iant@google.com>
4899
4900         * target.h (class Target): Add osabi_ field.
4901         (Target::osabi): New function.
4902         (Target::set_osabi): New function.
4903         (Target::Target): Initialize osabi_.
4904         (Target::do_adjust_elf_header): Make pure virtual.
4905         (Sized_target::do_adjust_elf_header): Declare.
4906         * target.cc (Sized_target::do_adjust_elf_header): New function.
4907         (class Sized_target): Instantiate all versions.
4908         * freebsd.h (class Target_freebsd): Remove.
4909         (Target_selector_freebsd::do_recognize): Call set_osabi on
4910         Target.
4911         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4912         (Target_selector_freebsd::set_osabi): Remove.
4913         * i386.cc (class Target_i386): Inherit from Sized_target rather
4914         than Target_freebsd.
4915         * x86_64.cc (class Target_x86_64): Likewise.
4916
4917 2011-06-28  Ian Lance Taylor  <iant@google.com>
4918
4919         * target.h (Target::can_check_for_function_pointers): Rewrite.
4920         Make non-virtual.
4921         (Target::can_icf_inline_merge_sections): Likewise.
4922         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4923         (Target::Target_info): Add can_icf_inline_merge_sections field.
4924         (Target::do_can_check_for_function_pointers): New virtual
4925         function.
4926         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4927         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4928         from can_check_for_function_pointers, move in file.
4929         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4930         section_may_have_icf_unsafe_poineters, move in file.
4931         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4932         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4933         Rename from can_check_for_function_pointers, move in file.
4934         (Target_i386::can_icf_inline_merge_sections): Remove.
4935         (Target_i386::i386_info): Initialize
4936         can_icf_inline_merge_sections.
4937         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4938         Initialize can_icf_inline_merge_sections.
4939         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4940         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4941         Rename from can_check_for_function_pointers, move in file.
4942         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4943         (Target_x86_64::x86_64_info): Initialize
4944         can_icf_inline_merge_sections.
4945         * testsuite/testfile.cc (Target_test::test_target_info):
4946         Likewise.
4947         * icf.cc (get_section_contents): Correct formatting.
4948
4949 2011-06-27  Ian Lance Taylor  <iant@google.com>
4950
4951         * symtab.cc (Symbol::versioned_name): New function.
4952         (Symbol_table::add_to_final_symtab): Use versioned_name when
4953         appropriate.
4954         (Symbol_table::sized_write_symbol): Likewise.
4955         * symtab.h (class Symbol): Declare versioned_name.
4956         * stringpool.h (class Stringpool_template): Add variant of add
4957         which takes a std::basic_string.
4958         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4959         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4960         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4961         (ver_test_12.o): New target.
4962         * testsuite/Makefile.in: Rebuild.
4963
4964 2011-06-27  Doug Kwan  <dougkwan@google.com>
4965
4966         * arm.cc (Arm_relocate_functions::thm_jump8,
4967         Arm_relocate_functions::thm_jump11): Use a wider signed
4968         type to compute offset.
4969         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4970         arm_thm_jump8.
4971         * testsuite/Makefile.in: Regenerate.
4972         * testsuite/arm_branch_in_range.sh: Check test results of
4973         arm_thm_jump11 and arm_thm_jump8.
4974         * testsuite/arm_thm_jump11.s: New test source file.
4975         * testsuite/arm_thm_jump11.t: New linker script.
4976         * testsuite/arm_thm_jump8.s: New test source file.
4977         * testsuite/arm_thm_jump8.t: New linker script.
4978
4979 2011-06-24  Ian Lance Taylor  <iant@google.com>
4980
4981         * layout.cc: Include "object.h".
4982         (ctors_sections_in_init_array): New static variable.
4983         (Layout::is_ctors_in_init_array): New function.
4984         (Layout::layout): Add entry to ctors_sections_in_init_array if
4985         appropriate.
4986         * layout.h (class Layout): Declare is_ctors_in_init_array.
4987         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4988         is_ctors_reverse_view is set.
4989         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4990         all callers.  Set is_ctors_reverse_view field of View_size.
4991         (Sized_relobj_file::reverse_words): New function.
4992         * object.h (Sized_relobj_file::View_size): Add
4993         is_ctors_reverse_view field.
4994         (class Sized_relobj_file): Update declarations.
4995         * testsuite/initpri3.c: New test.
4996         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4997         initpri3b.
4998         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4999         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5000         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5001         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5002         * testsuite/Makefile.in: Rebuild.
5003
5004 2011-06-24  Cary Coutant  <ccoutant@google.com>
5005
5006         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5007         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5008         (debug_msg_cdebug.err): New targets.
5009         * testsuite/Makefile.in: Regenerate.
5010         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5011         Fix checks for link with shared library.
5012
5013 2011-06-24  Doug Kwan  <dougkwan@google.com>
5014
5015         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5016         skip empty text sections.
5017         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5018
5019 2011-06-22  Ian Lance Taylor  <iant@google.com>
5020
5021         PR gold/12910
5022         * options.h (class General_options): Add --ctors-in-init-array.
5023         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5024         friends as SHT_PROGBITS for merging sections.
5025         (Layout::layout): Remove special handling of .init_array and
5026         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5027         and .dtors if ctors_in_init_array.
5028         (Layout::make_output_section): Force correct section types for
5029         .init_array and friends.  Don't sort if doing relocatable link,
5030         Don't sort .ctors and .dtors if ctors_in_init_array.
5031         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5032         (Layout::output_section_name): Add relobj parameter.  Change all
5033         callers.  Handle .ctors. and .dtors. in code rather than table.
5034         Handle .ctors and .dtors if ctors_in_init_array.
5035         (Layout::match_file_name): New function, moved from output.cc.
5036         * layout.h (class Layout): Update declarations.
5037         * output.cc: Include "layout.h".
5038         (Input_section_sort_entry::get_priority): New function.
5039         (Input_section_sort_entry::match_file_name): Just call
5040         Layout::match_file_name.
5041         (Output_section::Input_section_sort_init_fini_compare::operator()):
5042         Handle .ctors and .dtors.  Sort by explicit priority rather than
5043         by name.
5044         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5045         * testsuite/initpri2.c: New test.
5046         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5047         (check_PROGRAMS): Add initpri2.
5048         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5049         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5050         * configure, testsuite/Makefile.in: Rebuild.
5051
5052 2011-06-19  Ian Lance Taylor  <iant@google.com>
5053
5054         PR gold/12880
5055         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5056         .interp section to a PT_INTERP segment even if we have seen a
5057         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5058         clause in a linker script.
5059         (Layout::finalize): Don't create a .interp section if we've
5060         already create a PT_INTERP segment.
5061         (Layout::create_interp): Always call choose_output_section (revert
5062         patch of 2011-06-17).  Don't create PT_INTERP segment.
5063         * script-sections.cc
5064         (Script_sections::create_note_and_tls_segments): Add a .interp
5065         section to a PT_INTERP segment even if we have seen a
5066         --dynamic-linker option.
5067
5068 2011-06-18  Ian Lance Taylor  <iant@google.com>
5069
5070         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5071         merely because a non-PT_LOAD segment has a dynamic reloc.
5072
5073 2011-06-18  Ian Lance Taylor  <iant@google.com>
5074
5075         * layout.cc (Layout::finish_dynamic_section): Don't create
5076         DT_FLAGS entry if not needed.
5077
5078 2011-06-18  Ian Lance Taylor  <iant@google.com>
5079
5080         PR gold/12745
5081         * layout.cc (Layout::layout_eh_frame): Correct handling of
5082         writable .eh_frame section.
5083
5084 2011-06-17  Ian Lance Taylor  <iant@google.com>
5085
5086         PR gold/12893
5087         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5088         symbol is redefined with the exact same object and value.
5089
5090 2011-06-17  Ian Lance Taylor  <iant@google.com>
5091
5092         PR gold/12880
5093         * layout.h (class Layout): Add interp_segment_ field.
5094         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5095         (Layout::attach_allocated_section_to_segment): If making shared
5096         library, put .interp section in PT_INTERP segment.
5097         (Layout::finalize): Also call create_interp if -dynamic-linker
5098         option was used.
5099         (Layout::create_interp): Assert that there is no PT_INTERP
5100         segment.  If not using a SECTIONS clause, use make_output_section.
5101         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5102         * script-sections.cc
5103         (Script_sections::create_note_and_tls_segments): If making shared
5104         library, put .interp section in PT_INTERP segment.
5105
5106 2011-06-17  Ian Lance Taylor  <iant@google.com>
5107
5108         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5109         when making a shared library.
5110
5111 2011-06-17  Ian Lance Taylor  <iant@google.com>
5112
5113         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5114         parameter.  Change all callers.  Don't issue warning about PC32
5115         against locally defined symbol.
5116
5117 2011-06-16  Ian Lance Taylor  <iant@google.com>
5118
5119         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5120         occurs in same object.
5121
5122 2011-06-14  Alan Modra  <amodra@gmail.com>
5123
5124         * po/POTFILES.in: Regenerate.
5125
5126 2011-06-09  Ian Lance Taylor  <iant@google.com>
5127
5128         * script-sections.cc
5129         (Orphan_output_section::set_section_addresses): For a relocatable
5130         link set address to 0.
5131
5132 2011-06-09  Cary Coutant  <ccoutant@google.com>
5133
5134         PR gold/12804
5135         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5136         used with --compress-debug-sections.
5137         * gold/object.cc (Sized_relobj_file::do_layout): Report
5138         uncompressed size of compressed input sections.
5139
5140 2011-06-08  Cary Coutant  <ccoutant@google.com>
5141
5142         PR gold/12804
5143         * testsuite/two_file_test_2_v1.cc: Change initialization of
5144         v2 to keep it in .data.
5145
5146 2011-06-07  Cary Coutant  <ccoutant@google.com>
5147
5148         * common.cc (Symbol_table::do_allocate_commons_list): Call
5149         gold_fallback.
5150         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5151         (Errors::fallback): New function.
5152         (gold_fallback): New function.
5153         * errors.h (Errors::fallback): New function.
5154         * gold.cc (gold_exit): Change status parameter to enum; adjust
5155         all callers.
5156         (queue_initial_tasks): Call gold_fallback.
5157         * gold.h: Include cstdlib.
5158         (Exit_status): New enum type.
5159         (gold_exit): Change status parameter to enum.
5160         (gold_fallback): New function.
5161         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5162         (Layout::create_symtab_sections): Likewise.
5163         (Layout::create_shdrs): Likewise.
5164         * main.cc (main): Adjust call to gold_exit.
5165         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5166         (Output_data_got::add_got_entry_pair): Likewise.
5167         (Output_section::add_input_section): Likewise.
5168         (Output_section::add_output_section_data): Likewise.
5169         (Output_segment::set_section_list_addresses): Likewise.
5170         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5171
5172 2011-06-07  Cary Coutant  <ccoutant@google.com>
5173
5174         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5175         for incremental links.
5176         * output.cc (Output_segment::set_section_list_addresses): Remove
5177         FIXME and test for TLS or BSS.
5178
5179 2011-06-07  Cary Coutant  <ccoutant@google.com>
5180
5181         * testsuite/Makefile.am: Add incremental_copy_test,
5182         incremental_common_test_1.
5183         * testsuite/Makefile.in: Regenerate.
5184         * testsuite/common_test_1_v1.c: New source file.
5185         * testsuite/common_test_1_v2.c: New source file.
5186         * testsuite/copy_test_v1.cc: New source file.
5187
5188 2011-06-07  Cary Coutant  <ccoutant@google.com>
5189
5190         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5191         update, allocate common from bss section's free list.
5192         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5193         linker-defined symbols.
5194         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5195         Skip GOT and PLT entries that are no longer referenced.
5196         (Output_section_incremental_inputs::write_info_blocks): Mark
5197         linker-defined symbols.
5198         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5199         * output.cc (Output_section::allocate): New function.
5200         * output.h (Output_section::allocate): New function.
5201         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5202         linker-defined symbols.
5203         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5204         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5205         (Symbol::init_base_output_data): Likewise.
5206         (Symbol::init_base_output_segment): Likewise.
5207         (Symbol::init_base_constant): Likewise.
5208         (Sized_symbol::init_output_data): Likewise.
5209         (Sized_symbol::init_output_segment): Likewise.
5210         (Sized_symbol::init_constant): Likewise.
5211         (Symbol_table::do_define_in_output_data): Likewise.
5212         (Symbol_table::do_define_in_output_segment): Likewise.
5213         (Symbol_table::do_define_as_constant): Likewise.
5214         * symtab.h (Symbol::is_predefined): New function.
5215         (Symbol::init_base_output_data): Add is_predefined parameter.
5216         (Symbol::init_base_output_segment): Likewise.
5217         (Symbol::init_base_constant): Likewise.
5218         (Symbol::is_predefined_): New data member.
5219         (Sized_symbol::init_output_data): Add is_predefined parameter.
5220         (Sized_symbol::init_output_segment): Likewise.
5221         (Sized_symbol::init_constant): Likewise.
5222         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5223
5224 2011-06-07  Cary Coutant  <ccoutant@google.com>
5225
5226         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5227         instead of emit_copy_reloc.
5228         (Copy_relocs::emit_copy_reloc): Refactor.
5229         (Copy_relocs::make_copy_reloc): New function.
5230         (Copy_relocs::add_copy_reloc): Remove.
5231         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5232         section.
5233         (Copy_relocs::make_copy_reloc): New function.
5234         (Copy_relocs::add_copy_reloc): Remove.
5235         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5236         unchanged input files.
5237         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5238         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5239         Reserve BSS space for COPY relocations.
5240         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5241         (Output_section_incremental_inputs::write_info_blocks): Record
5242         whether a symbol is copied from a shared object.
5243         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5244         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5245         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5246         (Incremental_input_entry_reader::get_output_symbol_index): Add
5247         is_copy parameter.
5248         (Incremental_binary::emit_copy_relocs): New function.
5249         (Incremental_binary::do_emit_copy_relocs): New function.
5250         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5251         new data member.
5252         (Sized_incremental_binary::add_copy_reloc): New function.
5253         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5254         (Sized_incremental_binary::Copy_reloc): New struct.
5255         (Sized_incremental_binary::Copy_relocs): New typedef.
5256         (Sized_incremental_binary::copy_relocs_): New data member.
5257         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5258         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5259         * target.h (Sized_target::emit_copy_reloc): New function.
5260         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5261
5262 2011-06-02  Cary Coutant  <ccoutant@google.com>
5263
5264         PR gold/12163
5265         * gold/archive.cc (Archive::Archive): Initialize new data member.
5266         (Archive::include_all_members): Return if archive has already been
5267         included.
5268         * gold/archive.h (Archive::include_all_members_): New data member.
5269
5270 2011-06-02  Nick Clifton  <nickc@redhat.com>
5271
5272         * dynobj.h: Fix spelling mistake in comment.
5273         * output.cc: Likewise.
5274
5275 2011-05-31  Doug Kwan  <dougkwan@google.com>
5276             Asier Llano
5277
5278         PR gold/12826
5279         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5280         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5281         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5282         redundant arm_exidx_test.so.
5283         * testsuite/Makefile.in: Regenerate.
5284         (check_SCRIPTS): Add pr12826.sh
5285         (check_DATA): Add pr12826.stdout
5286         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5287         * testsuite/pr12826.sh: New file.
5288         * testsuite/pr12826_1.s: Ditto.
5289         * testsuite/pr12826_1.s: Ditto.
5290
5291 2011-05-30  Ian Lance Taylor  <iant@google.com>
5292
5293         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5294         sections.
5295
5296 2011-05-29  Ian Lance Taylor  <iant@google.com>
5297
5298         PR gold/12804
5299         * testsuite/Makefile.am: Use different file name for two_file_test
5300         temporary file for each incremental test.
5301         * testsuite/Makefile.in: Rebuild.
5302
5303 2011-05-29  Ian Lance Taylor  <iant@google.com>
5304
5305         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5306         binary input file is empty.
5307
5308 2011-05-27  Ian Lance Taylor  <iant@google.com>
5309
5310         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5311         (ver_test_9.so): Likewise.
5312         * testsuite/Makefile.in: Rebuild.
5313
5314 2011-05-26 Cary Coutant  <ccoutant@google.com>
5315
5316         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5317         * incremental.cc (Incremental_inputs::report_input_section): Fix
5318         comment, indentation.
5319         (Incremental_inputs::report_comdat_group): New function.
5320         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5321         of data for incremental input file entry.
5322         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5323         group count, COMDAT group signatures.
5324         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5325         an unchanged input file.
5326         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5327         Initialize new data member.
5328         (Incremental_object_entry::add_comdat_group): New function.
5329         (Incremental_object_entry::get_comdat_group_count): New function.
5330         (Incremental_object_entry::get_comdat_signature_key): New function.
5331         (Incremental_object_entry::groups_): New data member.
5332         (Incremental_inputs::report_comdat_group): New function.
5333         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5334         data for incremental input file entry.
5335         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5336         (Incremental_input_entry_reader::get_input_section): Adjust size of
5337         data for incremental input file entry.
5338         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5339         (Incremental_input_entry_reader::get_comdat_group_signature): New
5340         function.
5341         * object.cc (Sized_relobj::include_section_group): Report kept
5342         COMDAT groups for incremental links.
5343
5344 2011-05-24  David Meyer  <pdox@google.com>
5345
5346         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5347         with name parameter.  Add found_name parameter.
5348         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5349         * dirsearch.h (class Dirsearch): Update declaration.
5350
5351 2011-05-24  Ian Lance Taylor  <iant@google.com>
5352
5353         * archive.cc (Library_base::should_include_member): Pull in object
5354         from archive if it defines the entry symbol.
5355         * parameters.cc (Parameters::entry): New function.
5356         * parameters.h (class Parameters): Declare entry.
5357         * output.h (class Output_file_header): Remove entry_ field.
5358         * output.cc (Output_file_header::Output_file_header): Remove entry
5359         parameter.  Change all callers.
5360         (Output_file_header::entry): Use parameters->entry.
5361         * gold.cc (queue_middle_tasks): Likewise.
5362         * plugin.cc (Plugin_hook::run): Likewise.
5363
5364 2011-05-24 Cary Coutant  <ccoutant@google.com>
5365
5366         * gold.cc (queue_initial_tasks): Pass incremental base filename
5367         to Output_file::open_base_file; don't print error message.
5368         * incremental-dump.cc (main): Adjust call to
5369         Output_file::open_for_modification.
5370         * incremental-dump.cc (main): Likewise.
5371         * incremental.cc (Incremental_inputs::report_command_line):
5372         Ignore --incremental-base option when comparing command lines.
5373         Ignore parameter when given as separate argument.
5374         * options.h (class General_options): Add --incremental-base.
5375         * output.cc (Output_file::Output_file):
5376         (Output_file::open_base_file): Add base_name and writable parameters;
5377         read base file into new file; print error message here.
5378         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5379         callers.
5380         * output.h (Output_file::open_for_modification): Rename to...
5381         (Output_file::open_base_file): ...this; add base_name and
5382         writable parameters; adjust all callers.
5383         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5384         callers.
5385         * testsuite/Makefile.am (incremental_test_4): Test
5386         --incremental-base.
5387         * testsuite/Makefile.in: Regenerate.
5388
5389 2011-05-24 Cary Coutant  <ccoutant@google.com>
5390
5391         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5392         incremental_test_4.
5393         * testsuite/Makefile.in: Regenerate.
5394         * testsuite/two_file_test_1_v1.cc: New test source file.
5395         * testsuite/two_file_test_1b_v1.cc: New test source file.
5396         * testsuite/two_file_test_2_v1.cc: New test source file.
5397
5398 2011-05-24 Cary Coutant  <ccoutant@google.com>
5399
5400         * dynobj.h (Dynobj::do_dynobj): New function.
5401         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5402         flag and soname for shared objects.
5403         * incremental.cc (Incremental_inputs::report_object): Make
5404         either Incremental_object_entry or Incremental_dynobj_entry; add
5405         soname to string table.
5406         (Incremental_inputs::report_input_section): Add assertion.
5407         (Output_section_incremental_inputs::set_final_data_size): Adjust
5408         type of input file entry for shared libraries; adjust size of
5409         shared library info entry.
5410         (Output_section_incremental_inputs::write_input_files): Write
5411         as_needed flag for shared libraries.
5412         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5413         of input file entry for shared libraries; write soname.
5414         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5415         soname from incremental info.
5416         * incremental.h (enum Incremental_input_flags): Add
5417         INCREMENTAL_INPUT_AS_NEEDED.
5418         (Incremental_input_entry::Incremental_input_entry): Initialize new
5419         data member.
5420         (Incremental_input_entry::set_as_needed): New function.
5421         (Incremental_input_entry::as_needed): New function.
5422         (Incremental_input_entry::do_dynobj_entry): New function.
5423         (Incremental_input_entry::as_needed_): New data member.
5424         (Incremental_object_entry::Incremental_object_entry): Don't check
5425         for shared library.
5426         (Incremental_object_entry::do_type): Likewise.
5427         (class Incremental_dynobj_entry): New class.
5428         (Incremental_input_entry_reader::as_needed): New function.
5429         (Incremental_input_entry_reader::get_soname): New function.
5430         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5431         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5432         size of shared library info entry.
5433         * layout.cc (Layout::finish_dynamic_section): Don't test for
5434         incremental link when adding DT_NEEDED entries.
5435         * object.h (Object::Object): Initialize new data member.
5436         (Object::dynobj): New function.
5437         (Object::set_as_needed): New function.
5438         (Object::as_needed): New function.
5439         (Object::do_dynobj): New function.
5440         (Object::as_needed_): New data member.
5441
5442 2011-05-24 Cary Coutant  <ccoutant@google.com>
5443
5444         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5445         info; adjust display of GOT entries.
5446         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5447         vector of input objects; remove file_status_.
5448         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5449         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5450         got_plt reader; call target hooks to reserve GOT entries.
5451         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5452         of input file info header and GOT info entry.
5453         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5454         relocation info.
5455         (Got_plt_view_info::got_descriptor): Remove.
5456         (Got_plt_view_info::sym_index): New data member.
5457         (Got_plt_view_info::input_index): New data member.
5458         (Local_got_offset_visitor::visit): Write input file index.
5459         (Global_got_offset_visitor::visit): Write 0 for input file index.
5460         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5461         with sym_index and input_index.
5462         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5463         incremental info GOT entry; replace got_descriptor with input_index.
5464         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5465         map from input file index to object.
5466         (Sized_relobj_incr::do_layout): Replace direct data member reference
5467         with accessor function.
5468         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5469         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5470         Adjust size of input file info header.
5471         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5472         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5473         (Incremental_input_entry_reader::get_input_section): Adjust size of
5474         input file info header.
5475         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5476         of incremental info GOT entry.
5477         (Incremental_got_plt_reader::get_got_desc): Remove.
5478         (Incremental_got_plt_reader::get_got_symndx): New function.
5479         (Incremental_got_plt_reader::get_got_input_index): New function.
5480         (Sized_incremental_binary::Sized_incremental_binary): Remove
5481         file_status_; add input_objects_.
5482         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5483         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5484         (Sized_incremental_binary::file_is_unchanged): Remove.
5485         (Sized_incremental_binary::set_input_object): New function.
5486         (Sized_incremental_binary::input_object): New function.
5487         (Sized_incremental_binary::file_status_): Remove.
5488         (Sized_incremental_binary::input_objects_): New data member.
5489         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5490         references.
5491         (Sized_relobj_incr::invalid_address): Move to base class.
5492         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5493         class.
5494         (Sized_relobj_incr::do_output_section_offset): Likewise.
5495         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5496         (Sized_relobj_incr::section_offsets_): Likewise.
5497         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5498         function.
5499         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5500         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5501         with accessor function.
5502         (Sized_relobj_file::do_layout): Likewise.
5503         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5504         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5505         (Sized_relobj_file::compute_final_local_value): Replace refs to
5506         section_offsets_ with accessor function.
5507         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5508         * object.h (Relobj::Relobj): Initialize new data members.
5509         (Relobj::add_dyn_reloc): New function.
5510         (Relobj::first_dyn_reloc): New function.
5511         (Relobj::dyn_reloc_count): New function.
5512         (Relobj::first_dyn_reloc_): New data member.
5513         (Relobj::dyn_reloc_count_): New data member.
5514         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5515         references.
5516         (Sized_relobj::Address): New typedef.
5517         (Sized_relobj::invalid_address): Move here from child class.
5518         (Sized_relobj::Sized_relobj): Initialize new data members.
5519         (Sized_relobj::sized_relobj): New function.
5520         (Sized_relobj::is_output_section_offset_invalid): Move here from
5521         child class.
5522         (Sized_relobj::get_output_section_offset): Likewise.
5523         (Sized_relobj::local_has_got_offset): Likewise.
5524         (Sized_relobj::local_got_offset): Likewise.
5525         (Sized_relobj::set_local_got_offset): Likewise.
5526         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5527         (Sized_relobj::clear_got_offsets): New function.
5528         (Sized_relobj::section_offsets): Move here from child class.
5529         (Sized_relobj::do_output_section_offset): Likewise.
5530         (Sized_relobj::do_set_section_offset): Likewise.
5531         (Sized_relobj::Local_got_offsets): Likewise.
5532         (Sized_relobj::local_got_offsets_): Likewise.
5533         (Sized_relobj::section_offsets_): Likewise.
5534         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5535         references.
5536         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5537         class.
5538         (Sized_relobj_file::sized_relobj): New function
5539         (Sized_relobj_file::local_has_got_offset): Move to base class.
5540         (Sized_relobj_file::local_got_offset): Likewise.
5541         (Sized_relobj_file::set_local_got_offset): Likewise.
5542         (Sized_relobj_file::get_output_section_offset): Likewise.
5543         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5544         (Sized_relobj_file::do_output_section_offset): Likewise.
5545         (Sized_relobj_file::do_set_section_offset): Likewise.
5546         (Sized_relobj_file::Local_got_offsets): Likewise.
5547         (Sized_relobj_file::local_got_offsets_): Likewise.
5548         (Sized_relobj_file::section_offsets_): Likewise.
5549         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5550         (all constructors).
5551         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5552         (Output_reloc::get_symbol_index): Likewise.
5553         (Output_reloc::local_section_offset): Likewise.
5554         (Output_reloc::get_address): Likewise.
5555         (Output_reloc::symbol_value): Likewise.
5556         (Output_data_got::reserve_slot): Move to class definition.
5557         (Output_data_got::reserve_local): New function.
5558         (Output_data_got::reserve_slot_for_global): Remove.
5559         (Output_data_got::reserve_global): New function.
5560         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5561         (all constructors, two instantiations).
5562         (Output_reloc::get_relobj): New function (two instantiations).
5563         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5564         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5565         (Output_data_reloc::add_global): Adjust type of relobj.
5566         (Output_data_reloc::add_global_relative): Likewise.
5567         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5568         (Output_data_reloc::add_local): Likewise.
5569         (Output_data_reloc::add_local_relative): Likewise.
5570         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5571         (Output_data_reloc::add_local_section): Likewise.
5572         (Output_data_reloc::add_output_section): Likewise.
5573         (Output_data_reloc::add_absolute): Likewise.
5574         (Output_data_reloc::add_target_specific): Likewise.
5575         (Output_data_got::reserve_slot): Move definition here.
5576         (Output_data_got::reserve_local): New function.
5577         (Output_data_got::reserve_global): New function.
5578         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5579         section_offsets_ with accessor function.
5580         (Sized_relobj_file::write_sections): Likewise.
5581         (Sized_relobj_file::do_relocate_sections): Likewise.
5582         * target.h (Sized_target::reserve_local_got_entry): New function.
5583         (Sized_target::reserve_global_got_entry): New function.
5584         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5585         (Target_x86_64::reserve_global_got_entry): New function.
5586         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5587
5588 2011-05-23 Cary Coutant  <ccoutant@google.com>
5589
5590         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5591         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5592         bit when checking got_type.
5593         * incremental.cc (Sized_incremental_binary::setup_readers):
5594         Store symbol table and string table locations; initialize bit vector
5595         of file status flags.
5596         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5597         unchanged files.
5598         (Sized_incremental_binary::do_process_got_plt): New function.
5599         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5600         (Output_section_incremental_inputs::set_final_data_size): Record
5601         file index for each input file.
5602         (Output_section_incremental_inputs::write_got_plt): Store file index
5603         instead of input entry offset for each GOT entry.
5604         * incremental.h
5605         (Incremental_input_entry::Incremental_input_entry): Initialize new
5606         data member.
5607         (Incremental_input_entry::set_offset): Store file index.
5608         (Incremental_input_entry::get_file_index): New function.
5609         (Incremental_input_entry::file_index_): New data member.
5610         (Incremental_binary::process_got_plt): New function.
5611         (Incremental_binary::do_process_got_plt): New function.
5612         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5613         data members.
5614         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5615         (Sized_incremental_binary::set_file_is_unchanged): New function.
5616         (Sized_incremental_binary::file_is_unchanged): New function.
5617         (Sized_incremental_binary::do_process_got_plt): New function.
5618         (Sized_incremental_binary::file_status_): New data member.
5619         (Sized_incremental_binary::main_symtab_loc_): New data member.
5620         (Sized_incremental_binary::main_strtab_loc_): New data member.
5621         * output.cc (Output_data_got::Got_entry::write): Add case
5622         RESERVED_CODE.
5623         (Output_data_got::add_global): Call add_got_entry.
5624         (Output_data_got::add_global_plt): Likewise.
5625         (Output_data_got::add_global_with_rel): Likewise.
5626         (Output_data_got::add_global_with_rela): Likewise.
5627         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5628         (Output_data_got::add_global_pair_with_rela): Likewise.
5629         (Output_data_got::add_local): Call add_got_entry.
5630         (Output_data_got::add_local_plt): Likewise.
5631         (Output_data_got::add_local_with_rel): Likewise.
5632         (Output_data_got::add_local_with_rela): Likewise.
5633         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5634         (Output_data_got::add_local_pair_with_rela): Likewise.
5635         (Output_data_got::reserve_slot): New function.
5636         (Output_data_got::reserve_slot_for_global): New function.
5637         (Output_data_got::add_got_entry): New function.
5638         (Output_data_got::add_got_entry_pair): New function.
5639         (Output_section::add_output_section_data): Edit FIXME.
5640         * output.h
5641         (Output_section_data_build::Output_section_data_build): New
5642         constructor with size parameter.
5643         (Output_data_space::Output_data_space): Likewise.
5644         (Output_data_got::Output_data_got): Initialize new data member; new
5645         constructor with size parameter.
5646         (Output_data_got::add_constant): Call add_got_entry.
5647         (Output_data_got::reserve_slot): New function.
5648         (Output_data_got::reserve_slot_for_global): New function.
5649         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5650         (Output_data_got::add_got_entry): New function.
5651         (Output_data_got::add_got_entry_pair): New function.
5652         (Output_data_got::free_list_): New data member.
5653         * target.h (Sized_target::init_got_plt_for_update): New function.
5654         (Sized_target::register_global_plt_entry): New function.
5655         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5656         Initialize new data member; call init; add constructor with PLT count.
5657         (Output_data_plt_x86_64::init): New function.
5658         (Output_data_plt_x86_64::add_relocation): New function.
5659         (Output_data_plt_x86_64::reserve_slot): New function.
5660         (Output_data_plt_x86_64::free_list_): New data member.
5661         (Target_x86_64::init_got_plt_for_update): New function.
5662         (Target_x86_64::register_global_plt_entry): New function.
5663         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5664         incremental updates.
5665         (Output_data_plt_x86_64::add_relocation): New function.
5666         * testsuite/object_unittest.cc (Object_test): Set default options.
5667
5668 2011-05-16  Ian Lance Taylor  <iant@google.com>
5669
5670         * options.h (class General_options): Make -i a synonym for -r.
5671
5672 2011-05-16  Ian Lance Taylor  <iant@google.com>
5673
5674         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5675
5676 2011-05-10 Cary Coutant  <ccoutant@google.com>
5677
5678         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5679         strip_all (-s).
5680
5681 2011-05-06  Ian Lance Taylor  <iant@google.com>
5682
5683         * layout.cc (Layout::layout): If the output section flags change,
5684         update the ordering.
5685
5686 2011-04-25 Cary Coutant  <ccoutant@google.com>
5687
5688         * incremental-dump.cc (dump_incremental_inputs): Print local
5689         symbol info for each input file.
5690         * incremental.cc
5691         (Output_section_incremental_inputs::set_final_data_size): Add local
5692         symbol info to input file entries in incremental info.
5693         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5694         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5695         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5696         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5697         implementation.
5698         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5699         (Sized_incr_relobj::do_relocate): Write the local symbols.
5700         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5701         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5702         Adjust size of input file header.
5703         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5704         (Incremental_inputs_reader::get_local_symbol_count): New function.
5705         (Incremental_inputs_reader::get_input_section): Adjust size of input
5706         file header.
5707         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5708         (Sized_incr_relobj::This): New typedef.
5709         (Sized_incr_relobj::sym_size): New const data member.
5710         (Sized_incr_relobj::Local_symbol): New struct.
5711         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5712         (Sized_incr_relobj::do_local_symbol_offset): New function.
5713         (Sized_incr_relobj::local_symbol_count_): New data member.
5714         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5715         (Sized_incr_relobj::local_symbol_index_): New data member.
5716         (Sized_incr_relobj::local_symbol_offset_): New data member.
5717         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5718         (Sized_incr_relobj::local_symbols_): New data member.
5719         * object.h (Relobj::output_local_symbol_count): New function.
5720         (Relobj::local_symbol_offset): New function.
5721         (Relobj::do_output_local_symbol_count): New function.
5722         (Relobj::do_local_symbol_offset): New function.
5723         (Sized_relobj::do_output_local_symbol_count): New function.
5724         (Sized_relobj::do_local_symbol_offset): New function.
5725
5726 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5727
5728         * descriptors.cc (set_close_on_exec): New function.
5729         (Descriptors::open): Use set_close_on_exec.
5730         * output.cc (S_ISLNK): Define if not defined.
5731
5732 2011-04-22 Cary Coutant  <ccoutant@google.com>
5733
5734         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5735         global symbol map.
5736         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5737         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5738         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5739         relocations.
5740         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5741         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5742         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5743         * incremental.h
5744         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5745         function.
5746         (Incremental_binary::apply_incremental_relocs): New function.
5747         (Incremental_binary::do_apply_incremental_relocs): New function.
5748         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5749         data member.
5750         (Sized_incremental_binary::add_global_symbol): New function.
5751         (Sized_incremental_binary::global_symbol): New function.
5752         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5753         (Sized_incremental_binary::symbol_map_): New data member.
5754         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5755         * target.h (Sized_target::apply_relocation): New function.
5756         * target-reloc.h (apply_relocation): New function.
5757         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5758
5759 2011-04-22  Doug Kwan  <dougkwan@google.com>
5760
5761         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5762         flag of a SHT_ARM_EXIDX section.
5763         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5764         * testsuite/Makefile.in: Regenerate.
5765         * testsuite/arm_exidx_test.s: New file.
5766         * testsuite/arm_exidx_test.sh: Same.
5767
5768 2011-04-20 Cary Coutant  <ccoutant@google.com>
5769
5770         PR gold/12689
5771         * archive.h (Incremental_archive_entry::Archive_member):
5772         Initialize arg_serial_ (second constructor).
5773
5774 2011-04-17  Ian Lance Taylor  <iant@google.com>
5775
5776         * object.cc (Relocate_info::location): Simplify location string.
5777         * errors.cc (Errors::error_at_location): Don't print program
5778         name.
5779         (Errors::warning_at_location): Likewise.
5780         (Errors::undefined_symbol): Likewise.
5781         * testsuite/debug_msg.sh: Update accordingly.
5782
5783 2011-04-14 Cary Coutant  <ccoutant@google.com>
5784
5785         * gold/layout.cc (Layout::symtab_section_offset): New function.
5786         * gold/layout.h (Layout::symtab_section_offset): New function.
5787         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5788
5789 2011-04-12  Ian Lance Taylor  <iant@google.com>
5790
5791         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5792         with MREMAP_MAYMOVE.
5793         * output.h (class Output_file): Add map_is_allocated_ field.
5794         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5795         not available, provide stubs.  If mremap is not available, #define
5796         it to gold_mremap.
5797         (MREMAP_MAYMOVE): Define if not defined.
5798         (Output_file::Output_file): Initialize map_is_allocated_.
5799         (Output_file::resize): Check map_is_allocated_.
5800         (Output_file::map_anonymous): If mmap fails, use malloc.
5801         (Output_file::unmap): Don't do anything for an anonymous map.
5802         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5803         is not available, provide stubs.
5804         (File_read::View::~View): Use free rather than delete[].
5805         (File_read::make_view): Use malloc rather than new[].  If mmap
5806         fails, use malloc.
5807         (File_read::find_or_make_view): Use malloc rather than new[].
5808         * gold.h: Remove HAVE_REMAP code.
5809         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5810         exists.  Rename mremap to gold_mremap.  If mmap is not available
5811         don't do anything.
5812         * configure, config.in: Rebuild.
5813
5814 2011-04-11  Ian Lance Taylor  <iant@google.com>
5815
5816         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5817         initialize local variable v.
5818
5819 2011-04-11  Cary Coutant  <ccoutant@google.com>
5820
5821         * archive.cc (Archive::include_member): Adjust call to
5822         report_object.
5823         (Add_archive_symbols::run): Track argument serial numbers.
5824         (Lib_group::include_member): Likewise.
5825         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5826         * archive.h (Incremental_archive_entry::Archive_member):
5827         Initialize arg_serial_.
5828         (Archive_member::arg_serial_): New data member.
5829         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5830         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5831         incremental link.
5832         (Sized_dynobj::do_for_all_local_got_entries): New function.
5833         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5834         function.
5835         * fileread.cc (get_mtime): New function.
5836         * fileread.h (get_mtime): New function.
5837         * gold.cc (queue_initial_tasks): Check for incremental update.
5838         (process_incremental_input): New function.
5839         (queue_middle_tasks): Don't force valid target for incremental
5840         update.
5841         * incremental-dump.cc (find_input_containing_global): Adjust
5842         size of symbol info entry.
5843         (dump_incremental_inputs): Dump argument serial number and
5844         in_system_directory flag; bias shndx by 1; print symbol names
5845         when dumping per-file symbol lists; use new symbol info readers.
5846         * incremental.cc
5847         (Output_section_incremental_inputs:update_data_size): New function.
5848         (Sized_incremental_binary::setup_readers): Setup input readers
5849         for each input file; build maps for files added from libraries
5850         and scripts.
5851         (Sized_incremental_binary::check_input_args): New function.
5852         (Sized_incremental_binary::do_check_inputs): Build map of argument
5853         serial numbers to input arguments.
5854         (Sized_incremental_binary::do_file_has_changed): Rename
5855         do_file_is_unchanged to this; compare file modification times.
5856         (Sized_incremental_binary::do_init_layout): New function.
5857         (Sized_incremental_binary::do_reserve_layout): New function.
5858         (Sized_incremental_binary::do_get_input_reader): Remove.
5859         (Sized_incremental_binary::get_symtab_view): New function.
5860         (Incremental_checker::can_incrementally_link_output_file): Remove.
5861         (Incremental_inputs::report_command_line): Exclude --debug options.
5862         (Incremental_inputs::report_archive_begin): Add parameter; track
5863         argument serial numbers; don't put input file entry for archive
5864         before archive members.
5865         (Incremental_inputs::report_archive_end): Put input file entry
5866         for archive after archive members.
5867         (Incremental_inputs::report_object): Add parameter; track argument
5868         serial numbers and in_system_directory flag.
5869         (Incremental_inputs::report_script): Add parameter; track argument
5870         serial numbers.
5871         (Output_section_incremental_inputs::set_final_data_size): Adjust
5872         size of symbol info entry; check for forwarding symbols.
5873         (Output_section_incremental_inputs::write_input_files): Write
5874         in_system_directory flag and argument serial number.
5875         (Output_section_incremental_inputs::write_info_blocks): Map section
5876         indices between incremental info and original input file; store
5877         input section index for each symbol.
5878         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5879         change operator() to visit().
5880         (class Global_got_offset_visitor): Likewise.
5881         (class Global_symbol_visitor_got_plt):
5882         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5883         classes.
5884         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5885         (Sized_incr_relobj::do_read_symbols): New function.
5886         (Sized_incr_relobj::do_layout): New function.
5887         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5888         (Sized_incr_relobj::do_add_symbols): New function.
5889         (Sized_incr_relobj::do_should_include_member): New function.
5890         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5891         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5892         (Sized_incr_relobj::do_section_size): New function.
5893         (Sized_incr_relobj::do_section_name): New function.
5894         (Sized_incr_relobj::do_section_contents): New function.
5895         (Sized_incr_relobj::do_section_flags): New function.
5896         (Sized_incr_relobj::do_section_entsize): New function.
5897         (Sized_incr_relobj::do_section_address): New function.
5898         (Sized_incr_relobj::do_section_type): New function.
5899         (Sized_incr_relobj::do_section_link): New function.
5900         (Sized_incr_relobj::do_section_info): New function.
5901         (Sized_incr_relobj::do_section_addralign): New function.
5902         (Sized_incr_relobj::do_initialize_xindex): New function.
5903         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5904         (Sized_incr_relobj::do_read_relocs): New function.
5905         (Sized_incr_relobj::do_gc_process_relocs): New function.
5906         (Sized_incr_relobj::do_scan_relocs): New function.
5907         (Sized_incr_relobj::do_count_local_symbols): New function.
5908         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5909         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5910         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5911         (Sized_incr_relobj::do_relocate): New function.
5912         (Sized_incr_relobj::do_set_section_offset): New function.
5913         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5914         (Sized_incr_dynobj::do_read_symbols): New function.
5915         (Sized_incr_dynobj::do_layout): New function.
5916         (Sized_incr_dynobj::do_add_symbols): New function.
5917         (Sized_incr_dynobj::do_should_include_member): New function.
5918         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5919         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5920         (Sized_incr_dynobj::do_section_size): New function.
5921         (Sized_incr_dynobj::do_section_name): New function.
5922         (Sized_incr_dynobj::do_section_contents): New function.
5923         (Sized_incr_dynobj::do_section_flags): New function.
5924         (Sized_incr_dynobj::do_section_entsize): New function.
5925         (Sized_incr_dynobj::do_section_address): New function.
5926         (Sized_incr_dynobj::do_section_type): New function.
5927         (Sized_incr_dynobj::do_section_link): New function.
5928         (Sized_incr_dynobj::do_section_info): New function.
5929         (Sized_incr_dynobj::do_section_addralign): New function.
5930         (Sized_incr_dynobj::do_initialize_xindex): New function.
5931         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5932         (make_sized_incremental_object): New function.
5933         (Incremental_library::copy_unused_symbols): New function.
5934         (Incremental_library::do_for_all_unused_symbols): New function.
5935         * incremental.h (enum Incremental_input_flags): New type.
5936         (class Incremental_checker): Remove.
5937         (Incremental_input_entry::Incremental_input_entry): Add argument
5938         serial number.
5939         (Incremental_input_entry::arg_serial): New function.
5940         (Incremental_input_entry::set_is_in_system_directory): New function.
5941         (Incremental_input_entry::is_in_system_directory): New function.
5942         (Incremental_input_entry::arg_serial_): New data member.
5943         (Incremental_input_entry::is_in_system_directory_): New data member.
5944         (class Script_info): Move here from script.h.
5945         (Script_info::Script_info): Add filename parameter.
5946         (Script_info::filename): New function.
5947         (Script_info::filename_): New data member.
5948         (Incremental_script_entry::Incremental_script_entry): Add argument
5949         serial number.
5950         (Incremental_object_entry::Incremental_object_entry): Likewise.
5951         (Incremental_object_entry::add_input_section): Build list of input
5952         sections with map to original shndx.
5953         (Incremental_object_entry::get_input_section_index): New function.
5954         (Incremental_object_entry::shndx_): New data member.
5955         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5956         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5957         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5958         serial number.
5959         (Incremental_inputs::report_archive_begin): Likewise.
5960         (Incremental_inputs::report_object): Likewise.
5961         (Incremental_inputs::report_script): Likewise.
5962         (class Incremental_global_symbol_reader): New class.
5963         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5964         and store flags and input file type.
5965         (Incremental_input_entry_reader::arg_serial): New function.
5966         (Incremental_input_entry_reader::type): Extract type from flags.
5967         (Incremental_input_entry_reader::is_in_system_directory): New function.
5968         (Incremental_input_entry_reader::get_input_section_count): Call
5969         accessor function for type.
5970         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5971         function for type; adjust size of global symbol entry.
5972         (Incremental_input_entry_reader::get_global_symbol_count): Call
5973         accessor function for type.
5974         (Incremental_input_entry_reader::get_object_count): Likewise.
5975         (Incremental_input_entry_reader::get_object_offset): Likewise.
5976         (Incremental_input_entry_reader::get_member_count): Likewise.
5977         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5978         (Incremental_input_entry_reader::get_member_offset): Likewise.
5979         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5980         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5981         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5982         (Incremental_input_entry_reader::get_global_symbol_reader): New
5983         function.
5984         (Incremental_input_entry_reader::get_output_symbol_index): New
5985         function.
5986         (Incremental_input_entry_reader::type_): Remove.
5987         (Incremental_input_entry_reader::flags_): New data member.
5988         (Incremental_inputs_reader::input_file_offset): New function.
5989         (Incremental_inputs_reader::input_file_index): New function.
5990         (Incremental_inputs_reader::input_file): Call input_file_offset.
5991         (Incremental_inputs_reader::input_file_at_offset): New function.
5992         (Incremental_relocs_reader::get_r_type): Reformat.
5993         (Incremental_relocs_reader::get_r_shndx): Reformat.
5994         (Incremental_relocs_reader::get_r_offset): Reformat.
5995         (Incremental_relocs_reader::data): New function.
5996         (Incremental_binary::Incremental_binary): Initialize new data members.
5997         (Incremental_binary::check_inputs): Add cmdline parameter.
5998         (Incremental_binary::file_is_unchanged): Remove.
5999         (Input_reader::arg_serial): New function.
6000         (Input_reader::get_unused_symbol_count): New function.
6001         (Input_reader::get_unused_symbol): New function.
6002         (Input_reader::do_arg_serial): New function.
6003         (Input_reader::do_get_unused_symbol_count): New function.
6004         (Input_reader::do_get_unused_symbol): New function.
6005         (Incremental_binary::input_file_count): New function.
6006         (Incremental_binary::get_input_reader): Change signature to use
6007         index instead of filename.
6008         (Incremental_binary::file_has_changed): New function.
6009         (Incremental_binary::get_input_argument): New function.
6010         (Incremental_binary::get_library): New function.
6011         (Incremental_binary::get_script_info): New function.
6012         (Incremental_binary::init_layout): New function.
6013         (Incremental_binary::reserve_layout): New function.
6014         (Incremental_binary::output_file): New function.
6015         (Incremental_binary::do_check_inputs): New function.
6016         (Incremental_binary::do_file_is_unchanged): Remove.
6017         (Incremental_binary::do_file_has_changed): New function.
6018         (Incremental_binary::do_init_layout): New function.
6019         (Incremental_binary::do_reserve_layout): New function.
6020         (Incremental_binary::do_input_file_count): New function.
6021         (Incremental_binary::do_get_input_reader): Change signature.
6022         (Incremental_binary::input_args_map_): New data member.
6023         (Incremental_binary::library_map_): New data member.
6024         (Incremental_binary::script_map_): New data member.
6025         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6026         new data members.
6027         (Sized_incremental_binary::output_section): New function.
6028         (Sized_incremental_binary::inputs_reader): Add const.
6029         (Sized_incremental_binary::symtab_reader): Add const.
6030         (Sized_incremental_binary::relocs_reader): Add const.
6031         (Sized_incremental_binary::got_plt_reader): Add const.
6032         (Sized_incremental_binary::get_symtab_view): New function.
6033         (Sized_incremental_binary::Inputs_reader): New typedef.
6034         (Sized_incremental_binary::Input_entry_reader): New typedef.
6035         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6036         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6037         (Sized_incremental_binary::do_file_has_changed): New function.
6038         (Sized_incremental_binary::do_init_layout): New function.
6039         (Sized_incremental_binary::do_reserve_layout): New function.
6040         (Sized_input_reader::Inputs_reader): Remove.
6041         (Sized_input_reader::Input_entry_reader): Remove.
6042         (Sized_input_reader::do_arg_serial): New function.
6043         (Sized_input_reader::do_get_unused_symbol_count): New function.
6044         (Sized_input_reader::do_get_unused_symbol): New function.
6045         (Sized_incremental_binary::do_input_file_count): New function.
6046         (Sized_incremental_binary::do_get_input_reader): Change signature;
6047         use index instead of filename.
6048         (Sized_incremental_binary::section_map_): New data member.
6049         (Sized_incremental_binary::input_entry_readers_): New data member.
6050         (class Sized_incr_relobj): New class.
6051         (class Sized_incr_dynobj): New class.
6052         (make_sized_incremental_object): New function.
6053         (class Incremental_library): New class.
6054         * layout.cc (Free_list::num_lists): New static data member.
6055         (Free_list::num_nodes): New static data member.
6056         (Free_list::num_removes): New static data member.
6057         (Free_list::num_remove_visits): New static data member.
6058         (Free_list::num_allocates): New static data member.
6059         (Free_list::num_allocate_visits): New static data member.
6060         (Free_list::init): New function.
6061         (Free_list::remove): New function.
6062         (Free_list::allocate): New function.
6063         (Free_list::dump): New function.
6064         (Free_list::print_stats): New function.
6065         (Layout_task_runner::run): Resize output file for incremental updates.
6066         (Layout::Layout): Initialize new data members.
6067         (Layout::set_incremental_base): New function.
6068         (Layout::init_fixed_output_section): New function.
6069         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6070         incremental updates.
6071         (Layout::create_gold_note): Do not create gold note section for
6072         incremental updates.
6073         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6074         for incremental updates.
6075         (Layout::set_section_offsets): For incremental updates, allocate space
6076         from free list.
6077         (Layout::create_symtab_sections): Layout with offsets relative to
6078         start of section; for incremental updates, allocate space from free
6079         list.
6080         (Layout::create_shdrs): For incremental updates, allocate space from
6081         free list.
6082         (Layout::finish_dynamic_section): For incremental updates, do not
6083         check --as-needed (fixed in subsequent patch).
6084         * layout.h (class Free_list): New class.
6085         (Layout::set_incremental_base): New function.
6086         (Layout::incremental_base): New function.
6087         (Layout::init_fixed_output_section): New function.
6088         (Layout::allocate): New function.
6089         (Layout::incremental_base_): New data member.
6090         (Layout::free_list_): New data member.
6091         * main.cc (main): Print Free_list statistics.
6092         * object.cc (Relobj::finalize_incremental_relocs): Add
6093         clear_counts parameter; clear counts only when clear_counts is set.
6094         (Sized_relobj::Sized_relobj): Initialize new base class.
6095         (Sized_relobj::do_layout): Don't report special sections.
6096         (Sized_relobj::do_for_all_local_got_entries): New function.
6097         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6098         symtab_off to all symbol table offsets.
6099         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6100         * object.h (class Got_offset_list): Move to top of file.
6101         (Object::Object): Allow case where input_file == NULL.
6102         (Object::~Object): Likewise.
6103         (Object::input_file): Assert that input_file != NULL.
6104         (Object::lock): Allow case where input_file == NULL.
6105         (Object::unlock): Likewise.
6106         (Object::is_locked): Likewise.
6107         (Object::token): Likewise.
6108         (Object::release): Likewise.
6109         (Object::is_incremental): New function.
6110         (Object::get_mtime): New function.
6111         (Object::for_all_local_got_entries): New function.
6112         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6113         (Object::set_is_in_system_directory): New function.
6114         (Object::is_in_system_directory): New function.
6115         (Object::do_is_incremental): New function.
6116         (Object::do_get_mtime): New function.
6117         (Object::do_for_all_local_got_entries): New function.
6118         (Object::is_in_system_directory_): New data member.
6119         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6120         (class Sized_relobj_base): New class.
6121         (class Sized_relobj): Derive from Sized_relobj_base.
6122         (class Sized_relobj::Symbols): Redeclare from base class.
6123         (class Sized_relobj::local_got_offset_list): Remove.
6124         (class Sized_relobj::Output_sections): Redeclare from base class.
6125         (class Sized_relobj::do_for_all_local_got_entries): New function.
6126         (class Sized_relobj::write_local_symbols): Add offset parameter.
6127         (class Sized_relobj::local_symbol_offset_): Update comment.
6128         (class Sized_relobj::local_dynsym_offset_): Update comment.
6129         * options.cc (Input_arguments::add_file): Remove const.
6130         * options.h (Input_file_argument::Input_file_argument):
6131         Initialize arg_serial_ (all constructors).
6132         (Input_file_argument::set_arg_serial): New function.
6133         (Input_file_argument::arg_serial): New function.
6134         (Input_file_argument::arg_serial_): New data member.
6135         (Input_arguments::Input_arguments): Initialize file_count_.
6136         (Input_arguments::add_file): Remove const.
6137         (Input_arguments::number_of_input_files): New function.
6138         (Input_arguments::file_count_): New data member.
6139         (Command_line::number_of_input_files): Call
6140         Input_arguments::number_of_input_files.
6141         * output.cc (Output_segment_headers::Output_segment_headers):
6142         Set current size.
6143         (Output_section::Input_section::current_data_size): New function.
6144         (Output_section::Output_section): Initialize new data members.
6145         (Output_section::add_input_section): Don't do merge sections for
6146         an incremental link; allocate space from free list for an
6147         incremental update.
6148         (Output_section::add_output_section_data): Allocate space from
6149         free list for an incremental update.
6150         (Output_section::update_data_size): New function.
6151         (Output_section::set_fixed_layout): New function.
6152         (Output_section::reserve): New function.
6153         (Output_segment::set_section_addresses): Remove const.
6154         (Output_segment::set_section_list_addresses): Remove const; allocate
6155         space from free list for an incremental update.
6156         (Output_segment::set_offset): Adjust size of RELRO segment for an
6157         incremental update.
6158         * output.h (Output_data::current_data_size): Move here from
6159         child classes.
6160         (Output_data::pre_finalize_data_size): New function.
6161         (Output_data::update_data_size): New function.
6162         (Output_section_headers::update_data_size): new function.
6163         (Output_section_data_build::current_data_size): Move to Output_data.
6164         (Output_data_strtab::update_data_size): New function.
6165         (Output_section::current_data_size): Move to Output_data.
6166         (Output_section::set_fixed_layout): New function.
6167         (Output_section::has_fixed_layout): New function.
6168         (Output_section::reserve): New function.
6169         (Output_section::update_data_size): New function.
6170         (Output_section::has_fixed_layout_): New data member.
6171         (Output_section::free_list_): New data member.
6172         (Output_segment::set_section_addresses): Remove const.
6173         (Output_segment::set_section_list_addresses): Remove const.
6174         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6175         New function.
6176         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6177         New function.
6178         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6179         parameter when calling Add_symbols constructor; store argument
6180         serial number for members of a lib group.
6181         (Add_symbols::locks): Allow case where token == NULL.
6182         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6183         (Read_member::~Read_member): New function.
6184         (Read_member::is_runnable): New function.
6185         (Read_member::locks): New function.
6186         (Read_member::run): New function.
6187         (Check_script::~Check_script): New function.
6188         (Check_script::is_runnable): New function.
6189         (Check_script::locks): New function.
6190         (Check_script::run): New function.
6191         (Check_library::~Check_library): New function.
6192         (Check_library::is_runnable): New function.
6193         (Check_library::locks): New function.
6194         (Check_library::run): New function.
6195         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6196         (Add_symbols::library_): New data member.
6197         (class Read_member): New class.
6198         (class Check_script): New class.
6199         (class Check_library): New class.
6200         * reloc.cc (Read_relocs::is_runnable): Allow case where
6201         token == NULL.
6202         (Read_relocs::locks): Likewise.
6203         (Scan_relocs::locks): Likewise.
6204         (Relocate_task::locks): Likewise.
6205         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6206         to clear counters.
6207         (Sized_relobj::incremental_relocs_scan): Fix comment.
6208         (Sized_relobj::do_relocate): Pass output file offset to
6209         write_local_symbols.
6210         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6211         from class declaration.
6212         * script.cc (read_input_script): Allocate Script_info; pass
6213         argument serial number to report_script.
6214         * script.h (class Script_info): Move to incremental.h.
6215         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6216         * symtab.h (Symbol_table::add_from_incrobj): New function.
6217         (Symbol_table::set_file_offset): New function.
6218
6219 2011-04-05  Cary Coutant  <ccoutant@google.com>
6220
6221         * incremental-dump.cc (dump_incremental_inputs): Change signature
6222         to take a Sized_incremental_binary; change caller.  Use readers
6223         in Sized_incremental_binary.
6224         * incremental.cc
6225         (Sized_incremental_binary::find_incremental_inputs_sections):
6226         Rename do_find_incremental_inputs_sections to this.
6227         (Sized_incremental_binary::setup_readers): New function.
6228         (Sized_incremental_binary::do_check_inputs): Check
6229         has_incremental_info_ flag; move setup code to setup_readers;
6230         use input readers.
6231         (Sized_incremental_binary::do_file_is_unchanged): New function.
6232         (Sized_incremental_binary::do_get_input_reader): New function.
6233         * incremental.h (class Incremental_binary): Move to end of file.
6234         (Incremental_binary::file_is_unchanged): New function.
6235         (Incremental_binary::do_file_is_unchanged): New function.
6236         (Incremental_binary::Input_reader): New class.
6237         (Incremental_binary::get_input_reader): New function.
6238         (class Sized_incremental_binary): Move to end of file.
6239         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6240         input section reader classes.
6241         (Sized_incremental_binary::has_incremental_info): New function.
6242         (Sized_incremental_binary::inputs_reader): New function.
6243         (Sized_incremental_binary::symtab_reader): New function.
6244         (Sized_incremental_binary::relocs_reader): New function.
6245         (Sized_incremental_binary::got_plt_reader): New function.
6246         (Sized_incremental_binary::do_file_is_unchanged): New function.
6247         (Sized_incremental_binary::Sized_input_reader): New class.
6248         (Sized_incremental_binary::get_input_reader): New function.
6249         (Sized_incremental_binary::find_incremental_inputs_sections):
6250         Rename do_find_incremental_inputs_sections to this.
6251         (Sized_incremental_binary::setup_readers): New function.
6252         (Sized_incremental_binary::has_incremental_info_): New data member.
6253         (Sized_incremental_binary::inputs_reader_): New data member.
6254         (Sized_incremental_binary::symtab_reader_): New data member.
6255         (Sized_incremental_binary::relocs_reader_): New data member.
6256         (Sized_incremental_binary::got_plt_reader_): New data member.
6257         (Sized_incremental_binary::current_input_file_): New data member.
6258
6259 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6260
6261         PR gold/12640
6262         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6263         violation.
6264
6265 2011-03-30  Cary Coutant  <ccoutant@google.com>
6266
6267         * archive.cc (Archive::include_member): Adjust call to report_object.
6268         (Add_archive_symbols::run): Add script_info to call to
6269         report_archive_begin.
6270         (Lib_group::include_member): Adjust call to report_object.
6271         (Add_lib_group_symbols::run): Adjust call to report_object.
6272         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6273         blocks.  Add object count for script input files.
6274         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6275         script_info parameter; change all callers.
6276         (Incremental_inputs::report_object): Add script_info parameter;
6277         change all callers.
6278         (Incremental_inputs::report_script): Store backpointer to
6279         incremental info entry.
6280         (Output_section_incremental_inputs::set_final_data_size): Record
6281         additional information for scripts.
6282         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6283         * incremental.h (Incremental_script_entry::add_object): New function.
6284         (Incremental_script_entry::get_object_count): New function.
6285         (Incremental_script_entry::get_object): New function.
6286         (Incremental_script_entry::objects_): New data member; adjust
6287         constructor.
6288         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6289         (Incremental_inputs::report_object): Add script_info parameter.
6290         (Incremental_inputs_reader::get_object_count): New function.
6291         (Incremental_inputs_reader::get_object_offset): New function.
6292         * options.cc (Input_arguments::add_file): Return reference to
6293         new input argument.
6294         * options.h (Input_argument::set_script_info): New function.
6295         (Input_argument::script_info): New function.
6296         (Input_argument::script_info_): New data member; adjust all
6297         constructors.
6298         (Input_file_group::add_file): Return reference to new input argument.
6299         (Input_file_lib::add_file): Likewise.
6300         (Input_arguments::add_file): Likewise.
6301         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6302         * script.cc (Parser_closure::Parser_closure): Add script_info
6303         parameter; adjust all callers.
6304         (Parser_closure::script_info): New function.
6305         (Parser_closure::script_info_): New data member.
6306         (read_input_script): Report scripts earlier to incremental info.
6307         (script_add_file): Set script_info in Input_argument.
6308         (script_add_library): Likewise.
6309         * script.h (Script_options::Script_info): Rewrite class.
6310
6311 2011-03-29  Cary Coutant  <ccoutant@google.com>
6312
6313         * archive.cc (Library_base::should_include_member): Move
6314         method here from class Archive.
6315         (Archive::Archive): Initialize base class.
6316         (Archive::should_include_member): Move to base class.
6317         (Archive::do_for_all_unused_symbols): New function.
6318         (Add_archive_symbols::run): Remove redundant access to
6319         incremental_inputs.
6320         (Lib_group::Lib_group): Initialize base class.
6321         (Lib_group::do_filename): New function.
6322         (Lib_group::include_member): Pass pointer to Lib_group to
6323         report_object.
6324         (Lib_group::do_for_all_unused_symbols): New function.
6325         (Add_lib_group_symbols::run): Report archive information for
6326         incremental links.
6327         * archive.h (class Library_base): New base class.
6328         (class Archive): Derive from Library_base.
6329         (Archive::filename): Move to base class.
6330         (Archive::set_incremental_info): Likewise.
6331         (Archive::incremental_info): Likewise.
6332         (Archive::Should_include): Likewise.
6333         (Archive::should_include_member): Likewise.
6334         (Archive::Armap_entry): Remove.
6335         (Archive::Unused_symbol_iterator): Remove.
6336         (Archive::unused_symbols_begin): Remove.
6337         (Archive::unused_symbols_end): Remove.
6338         (Archive::do_filename): New function.
6339         (Archive::do_get_mtime): New function.
6340         (Archive::do_for_all_unused_symbols): New function.
6341         (Archive::task_): Move to base class.
6342         (Archive::incremental_info_): Likewise.
6343         (class Lib_group): Derive from Library_base.
6344         (Lib_group::do_filename): New function.
6345         (Lib_group::do_get_mtime): New function.
6346         (Lib_group::do_for_all_unused_symbols): New function.
6347         (Lib_group::task_): Move to base class.
6348         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6349         function.
6350         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6351         function.
6352         * incremental.cc (Incremental_inputs::report_archive_begin):
6353         Use Library_base; call library's get_mtime; add incremental inputs
6354         entry before members.
6355         (class Unused_symbol_visitor): New class.
6356         (Incremental_inputs::report_archive_end): Use Library_base; use
6357         visitor class to record unused symbols; don't add incremental inputs
6358         entry after members.
6359         (Incremental_inputs::report_object): Use Library_base.
6360         * incremental.h
6361         (Incremental_archive_entry::Incremental_archive_entry): Remove
6362         unused Archive parameter.
6363         (Incremental_inputs::report_archive_begin): Use Library_base.
6364         (Incremental_inputs::report_archive_end): Likewise.
6365         (Incremental_inputs::report_object): Likewise.
6366         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6367         function.
6368         * object.h (Object::for_all_global_symbols): New function.
6369         (Object::do_for_all_global_symbols): New function.
6370         (Sized_relobj::do_for_all_global_symbols): New function.
6371         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6372         function.
6373         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6374         function.
6375
6376 2011-03-27  Ian Lance Taylor  <iant@google.com>
6377
6378         * archive.cc (Archive::interpret_header): Return -1 if something
6379         goes wrong.  Change callers accordingly.
6380
6381 2011-03-25  Cary Coutant  <ccoutant@google.com>
6382
6383         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6384         * testsuite/Makefile.in: Regenerate.
6385
6386 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6387
6388         * plugin.cc (get_view): New.
6389         (Plugin::load): Pass get_view to the plugin.
6390         (Plugin_manager::get_view): New.
6391
6392 2011-03-21  Ian Lance Taylor  <iant@google.com>
6393
6394         * testsuite/final_layout.sh: Rewrite to not use dc.
6395         * testsuite/relro_test.sh: Fail if dc is not present.
6396
6397 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6398
6399         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6400         Change == to -eq.
6401         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6402         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6403         Change == to -eq.
6404         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6405         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6406
6407 2011-03-14  Ian Lance Taylor  <iant@google.com>
6408
6409         * script-sections.cc (Sort_output_sections::script_compare):
6410         Rename from is_before, change return type.
6411         (Sort_output_sections::operator()): Adjust accordingly.
6412
6413 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6414
6415         PR gold/12572
6416         * testsuite/odr_violation2.cc: Add comment to make all error line
6417         numbers double digits.
6418         * testsuite/debug_msg.sh: Adjust expected errors.
6419
6420 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6421
6422         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6423         but mark earlier ones as non-canonical
6424         (offset_to_iterator): Update search target and example
6425         (do_addr2line): Return extra lines in a vector*
6426         (format_file_lineno): Extract from do_addr2line
6427         (one_addr2line): Add vector* out-param
6428         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6429         when a lineno entry appeared last for its instruction
6430         (Dwarf_line_info): Add vector* out-param
6431         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6432         * symtab.cc (Odr_violation_compare): Include the lineno in the
6433         comparison again.
6434         (linenos_from_loc): New. Combine the canonical line for an
6435         address with its other lines.
6436         (True_if_intersect): New. Helper functor to make
6437         std::set_intersection a query.
6438         (detect_odr_violations): Compare sets of lines instead of just
6439         one line for each function. This became less deterministic, but
6440         has fewer false positives.
6441         * symtab.h: Declarations.
6442         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6443         mix an optimized and non-optimized object in the same binary
6444         (odr_violation2.so): Same.
6445         * testsuite/Makefile.in: Regenerate from Makefile.am.
6446         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6447         * testsuite/debug_msg.sh: Update line numbers and add
6448         assertions.
6449         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6450         non-optimized context.
6451         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6452         isn't inlined, and use OdrDerived in an optimized context.
6453         * testsuite/odr_header1.h: Defines OdrDerived, where
6454         optimization will change the
6455         first-instruction-in-the-destructor's file and line number.
6456         * testsuite/odr_header2.h: Defines OdrBase.
6457
6458 2011-03-09  Ian Lance Taylor  <iant@google.com>
6459
6460         * fileread.cc (File_read::clear_views): Don't delete the whole
6461         file view.
6462
6463 2011-03-08  Ian Lance Taylor  <iant@google.com>
6464
6465         PR gold/12525
6466         * fileread.cc: #include <climits>.
6467         (GOLD_IOV_MAX): Define.
6468         (File_read::read_multiple): Limit number of entries by iov_max.
6469         * fileread.h (class File_read): Always set max_readv_entries to
6470         128.
6471
6472 2011-03-07  Ian Lance Taylor  <iant@google.com>
6473
6474         PR gold/12525
6475         * options.h (class General_options): Add -dy and -dn.
6476
6477 2011-03-02  Cary Coutant  <ccoutant@google.com>
6478
6479         * testsuite/script_test_9.t: Add TLS segment.
6480
6481 2011-03-02  Simon Baldwin  <simonb@google.com>
6482
6483         * configure.ac: Add check for gnu_indirect_function support in
6484         the toolchain building binutils.
6485         * configure: Rebuild.
6486
6487 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6488
6489         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6490         plugin only symbols.
6491         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6492         in plugin files as not needed in the symbol table.
6493
6494 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6495
6496         * output.cc (Output_section::add_input_section): Delay fill
6497         generation for section ordering.
6498
6499 2011-02-09  Ian Lance Taylor  <iant@google.com>
6500
6501         PR gold/12316
6502         * object.h (class Sized_relobj): Remove clear_local_symbols.
6503         * reloc.cc (Sized_relobj::do_relocate): Don't call
6504         clear_local_symbols.
6505
6506 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6507
6508         * plugin.cc (is_visible_from_outside): Return true for symbols
6509         in the -u option.
6510
6511 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6512
6513         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6514         filename.
6515
6516 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6517
6518         * icf.h (is_section_foldable_candidate): Change type of parameter
6519         to std::string.
6520         * icf.cc (Icf::find_identical_sections): Change type of local variable
6521         section_name to be std::string.
6522         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6523
6524 2011-01-25  Ian Lance Taylor  <iant@google.com>
6525
6526         * script.cc (script_add_extern): Rewrite to use
6527         add_symbol_reference.
6528
6529 2011-01-25  Doug Kwan  <dougkwan@google.com>
6530
6531         * icf.cc (get_section_contents): Always lock section's object.
6532
6533 2011-01-24  Ian Lance Taylor  <iant@google.com>
6534
6535         * options.h (class General_options): Accept
6536         --no-detect-odr-violations.
6537
6538 2011-01-24  Ian Lance Taylor  <iant@google.com>
6539
6540         * version.cc (version_string): Bump to 1.11.
6541
6542 2011-01-24  Ian Lance Taylor  <iant@google.com>
6543
6544         * plugin.cc (class Plugin_rescan): Define new class.
6545         (Plugin_manager::claim_file): Set any_claimed_.
6546         (Plugin_manager::save_archive): New function.
6547         (Plugin_manager::save_input_group): New function.
6548         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6549         necessary.
6550         (Plugin_manager::new_undefined_symbol): New function.
6551         (Plugin_manager::rescan): New function.
6552         (Plugin_manager::rescannable_defines): New function.
6553         (Plugin_manager::add_input_file): Set any_added_.
6554         * plugin.h (class Plugin_manager): define new fields rescannable_,
6555         undefined_symbols_, any_claimed_, and any_added_.  Declare
6556         Plugin_rescan as friend.  Declare new functions.
6557         (Plugin_manager::Rescannable): Define type.
6558         (Plugin_manager::Rescannable_list): Define type.
6559         (Plugin_manager::Undefined_symbol_list): Define type.
6560         (Plugin_manager::Plugin_manager): Initialize new fields.
6561         * archive.cc (Archive::defines_symbol): New function.
6562         (Add_archive_symbols::run): Pass archive to plugins if any.
6563         * archive.h (class Archive): Declare defines_symbol.
6564         * readsyms.cc (Input_group::~Input_group): New function.
6565         (Finish_group::run): Pass input_group to plugins if any.
6566         * readsyms.h (class Input_group): Declare destructor.
6567         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6568         any.
6569
6570 2011-01-10  Ian Lance Taylor  <iant@google.com>
6571
6572         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6573         section as relro.
6574         (Layout::set_segment_offsets): Reset increase_relro before calling
6575         set_section_addresses a second time.
6576
6577 2011-01-04  Cary Coutant  <ccoutant@google.com>
6578
6579         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6580         sections before NOBITS sections.
6581
6582 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6583
6584         * version.cc (print_version): Update copyright to 2011.
6585
6586 2010-12-23  Cary Coutant  <ccoutant@google.com>
6587
6588         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6589         of OS to this->add.  Add OD parameter to second form of the function.
6590
6591 2010-12-20  Ian Lance Taylor  <iant@google.com>
6592
6593         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6594         second of two consecutive entries with same offset.
6595
6596 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6597
6598         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6599         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6600         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6601         to avoid unneeded links against $(LDADD).
6602         * testsuite/Makefile.in: Regenerate.
6603
6604 2010-12-15  Ian Lance Taylor  <iant@google.com>
6605
6606         PR gold/12324
6607         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6608         for R_X86_64_32 and R_X86_64_PC32.
6609         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6610         ver_matching_def_pic.o.
6611         (ver_matching_def_pic.o): New target.
6612
6613 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6614
6615         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6616         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6617         Move definition before File_read::View member definitions.
6618         (File_read::View::~View): Initialize and hold lock before
6619         updating current_mapped_bytes.
6620
6621 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6622
6623         * dwarf_reader.cc: Remove outdated comment.
6624         * gold-threads.cc: Fix typo in error message.
6625         * archive.cc: Fix typos in comments.
6626         * archive.h: Likewise.
6627         * arm-reloc-property.cc: Likewise.
6628         * arm-reloc-property.h: Likewise.
6629         * arm-reloc.def: Likewise.
6630         * arm.cc: Likewise.
6631         * attributes.h: Likewise.
6632         * cref.cc: Likewise.
6633         * ehframe.cc: Likewise.
6634         * fileread.h: Likewise.
6635         * gold.h: Likewise.
6636         * i386.cc: Likewise.
6637         * icf.cc: Likewise.
6638         * incremental.h: Likewise.
6639         * int_encoding.cc: Likewise.
6640         * layout.h: Likewise.
6641         * main.cc: Likewise.
6642         * merge.h: Likewise.
6643         * object.cc: Likewise.
6644         * object.h: Likewise.
6645         * options.cc: Likewise.
6646         * readsyms.cc: Likewise.
6647         * reduced_debug_output.cc: Likewise.
6648         * reloc.cc: Likewise.
6649         * script-sections.cc: Likewise.
6650         * sparc.cc: Likewise.
6651         * symtab.h: Likewise.
6652         * target-reloc.h: Likewise.
6653         * target.cc: Likewise.
6654         * target.h: Likewise.
6655         * timer.cc: Likewise.
6656         * timer.h: Likewise.
6657         * x86_64.cc: Likewise.
6658
6659 2010-12-09  Cary Coutant  <ccoutant@google.com>
6660
6661         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6662         stack.
6663         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6664         parameter; change all callers.
6665         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6666         * options.h (warn_execstack): New option.
6667
6668 2010-12-07  Doug Kwan  <dougkwan@google.com>
6669
6670         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6671         like function call relocations.
6672
6673 2010-12-07  Ian Lance Taylor  <iant@google.com>
6674
6675         * archive.cc (Archive::get_elf_object_for_member): Permit
6676         punconfigured to be NULL.
6677         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6678         (Archive::include_member): Pass NULL to get_elf_object_for_member
6679         if we searched for the archive and this is the first included
6680         object.
6681
6682 2010-12-01  Ian Lance Taylor  <iant@google.com>
6683
6684         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6685         track_relocs_type_ field.
6686         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6687         Set track_relocs_type_.
6688         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6689         contents when using RELA relocs.
6690         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6691         reloc_map_.
6692         * reloc.cc (Track_relocs::next_addend): New function.
6693         * reloc.h (class Track_relocs): Declare next_addend.
6694
6695 2010-12-01  Ian Lance Taylor  <iant@google.com>
6696
6697         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6698         virtual destructor.
6699
6700 2010-12-01  Ian Lance Taylor  <iant@google.com>
6701
6702         * README: Update compilers known to work and fail.
6703
6704 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6705
6706         * configure.in: For --enable-gold, handle value `default' instead of
6707         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6708         not the default.
6709         * configure: Regenerate.
6710
6711 2010-11-18  Doug Kwan  <dougkwan@google.com>
6712
6713         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6714         and right_alignment to be zero.  Store result alignment only if it is
6715         greater than existing alignment.
6716
6717 2010-11-16  Cary Coutant  <ccoutant@google.com>
6718
6719         PR gold/12220
6720         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6721         Check for ".zdebug_line".
6722
6723 2010-11-16  Doug Kwan  <dougkwan@google.com>
6724             Cary Coutant  <ccoutant@google.com>
6725
6726         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6727         by reference; adjust all callers.
6728         * output.cc (Output_segment::set_section_addresses): Adjust references
6729         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6730         list is empty.
6731         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6732         end at page boundary.
6733
6734 2010-11-16  Cary Coutant  <ccoutant@google.com>
6735
6736         PR gold/12220
6737         * layout.cc (Layout::choose_output_section): Transform names of
6738         compressed sections even when using a script with a SECTIONS clause.
6739         (Layout::output_section_name): Remove code to transform
6740         compressed debug section names.
6741         * output.cc (Output_section::add_input_section): Use uncompressed
6742         section size when tracking input sections.
6743
6744 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6745
6746         * symtab.h (Symbol::NON_PIC_REF): Remove.
6747         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6748         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6749         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6750         (Symbol::use_plt_offset): Take a flags argument and pass it
6751         directly to needs_dynamic_reloc.  Restrict check for undefined
6752         weak symbols to function calls.
6753         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6754         (Target_arm::Scan::global): Use it.
6755         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6756         (Target_arm::Relocate::relocate): Likewise.
6757         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6758         parameter with an r_type parameter.  Use get_reference_flags
6759         to get the flags.
6760         (Target_arm::Relocate::relocate): Update accordingly.
6761         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6762         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6763         (Target_i386::Scan::global): Likewise.
6764         (Target_i386::Relocate::relocate): Likewise.
6765         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6766         parameter with an r_type parameter.  Use get_reference_flags
6767         to get the flags.
6768         (Target_i386::Relocate::relocate): Update accordingly.
6769         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6770         (Target_powerpc::Scan::global): Use it.
6771         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6772         (Target_powerpc::Relocate::relocate): Likewise.
6773         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6774         (Target_sparc::Scan::global): Use it.
6775         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6776         (Target_sparc::Relocate::relocate): Likewise.
6777         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6778         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6779         (Target_x86_64::Scan::global): Likewise.
6780         (Target_x86_64::Relocate::relocate): Likewise.
6781
6782 2010-11-08  Doug Kwan  <dougkwan@google.com>
6783             Cary Coutant  <ccoutant@google.com>
6784
6785         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6786         (Arm_exidx_merge_section::section_contents_): New data member.
6787         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6788         (Arm_input_section::~Arm_input_section): De-allocate memory.
6789         (Arm_input_section::original_contents_): New data member.
6790         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6791         in parameters instead of calling Object::section_contents without
6792         locking.
6793         (Arm_output_section::group_section): New parameter TASK.  Pass it
6794         to callees that need locking objects.
6795         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6796         to lock EXIDX input sections.  Fix a formatting issue.  Call
6797         Arm_exidx_merged_section::build_contents to create merged section
6798         contents.
6799         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6800         to lock object of stub table owner.
6801         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6802         TEXT_SIZE to initialize data member TEXT_SIZE_.
6803         (Arm_exidx_input_section::addralign): Fix typo in comment.
6804         (Arm_exidx_input_section::text_size): New method.
6805         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6806         that require locking objects.  Lock objects before scanning for stubs
6807         and updating local symbols.
6808         (Arm_input_section<big_endian>::init): Copy contents of original
6809         input section.
6810         (Arm_input_section<big_endian>::do_write): Use saved contents of
6811         original input section instead of calling Object::section_contents
6812         without locking.
6813         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6814         size without calling Object::section_size().
6815         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6816         for size.  Allocate a buffer for merged EXIDX entries.
6817         (Arm_exidx_merged_section::build_contents): New method.
6818         (Arm_exidx_merged_section::do_write): Move merge section contents
6819         building code to Arm_exidx_merged_section::build_contetns.  Write
6820         out contetns in buffer instead of building it on the fly.
6821         (Arm_relobj::make_exidx_input_section): Also pass text section size
6822         to Arm_exidx_input_section constructor.
6823         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6824         (Arm_dynobj::do_read_symbols): Fix memory leak.
6825         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6826         * target.h: (class Task): Add forward declaration.
6827         (Target::relax): Add new parameter TASK and pass it to
6828         Target::do_relax().
6829         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6830
6831 2010-11-05  Cary Coutant  <ccoutant@google.com>
6832
6833         PR gold/10708
6834         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6835         object when reading from the file.
6836         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6837         second layout pass.
6838         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6839         when reading section contents.
6840         (get_section_contents): Likewise.
6841         (icf::find_identical_sections): Likewise.
6842         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6843         object when reading from the file.
6844         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6845         the object when doing deferred section layout.
6846
6847 2010-11-03  Nick Clifton  <nickc@redhat.com>
6848
6849         PR gold/12001
6850         * script.h (class Symbol_assignment: name): New member.  Returns
6851         the name of the symbol.
6852         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6853         Returns true if the given symbol name is on the list of
6854         assignments wating to be processed.
6855         * archive.cc (should_incldue_member): If the symbol is undefined,
6856         check to see if it is on the list of symbols pending assignment.
6857
6858 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6859
6860         * script-sections.cc (Script_sections::find_memory_region): Check
6861         for a NULL output section pointer.
6862
6863 2010-10-29  Doug Kwan  <dougkwan@google.com>
6864
6865         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6866         Output_section::add_relaxed_input_section.
6867         * output.cc (Output_section::add_relaxed_input_section): Add new
6868         arguments LAYOUT and NAME.  Set section order index.
6869         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6870         Copy section order index.
6871         * output.h (Output_section::add_relaxed_input_section): Add new
6872         arguments LAYOUT and NAME.
6873
6874 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6875
6876         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6877         NATIVE_OR_CROSS_LINKER.
6878         * testsuite/Makefile.in: Regenerate.
6879
6880 2010-10-20  Doug Kwan  <dougkwan@google.com>
6881
6882         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6883         without SHF_LINK_ORDER flags.
6884         * layout.cc (Layout::choose_output_section): Do not filter
6885         SHF_LINK_ORDER flag in a relocatable link.
6886
6887 2010-10-17  Cary Coutant  <ccoutant@google.com>
6888
6889         * output.h (Output_segment::set_section_addresses): Change function
6890         signature.  Update all callers.
6891         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6892         sections.
6893         (Output_segment::set_section_addresses): Align after last TLS
6894         section.  Add padding before last relro section instead of after.
6895
6896 2010-10-17  Doug Kwan  <dougkwan@google.com>
6897
6898         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6899         GOT output section to be writable.
6900
6901 2010-10-14  Cary Coutant  <ccoutant@google.com>
6902
6903         * debug.h (DEBUG_INCREMENTAL): New flag.
6904         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6905         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6906         mode.
6907         * incremental.cc (report_command_line): Ignore all forms of
6908         --incremental.
6909         * layout.cc (Layout::Layout): Check parameters for incremental link
6910         mode.
6911         * options.cc (General_options::parse_incremental): New function.
6912         (General_options::parse_no_incremental): New function.
6913         (General_options::parse_incremental_full): New function.
6914         (General_options::parse_incremental_update): New function.
6915         (General_options::incremental_mode_): New data member.
6916         (General_options::finalize): Check incremental_mode_.
6917         * options.h (General_options): Update help text for --incremental.
6918         Add --no-incremental, --incremental-full, --incremental-update.
6919         (General_options::Incremental_mode): New enum type.
6920         (General_options::incremental_mode): New function.
6921         (General_options::incremental_mode_): New data member.
6922         * parameters.cc (Parameters::incremental_mode_): New data member.
6923         (Parameters::set_options): Set incremental_mode_.
6924         (Parameters::set_incremental_full): New function.
6925         (Parameters::incremental): New function.
6926         (Parameters::incremental_update): New function.
6927         (set_parameters_incremental_full): New function.
6928         * parameters.h (Parameters::set_incremental_full): New function.
6929         (Parameters::incremental): New function.
6930         (Parameters::incremental_update): New function.
6931         (Parameters::incremental_mode_): New data member.
6932         (set_parameters_incremental_full): New function.
6933         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6934         incremental link mode.
6935         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6936         (Sized_relobj::do_relocate_sections): Likewise.
6937         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6938         option.
6939         * testsuite/Makefile.in: Regenerate.
6940         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6941
6942 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6943
6944         * script-sections.h (class Script_sections): Make
6945         Sections_elements typedef public.
6946         * script-sections.cc (class Sort_output_sections): Add elements_
6947         field.  Add constructor which sets it; change all callers.
6948         (Sort_output_sections::is_before): New function.
6949         (Sort_output_sections::operator()): Call is_before.
6950         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6951         conditional.
6952         * testsuite/script_test_10.sh: New test. Test script section
6953         order.
6954         * testsuite/script_test_10.t: Likewise.
6955         * testsuite/script_test_10.s: Likewise.
6956         * testsuite/Makefile.am: Wrap the cross linker tests and the
6957         common tests into NATIVE_OR_CROSS_LINKER.
6958         (check_SCRIPTS): Add script_test_10.sh.
6959         (check_DATA): Add script_test_10.stdout.
6960         (script_test_10.o, script_test_10): New targets.
6961         (script_test_10.stdout): New target.
6962         * configure, testsuite/Makefile.in: Regenerate.
6963
6964 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6965
6966         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6967         error for the deprecated relocations.
6968         (Target_arm::Scan::global): Likewise.
6969         (Target_arm::Relocate::relocate): Likewise.
6970
6971 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6972
6973         * fileread.cc (Input_file::find_file): Initialize *found_name
6974         and *namep when using the fallback search for case 4.
6975
6976 2010-10-11  Cary Coutant  <ccoutant@google.com>
6977
6978         * options.h (class General_options): Redefine -z lazy as an alias for
6979         the negation of -z now.
6980
6981 2010-10-11  Ian Lance Taylor  <iant@google.com>
6982
6983         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6984         binding.
6985
6986 2010-10-06  Nick Clifton  <nickc@redhat.com>
6987
6988         * script-sections.cc(class Memory_region): Remove
6989         current_lma_offset_ field.  Rename current_vma_offset_ to
6990         current_offset_.  Add last_section_ field.
6991         (Memory_region::get_current_vma_address): Rename to
6992         get_current_address.
6993         (Memory_region::get_current_lma_address): Delete.
6994         (Memory_region::increment_vma_offset): Rename to
6995         increment_offset.
6996         (Memory_region::increment_lma_offset): Delete.
6997         (Memory_region::attributes_compatible): New method.  Returns
6998         true if the provided section is compatible with the region.
6999         (Memory_region::get_last_section): New method.  Returns the last
7000         section to use the region.
7001         (Memory_region::set_last_section): New method.  Stores the last
7002         section to use the region.
7003         (Script_sections::block_in_region): New method.  Returns true if
7004         a block of memory is contained within a region.
7005         (Script_sections::find_memory_region): New method.  Locates a
7006         memory region to be used to set a VMA or LMA address.
7007         (Output_section_definition::set_section_addresses): Add code to
7008         check for addresses set by memory regions.
7009         (Output_segment::set_section_addresses): Remove memory region
7010         walking code.
7011         (Script_sections::create_segment): Add a warning if a header
7012         segment is created outside of any region.
7013         * script-sections.h (class Script_sections): Add prototypes for
7014         find_memory_region and block_in_region methods.
7015         * testsuite/memory_test.s: Use .long instead of .word.
7016         * testsuite/memory_test.t: Add some more output sections.
7017         * testsuite/memory_test.sh: Update expected output.
7018
7019 2010-10-02  Doug Kwan  <dougkwan@google.com>
7020
7021         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7022         defintion to symtab.h
7023         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7024         declaration to defintion.
7025
7026 2010-10-01  Nick Clifton  <nickc@redhat.com>
7027
7028         * expression.cc (eval): Replace dummy argument with NULL.
7029         (eval_maybe_dot): Check for a NULL result section pointer.
7030         (Symbol_expression::value): Likewise.
7031         (Dot_expression::value): Likewise.
7032         (BINARY_EXPRESSION): Likewise.
7033         (Max_expression::value): Likewise.
7034         (Min_expression::value): Likewise.
7035         (Absolute_expression::value): Likewise.
7036         (Addr_expression::value_from_output_section): Likewise.
7037         (Loaddddr_expression::value_from_output_section): Likewise.
7038         (Segment_start_expression::value): Likewise.
7039         * script-sections.cc
7040         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7041         argument with NULL.
7042         (Sections_elememt_dot_assignment::set_section_addresses):
7043         Likewise.
7044         (Output_data_expression::do_write_to_buffer): Likewise.
7045         (Output_section_definition::finalize_symbols): Likewise.
7046         (Output_section_definition::set_section_addresses): Likewise.
7047
7048 2010-09-30  Doug Kwan  <dougkwan@google.com>
7049
7050         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7051
7052 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7053
7054         * target.h (Target::can_icf_inline_merge_sections): New virtual
7055         function.
7056         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7057         virtual function.
7058         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7059         virtual function.
7060         * icf.cc (get_section_contents): Inline merge sections only when
7061         target allows it.
7062
7063 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7064
7065         * configure: Regenerate.
7066
7067 2010-09-17  Ian Lance Taylor  <iant@google.com>
7068
7069         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7070         * testsuite/Makefile.am (memory_test.o): New target.
7071         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7072         memory_test.t.
7073         * testsuite/Makefile.in: Rebuild.
7074
7075 2010-09-17  Doug Kwan  <dougkwan@google.com>
7076
7077         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7078         defintion if relocation uses GOT entries of the symbol.
7079         * testsuite/icf_safe_test.sh: Fix test.
7080         * testsuite/icf_safe_so_test.sh: Fix test.
7081
7082 2010-09-16  Cary Coutant  <ccoutant@google.com>
7083
7084         * script_sections.cc (class Memory_region): Remove "NULL" from
7085         vector initializations.
7086
7087 2010-09-15  Cary Coutant  <ccoutant@google.com>
7088
7089         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7090         Resolve forwarding symbols.
7091
7092 2010-09-15  Doug Kwan  <dougkwan@google.com>
7093
7094         * gold/testsuite/script_test_3.t: Add ARM special sections.
7095         * gold/testsuite/script_test_4.t: Same.
7096         * gold/testsuite/script_test_5.t: Same.
7097         * gold/testsuite/script_test_6.t: Same.
7098         * gold/testsuite/script_test_7.t: Same.
7099         * gold/testsuite/script_test_7.t: Same.
7100         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7101
7102 2010-09-14  Cary Coutant  <ccoutant@google.com>
7103
7104         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7105         (Target_x86_64::Relocate::relocate_tls): Replace check for
7106         saw_tls_block_reloc_ with test for executable section.
7107
7108 2010-09-12  Cary Coutant  <ccoutant@google.com>
7109
7110         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7111         position-independent executables to shared libraries need dynamic
7112         relocations.
7113         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7114         position-independent executables.
7115         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7116         * testsuite/Makefile.in: Regenerate.
7117
7118 2010-09-10  Nick Clifton  <nickc@redhat.com>
7119
7120         PR gold/11997
7121         * testsuite/memory_test.t: Discard any sections that are not
7122         needed.
7123
7124 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7125
7126         PR gold/11996
7127         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7128         "This::" to work around a bug in gcc 4.2.
7129
7130         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7131
7132 2010-09-09  Rafael Espindola  <espindola@google.com>
7133
7134         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7135         sections with different PF_X flags in the same segment.
7136         (Layout::find_first_load_seg): Search all segments to find the first
7137         one.
7138         * options.h (rosegment): New.
7139
7140 2010-09-08  Rafael Espindola  <espindola@google.com>
7141
7142         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7143
7144 2010-09-08  Doug Kwan  <dougkwan@google.com>
7145
7146         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7147         (Arm_relobj::do_relocate_sections): Add new parameter for output
7148         file to match the parent.
7149         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7150         of local symbols instead of input values.  Update code to track
7151         changes in gold::relocate_section.
7152         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7153         (Sized_relobj::compute_final_local_value_internal): New methods.
7154         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7155         body into private version of Sized_relobj::compute_final_local_value.
7156         Call the inline method.
7157         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7158         merged symbol value if there is one.
7159         (Symbol_value::has_output_value): New method defintiion.
7160         (Sized_relobj::Compute_final_local_value_status): New enum type.
7161         (Sized_relobj::compute_final_local_value): New methods.
7162         (Sized_relobj::compute_final_local_value_internal): New methods.
7163         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7164         and arm_cortex_a8.sh.
7165         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7166         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7167         New tests.
7168         * Makefile.in: Regenerate.
7169         * testsuite/arm_bl_out_of_range.s: Update test.
7170         * testsuite/thumb_bl_out_of_range.s: Ditto.
7171         * testsuite/thumb_blx_out_of_range.s: Ditto.
7172         * testsuite/arm_branch_out_of_range.sh: New file.
7173         * testsuite/arm_cortex_a8.sh: Ditto.
7174         * testsuite/arm_cortex_a8_b.s: Ditto.
7175         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7176         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7177         * testsuite/arm_cortex_a8_bl.s: Ditto.
7178         * testsuite/arm_cortex_a8_blx.s: Ditto.
7179         * testsuite/arm_cortex_a8_local.s: Ditto.
7180         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7181         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7182
7183 2010-09-08  Rafael Espindola  <espindola@google.com>
7184
7185         * Makefile.am (memory_test.stdout): Run readelf with -W.
7186         * Makefile.in: Regenerate.
7187         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7188         64 bit output.
7189
7190 2010-09-08  Rafael Espindola  <espindola@google.com>
7191
7192         * script-sections.cc (Script_sections::add_memory_region): Convert
7193         field precision to int.
7194         * script.cc (script_set_section_region, script_set_section_region):
7195         Convert field precision to int.
7196
7197 2010-09-08  Rafael Espindola  <espindola@google.com>
7198
7199         * arm.cc (do_finalize_sections): Create the __exidx_start and
7200         __exdix_end symbols even when the section is missing.
7201
7202 2010-09-08  Nick Clifton  <nickc@redhat.com>
7203
7204         * README: Remove claim that MEMORY is not supported.
7205         * expression.cc (script_exp_function_origin)
7206         (script_exp_function_length): Move from here to ...
7207         * script.cc: ... here.
7208         (script_set_section_region, script_add_memory)
7209         (script_parse_memory_attr, script_include_directive): New
7210         functions.
7211         * script-sections.cc
7212         (class Memory_region): New class.
7213         (class Output_section_definition): Add set_memory_region,
7214         set_section_vma, set_section_lma and get_section_name methods.
7215         (class Script_Sections): Add add_memory_region,
7216         find_memory_region, find_memory_region_origin,
7217         find_memory_region_length and set_memory_region methods.
7218         Have set_section_addresses method walk the list of set memory
7219         regions.
7220         Extend the print methos to display memory regions.
7221         * script-sections.h: Add prototypes for new methods.
7222         Add enum for MEMORY region attributes.
7223         * yyscript.y: Add support for parsing MEMORY regions.
7224         * script-c.h: Add prototypes for new functions.
7225         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7226         * testsuite/Makefile.in: Regenerate.
7227         * testsuite/memory_test.sh: New script.
7228         * testsuite/memory_test.s: New assembler source file.
7229         * testsuite/memory_test.t: New linker script.
7230
7231 2010-08-27  Doug Kwan  <dougkwan@google.com>
7232
7233         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7234         reference override an existing dynamic weak reference.
7235         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7236         * testsuite/Makefile.in: Regenerate.
7237         * testsuite/dyn_weak_ref.sh: New file.
7238         * testsuite/dyn_weak_ref_1.c: Ditto.
7239         * testsuite/dyn_weak_ref_2.c: Ditto.
7240
7241 2010-08-27  Ian Lance Taylor  <iant@google.com>
7242
7243         * incremental.h (class Incremental_input_entry): Add virtual
7244         destructor.
7245
7246 2010-08-27  Ian Lance Taylor  <iant@google.com>
7247
7248         * testsuite/start_lib_test_3.c: Mark t3 as used.
7249
7250 2010-08-27  Nick Clifton  <nickc@redhat.com>
7251
7252         * options.cc (version_script): Fix small typo in previous
7253         whitespace tidyup.
7254
7255 2010-08-25  Nick Clifton  <nickc@redhat.com>
7256
7257         * archive.cc: Formatting fixes: Remove whitespace between
7258         typename and following asterisk.  Remove whitespace between
7259         function name and opening parenthesis.
7260         * archive.h: Likewise.
7261         * arm.cc: Likewise.
7262         * attributes.cc: Likewise.
7263         * attributes.h: Likewise.
7264         * common.cc: Likewise.
7265         * copy-relocs.cc: Likewise.
7266         * dirsearch.h: Likewise.
7267         * dynobj.cc: Likewise.
7268         * ehframe.cc: Likewise.
7269         * ehframe.h: Likewise.
7270         * expression.cc: Likewise.
7271         * fileread.cc: Likewise.
7272         * fileread.h: Likewise.
7273         * gc.h: Likewise.
7274         * gold-threads.cc: Likewise.
7275         * gold.cc: Likewise.
7276         * i386.cc: Likewise.
7277         * icf.h: Likewise.
7278         * incremental-dump.cc: Likewise.
7279         * incremental.cc: Likewise.
7280         * layout.cc: Likewise.
7281         * layout.h: Likewise.
7282         * main.cc: Likewise.
7283         * merge.cc: Likewise.
7284         * merge.h: Likewise.
7285         * object.cc: Likewise.
7286         * object.h: Likewise.
7287         * options.cc: Likewise.
7288         * options.h: Likewise.
7289         * output.cc: Likewise.
7290         * output.h: Likewise.
7291         * plugin.cc: Likewise.
7292         * plugin.h: Likewise.
7293         * powerpc.cc: Likewise.
7294         * reloc.cc: Likewise.
7295         * script-c.h: Likewise.
7296         * script-sections.cc: Likewise.
7297         * script.cc: Likewise.
7298         * stringpool.cc: Likewise.
7299         * symtab.cc: Likewise.
7300         * symtab.h: Likewise.
7301         * target.cc: Likewise.
7302         * timer.cc: Likewise.
7303         * timer.h: Likewise.
7304         * version.cc: Likewise.
7305         * x86_64.cc: Likewise.
7306
7307 2010-08-24  Nick Clifton  <nickc@redhat.com>
7308
7309         PR 11899
7310         * layout.cc (segment_precedes): Sort segments by their physical
7311         addresses, if they have been set.
7312
7313 2010-08-23  Cary Coutant  <ccoutant@google.com>
7314
7315         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7316         symbols data.
7317         (Lib_group::include_member): Unlock object after deleting its
7318         symbols data.
7319         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7320         the bug fixed here.
7321
7322 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7323             Cary Coutant  <ccoutant@google.com>
7324
7325         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7326         constructor, and set_blocker.
7327         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7328         readsyms_blocker_.
7329         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7330         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7331         * testsuite/Makefile.am (start_lib_test): New test case.
7332         * testsuite/Makefile.in: Regenerate.
7333         * testsuite/start_lib_test_main.c: New file.
7334         * testsuite/start_lib_test_1.c: New file.
7335         * testsuite/start_lib_test_2.c: New file.
7336         * testsuite/start_lib_test_3.c: New file.
7337
7338 2010-08-19  Ian Lance Taylor  <iant@google.com>
7339
7340         * Makefile.in: Rebuild with automake 1.11.1.
7341         * aclocal.m4: Likewise.
7342         * testsuite/Makefile.in: Likewise.
7343
7344 2010-08-19  Ian Lance Taylor  <iant@google.com>
7345
7346         PR 10893
7347         * i386.cc (class Output_data_plt_i386): Update declarations.
7348         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7349         local_ifuncs_ fields.
7350         (Target_i386::do_plt_section_for_global): New function.
7351         (Target_i386::do_plt_section_for_local): New function.
7352         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7353         parameter; change all callers.  Initialize global_ifuncs_ and
7354         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7355         __rel_iplt_end.
7356         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7357         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7358         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7359         symbols.
7360         (Target_i386::make_plt_section): New function, broken out of
7361         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7362         (Target_i386::make_plt_entry): Call make_plt_section.
7363         (Target_i386::make_local_ifunc_plt_entry): New function.
7364         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7365         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7366         R_386_IRELATIVE to switch.
7367         (Target_i386::Scan::global): Likewise.
7368         (Target_i386::Relocate::relocate): Likewise.
7369         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7370         switch.
7371         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7372         (Target_x86_64::do_plt_section_for_global): New function.
7373         (Target_x86_64::do_plt_section_for_local): New function.
7374         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7375         parameter; change all callers.  If doing a static link define
7376         __rela_iplt_start and __rela_iplt_end.
7377         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7378         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7379         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7380         to point to .plt.
7381         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7382         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7383         switch.
7384         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7385         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7386         R_X86_64_IRELATIVE to switch.
7387         (Target_x86_64::Scan::global): Likewise.
7388         (Target_x86_64::Relocate::relocate): Likewise.
7389         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7390         switch.
7391         * target.h (class Target): Add plt_section_for_global and
7392         plt_section_for_local functions.  Add do_plt_section_for_global
7393         and do_plt_section_for_local virtual functions.
7394         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7395         clarifying comments.
7396         (Symbol::use_plt_offset): Handle IFUNC symbol.
7397         * object.cc (Sized_relobj::Sized_relobj): Initialize
7398         local_plt_offsets_.
7399         (Sized_relobj::local_has_plt_offset): New function.
7400         (Sized_relobj::local_plt_offset): New function.
7401         (Sized_relobj::set_local_plt_offset): New function.
7402         (Sized_relobj::do_count): Handle IFUNC symbol.
7403         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7404         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7405         is_ifunc_symbol functions.
7406         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7407         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7408         local_plt_offsets_ field.
7409         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7410         * output.h (class Output_section_data): Add non-const
7411         output_section function.
7412         (class Output_data_got): Update declarations.
7413         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7414         Add use_plt_offset parameter to global and local constructors.
7415         Change all callers.  Change local_sym_index_ field to 31 bits.
7416         Change GSYM_CODE and CONSTANT_CODE accordingly.
7417         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7418         doing a static link don't set sh_link field.
7419         (Output_data_got::Got_entry::write): Use PLT offset if
7420         appropriate.
7421         (Output_data_got::add_global_plt): New function.
7422         (Output_data_got::add_local_plt): New function.
7423         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7424         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7425         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7426         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7427         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7428         IFUNC conditional.
7429         * testsuite/ifunc-sel.h: New file.
7430         * testsuite/ifuncmain1.c: New file.
7431         * testsuite/ifuncmain1vis.c: New file.
7432         * testsuite/ifuncmod1.c: New file.
7433         * testsuite/ifuncdep2.c: New file.
7434         * testsuite/ifuncmain2.c: New file.
7435         * testsuite/ifuncmain3.c: New file.
7436         * testsuite/ifuncmod3.c: New file.
7437         * testsuite/ifuncmain4.c: New file.
7438         * testsuite/ifuncmain5.c: New file.
7439         * testsuite/ifuncmod5.c: New file.
7440         * testsuite/ifuncmain6pie.c: New file.
7441         * testsuite/ifuncmod6.c: New file.
7442         * testsuite/ifuncmain7.c: New file.
7443         * configure, testsuite/Makefile.in: Rebuild.
7444
7445 2010-08-18  Ian Lance Taylor  <iant@google.com>
7446
7447         * incremental.cc
7448         (Output_section_incremental_inputs::write_input_files): Add cast
7449         to avoid signed/unsigned comparison warning.
7450         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7451
7452 2010-08-12  Cary Coutant  <ccoutant@google.com>
7453
7454         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7455
7456 2010-08-13  Ian Lance Taylor  <iant@google.com>
7457
7458         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7459
7460 2010-08-12  Cary Coutant  <ccoutant@google.com>
7461             Doug Kwan  <dougkwan@google.com>
7462
7463         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7464         defintion overrides non-weak undef, remember that the original undef
7465         is not weak.
7466         * symtab.cc (Symbol_table::sized_write_global): For undef without
7467         an original weak binding, set binding to global in output.
7468         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7469         * testsuite/Makefile.in: Regenerate.
7470         * testsuite/strong_ref_weak_def.sh: New file.
7471         * testsuite/strong_ref_weak_def_1.c: Ditto.
7472         * testsuite/strong_ref_weak_def_2.c: Ditto.
7473
7474 2010-08-12  Cary Coutant  <ccoutant@google.com>
7475
7476         * testsuite/incremental_test.sh: Rewrite.
7477         * testsuite/incremental_test_1.c: Rewrite.
7478         * testsuite/incremental_test_2.c: Rewrite.
7479
7480 2010-08-12  Cary Coutant  <ccoutant@google.com>
7481
7482         * arm.cc (Target_arm::got_size): Add const.
7483         (Target_arm::got_entry_count): New function.
7484         (Target_arm::plt_entry_count): New function.
7485         (Target_arm::first_plt_entry_offset): New function.
7486         (Target_arm::plt_entry_size): New function.
7487         (Output_data_plt_arm::entry_count): New function.
7488         (Output_data_plt_arm::first_plt_entry_offset): New function.
7489         (Output_data_plt_arm::get_plt_entry_size): New function.
7490         * i386.cc (Target_i386::got_size): Add const.
7491         (Target_i386::got_entry_count): New function.
7492         (Target_i386::plt_entry_count): New function.
7493         (Target_i386::first_plt_entry_offset): New function.
7494         (Target_i386::plt_entry_size): New function.
7495         (Output_data_plt_i386::entry_count): New function.
7496         (Output_data_plt_i386::first_plt_entry_offset): New function.
7497         (Output_data_plt_i386::get_plt_entry_size): New function.
7498         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7499         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7500         * incremental.cc: Include target.h.
7501         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7502         parameter.  Adjust all callers.  Find incremental_got_plt section.
7503         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7504         section.
7505         (Output_section_incremental_inputs::set_final_data_size): Calculate
7506         size of incremental_got_plt section.
7507         (Output_section_incremental_inputs::do_write): Write the
7508         incremental_got_plt section.
7509         (Got_plt_view_info): New struct.
7510         (Local_got_offset_visitor): New class.
7511         (Global_got_offset_visitor): New class.
7512         (Global_symbol_visitor_got_plt): New class.
7513         (Output_section_incremental_inputs::write_got_plt): New function.
7514         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7515         Add parameter.  Adjust all callers.
7516         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7517         (Incremental_inputs::got_plt_section): New function.
7518         (Incremental_inputs::got_plt_section_): New data member.
7519         (Incremental_got_plt_reader): New class.
7520         * layout.cc (Layout::create_incremental_info_sections): Add the
7521         incremental_got_plt section.
7522         * object.h (Got_offset_list::get_list): New function.
7523         (Got offset_list::for_all_got_offsets): New function.
7524         (Sized_relobj::local_got_offset_list): New function.
7525         * powerpc.cc (Target_powerpc::got_size): Add const.
7526         (Target_powerpc::got_entry_count): New function.
7527         (Target_powerpc::plt_entry_count): New function.
7528         (Target_powerpc::first_plt_entry_offset): New function.
7529         (Target_powerpc::plt_entry_size): New function.
7530         (Output_data_plt_powerpc::entry_count): New function.
7531         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7532         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7533         * sparc.cc (Target_sparc::got_size): Add const.
7534         (Target_sparc::got_entry_count): New function.
7535         (Target_sparc::plt_entry_count): New function.
7536         (Target_sparc::first_plt_entry_offset): New function.
7537         (Target_sparc::plt_entry_size): New function.
7538         (Output_data_plt_sparc::entry_count): New function.
7539         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7540         (Output_data_plt_sparc::get_plt_entry_size): New function.
7541         * symtab.h (Symbol::got_offset_list): New function.
7542         (Symbol_table::for_all_symbols): New function.
7543         * target.h (Sized_target::got_entry_count): New function.
7544         (Sized_target::plt_entry_count): New function.
7545         (Sized_target::plt_entry_size): New function.
7546         * x86_64.cc (Target_x86_64::got_size): Add const.
7547         (Target_x86_64::got_entry_count): New function.
7548         (Target_x86_64::plt_entry_count): New function.
7549         (Target_x86_64::first_plt_entry_offset): New function.
7550         (Target_x86_64::plt_entry_size): New function.
7551         (Output_data_plt_x86_64::entry_count): New function.
7552         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7553         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7554
7555 2010-08-12  Cary Coutant  <ccoutant@google.com>
7556
7557         * archive.cc: Include incremental.h.
7558         (Archive::Archive): Initialize incremental_info_.
7559         (Archive::include_member): Record archive members in incremental info.
7560         (Add_archive_symbols::run): Record begin and end of an archive in
7561         incremental info.
7562         (Lib_group::include_member): Record objects in incremental info.
7563         * archive.h (Incremental_archive_entry): Forward declaration.
7564         (Archive::set_incremental_info): New member function.
7565         (Archive::incremental_info): New member function.
7566         (Archive::Unused_symbol_iterator): New class.
7567         (Archive::unused_symbols_begin): New member function.
7568         (Archive::unused_symbols_end): New member function.
7569         (Archive::incremental_info_): New data member.
7570         * incremental-dump.cc (find_input_containing_global): New function.
7571         (dump_incremental_inputs): Dump new incremental info sections.
7572         * incremental.cc: Include symtab.h.
7573         (Output_section_incremental_inputs): New class.
7574         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7575         new incremental info sections.
7576         (Sized_incremental_binary::do_check_inputs): Likewise.
7577         (Incremental_inputs::report_archive): Remove.
7578         (Incremental_inputs::report_archive_begin): New function.
7579         (Incremental_inputs::report_archive_end): New function.
7580         (Incremental_inputs::report_object): New function.
7581         (Incremental_inputs::finalize_inputs): Remove.
7582         (Incremental_inputs::report_input_section): New function.
7583         (Incremental_inputs::report_script): Rewrite.
7584         (Incremental_inputs::finalize): Do nothing but finalize string table.
7585         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7586         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7587         (Incremental_inputs::create_data_sections): New function.
7588         (Incremental_inputs::relocs_entsize): New function.
7589         (Output_section_incremental_inputs::set_final_data_size): New function.
7590         (Output_section_incremental_inputs::do_write): New function.
7591         (Output_section_incremental_inputs::write_header): New function.
7592         (Output_section_incremental_inputs::write_input_files): New function.
7593         (Output_section_incremental_inputs::write_info_blocks): New function.
7594         (Output_section_incremental_inputs::write_symtab): New function.
7595         * incremental.h (Incremental_script_entry): Forward declaration.
7596         (Incremental_object_entry): Forward declaration.
7597         (Incremental_archive_entry): Forward declaration.
7598         (Incremental_inputs): Forward declaration.
7599         (Incremental_inputs_header_data): Remove.
7600         (Incremental_inputs_header): Remove.
7601         (Incremental_inputs_header_write): Remove.
7602         (Incremental_inputs_entry_data): Remove.
7603         (Incremental_inputs_entry): Remove.
7604         (Incremental_inputs_entry_write): Remove.
7605         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7606         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7607         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7608         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7609         Likewise.
7610         (Incremental_input_entry): New class.
7611         (Incremental_script_entry): New class.
7612         (Incremental_object_entry): New class.
7613         (Incremental_archive_entry): New class.
7614         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7615         (Incremental_inputs::report_inputs): Remove.
7616         (Incremental_inputs::report_archive): Remove.
7617         (Incremental_inputs::report_archive_begin): New function.
7618         (Incremental_inputs::report_archive_end): New function.
7619         (Incremental_inputs::report_object): Change prototype.
7620         (Incremental_inputs::report_input_section): New function.
7621         (Incremental_inputs::report_script): Change prototype.
7622         (Incremental_inputs::get_reloc_count): New function.
7623         (Incremental_inputs::set_reloc_count): New function.
7624         (Incremental_inputs::create_data_sections): New function.
7625         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7626         (Incremental_inputs::inputs_section): New function.
7627         (Incremental_inputs::symtab_section): New function.
7628         (Incremental_inputs::relocs_section): New function.
7629         (Incremental_inputs::get_stringpool): Add const.
7630         (Incremental_inputs::command_line): Add const.
7631         (Incremental_inputs::inputs): Remove.
7632         (Incremental_inputs::command_line_key): New function.
7633         (Incremental_inputs::input_file_count): New function.
7634         (Incremental_inputs::input_files): New function.
7635         (Incremental_inputs::relocs_entsize): New function.
7636         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7637         (Incremental_inputs::finalize_inputs): Remove.
7638         (Incremental_inputs::Input_info): Remove.
7639         (Incremental_inputs::lock_): Remove.
7640         (Incremental_inputs::inputs_): Change type.
7641         (Incremental_inputs::inputs_map_): Remove.
7642         (Incremental_inputs::current_object_entry_): New data member.
7643         (Incremental_inputs::inputs_section_): New data member.
7644         (Incremental_inputs::symtab_section_): New data member.
7645         (Incremental_inputs::relocs_section_): New data member.
7646         (Incremental_inputs::reloc_count_): New data member.
7647         (Incremental_inputs_reader): New class.
7648         (Incremental_symtab_reader): New class.
7649         (Incremental_relocs_reader): New class.
7650         * layout.cc (Layout::finalize): Move finalization of incremental info
7651         and creation of incremental info sections to follow finalization of
7652         symbol table.  Set offsets for postprocessing sections.
7653         (Layout::create_incremental_info_sections): Call
7654         Incremental_inputs::create_data_sections.  Add incremental symtab
7655         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7656         sections to layout after input sections.
7657         * layout.h (struct Timespec): Forward declaration.
7658         (Layout::incremental_inputs): Add const.
7659         (Layout::create_incremental_info_sections): Add parameter.
7660         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7661         * object.cc: Include incremental.h.
7662         (Relobj::finalize_incremental_relocs): New function.
7663         (Sized_relobj::do_layout): Record input sections in incremental info.
7664         * object.h (Object::output_section): New function.
7665         (Object::output_section_offset): Moved from Relobj.
7666         (Object::get_incremental_reloc_base): New function.
7667         (Object::get_incremental_reloc_count): New function.
7668         (Object::do_output_section): New function.
7669         (Object::do_output_section_offset): Moved from Relobj.
7670         (Object::do_get_incremental_reloc_base): New function.
7671         (Object::do_get_incremental_reloc_count): New function.
7672         (Object::Object): Initialize new data members.
7673         (Relobj::output_section): Renamed do_output_section and moved to
7674         protected.
7675         (Relobj::output_section_offset): Moved to Object.
7676         (Relobj::do_get_incremental_reloc_base): New function.
7677         (Relobj::do_get_incremental_reloc_count): New function.
7678         (Relobj::allocate_incremental_reloc_counts): New function.
7679         (Relobj::count_incremental_reloc): New function.
7680         (Relobj::finalize_incremental_relocs): New function.
7681         (Relobj::next_incremental_reloc_index): New function.
7682         (Relobj::reloc_counts_): New data member.
7683         (Relobj::reloc_bases_): New data member.
7684         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7685         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7686         (Sized_relobj::incremental_relocs_scan): New function.
7687         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7688         (Sized_relobj::incremental_relocs_write): New function.
7689         (Sized_relobj::incremental_relocs_write_reltype): New function.
7690         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7691         incremental link.
7692         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7693         archives and object files elsewhere.
7694         (Add_symbols::run): Report object files here.
7695         (Finish_group::run): Report end of archive at end of group.
7696         * reloc.cc: Include layout.h, incremental.h.
7697         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7698         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7699         (Sized_relobj::incremental_relocs_scan): New function.
7700         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7701         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7702         (Sized_relobj::incremental_relocs_write): New function.
7703         (Sized_relobj::incremental_relocs_write_reltype): New function.
7704         * script.cc (read_input_script): Rewrite test for incremental link.
7705         Change call to Incremental_inputs::report_script.
7706         * symtab.h (Symbol_table::first_global_index): New function.
7707         (Symbol_table::output_count): New function.
7708
7709 2010-08-12  Doug Kwan  <dougkwan@google.com>
7710
7711         * arm.cc (Target_arm::merge_object_attributes): Check command line
7712         options --no-wchar-size-warning and --no-enum-size-warning.
7713         * options.h (General_options): Add ld-compatible options
7714         --no-enum-size-warning and --no-wchar-size-warning.
7715
7716 2010-08-04  Ian Lance Taylor  <iant@google.com>
7717
7718         * x86_64.cc (Target_x86_64::Scan::local): Use
7719         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7720         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7721         (Target_x86_64::Scan::global): Likewise.
7722         (Target_x86_64::Relocate::relocate): Likewise.
7723         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7724         Likewise.
7725
7726 2010-08-03  Cary Coutant  <ccoutant@google.com>
7727
7728         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7729         to reserve space in merged_strings vector. Keep total input size
7730         for stats.
7731         (Output_merge_string::do_print_merge_stats): Print total input size.
7732         * merge.h (Output_merge_string): Add input_size_ field.
7733         * stringpool.cc (Stringpool_template::string_length): Move
7734         implementations out of Stringpool_template class and place in
7735         stringpool.h.
7736         * stringpool.h (string_length): Move out of Stringpool_template.
7737
7738 2010-08-03  Ian Lance Taylor  <iant@google.com>
7739
7740         PR 11712
7741         * layout.cc (relaxation_loop_body): If address of load segment is
7742         set, adjust address to include headers if possible.
7743
7744 2010-08-03  Ian Lance Taylor  <iant@google.com>
7745
7746         * version.cc (version_string): Bump to 1.10.
7747
7748 2010-08-03  Ian Lance Taylor  <iant@google.com>
7749
7750         PR 11805
7751         * layout.h (enum Output_section_order): Define.
7752         (class Layout): Update declarations.
7753         * layout.cc (Layout::get_output_section): Add order parameter.
7754         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7755         is_first_non_relro parameters.  Change all callers.
7756         (Layout::choose_output_section): Likewise.
7757         (Layout::add_output_section_data): Likewise.
7758         (Layout::make_output_section): Likewise.  Set order.
7759         (Layout::default_section_order): New function.
7760         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7761         * output.cc (Output_section::Output_section): Initialize order_.
7762         Don't initialize deleted fields.
7763         (Output_segment::Output_segment): Don't initialize deleted
7764         fields.
7765         (Output_segment::add_output_section_to_load): New function
7766         replacing add_output_section.  Change all callers to call this or
7767         add_output_section_to_nonload.
7768         (Output_segment::add_output_section_to_nonload): New function.
7769         (Output_segment::remove_output_section): Rewrite.
7770         (Output_segment::add_initial_output_data): Likewise.
7771         (Output_segment::has_any_data_sections): Likewise.
7772         (Output_segment::is_first_section_relro): Likewise.
7773         (Output_segment::maximum_alignment): Likewise.
7774         (Output_segment::has_dynamic_reloc): New function replacing
7775         dynamic_reloc_count.  Change all callers.
7776         (Output_segment::has_dynamic_reloc_list): New function replacing
7777         dynamic_reloc_count_list.  Change all callers.
7778         (Output_segment::set_section_addresses): Rewrite.
7779         (Output_segment::set_offset): Rewrite.
7780         (Output_segment::find_first_and_last_list): Remove.
7781         (Output_segment::set_tls_offsets): Rewrite.
7782         (Output_segment::first_section_load_address): Likewise.
7783         (Output_segment::output_section_count): Likewise.
7784         (Output_segment::section_with_lowest_load_address): Likewise.
7785         (Output_segment::write_section_headers): Likewise.
7786         (Output_segment::print_sections_to_map): Likewise.
7787         * output.h (class Output_data): Remove dynamic_reloc_count_
7788         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7789         (Output_data::add_dynamic_reloc): Rewrite.
7790         (Output_data::has_dynamic_reloc): New function.
7791         (Output_data::dynamic_reloc_count): Remove.
7792         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7793         is_last_relro_, is_first_non_relro_, is_interp_,
7794         is_dynamic_linker_section_ fields.  Add order and set_order
7795         functions.  Remove is_relro_local, set_is_relro_local,
7796         is_last_relro, set_is_last_relro, is_first_non_relro,
7797         set_is_first_non_relro functions, is_interp, set_is_interp,
7798         is_dynamic_linker_section, and set_is_dynamic_linker_section
7799         functions.
7800         (class Output_segment): Change Output_data_list from std::list to
7801         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7802         output_bss_ fields.  Update declarations.
7803
7804 2010-08-02  Ian Lance Taylor  <iant@google.com>
7805
7806         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7807         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7808         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7809
7810 2010-08-02  Ian Lance Taylor  <iant@google.com>
7811
7812         PR 11855
7813         * script.cc (Script_options::Script_options): Initialize
7814         symbol_definitions_ and symbol_references_.
7815         (Script_options::add_symbol_assignment): Update
7816         symbol_definitions_ and symbol_references_.
7817         (Script_options::add_symbol_reference): New function.
7818         (script_symbol): New function.
7819         * script.h (class Script_options): Add symbol_definitions_ and
7820         symbol_references_ fields.
7821         (Script_options::referenced_const_iterator): New type.
7822         (Script_options::referenced_begin): New function.
7823         (Script_options::referenced_end): New function.
7824         (Script_options::is_referenced): New function.
7825         (Script_options::any_unreferenced): New function.
7826         * script-c.h (script_symbol): Declare.
7827         * yyscript.y (exp): Call script_symbol.
7828         * symtab.cc: Include "script.h".
7829         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7830         Change all callers.  Check symbols referenced by scripts.
7831         (Symbol_table::add_undefined_symbols_from_command_line): Add
7832         layout parameter.  Change all callers.
7833         (Symbol_table::do_add_undefined_symbols_from_command_line):
7834         Likewise.  Break out loop body.  Check symbols referenced by
7835         scripts.
7836         (Symbol_table::add_undefined_symbol_from_command_line): New
7837         function broken out of
7838         do_add_undefined_symbols_from_command_line.
7839         * symtab.h (class Symbol_table): Update declarations.
7840         * archive.cc: Include "layout.h".
7841         (Archive::should_include_member): Add layout parameter.  Change
7842         all callers.  Check for symbol mentioned in expression.
7843         * archive.h (class Archive): Update declaration.
7844         * object.cc (Sized_relobj::do_should_include_member): Add layout
7845         parameter.
7846         * object.h (Object::should_include_member): Add layout parameter.
7847         Change all callers.
7848         (Object::do_should_include_member): Add layout parameter.
7849         (class Sized_relobj): Update declaration.
7850         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7851         parameter.
7852         * dynobj.h (class Sized_dynobj): Update declaration.
7853         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7854         layout parameter.
7855         * plugin.h (class Sized_pluginobj): Update declaration.
7856
7857 2010-08-02  Ian Lance Taylor  <iant@google.com>
7858
7859         PR 11866
7860         * output.cc (Output_segment::set_offset): Search for the first and
7861         last sections rather than assuming that the list is in order.
7862         (Output_segment::find_first_and_last_list): New function.
7863         * output.h (class Output_segment): Update declarations.
7864         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7865         (relro_strip_test_SOURCES): New variable.
7866         (relro_strip_test_DEPENDENCIES): New variable.
7867         (relro_strip_test_LDFLAGS): New variable.
7868         (relro_strip_test_LDADD): New variable.
7869         (relro_strip_test.so): New target.
7870
7871 2010-08-02  Ian Lance Taylor  <iant@google.com>
7872
7873         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7874         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7875         (Target_i386::got_tlsdesc_section): New function.
7876         (Target_i386::got_section): Create space for GOT entries for
7877         TLSDESC relocations.
7878         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7879         R_386_TLS_GOTDESC.
7880         (Target_i386::Scan::global): Likewise.
7881         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7882         using TLSDESC GOT.
7883         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7884         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7885         (Target_x86_64::got_tlsdesc_section): New function.
7886         (Target_x86_64::got_section): Create space for GOT entries for
7887         TLSDESC relocations.
7888         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7889         R_386_TLS_GOTDESC.
7890         (Target_x86_64::Scan::global): Likewise.
7891         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7892         using TLSDESC GOT.
7893
7894 2010-08-02  Ian Lance Taylor  <iant@google.com>
7895
7896         * testsuite/final_layout.sh: Use dc to convert from hex to
7897         decimal.
7898
7899 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7900
7901         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7902         paramter to the call to gold::gc_process_relocs.
7903         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7904         paramter to the call to gold::gc_process_relocs.
7905         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7906         parameter to the call to gold::gc_process_relocs.
7907         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7908         template parameter to the call to gold::gc_process_relocs.
7909         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7910         paramter to the call to gold::gc_process_relocs.
7911         * gc.h (get_embedded_addend_size): New function.
7912         (gc_process_relocs): Save the size of the reloc for use by ICF.
7913         * icf.cc (get_section_contents): Get the addend from the text section
7914         for SHT_REL relocation sections.
7915         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7916         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7917         * int_encoding.h (read_from_pointer): New overloaded function.
7918         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7919         * testsuite/icf_sht_rel_addend_test.sh: New file.
7920         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7921         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7922
7923 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7924
7925         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7926         * Makefile.in: Regenerate.
7927         * testsuite/Makefile.in: Regenerate.
7928
7929 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7930
7931         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7932         * gold/testsuite/debug_msg.cc: Likewise.
7933         * gold/testsuite/odr_violation1.cc
7934         * gold/testsuite/odr_violation2.cc
7935
7936 2010-07-21  Cary Coutant  <ccoutant@google.com>
7937
7938         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7939         string, and length fields.
7940         (Output_merge_string::Merged_strings_list): New type.
7941         (Output_merge_string::Merged_strings_lists): New typedef.
7942         (Output_merge_string): Replace merged_strings_ with
7943         merged_strings_lists_.
7944         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7945         Merged_strings_list per input object and section.  Don't store pointer
7946         to the string.  Don't store length with each merged string entry.
7947         (Output_merge_string::finalize_merged_data): Loop over list of merged
7948         strings lists.  Recompute length of each merged string.
7949
7950 2010-07-15  Cary Coutant  <ccoutant@google.com>
7951
7952         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7953         here.
7954
7955 2010-07-14  Ian Lance Taylor  <iant@google.com>
7956
7957         * descriptors.cc (Descriptors::open): Report correct name in error
7958         message.
7959
7960 2010-07-13  Doug Kwan  <dougkwan@google.com>
7961
7962         * arm.cc (Arm_input_section::Arm_input_section): For a
7963         SHT_ARM_EXIDX section, always keeps the input sections.
7964         (Arm_input_section::set_exidx_section_link): New method.
7965         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7966         has_errors_ to false.
7967         (Arm_exidx_input_section::has_errors,
7968         Arm_exidx_input_section::set_has_errors): New methods.
7969         (Arm_exidx_input_section::has_errors_): New data member.
7970         (Arm_relobj::get_exidx_shndx_list): New method.
7971         (Arm_output_section::append_text_sections_to_list): Do not skip
7972         section without SHF_EXECINSTR.
7973         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7974         errors.
7975         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7976         section header.  Make error messages more verbose.  Check for
7977         a non-executable section linked to an EXIDX section.
7978         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7979         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7980         check that there is no deferred EXIDX section if we exit early.
7981         Instead of not making an EXIDX section in case of an error, make one
7982         and set the has_errors flag of it.
7983         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7984         in a relocatable link.
7985         (Target_arm::do_relax): Look for the EXIDX output section instead of
7986         assuming that it is called .ARM.exidx.
7987         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7988         section list.  Do not check for SHF_EXECINSTR section flags but
7989         skip any input section with errors.
7990         * output.cc (Output_section::Output_section): Initialize
7991         always_keeps_input_sections_ to false.
7992         (Output_section::add_input_section): Check for
7993         always_keeps_input_sections_.
7994         *  output.h (Output_section::always_keeps_input_sections,
7995         Output_section::set_always_keeps_input_sections): New methods.
7996         (Output_section::always_keeps_input_sections): New data member.
7997
7998 2010-07-13  Rafael Espindola  <espindola@google.com>
7999
8000         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8001         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8002
8003 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8004             Ian Lance Taylor  <iant@google.com>
8005
8006         * output.h (Output_section_lookup_maps::add_merge_section):
8007         Correct check of whether value was inserted.
8008         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8009         (Output_section_lookup_maps::add_relaxed_input_section):
8010         Likewise.
8011         * arm.cc (Target_arm::got_section): Remove used local os.
8012         * i386.cc (Target_i386::got_section): Likewise.
8013         * x86_64.cc (Target_x86_64::got_section): Likewise.
8014         * sparc.cc (Target_sparc::got_section): Likewise.
8015         (Target_sparc::relocate): Remove unused local have_got_offset.
8016         * powerpc.cc (Target_powerpc::relocate): Likewise.
8017
8018 2010-07-13  Ian Lance Taylor  <iant@google.com>
8019
8020         * compressed_output.cc (zlib_decompress): Fix signature in
8021         !HAVE_ZLIB_H case.
8022
8023         * archive.cc (Archive::include_member): Unlock an external member
8024         of a thin archive.  Don't bother to delete an object we know is
8025         NULL.
8026
8027 2010-07-12  Cary Coutant  <ccoutant@google.com>
8028
8029         * compressed_output.cc (zlib_decompress): New function.
8030         (get_uncompressed_size): New function.
8031         (decompress_input_section): New function.
8032         * compressed_output.h (get_uncompressed_size): New function.
8033         (decompress_input_section): New function.
8034         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8035         Handle compressed debug sections.
8036         * layout.cc (is_compressed_debug_section): New function.
8037         (Layout::output_section_name): Map compressed section names to
8038         canonical names.
8039         * layout.h (is_compressed_debug_section): New function.
8040         (is_debug_info_section): Recognize compressed debug sections.
8041         * merge.cc: Include compressed_output.h.
8042         (Output_merge_data::do_add_input_section): Handle compressed
8043         debug sections.
8044         (Output_merge_string::do_add_input_section): Handle compressed
8045         debug sections.
8046         * object.cc: Include compressed_output.h.
8047         (Sized_relobj::Sized_relobj): Initialize new data members.
8048         (build_compressed_section_map): New function.
8049         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8050         * object.h (Object::section_is_compressed): New method.
8051         (Object::do_section_is_compressed): New method.
8052         (Sized_relobj::Compressed_section_map): New type.
8053         (Sized_relobj::do_section_is_compressed): New method.
8054         (Sized_relobj::compressed_sections_): New data member.
8055         * output.cc (Output_section::add_input_section): Handle compressed
8056         debug sections.
8057         * reloc.cc: Include compressed_output.h.
8058         (Sized_relobj::write_sections): Handle compressed debug sections.
8059
8060 2010-07-08  Cary Coutant  <ccoutant@google.com>
8061
8062         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8063         weak when resolving to a dynamic def.
8064         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8065         for weak undef/dynamic def cases. Adjust callers.
8066         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8067         undef_binding_weak_.
8068         (Symbol_table::sized_write_globals): Adjust symbol binding.
8069         (Symbol_table::sized_write_symbol): Add binding parameter.
8070         * symtab.h (Symbol::set_undef_binding): New method.
8071         (Symbol::is_undef_binding_weak): New method.
8072         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8073         (Symbol_table::should_override): Add new parameter.
8074         (Symbol_table::sized_write_symbol): Add new parameter.
8075
8076         * testsuite/weak_undef_file1.cc: Add new test case.
8077         * testsuite/weak_undef_file2.cc: Fix header comment.
8078         * testsuite/weak_undef_test.cc: Add new test case.
8079
8080 2010-06-29  Doug Kwan  <dougkwan@google.com>
8081
8082         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8083         Initialize USE_SYMBOL_.
8084         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8085         definition.
8086         (Arm_reloc_property::uses_symbol_): New data member declaration.
8087         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8088         uses symbol value and symbol is undefined but not weakly undefined.
8089
8090 2010-06-28  Rafael Espindola  <espindola@google.com>
8091
8092         * plugin.cc (Plugin::load): Use dlerror.
8093
8094 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8095
8096         * symtab.cc (detect_odr_violations): When reporting an ODR
8097         violation, report an object where the symbol is defined.
8098
8099 2010-06-25  Doug Kwan  <dougkwan@google.com>
8100
8101         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8102         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8103         definition.
8104         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8105         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8106         target hook to detect function points.
8107         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8108         * icf.h (Icf::check_section_for_function_pointers): Change type of
8109         parameter SECTION_NAME to const reference to std::string.  Use
8110         target hook to determine if section may have unsafe pointers.
8111         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8112         method definition.
8113
8114 2010-06-21  Rafael Espindola  <espindola@google.com>
8115
8116         * fileread.cc (Input_file::find_fie): New
8117         (Input_file::open): Use Input_file::find_fie.
8118         * fileread.h (Input_file::find_fie): New
8119         * plugin.cc (set_extra_library_path): New.
8120         (Plugin::load): Add set_extra_library_path to the transfer vector.
8121         (Plugin_manager::set_extra_library_path): New.
8122         (Plugin_manager::add_input_file): Use the extra search path if set.
8123         (set_extra_library_path(): New.
8124         * plugin.h (Plugin_manager): Add set_extra_library_path and
8125         extra_search_path_.
8126
8127 2010-06-19  Cary Coutant  <ccoutant@google.com>
8128
8129         * layout.cc (gdb_sections): Add .debug_types.
8130         (lines_only_debug_sections): Likewise.
8131
8132 2010-06-18  Rafael Espindola  <espindola@google.com>
8133
8134         * plugin.cc (add_input_file,add_input_library)
8135         (Plugin_manager::add_input_file): Make filename arguments const.
8136         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8137         const.
8138
8139 2010-06-16  Doug Kwan  <dougkwan@google.com>
8140
8141         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8142         .ARM.attributes section if we have not merged any input
8143         attributes sections.
8144
8145 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8146
8147         * arm.cc: Allow combining objects with no EABI version
8148         information.
8149
8150 2010-06-15  Rafael Espindola  <espindola@google.com>
8151
8152         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8153
8154 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8155
8156         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8157         (struct iovec): Correct !HAVE_READV definition.
8158
8159 2010-06-10  Cary Coutant  <ccoutant@google.com>
8160
8161         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8162         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8163         reloc sections.
8164         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8165
8166         PR 11683
8167         * symtab.h (Symbol::is_placeholder): New member function.
8168         * target-reloc.h (relocate_section): Check for placeholder symbols.
8169
8170         * testsuite/Makefile.am (plugin_test_8): New test.
8171         (plugin_test_9): New test.
8172         * testsuite/Makefile.in: Regenerate.
8173
8174 2010-06-09  Nick Clifton  <nickc@redhat.com>
8175
8176         * yyscript.y (input_list_element): Allow strings prefixed with
8177         the '-' character.  Treat these as libraries.
8178         * script.cc (script_add_library): New function.  Adds a library
8179         specified by "-l<name>" found in an input script.
8180         * script-c.h: Add prototype for script_add_library.
8181
8182 2010-06-07  Doug Kwan  <dougkwan@google.com>
8183
8184         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8185         Restrict stub-group size to be within long conditional branch
8186         range when working around cortex-A8 erratum.
8187
8188 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8189
8190         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8191         #ifdef typo.
8192
8193 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8194
8195         PR gold/11658
8196         * output.cc
8197         (Output_section::Input_section_sort_entry::compare_section_ordering):
8198         Change to return non-zero correctly.
8199         (Output_section::Input_section_sort_section_order_index_compare
8200         ::operator()): Change to fix ambiguity in comparisons.
8201
8202 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8203
8204         * gold.h (is_wildcard_string): New function.
8205         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8206         (Layout::layout_eh_frame): Ditto.
8207         (Layout::find_section_order_index): New method.
8208         (Layout::read_layout_from_file): New method.
8209         * layout.h (Layout::find_section_order_index): New method.
8210         (Layout::read_layout_from_file): New method.
8211         (Layout::input_section_position_): New private member.
8212         (Layout::input_section_glob_): New private member.
8213         * main.cc (main): Call read_layout_from_file here.
8214         * options.h (--section-ordering-file): New option.
8215         * output.cc (Output_section::input_section_order_specified_): New
8216         member.
8217         (Output_section::Output_section): Initialize new member.
8218         (Output_section::add_input_section): Add new parameter.
8219         Keep input sections when --section-ordering-file is used.
8220         (Output_section::set_final_data_size): Sort input sections when
8221         section ordering file is specified.
8222         (Output_section::Input_section_sort_entry): Add new parameter.
8223         Check sorting type.
8224         (Output_section::Input_section_sort_entry::compare_section_ordering):
8225         New method.
8226         (Output_section::Input_section_sort_compare::operator()): Change to
8227         consider section_order_index.
8228         (Output_section::Input_section_sort_init_fini_compare::operator()):
8229         Change to consider section_order_index.
8230         (Output_section::Input_section_sort_section_order_index_compare
8231         ::operator()): New method.
8232         (Output_section::sort_attached_input_sections): Change to sort
8233         according to section order when specified.
8234         (Output_section::add_input_section<32, true>): Add new parameter.
8235         (Output_section::add_input_section<64, true>): Add new parameter.
8236         (Output_section::add_input_section<32, false>): Add new parameter.
8237         (Output_section::add_input_section<64, false>): Add new parameter.
8238         * output.h (Output_section::add_input_section): Add new parameter.
8239         (Output_section::input_section_order_specified): New
8240         method.
8241         (Output_section::set_input_section_order_specified): New method.
8242         (Input_section::Input_section): Initialize section_order_index_.
8243         (Input_section::section_order_index): New method.
8244         (Input_section::set_section_order_index): New method.
8245         (Input_section::section_order_index_): New member.
8246         (Input_section::Input_section_sort_section_order_index_compare): New
8247         struct.
8248         (Output_section::input_section_order_specified_): New member.
8249         * script-sections.cc (is_wildcard_string): Delete and move modified
8250         method to gold.h.
8251         (Output_section_element_input::Output_section_element_input): Modify
8252         call to is_wildcard_string.
8253         (Output_section_element_input::Input_section_pattern
8254         ::Input_section_pattern): Ditto.
8255         (Output_section_element_input::Output_section_element_input): Ditto.
8256         * testsuite/Makefile.am (final_layout): New test case.
8257         * testsuite/Makefile.in: Regenerate.
8258         * testsuite/final_layout.cc: New file.
8259         * testsuite/final_layout.sh: New file.
8260
8261 2010-06-01  Rafael Espindola  <espindola@google.com>
8262
8263         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8264
8265 2010-06-01  Rafael Espindola  <espindola@google.com>
8266
8267         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8268         visibility of symbols.
8269
8270 2010-05-27  Doug Kwan  <dougkwan@google.com>
8271
8272         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8273         from start of output section instead of address for a local symbol
8274         in a merged or relaxed section when doing a relocatable link.
8275
8276 2010-05-26  Rafael Espindola  <espindola@google.com>
8277
8278         PR 11604
8279         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8280         adding sections the garbage collector removed.
8281         * gold/testsuite/Makefile.am: Add test.
8282         * gold/testsuite/Makefile.in: Regenerate.
8283         * gold/testsuite/plugin_test_7.sh: New.
8284         * gold/testsuite/plugin_test_7_1.c: New.
8285         * gold/testsuite/plugin_test_7_2.c: New.
8286
8287 2010-05-26  Rafael Espindola  <espindola@google.com>
8288
8289         * script-sections.cc (Output_section_definition::set_section_addresses):
8290         Check for --section-start.
8291
8292 2010-05-26  Doug Kwan  <dougkwan@google.com>
8293
8294         * arm.cc (Arm_scan_relocatable_relocs): New class.
8295         (Target_arm::relocate_special_relocatable): New method.
8296         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8297         (Arm_relocate_functions::thumb_branch_common): Same.
8298         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8299         instead of Default_scan_relocatable_relocs.
8300         * target-reloc.h (relocate_for_relocatable): Let target handle
8301         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8302         * target.h (Sized_target::relocate_special_relocatable): New method.
8303
8304 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8305
8306         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8307
8308 2010-05-23  Doug Kwan  <dougkwan@google.com>
8309
8310         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8311         instead of a cast.
8312         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8313         with a direct branch, not a conditional branch, to a stub.
8314         * merge.cc (Output_merge_base::record_input_section): New method
8315         defintion.
8316         (Output_merge_data::do_add_input_section): Record input section if
8317         keeps-input-sections flag is set.
8318         (Output_merge_string::do_add_input_section): Ditto.
8319         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8320         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8321         INPUT_SECTIONS_.
8322         (Output_merge_base::keeps_input_sections,
8323         Output_merge_base::set_keeps_input_sections,
8324         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8325         method definitions.
8326         (Output_merge_base::Input_sections): New type declaration.
8327         (Output_merge_base::input_sections_begin,
8328         Output_merge_base::input_sections_end,
8329         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8330         (Output_merge_base::bool keeps_input_sections_,
8331         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8332         Output_merge_base::input_sections_): New data members.
8333         (Output_merge_data::do_set_keeps_input_sections): New method
8334         defintion.
8335         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8336         * output.cc (Output_section::Input_section::relobj): Move method
8337         defintion from class declaration to here and handle merge sections.
8338         (Output_section::Input_section::shndx): Ditto.
8339         (Output_section::Output_section): Remove initializations of removed
8340         data members and initialize new data member LOOKUP_MAPS_.
8341         (Output_section::add_input_section): Set keeps-input-sections flag
8342         for a newly created merge output section as appropriate.  Adjust code
8343         to use Output_section_lookup_maps class.
8344         (Output_section::add_relaxed_input_section): Adjst code for lookup
8345         maps code refactoring.
8346         (Output_section::add_merge_input_section): Add a new parameter
8347         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8348         class.  If adding input section to a newly created merge output
8349         section fails, remove the new merge section.
8350         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8351         Adjust code for use of the Output_section_lookup_maps class.
8352         (Output_section::find_merge_section): Ditto.
8353         (Output_section::build_lookup_maps): New method defintion.
8354         (Output_section::find_relaxed_input_section): Adjust code to use
8355         Output_section_lookup_maps class.
8356         (Output_section::get_input_sections): Export merge sections.  Adjust
8357         code to use Output_section_lookup_maps class.
8358         (Output_section:::add_script_input_section): Adjust code to use
8359         Output_section_lookup_maps class.  Update lookup maps for merge
8360         sections also.
8361         (Output_section::discard_states): Use Output_section_lookup_maps.
8362         (Output_section::restore_states): Same.
8363         * output.h (Merge_section_properties): Move class defintion out of
8364         Output_section.
8365         (Output_section_lookup_maps): New class.
8366         (Output_section::Input_section::is_merge_section): New method
8367         defintion.
8368         (Output_section::Input_section::relobj): Move defintion out of class
8369         defintion.  Declare method only.
8370         (Output_section::Input_section::shndx): Ditto.
8371         (Output_section::Input_section::output_merge_base): New method defintion.
8372         (Output_section::Input_section::u2_.pomb): New union field.
8373         (Output_section::Merge_section_by_properties_map,
8374         Output_section::Output_section_data_by_input_section_map,
8375         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8376         Remove types.
8377         (Output_section::add_merge_input_section): Add new parameter
8378         KEEPS_INPUT_SECTIONS.
8379         (Output_section::build_lookup_maps): New method declaration.
8380         (Output_section::merge_section_map_,
8381         Output_section::merge_section_by_properties_map_,
8382         Output_section::relaxed_input_section_map_,
8383         Output_section::is_relaxed_input_section_map_valid_): Remove data
8384         members.
8385         (Output_section::lookup_maps_): New data member.
8386
8387 2010-05-21  Doug Kwan  <dougkwan@google.com>
8388
8389         PR gold/11619
8390         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8391         avoid a compilation error.
8392
8393 2010-05-19  Rafael Espindola  <espindola@google.com>
8394
8395         * script-sections.cc (Output_section_definition::allocate_to_segment):
8396         Update the phdrs_list even when the output section is NULL.
8397         * testsuite/Makefile.am: Add test.
8398         * testsuite/Makefile.in: Regenerate.
8399         * testsuite/script_test_9.cc: New.
8400         * testsuite/script_test_9.sh: New.
8401         * testsuite/script_test_9.t: New.
8402
8403 2010-05-19  Doug Kwan  <dougkwan@google.com>
8404
8405         * arm.cc (Arm_input_section::original_size): New method.
8406         (Arm_input_section::do_addralign): Add a cast.
8407         (Arm_input_section::do_output_offset): Remove static cast.
8408         (Arm_input_section::original_addralign,
8409          Arm_input_section::original_size_): Change type to uint32_t.
8410         (Arm_input_section::init): Add safe casts for section alignment
8411         and size.
8412         (Arm_input_section::set_final_data_size): Do not set address and
8413         offset of stub table.
8414         (Arm_output_section::fix_exidx_coverage): Change use of of
8415         Output_section::Simple_input_section to that of
8416         Output_section::Input_section.
8417         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8418         except for the first pass.
8419         * output.cc (Output_section::get_input_sections): Change type of
8420         input_sections to std::list<Input_section>.
8421         (Output_section::add_script_input_section): Rename from
8422         Output_section::add_simple_input_section.  Change type of SIS
8423         parameter from Simple_input_section to Input_section.
8424         * output.h (Output_section::Simple_input_section): Remove class.
8425         (Output_section::Input_section): Change class visibility to public.
8426         (Output_section::Input_section::addralign): Use stored alignments
8427         for special input sections if set.
8428         (Output_section::Input_section::set_addralign): New method.
8429         (Output_section::get_input_sections): Change parameter type from
8430         list of Simple_input_section to list of Input_section.
8431         (Output_section::add_script_input_section): Rename from
8432         Output_section::add_simple_input_section. Change first parameter's
8433         type from Simple_input_section to Input_section and remove the
8434         second and third parameters.
8435         * script-sections.cc (Input_section::Input_section_list): Change
8436         type to list of Output_section::Input_section/
8437         (Input_section_info::Input_section_info): Change parameter type of
8438         INPUT_SECTION to Output_section::Input_section.
8439         (Input_section_info::input_section): Change return type.
8440         (Input_section_info::input_section_): Change type to
8441         Output_section::Input_section.
8442         (Output_section_element_input::set_section_addresses): Adjust code
8443         to use Output_section::Input_section instead of
8444         Output_section::Simple_input_section.  Adjust code for renaming
8445         of Output_section::add_simple_input_section.
8446         (Orphan_output_section::set_section_addresses): Ditto.
8447
8448 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8449
8450         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8451         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8452
8453 2010-05-18  Rafael Espindola  <espindola@google.com>
8454
8455         * options.cc (General_options::finalize): Handle -nostdlib.
8456         * options.h (nostdlib): New option.
8457         * script.cc (script_add_search_dir): Handle -nostdlib.
8458
8459 2010-05-12  Doug Kwan  <dougkwan@google.com>
8460
8461         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8462         attributes section only if there no attributes section after merging.
8463         (Target_arm::merge_object_attributes): Move value of
8464         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8465         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8466         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8467         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8468         and arm_attr_merge_7.stdout.
8469         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8470         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8471         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8472         arm_attr_merge_7b.o): New rules.
8473         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8474         arm_attr_merge_7
8475         * testsuite/Makefile.in: Regenerate.
8476         * testsuite/arm_attr_merge.sh: New file.
8477         * testsuite/arm_attr_merge_[67][ab].s: Same.
8478
8479 2010-05-05  Nick Clifton  <nickc@redhat.com>
8480
8481         * po/es.po: Updated Spanish translation.
8482
8483 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8484
8485         * Makefile.am (install-exec-local): Properly install gold as
8486         default cross linker.
8487         * Makefile.in: Regenerated.
8488
8489 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8490             Nick Clifton  <nickc@redhat.com>
8491
8492         * configure.ac (install_as_default): Define and set to false
8493         unless --enable-gold or --enable-gold=both/gold has been
8494         specified.
8495         * configure: Regenerate.
8496
8497         * Makefile.am (install-exec-local): Install the executable as
8498         'ld.gold'.  If install_as_default is true then also install it as
8499         'ld'.
8500         * Makefile.in: Regenerated.
8501
8502 2010-04-24  Ian Lance Taylor  <iant@google.com>
8503
8504         * layout.cc (Layout::layout_reloc): In relocatable link don't
8505         combine reloc sections for grouped sections.
8506
8507 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8508
8509         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8510         sections that are not ordinary to icf.
8511         * icf.cc (get_section_contents): Handle relocation pointing to section
8512         with no object or shndx information.
8513         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8514         * testsuite/Makefile.in: Regenerate.
8515         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8516         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8517
8518 2010-04-22  Ian Lance Taylor  <iant@google.com>
8519
8520         * expression.cc (Expression::Expression_eval_info): Add
8521         result_alignment_pointer field.
8522         (Expression::eval_with_dot): Add result_alignment_pointer
8523         parameter.  Change all callers.
8524         (Expression::eval_maybe_dot): Likewise.
8525         (class Binary_expression): Add alignment_pointer parameter to
8526         left_value and right_value.  Change all callers.
8527         (BINARY_EXPRESSION): Set result alignment.
8528         (class Trinary_expression): Add alignment_pointer parameter to
8529         arg2_value and arg3_value.  Change all callers.
8530         (Trinary_cond::value): Set result alignment.
8531         (Max_expression::value, Min_expression::value): Likewise.
8532         (Align_expression::value): Likewise.
8533         * script-sections.cc (class Sections_element): Add dot_alignment
8534         parameter to set_section_addresses virtual function.  Update
8535         instantiations.
8536         (class Output_section_element): Likewise.
8537         (Script_sections::create_segments): Add dot_alignment parameter.
8538         Change all callers.
8539         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8540         (Script_sections::set_phdrs_clause_addresses): Likewise.
8541         * script-sections.h: Update declarations.
8542         * script.h: Update declarations.
8543         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8544         min_p_align.
8545         * testsuite/script_test_3.t: Set large alignment.
8546         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8547         segment has expected alignment.
8548
8549 2010-04-22  Nick Clifton  <nickc@redhat.com>
8550
8551         * po/gold.pot: Updated by the Translation project.
8552         * po/vi.po: Updated Vietnamese translation.
8553
8554 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8555
8556         * testsuite/Makefile.am (check_PROGRAMS): Add
8557         icf_virtual_function_folding_test.
8558         * testsuite/Makefile.in: Regenerated.
8559
8560 2010-04-15  Andrew Haley  <aph@redhat.com>
8561
8562         * options.h (merge_exidx_entries): New option.
8563         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8564         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8565         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8566         (Target_arm::merge_exidx_entries): New function.
8567         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8568         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8569         to Arm_exidx_fixup constructor.
8570         Add new arg, merge_exidx_entries.
8571         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8572         Arm_output_section::fix_exidx_coverage.
8573
8574 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8575
8576         * icf.cc (get_section_contents): Check for preemptible functions.
8577         Ignore addend when appropriate.
8578         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8579         section folded.
8580         (add_from_relobj): Check for section folded.
8581         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8582         * symtab.h (should_add_dynsym_entry): Add new parameter.
8583         * target-reloc.h (scan_relocs): Check for section folded.
8584         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8585         Check reloc types for function pointers in shared objects.
8586         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8587         case.
8588         (icf_preemptible_functions_test): New test case.
8589         (icf_string_merge_test): New test case.
8590         * testsuite.Makefile.in: Regenerate.
8591         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8592         bar_glob.  Refactor code.
8593         * testsuite/icf_preemptible_functions_test.cc: New file.
8594         * testsuite/icf_preemptible_functions_test.sh: New file.
8595         * testsuite/icf_string_merge_test.cc: New file.
8596         * testsuite/icf_string_merge_test.sh: New file.
8597         * testsuite/icf_virtual_function_folding_test.cc: New file.
8598         * testsuite/icf_virtual_function_folding_test.sh: New file.
8599
8600 2010-04-14  Doug Kwan  <dougkwan@google.com>
8601
8602         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8603         for local symbol recounting if we remove a section due to ICF.
8604         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8605         there are no regular objects in input.
8606
8607 2010-04-13  Doug Kwan  <dougkwan@google.com>
8608
8609         * arm.cc (Arm_input_section::set_final_data_size): Compute
8610         accurate final data size instead of using current data size.
8611
8612 2010-04-09  Doug Kwan  <dougkwan@google.com>
8613
8614         * layout.cc (Layout::choose_output_section): Handle script section
8615         types.
8616         (Layout::make_output_section_for_script): Add section type parameter.
8617         Handle script section types.
8618         * layout.h (Layout::make_output_section_for_script): Add section
8619         type parameter.
8620         * output.cc (Output_section::Output_section): Initialize data member
8621         is_noload_.
8622         (Output_section::do_reset_address_and_file_offset): Do not set address
8623         to 0 if section is a NOLOAD section.
8624         * output.h (Output_section::is_noload): New method.
8625         (Output_section::set_is_noload): Ditto.
8626         (Output_section::is_noload_): New data member.
8627         * script-c.h (Script_section_type): New enum type.
8628         (struct Parser_output_section_header): Add new file section_type.
8629         * script-sections.cc (Sections_element::output_section_name): Add
8630         parameter for returning script section type.
8631         (Output_section_definition::output_section_name): Ditto.
8632         (Output_section_definition::section_type)P; New method.
8633         (Output_section_definiton::script_section_type_name): Ditto.
8634         (Output_section_definition::script_section_type_): New data member.
8635         (Output_section_definition::Output_section_definition): Initialize
8636         data member Output_section_definition::script_section_type_.
8637         (Output_section_definition::create_sections): Pass script section type
8638         to Layout::make_output_section_for_script.
8639         (Output_section_definition::output_section_name): Return script
8640         section type to caller.
8641         (Output_section_definition::set_section_address): Do not advance
8642         dot value and load address if section type is NOLOAD.  Set address
8643         of NOLOAD sections regardless of section flags.
8644         (Output_section_definition::print): Print section type if it is
8645         not SCRIPT_SECTION_TYPE_NONE.
8646         (Output_section_definition::section_type): New method.
8647         (Output_section_definition::script_section_type_name): Ditto.
8648         (Script_sections::output_section_name): Add new parameter
8649         PSECTION_TYPE for returning script section type.  Pass it to
8650         section elements.  Handle discard sections.
8651         (Sort_output_sections::operator()): Handle NOLOAD sections.
8652         * script-sections.h (Script_sections::Section_type): New enum type.
8653         (Script_sections::output_section_name): Add a new parameter for
8654         returning script section type.
8655         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8656         INFO and NOLOAD.
8657         * yyscript.y (union): Add new field SECTION_TYPE.
8658         (COPY, DSECT, INFO, NOLOAD): New tokens.
8659         (opt_address_and_section_type): Change type to output_section_header.
8660         (section_type): New non-terminal
8661         (section_header): Handle section type.
8662         (opt_address_and_section_type): Return section type value.
8663
8664 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8665
8666         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8667         * testsuite/plugin_common_test_2.c (foo): Likewise.
8668
8669 2010-04-08  Doug Kwan  <dougkwan@google.com>
8670
8671         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8672         Output_merge_data.
8673         * output.cc (Output_section::add_merge_input_section): Simplify
8674         code and return status of Output_merge_base::add_input_section.
8675         Update merge section map only if Output_merge_base::add_input_section
8676         returns true.
8677
8678 2010-04-07  Doug Kwan  <dougkwan@google.com>
8679
8680         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8681         if section is marked as containing instructions but has no mapping
8682         symbols.
8683         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8684         correct section index.
8685         (Arm_relobj::find_linked_text_section): Ditto.
8686
8687 2010-04-07  Cary Coutant  <ccoutant@google.com>
8688
8689         * archive.cc (include_member): Destroy Read_symbols_data object before
8690         releasing file.
8691         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8692         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8693         (Read_symbols_data::~Read_symbols_data) New destructor.
8694         (Section_relocs::Section_relocs) New constructor.
8695         (Section_relocs::~Section_relocs) New destructor.
8696         (Read_relocs_data::Read_relocs_data) New constructor.
8697         (Read_relocs_data::~Read_relocs_data) New destructor.
8698         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8699         pointers to NULL after deleting.
8700
8701 2010-04-07  Doug Kwan  <dougkwan@google.com>
8702
8703         * arm.cc: Replace "endianity" with "endianness" in comments.
8704         (Arm_exidx_cantunwind): Ditto.
8705         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8706         (Arm_relobj::merge_flags_and_attributes): New method.
8707         (Arm_relobj::merge_flags_and_attributes_): New data member.
8708         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8709         (Arm_relobj::scan_sections_for_stubs): Ditto.
8710         (Arm_relobj::do_read_symbols): Check to see if we really want to
8711         merge processor-specific flags and attributes.  Exit early if
8712         an object is empty except for section names and the undefined symbol.
8713         (Target_arm::do_finalize_sections): Move check for ELF format to
8714         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8715         attributes from a regular object only when we have determined that
8716         it is aapropriate.  Do not create an .ARM.attributes section in
8717         output if there is no regular input object.
8718         (Target_arm::merge_processor_specific_flags): Check
8719         --warn-mismatch before printing any error.
8720         (Target_arm::merge_object_attributes): Ditto.
8721         * gold.cc (queue_middle_tasks): Handle the case in which there is
8722         no regular object in input.
8723         * options.cc (General_options::parse_EB): New method.
8724         (General_options::parse_EL): Same.
8725         (General_options::General_options): Initialize endianness_.
8726         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8727         New options.
8728         (General_options::Endianness): New enum.
8729         (General_options::endianness): New method.
8730         (General_options::endianness_): New data member.
8731         * parameters.cc (Parameters::set_options): Check target endianness.
8732         (Parameters::set_target_once): Ditto.
8733         (Parameters::check_target_endianness): New method.
8734         (parameters_force_valid_target): If either -EL or -EB is specified,
8735         use it to define endianness of default target.
8736         * parameters.h (Parameters::check_target_endianness): New method
8737         declaration.
8738         * target.h (class Target): Change "endianity" to "endianness"
8739         in comments.
8740
8741 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8742
8743         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8744         * configure: Regenerate.
8745         * Makefile.in: Regenerate.
8746         * testsuite/Makefile.in: Regenerate.
8747
8748 2010-04-06  Cary Coutant  <ccoutant@google.com>
8749
8750         gcc PR lto/42757
8751         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8752         prevailing definitions of common symbols.
8753         * testsuite/plugin_test_6.sh: New test case.
8754         * testsuite/plugin_common_test_1.c: New test case.
8755         * testsuite/plugin_common_test_2.c: New test case.
8756         * testsuite/Makefile.am (plugin_test_6): New test case.
8757         * testsuite/Makefile.in: Regenerate.
8758
8759 2010-04-06  Nick Clifton  <nickc@redhat.com>
8760
8761         * po/vi.po: New Vietnamese translation.
8762
8763 2010-03-30  Doug Kwan  <dougkwan@google.com>
8764
8765         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8766
8767 2010-03-25  Doug Kwan  <dougkwan@google.com>
8768
8769         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8770         to avoid a conversion warning on a 32-bit host.
8771
8772 2010-03-24  Ian Lance Taylor  <iant@google.com>
8773
8774         * testsuite/script_test_3.t: Add a TLS segment.
8775         * testsuite/Makefile.am (check_PROGRAMS): Add
8776         tls_phdrs_script_test.
8777         (tls_phdrs_script_test_SOURCES): Define.
8778         (tls_phdrs_script_test_DEPENDENCIES): Define.
8779         (tls_phdrs_script_test_LDFLAGS): Define.
8780         (tls_phdrs_script_test_LDADD): Define.
8781         * testsuite/Makefile.in: Rebuild.
8782
8783 2010-03-23  Cary Coutant  <ccoutant@google.com>
8784
8785         * fileread.cc (find_or_make_view): Fix comment.
8786
8787 2010-03-23  Ian Lance Taylor  <iant@google.com>
8788
8789         * script-sections.cc (class Orphan_section_placement): Define
8790         PLACE_TLS and PLACE_TLS_BSS.
8791         (Orphan_section_placement::Orphan_section_placement): Initialize
8792         new places.
8793         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8794         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8795         (tls_script_test_SOURCES): Define.
8796         (tls_script_test_DEPENDENCIES): Define.
8797         (tls_script_test_LDFLAGS): Define.
8798         (tls_script_test_LDADD): Define.
8799         * testsuite/Makefile.in: Rebuild.
8800
8801 2010-03-22  Doug Kwan  <dougkwan@google.com>
8802
8803         * arm.cc (Arm_relocate_functions::abs8,
8804         Arm_relocate_functions::abs16): Use correct check for overflow
8805         specified in the ARM ELF specs.
8806         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8807         target of a BLX instruction specially.
8808         (Reloc_stub::stub_type_for_reloc): Ditto.
8809         (Relocate::relocate): Use symbolic names instead of numeric relocation
8810         codes to report error.
8811         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8812         workaround.
8813         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8814         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8815         thumb2_blx_out_of_range.stdout
8816         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8817         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8818         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8819         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8820         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8821         thumb2_blx_in_range, thumb2_blx_in_range.o,
8822         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8823         thumb2_blx_out_of_range.o): New rules.
8824         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8825         thumb2_blx_in_range and thumb2_blx_out_of_range.
8826         * testsuite/Makefile.in: Regenerate.
8827         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8828         * testsuite/thumb_blx_in_range.s: New file.
8829         * testsuite/thumb_blx_out_of_range.s: New file.
8830
8831 2010-03-22  Rafael Espindola  <espindola@google.com>
8832
8833         * archive.cc (Should_include): Move to archive.h.
8834         (should_include_member): Make it a member of Archive.
8835         (Lib_group): New.
8836         (Add_lib_group_symbols): New.
8837         * archive.h: Include options.h.
8838         (Archive_member): Moved from Archive.
8839         (Should_include): Moved from archive.cc.
8840         (Lib_group): New.
8841         (Add_lib_group_symbols): New.
8842         * dynobj.cc (do_should_include_member): New.
8843         * dynobj.h (do_should_include_member): New.
8844         * gold.cc (queue_initial_tasks): Update call to queue.
8845         * main.cc (main): Print lib group stats.
8846         * object.cc (do_should_include_member): New.
8847         * object.h: Include archive.h.
8848         (Object::should_include_member): New.
8849         (Object::do_should_include_member): New.
8850         (Sized_relobj::do_should_include_member): New.
8851         * options.cc (General_options::parse_start_lib): New.
8852         (General_options::parse_end_lib): New.
8853         (Input_arguments::add_file): Handle lib groups.
8854         (Input_arguments::start_group): Check we are not in a lib.
8855         (Input_arguments::start_lib): New.
8856         (Input_arguments::end_lib): New.
8857         * options.h (General_options): Add start_lib and end_lib.
8858         (Input_argument::lib_): New.
8859         (Input_argument::lib): New.
8860         (Input_argument::is_lib): New.
8861         (Input_file_lib): New.
8862         (Input_arguments::in_lib_): New.
8863         (Input_arguments::in_lib): New.
8864         (Input_arguments::start_lib): New.
8865         (Input_arguments::end_lib_): New.
8866         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8867         in unused members as preempted.
8868         (Sized_pluginobj::do_should_include_member): New.
8869         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8870         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8871         return the blocker.
8872         (Read_symbols::do_whole_lib_group): New.
8873         (Read_symbols::do_lib_group): New.
8874         (Read_symbols::do_read_symbols): Handle lib groups.
8875         (Read_symbols::get_name): Handle lib groups.
8876         * readsyms.h (Read_symbols): Add an archive member pointer.
8877         (Read_symbols::do_whole_lib_group): New.
8878         (Read_symbols::do_lib_group): New.
8879         (Read_symbols::member_): New.
8880         * script.cc (read_input_script): Update call to queue_soon.
8881
8882 2010-03-19  Doug Kwan  <dougkwan@google.com>
8883
8884         * arm.cc (Stub_table::Stub_table): Initialize new data members
8885         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8886         (Stub_table::add_reloc_stub): Assign stub offset and update
8887         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8888         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8889         New data members.
8890         (Stub_table::update_data_size_and_addralign): Use
8891         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8892         instead of going over all reloc stubs.
8893         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8894         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8895         Stringpool_template::offset_ to size of Stringpool_char.
8896         (Stringpool_template::new_key_offset): Remove code to initialize
8897         Stringpool_template::offset_.
8898         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8899         Stringpool_template::offset_ to zero.
8900
8901 2010-03-15  Doug Kwan  <dougkwan@google.com>
8902
8903         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8904         offset_.
8905         (Stringpool_template::new_key_offset): New method.
8906         (Stringpool_template::add_string): Assign offsets when adding new
8907         strings.
8908         (Stringpool_template::set_string_offsets): Do not set string offsets
8909         when not optimizing.
8910         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8911         member size_.
8912         (Chunked_vector::clear): Clear size_.
8913         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8914         (Chunked_vector::size): Return size_.
8915         (Chunked_vector::push_back): Use size_ to find insert position.
8916         (Chunked_vector::size_): New data member.
8917         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8918         (Stringpool_template::new_key_offset): New method declaration.
8919         (Stringpool_template::offset_): New data member.
8920
8921 2010-03-15   Rafael Espindola  <espindola@google.com>
8922
8923         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8924         Add_symbols' constructor.
8925         * readsyms.h (Add_symbols): Remove the input_group member.
8926
8927 2010-03-10  Ian Lance Taylor  <iant@google.com>
8928
8929         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8930         target to ask whether a reference to a symbol requires a stack
8931         split.
8932         * target.h (Target::is_call_to_non_split): New function.
8933         (Target::do_is_call_to_non_split): Declare virtual function.
8934         * target.cc: Include "symtab.h".
8935         (Target::do_is_call_to_non_split): New function.
8936         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8937
8938 2010-03-10  Cary Coutant  <ccoutant@google.com>
8939
8940         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8941         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8942         (File_read::open[2]): Add whole_file_view_ to list of views.
8943         (File_read::make_view): Remove test of whole_file_view_.
8944         (File_read::find_or_make_view): Create whole_file_view_ if
8945         necessary.
8946         (File_read::clear_views): Replace bool parameter with enum;
8947         adjust all callers.  Don't delete views with permanent data;
8948         do delete cached views and views from archives if
8949         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8950         if clearing the corresponding view.
8951         * fileread.h (File_read::Clear_views_mode): New enum.
8952         (File_read::View::is_permanent_view): New method.
8953         (File_read::clear_views): Replace bool parameter
8954         with enum; adjust all callers.
8955         * options.h (General_options): Change keep_files_mapped option;
8956         add map_whole_files.
8957         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8958         releasing the file.
8959         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8960         the file.
8961
8962 2010-03-10  David S. Miller  <davem@davemloft.net>
8963
8964         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8965
8966 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8967
8968         * icf.cc (get_section_contents): Add '@' marker after processing the
8969         merge reloc.
8970
8971 2010-03-08  Doug Kwan  <dougkwan@google.com>
8972
8973         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8974         due to a conversion warning.
8975         (Arm_relobj::update_output_local_symbol_count): Check for local
8976         symbol with unset output index.
8977
8978 2010-03-05  Ian Lance Taylor  <iant@google.com>
8979
8980         * options.h (class General_options): Add --spare-dynamic-tags.
8981         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8982         --spare-dynamic-tags.
8983
8984 2010-03-05  Ian Lance Taylor  <iant@google.com>
8985
8986         * incremental.cc: Include "libiberty.h".
8987
8988 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8989
8990         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8991         function, is_info_ member.
8992         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8993         (Versions::Versions): Update caller.
8994         (Versions::define_base_version): Likewise.
8995         (Versions::add_def): Likewise.
8996
8997 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8998
8999         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9000         (Scan::possible_function_pointer_reloc): New function.
9001         (Scan::local_reloc_may_be_function_pointer): Change to call
9002         possible_function_pointer_reloc.
9003         (Scan::global_reloc_may_be_function_pointer): Ditto.
9004         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9005         relocations in ".data.rel.ro._ZTV" section.
9006         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9007         * testsuite/icf_safe_so_test.cc: Ditto.
9008         * testsuite/icf_safe_test.cc: Ditto.
9009         * testsuite/icf_safe_test.sh: Ditto.
9010
9011 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9012             Ian Lance Taylor  <iant@google.com>
9013
9014         * target-reloc.h (relocate_section): Check the symbol table index
9015         for -1U before setting the local symbol index.
9016         (scan_relocatable_relocs): If copying the relocation, record that
9017         the local symbol is required.
9018         * object.h (Symbol_value::is_output_symtab_index_set): New
9019         function.
9020         (Symbol_value::may_be_discarded_from_output_symtab): New
9021         function.
9022         (Symbol_value::has_output_symtab_entry): New function.
9023         (Symbol_value::needs_output_symtab_entry): Remove.
9024         (Symbol_value::output_symtab_index): Make sure the symbol index is
9025         set.
9026         (Symbol_value::set_output_symtab_index): Make sure the symbol
9027         index is not set.  Make sure the new index is valid.
9028         (Symbol_value::set_must_have_output_symtab_entry): New function.
9029         (Symbol_value::has_output_dynsym_entry): New function.
9030         (Symbol_value::set_output_dynsym_index): Make sure the new index
9031         is valid.
9032         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9033         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9034         local symbol if permitted.
9035         (Sized_relobj::do_finalize_local_symbols): Call
9036         is_output_symtab_index_set rather than needs_output_symtab_entry.
9037         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9038         rather than needs_output_symtab_entry.  Call
9039         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9040         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9041         is_output_symtab_index_set rather than needs_output_symtab_entry.
9042         * testsuite/discard_locals_relocatable_test.c: New file.
9043         * testsuite/discard_locals_test.sh: Test -r.
9044         * testsuite/Makefile.am (check_DATA): Add
9045         discard_locals_relocatable_test1.syms,
9046         discard_local_relocatable_test2.syms.
9047         (MOSTLYCLEANFILES): Likewise.  Also add
9048         discard_locals_relocatable_test1.lout and
9049         discard_locals_relocatable_test2.out.
9050         (discard_locals_relocatable_test1.syms): New target.
9051         (discard_locals_relocatable_test.o): New target.
9052         (discard_locals_relocatable_test1.out): New target.
9053         (discard_locals_relocatable_test2.syms): New target.
9054         (discard_locals_relocatable_test2.out): New target.
9055         (various): Add missing ../ld-new dependencies.
9056         * testsuite/Makefile.in: Rebuild.
9057
9058 2010-03-03  Nick Clifton  <nickc@redhat.com>
9059
9060         * po/fi.po: New Finnish translation.
9061
9062 2010-03-01  Doug Kwan  <dougkwan@google.com>
9063
9064         * layout.cc (Layout::Layout): Force section types of .init_array*,
9065         .preinit_array* and .fini_array* sections.
9066         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9067         Fix check of return value of std::string::find.().
9068         (Output_section::Input_section_sort_compare::operator()): Remove
9069         comment about .init_array.
9070         (Output_section::Input_section_sort_init_fini_compare::operator()):
9071         New method.
9072         (Output_section::sort_attached_input_sections): Handle .init_array
9073         and .fini_array specially.
9074         * output.h (Output_section::Inut_section_sort_compare): Update
9075         comment.
9076         (Output_section::Input_section_sort_init_fini_compare): New struct.
9077
9078 2010-02-26  Doug Kwan  <dougkwan@google.com>
9079
9080         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9081         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9082         * testsuite/debug_msg.sh: Avoid matching source line number for
9083         use of global variable undef_int.
9084
9085 2010-02-26  Doug Kwan  <dougkwan@google.com>
9086
9087         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9088         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9089         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9090         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9091         * options.cc (General_options::General_options): Initialize member
9092         fix_v4bx_.
9093         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9094         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9095         and rm_no_fix_v4bx.stdout
9096         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9097         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9098         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9099         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9100         and arm_no_fix_v4bx.
9101         * Makefile.in: Regenerate.
9102         * testsuite/arm_fix_v4bx.s: New file.
9103         * testsuite/arm_fix_v4bx.sh: Ditto.
9104
9105 2010-02-24  Doug Kwan  <dougkwan@google.com>
9106
9107         * arm.cc (Target_arm::got_section): Make the .got section the first
9108         non RELRO section in the data segment.
9109         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9110         suffixes of section names.
9111
9112 2010-02-24  Doug Kwan  <dougkwan@google.com>
9113
9114         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9115         flags and attributes merging if an input file is a binary file.
9116         * fileread.cc (Input_file::open): Record format of original file.
9117         * fileread.h (Input_file::Format): New enum type.
9118         (Input_file::Input_file): Initialize data member format_.
9119         (Input_file::format): New method definition.
9120         (Input_file::format_):: New data member.
9121
9122 2010-02-24  Doug Kwan  <dougkwan@google.com>
9123
9124         * arm.cc (Arm_output_data_got): New class.
9125         (ARM_TCB_SIZE): New constant
9126         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9127         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9128         If user uses a script with a SECTIONS clause, issue only a warning
9129         for a misplaced EXIDX input section.  Otherwise, issue an error.
9130         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9131         garbage collection.
9132         (Target_arm::got_mode_index_entry): Handle static linking.
9133         (Target_arm::Scan::local): Ditto.
9134         (Target_arm::Scan::global): Ditto.
9135         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9136         all incorrectly implemented relocations.
9137         (Target_arm::fix_exidx_coverage): Pass layout to
9138         Arm_output_section::fix_exidx_coverage.
9139         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9140         from ".ARM.exidx." and ".ARM.extab.".
9141
9142 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9143
9144         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9145         section if it does not already exist.
9146         * attributes.cc (Attributes_section_data::Attributes_section_data):
9147         Don't crash if size is zero.
9148
9149 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9150             Ian Lance Taylor  <iant@google.com>
9151
9152         * gold.cc (queue_middle_tasks): If no input files were opened,
9153         exit.
9154         * workqueue.h (Task_function::Task_function): Assert that there is
9155         a blocker.
9156
9157 2010-02-22  Doug Kwan  <dougkwan@google.com>
9158
9159         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9160         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9161         types to avoid warnings due to different uint64_t implementations
9162         on different hosts.
9163
9164 2010-02-21  Doug Kwan  <dougkwan@google.com>
9165
9166         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9167         handling of the maximum backward branch offset.
9168         (Arm_relocate_functions::thumb_branch_common): Ditto.
9169         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9170         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9171         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9172         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9173         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9174         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9175         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9176         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9177         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9178         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9179         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9180         thumb2_bl_out_of_range.o): New rules.
9181         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9182         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9183         thumb2_bl_out_of_range
9184         * testsuite/Makefile.in: Regenerate.
9185         * testsuite/arm_bl_in_range.s: New file.
9186         * testsuite/arm_bl_out_of_range.s: Ditto.
9187         * testsuite/arm_branch_in_range.sh: Ditto.
9188         * testsuite/arm_branch_range.t: Ditto.
9189         * testsuite/thumb2_branch_range.t: Ditto.
9190         * testsuite/thumb_bl_in_range.s: Ditto.
9191         * testsuite/thumb_bl_out_of_range.s: Ditto.
9192         * testsuite/thumb_branch_range.t: Ditto.
9193
9194 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9195
9196         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9197         Add reloc offset information.
9198         * icf.cc (get_section_contents): Change iterators to point to the new
9199         vectors. Add reloc offset information to the contents.
9200         * icf.h (Icf::Sections_reachable_info): New typedef.
9201         (Icf::Sections_reachable_list): New typedef.
9202         (Icf::Offset_info): New typedef.
9203         (Icf::Reloc_info): New struct typedef.
9204         (Icf::Reloc_info_list): New typedef.
9205         (Icf::symbol_reloc_list): Delete method.
9206         (Icf::addend_reloc_list): Delete method.
9207         (Icf::section_reloc_list): Delete method.
9208         (Icf::reloc_info_list): New method.
9209         (Icf::reloc_info_list_): New member.
9210
9211 2010-02-19  Doug Kwan  <dougkwan@google.com>
9212
9213         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9214         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9215         * arm.cc (Arm_relocation_functions): New forward declaration.
9216         (Target_arm::Target_arm): Initialize new data members
9217         got_mod_index_offset_ and tls_base_symbol_defined_.
9218         (Target_arm::Relocate::relocate_tls): New method.
9219         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9220          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9221         New methods.
9222         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9223         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9224         (Target_arm::got_mod_index_offset_,
9225         Target_arm::tls_base_symbol_defined_): New data members.
9226         (Target_arm::Scan::local, Target::Scan::global,
9227         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9228         relocations.
9229
9230 2010-02-18  Doug Kwan  <dougkwan@google.com>
9231
9232         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9233         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9234         text section as a parameter becuase some broken tools may not set
9235         the link in section header.
9236         (Target_arm::has_got_section): New method.
9237         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9238         without any mapping symbol as data only.  Remove warning.
9239         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9240         link in its section header, try to discover the link by inspecting the
9241         REL31 relocation at the beginning of the section.
9242         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9243         in error message.
9244         (Target_arm::Scan::global): Treat any reference to the symbol
9245         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9246
9247 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9248
9249         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9250         (Scan::global_reloc_may_be_function_pointer): New function.
9251         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9252         (Scan::global_reloc_may_be_function_pointer): New function.
9253         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9254         (Scan::global_reloc_may_be_function_pointer): New function.
9255         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9256         (Scan::global_reloc_may_be_function_pointer): New function.
9257         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9258         (Scan::global_reloc_may_be_function_pointer): New function.
9259         (Scan::possible_function_pointer_reloc): New function.
9260         (Target_x86_64::can_check_for_function_pointers): New function.
9261         * gc.h (gc_process_relocs): Scan relocation types to determine if
9262         function pointers were taken for targets that support it.
9263         * icf.cc (Icf::find_identical_sections): Include functions for
9264         folding in safe ICF whose pointer is not taken.
9265         * icf.h (Secn_fptr_taken_set): New typedef.
9266         (fptr_section_id_): New member.
9267         (section_has_function_pointers): New function.
9268         (set_section_has_function_pointers): New function.
9269         (check_section_for_function_pointers): New function.
9270         * options.h: Fix comment for safe ICF option.
9271         * target.h (can_check_for_function_pointers): New function.
9272         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9273         Modify icf_safe_test for X86-64.
9274         * testsuite/Makefile.in: Regenerate.
9275         * testsuite/icf_safe_so_test.cc: New file.
9276         * testsuite/icf_safe_so_test.sh: New file.
9277         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9278         (main): Change to take pointer to function kept_func_3.
9279         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9280         folding is done correctly for X86-64.
9281
9282 2010-02-12  David S. Miller  <davem@davemloft.net>
9283
9284         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9285         is_symbolless parameter.
9286         (Output_reloc<SHT_REL>::is_symbolless): New.
9287         (Output_reloc<SHT_REL>::is_symbolless_): New.
9288         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9289         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9290         (Output_reloc<SHT_RELA>::is_symbolless): New.
9291         (Output_data_reloc::add_global): Handle is_symbolless.
9292         (Output_data_reloc::add_global_relative): Likewise.
9293         (Output_data_reloc::add_local): Likewise.
9294         (Output_data_reloc::add_local_relative): Likewise.
9295         (Output_data_reloc::add_symbolless_global_addend): New.
9296         (Output_data_reloc::add_symbolless_local_addend): New.
9297         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9298         is_symbolless.
9299         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9300         instead of ->is_relative_
9301         (Output_reloc::write): Likewise.
9302         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9303         (Output_reloc::write_rel): Simplify.
9304
9305         * sparc.cc (Target_sparc::Scan::local): Use
9306         ->add_symbolless_local_addend as needed.
9307         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9308         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9309         based upon relocation offset.
9310
9311 2010-02-11  Doug Kwan  <dougkwan@google.com>
9312
9313         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9314         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9315         beginning of function.
9316         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9317         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9318         parameter is_32bit in calls to should_apply_static_reloc.
9319         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9320         (check_DATA): Add arm_abs_global.stdout.
9321         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9322         arm_abs_global.stdout): New rules.
9323         (MOSTLLYCLEANFILES): Add arm_abs_global
9324         * Makefile.in: Regenerate.
9325         * testsuite/arm_abs_global.s: New file.
9326         * testsuite/arm_abs_global.sh: Ditto.
9327         * testsuite/arm_abs_lib.s: Ditto.
9328
9329 2010-02-11  Ian Lance Taylor  <iant@google.com>
9330
9331         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9332         Read_relocs task.
9333         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9334         Allocate_commons_task first.
9335         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9336         task, rather than symtab_lock_.
9337         (Gc_process_relocs::~Gc_process_relocs): New function.
9338         (Gc_process_relocs::is_runnable): Check this_blocker_.
9339         (Gc_process_relocs::locks): Use next_blocker_ rather than
9340         blocker_.
9341         (Scan_relocs::~Scan_relocs): New function.
9342         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9343         symtab_lock_.
9344         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9345         next_blocker_.
9346         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9347         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9348         constructor accordingly.
9349         (class Gc_process_relocs): Likewise.
9350         (class Scan_relocs): Likewise.
9351         * common.h (class Allocate_commons_task): Remove symtab_lock_
9352         field, and corresponding constructor parameter.
9353         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9354         symtab_lock_.
9355         (Allocate_commons_task::locks): Likewise.
9356
9357 2010-02-11  Ian Lance Taylor  <iant@google.com>
9358
9359         * gold-threads.h (class Once): Define.
9360         (class Initialize_lock): Rewrite as child of Once.
9361         * gold-threads.cc (class Once_initialize): Define.
9362         (once_pointer_control): New static variable.
9363         (once_pointer, once_arg): New static variables.
9364         (c_run_once): New static function.
9365         (Once::Once, Once::run_once, Once::internal_run): New functions.
9366         (class Initialize_lock_once): Remove.
9367         (initialize_lock_control): Remove.
9368         (initialize_lock_pointer): Remove.
9369         (initialize_lock_once): Remove.
9370         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9371         (Initialize_lock::initialize): Rewrite.
9372         (Initialize_lock::do_run_once): New function.
9373         * archive.cc (Archive::interpret_header): Only clear name if it is
9374         not already empty.
9375         * fileread.cc: Include "gold-threads.h"
9376         (file_counts_lock): New static variable.
9377         (file_counts_initialize_lock): Likewise.
9378         (File_read::release): Only increment counts when using --stats.
9379         Use a lock around the increment.
9380         * parameters.cc (class Set_parameters_target_once): Define.
9381         (set_parameters_target_once): New static variable.
9382         (Parameters::Parameters): Move here from parameters.h.
9383         (Parameters::set_target): Rewrite.
9384         (Parameters::set_target_once): New function.
9385         (Parameters::clear_target): Move here and rewrite.
9386         * parameters.h (class Parameters): Update declarations.  Add
9387         set_parameters_target_once_ field.
9388         (Parameters::Parameters): Move to parameters.cc.
9389         (Parameters::clear_target): Likewise.
9390         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9391         task.
9392         (Start_group::~Start_group): New function.
9393         (Start_group::is_runnable): New function.
9394         (Start_group::locks, Start_group::run): New functions.
9395         (Finish_group::run): Change saw_undefined to size_t.
9396         * readsyms.h (class Start_group): Define.
9397         (class Finish_group): Change saw_undefined_ field to size_t.
9398         (Finish_group::Finish_group): Remove saw_undefined and
9399         this_blocker parameters.  Change all callers.
9400         (Finish_group::set_saw_undefined): New function.
9401         (Finish_group::set_blocker): New function.
9402         * symtab.h (class Symbol_table): Change saw_undefined to return
9403         size_t.  Change saw_undefined_ field to size_t.
9404         * target-select.cc (Set_target_once::do_run_once): New function.
9405         (Target_selector::Target_selector): Initialize set_target_once_
9406         field.  Don't initialize lock_ and initialize_lock_ fields.
9407         (Target_selector::instantiate_target): Rewrite.
9408         (Target_selector::set_target): New function.
9409         * target-select.h (class Set_target_once): Define.
9410         (class Target_selector): Update declarations.  Make
9411         Set_target_once a friend.  Remove lock_ and initialize_lock_
9412         fields.  Add set_target_once_ field.
9413
9414 2010-02-10  Ian Lance Taylor  <iant@google.com>
9415
9416         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9417         queueing any tasks.
9418         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9419         (queue_middle_tasks): Add all blockers before queueing any tasks.
9420         (queue_final_tasks): Likewise.
9421         * token.h (Task_token::add_blockers): New function.
9422         * object.h (Input_objects::number_of_relobjs): New function.
9423
9424 2010-02-10  Ian Lance Taylor  <iant@google.com>
9425
9426         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9427         shared, not if not position independent.
9428         * x86_64.cc (Relocate::relocate_tls): Likewise.
9429         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9430         (tls_pie_pic_test): New target.
9431         * testsuite/Makefile.in: Rebuild.
9432
9433         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9434         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9435         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9436         * testsuite/Makefile.in: Rebuild.
9437
9438 2010-02-09  David S. Miller  <davem@davemloft.net>
9439
9440         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9441         R_SPARC_RELATIVE using ->add_local_relative().
9442         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9443
9444         * output.h (Output_data_dynamic::add_section_size): New method
9445         that takes two Output_data objects.
9446         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9447         entry param.  Handle it in initializers.
9448         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9449         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9450         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9451         arg.
9452         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9453         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9454         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9455         for dynrel_includes_plt.
9456         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9457         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9458         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9459         before .rela.plt
9460         (Target_sparc::do_finalize_sections): Update to pass true for
9461         dynrel_includes_plt.
9462         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9463         output before .rela.plt
9464         (Target_powerpc::do_finalize_sections): Update to pass true for
9465         dynrel_includes_plt when 32-bit.
9466
9467 2010-02-08  Doug Kwan  <dougkwan@google.com>
9468
9469         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9470         method.
9471         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9472         Arm_relobj::scan_section_for_cortex_a8_stubs,
9473         Arm_relobj::do_relocation_section): Instead of calling
9474         Output_section::output_address, use faster
9475         Arm_relobj::simple_input_section_output_address.
9476
9477 2010-02-08  David S. Miller  <davem@davemloft.net>
9478
9479         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9480         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9481         relocation helper function.
9482
9483         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9484         just like R_SPARC_GOT{10,13,22}.
9485         (Target_sparc::Scan::local): Likewise.
9486         (Target_sparc::Relocate:relocate): Likewise.
9487
9488 2010-02-06  Ian Lance Taylor  <iant@google.com>
9489
9490         * configure.ac: Rewrite targetobjs duplicate removal code to use
9491         only shell constructs.
9492         * configure: Rebuild.
9493
9494 2010-02-05  Doug Kwan  <dougkwan@google.com>
9495
9496         PR 11247
9497         * arm.cc (Arm_relobj::section_is_scannable): New method.
9498         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9499         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9500
9501 2010-02-04  Doug Kwan  <dougkwan@google.com>
9502
9503         PR 11247
9504         * arm-reloc-property.cc (cstdio): Include.
9505         * configure.ac (targetobjs): Remove duplicates.
9506         * configure: Regenerate.
9507         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9508         big and little endian version for a given address size.
9509
9510 2010-02-03  Doug Kwan  <dougkwan@google.com>
9511
9512         * arm-reloc-property.cc
9513         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9514         definition.
9515         * arm-reloc-property.h
9516         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9517         New method definition.
9518         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9519         declaration.
9520         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9521         overflow to N.
9522         (GOT_PREL): Change implemented to Y.
9523         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9524         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9525         (Arm_relocate_functions::movw_abs_nc): Remove method.
9526         (Arm_relocate_functions::movt_abs): Ditto.
9527         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9528         (Arm_relocate_functions::thm_movt_abs): Ditto.
9529         (Arm_relocate_functions::movw_rel_nc): Ditto.
9530         (Arm_relocate_functions::movw_rel): Ditto.
9531         (Arm_relocate_functions::movt_rel): Ditto.
9532         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9533         (Arm_relocate_functions:thm_movw_rel): Ditto.
9534         (Arm_relocate_functions:thm_movt_rel): Ditto.
9535         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9536         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9537         New method definitions.
9538         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9539         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9540         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9541         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9542         (Target_arm::Relocate::relocate): Check for non-static or
9543         unimplemented relocation code and exit early.  Change calls to
9544         Target_arm::reloc_uses_thumb_bit and
9545         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9546         instead.  Refactor code to handle similar relocations to increase
9547         code sharing.  Remove check for unsupported relocation code in switch
9548         statement.
9549         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9550         relocation property table to find out size.  Change error message to
9551         print out the name of a relocation code instead of the numeric value.
9552         (Target_arm::scan_reloc_for_stub): Use relocation property table
9553         instead of calling Target_arm::reloc_uses_thumb_bit().
9554
9555 2010-02-02  Doug Kwan  <dougkwan@google.com>
9556
9557         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9558         types of relaxed input section.
9559
9560 2010-02-02  Doug Kwan  <dougkwan@google.com>
9561
9562         * Makefile.am (HFILES): Add arm-reloc-property.h.
9563         (DEFFILES): New.
9564         (TARGETSOURCES): Add arm-reloc-property.cc
9565         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9566         (libgold_a_SOURCES): $(DEFFILES)
9567         * Makefile.in: Regenerate.
9568         * arm-reloc-property.cc: New file.
9569         * arm-reloc-property.h: New file.
9570         * arm-reloc.def: New file.
9571         * arm.cc: Update comments.
9572         (arm-reloc-property.h): New included header.
9573         (arm_reloc_property_table): New global variable.
9574         (Target_arm::do_select_as_default_target): New method definition.
9575         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9576         arm-reloc-property to targ_extra_obj.
9577         * parameters.cc (set_parameters_target): Call
9578         Target::select_as_default_target().
9579         * target.h (Target::select_as_default_target): New method definition.
9580         (Target::do_select_as_default_target): Same.
9581
9582 2010-02-01  Doug Kwan  <dougkwan@google.com>
9583
9584         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9585         first_output_text_section_.
9586         (Arm_exidx_fixup::first_output_text_section): New method definition.
9587         (Arm_exidx_fixup::first_output_text_section_): New data member.
9588         (Arm_exidx_fixup::process_exidx_section): Record the first text
9589         output section seen.
9590         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9591         and entsize in output section header.
9592
9593 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9594
9595         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9596         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9597         (Arm_relocate_functions::thm_alu11): New Method.
9598         (Arm_relocate_functions::thm_pc8): New Method.
9599         (Arm_relocate_functions::thm_pc12): New Method.
9600         (Target_arm::Scan::local): Handle the relocations.
9601         (Target_arm::Scan::global): Likewise.
9602         (Target_arm::Relocate::relocate): Likewise.
9603         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9604
9605 2010-01-29  Doug Kwan  <dougkwan@google.com>
9606
9607         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9608         of relocation types as ld.
9609
9610 2010-01-29  Doug Kwan  <dougkwan@google.com>
9611
9612         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9613         to public.
9614         (Arm_relocate_functions::thumb_branch_common): Ditto.
9615         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9616         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9617         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9618         Arm_relocate_functions::jump24): Remove.
9619         (Target_arm::Relocate::relocate): Adjust code to call
9620         Arm_relocation_functions::arm_branch_common and
9621         Arm_relocation_functions::thumb_branch_common instead of their removed
9622         wrappers.  Merge switch-cases together to reduce source code size.
9623
9624 2010-01-29  Doug Kwan  <dougkwan@google.com>
9625
9626         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9627         output_local_symbol_count_needs_update_.
9628         (Arm_relobj::output_local_symbol_count_needs_update,
9629          Arm_relobj::set_output_local_symbol_count_needs_update,
9630          Arm_relobj::update_output_local_symbol_count): New methods.
9631         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9632         member.
9633         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9634         of pointed function as in a R_ARM_PREL31 relocation.
9635         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9636         for output local symbol count updating.
9637         (Target_arm::do_relax): Update output local symbol counts in objects
9638         if necessary.
9639         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9640
9641 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9642
9643         * arm.cc: Added support for the ARM relocations:
9644         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9645         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9646         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9647         movw_prel_nc).
9648         (Arm_relocate_functions::movw_rel): New method.
9649         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9650         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9651         thm_movw_prel_nc).
9652         (Arm_relocate_functions::thm_movw_rel): New method.
9653         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9654         thm_movt_prel).
9655         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9656         relocations.
9657         (Target_arm::Scan::global): Likewise.
9658         (Target_arm::Relocate::relocate): Likewise.
9659         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9660         Likewise.
9661
9662 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9663
9664         * arm.cc: Added support for ARM group relocations.
9665         (Target_arm::reloc_needs_sym_origin): New method.
9666         (Arm_relocate_functions::calc_grp_kn): New method.
9667         (Arm_relocate_functions::calc_grp_residual): New method.
9668         (Arm_relocate_functions::calc_grp_gn): New method.
9669         (Arm_relocate_functions::arm_grp_alu): New Method.
9670         (Arm_relocate_functions::arm_grp_ldr): New Method.
9671         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9672         (Arm_relocate_functions::arm_grp_ldc): New Method.
9673         (Target_arm::Scan::local): Handle the ARM group relocations.
9674         (Target_arm::Scan::global): Likewise.
9675         (Target_arm::Relocate::relocate): Likewise.
9676         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9677         Likewise.
9678
9679 2010-01-26  Doug Kwan  <dougkwan@google.com>
9680
9681         * arm.cc (set): Include.
9682         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9683         pointer type.
9684         (Arm_output_section::Text_section_list): New type.
9685         (Arm_output_section::append_text_sections_to_list): New method.
9686         (Arm_output_section::fix_exidx_coverage): Ditto.
9687         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9688         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9689         Relobj::set_section_offset() instead of
9690         Sized_relobj::invalidate_section_offset().
9691         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9692         parameter for section headers. Ignore relocation sections for
9693         unallocated sections and EXIDX sections.
9694         (Target_arm::fix_exidx_coverage): New method.
9695         (Target_arm::output_section_address_less_than): New type.
9696         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9697         linked text section instead of the EXIDX section.
9698         (Arm_output_section::create_stub_group): Add an assertion to check
9699         that this is not an EXIDX output section.
9700         (Arm_output_section::append_text_sections_to_list): New method.
9701         (Arm_output_section::fix_exidx_coverage): Ditto.
9702         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9703         Arm_relobj::section_needs_reloc_stub_scanning.
9704         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9705         first pass.
9706         (Target_arm::fix_exidx_coverage): New method.
9707         * object.h (Relobj::set_output_section): New method.
9708         (Sized_relobj::invalidate_section_offset): Remove method.
9709         (Sized_relobj::do_invalidate_section_offset): Remove method.
9710         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9711
9712 2010-01-25  Doug Kwan  <dougkwan@google.com>
9713
9714         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9715         Fix warning due to signed and unsigned comparison on a 32-bit host.
9716
9717 2010-01-22  Doug Kwan  <dougkwan@google.com>
9718
9719         * arm.cc (Target_arm::do_relax): Record an output section for section
9720         offset adjustment it contains any stub table that has changed.
9721         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9722         offsets in an output section if necessary.
9723         * output.cc (Output_section::Output_section): Initialize
9724         section_offsets_need_adjustments_.
9725         (Output_section::add_input_section_for_script): Renamed to
9726         Output_section::add_simple_input_section.
9727         (Output_section::save_states): Add a comment.
9728         (Output_section::discard_states): New method defintion.
9729         (Output_section::adjust_section_offsets): Same.
9730         * output.h (Output_section::add_input_section_for_script): Renamed to
9731         Output_section::add_simple_input_section.
9732         (Output_section::discard_states): New method declaration.
9733         (Output_section::adjust_section_offsets): Same.
9734         (Output_section::section_offsets_need_adjustment,
9735         Output_section::set_section_offsets_need_adjustment): New method
9736         definitions.
9737         (Output_section::section_offsets_need_adjustment_): New data member.
9738         * script-sections.cc
9739         (Output_section_element_input::set_section_address): Adjust code for
9740         renaming of Output_section::add_input_section_for_script.
9741         (Orphan_output_section::set_section_address): Same.
9742
9743 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9744
9745         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9746         Fix_v4bx enum values .
9747         * gold/options.h (General_options): New option definitions.
9748         (General_options::fix_v4bx): New method.
9749         (General_options::Fix_v4bx): New enum.
9750         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9751         (General_options::parse_fix_v4bx_interworking): New method.
9752
9753 2010-01-22  Doug Kwan  <dougkwan@google.com>
9754
9755         * arm.cc (Arm_exidx_fixup): New class.
9756
9757 2010-01-21  Doug Kwan  <dougkwan@google.com>
9758
9759         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9760         classes.
9761         (Arm_exidx_section_offset_map): New type.
9762
9763 2010-01-21  Doug Kwan  <dougkwan@google.com>
9764
9765         * arm.cc (Arm_exidx_input_section): New class.
9766         (Arm_relobj::exidx_input_section_by_link,
9767         Arm_relobj::exidx_input_section_by_shndx,
9768         Arm_relobj::make_exidx_input_section): New methods.
9769         (read_arm_attributes_section): Remove.
9770         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9771         information about them.
9772         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9773         to here.
9774
9775 2010-01-20  Doug Kwan  <dougkwan@google.com>
9776
9777         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9778         Input_section_specifier to Section_id.
9779         (Target_arm::new_arm_input_section: Adjust code for change of key
9780         type.
9781         (Target_arm::find_arm_input_section): Ditto.
9782         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9783         (Section_id): Remove.
9784         (Garbage_collection::Section_id_hash): Remove.
9785         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9786         (Section_id): Remove.
9787         (Icf::Section_id_hash): Remove.
9788         * object.h (Section_id, Const_section_id, Section_id_hash,
9789         Const_section_id_hash): New type definitions.
9790         * output.cc (Output_section::add_relaxed_input_section): Change to
9791         use Const_section_id instead of Input_section_specifier as key type.
9792         (Output_section::add_merge_input_section): Ditto.
9793         (Output_section::build_relaxation_map): Change to use Section_id
9794         instead of Input_section_specifier as key type.
9795         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9796         Ditto.
9797         (Output_section::convert_input_sections_to_relaxed_sections): Change
9798         to use Const_section_id instead of Input_section_specifier as key type.
9799         (Output_section::find_merge_section): Ditto.
9800         (Output_section::find_relaxed_input_section): Ditto.
9801         * output.h (Input_section_specifier): Remove class.
9802         (Output_section::Output_section_data_by_input_section_map): Change
9803         key type to Const_section_id.
9804         (Output_section::Output_relaxed_input_section_by_input_section_map):
9805         Ditto.
9806         (Output_section::Relaxation_map): Change key type to Section_id.
9807
9808 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9809
9810         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9811         (class Arm_v4bx_stub): New class.
9812         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9813         (Stub_factory::make_arm_v4bx_stub): New method.
9814         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9815         (Stub_table::empty): Handle v4bx stubs.
9816         (Stub_table::add_arm_v4bx_stub): New method.
9817         (Stub_table::find_arm_v4bx_stub): New method.
9818         (Arm_relocate_functions::v4bx): New method.
9819         (Target_arm::fix_v4bx): New method.
9820         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9821         (Stub_table::relocate_stubs): Likewise.
9822         (Stub_table::do_write): Likewise.
9823         (Stub_table::update_data_size_and_addralign): Likewise.
9824         (Stub_table::finalize_stubs):  Likewise.
9825         (Target_arm::Scan::local): Likewise.
9826         (Target_arm::Scan::global): Likewise.
9827         (Target_arm::do_finalize_sections): Likewise.
9828         (Target_arm::Relocate::relocate): Likewise.
9829         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9830         Likewise.
9831         (Target_arm::scan_reloc_for_stub): Likewise.
9832         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9833
9834 2010-01-19  Ian Lance Taylor  <iant@google.com>
9835
9836         * output.cc (Output_section_headers::do_sized_write): Write large
9837         segment count to sh_info field.
9838         (Output_file_header::do_sized_write): For large segment count,
9839         write PN_XNUM to e_phnum field.
9840
9841 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9842
9843         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9844         (Arm_relocate_functions::thm_jump8): New function.
9845         (Arm_relocate_functions::thm_jump11): New function.
9846         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9847         R_ARM_THM_JUMP11.
9848         (Target_arm::Scan::global): Likewise.
9849         (Target_arm::Relocate::relocate): Likewise.
9850         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9851         Likewise.
9852
9853 2010-01-14  Doug Kwan  <dougkwan@google.com>
9854
9855         * arm.cc (map, utility): Include headers.
9856         (Target_arm::apply_cortex_a8_workaround): New method.
9857         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9858         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9859         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9860         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9861         the --[no-]fix-cortex-a8 command line options.
9862         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9863         (Target_arm::relocate_stub): Use addend in instruction template.
9864         * options.h (DEFINE_bool): Set the user-set flag.
9865         (General_options): Add --[no-]-fix-cortex options.
9866         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9867         : Update fast look-up map after conversion.
9868
9869 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9870
9871         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9872         in the first pass of do_layout.
9873
9874 2010-01-13  Doug Kwan  <dougkwan@google.com>
9875
9876         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9877         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9878         apparent compiler problem of not folding static constant integral
9879         data members of elfcpp::Elf_sizes<32>.
9880
9881 2010-01-13  Doug Kwan  <dougkwan@google.com>
9882
9883         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9884         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9885         Arm_relobj::scan_section_for_cortex_a8_erratum,
9886         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9887         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9888         sections to scan for relocation stubs into a new method
9889         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9890         relocation and Cortex-A8 stub scanning.
9891         (Target_arm::do_relax): Force stubs to be after stubbed sections
9892         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9893         the beginning of a new relaxation pass.  Update a comment.
9894         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9895
9896 2010-01-12  Ian Lance Taylor  <iant@google.com>
9897
9898         * target-reloc.h (visibility_error): New inline function.
9899         (relocate_section): Call visibility_error.
9900         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9901         (MOSTLYCLEANFILES): Likewise.
9902         (protected_4_pic.o, protected_3.err): New targets.
9903         * testsuite/protected_4.cc: New file.
9904
9905 2010-01-12  Doug Kwan  <dougkwan@google.com>
9906
9907         * arm.cc (Cortex_a8_reloc): New class.
9908         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9909         and cortex_a8_relocs_info_.
9910         (Target_arm::fix_cortex_a8): New method definition.
9911         (Target_arm::Cortex_a8_relocs_info): New type.
9912         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9913         New data member declarations.
9914         (Target_arm::scan_reloc_for_stub): Record information about
9915         relocations for THUMB branches that might be exempted from the
9916         Cortex-A8 workaround.
9917         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9918         at the beginning of a relaxation pass.
9919
9920 2010-01-12  Doug Kwan  <dougkwan@google.com>
9921
9922         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9923         (Arm_relobj::Mapping_symbol_position,
9924          Arm_reloj::Mapping_symbol_position_less,
9925          Arm_relobj::Mapping_symbols_info): New types.
9926         (Target_arm::is_mapping_symbol_name): New method definition.
9927         (Arm_relobj::do_count_local_symbols): Save information about mapping
9928         symbols.
9929
9930 2010-01-11  Doug Kwan  <dougkwan@google.com>
9931
9932         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9933         Arm_relocate_functions::thumb32_branch_upper,
9934         Arm_relocate_functions::thumb32_branch_lower,
9935         Arm_relocate_functions::thumb32_cond_branch_offset,
9936         Arm_relocate_functions::thumb32_cond_branch_upper,
9937         Arm_relocate_functions::thumb32_cond_branch_lower,
9938         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9939         branch offset encoding.
9940         (Arm_relocate_functions::thumb_branch_common): Use new branch
9941         offset encoding methods to avoid code duplication.
9942         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9943         (Stub_addend_reader::operator()): Use new branch encoding method
9944         to avoid code duplication.
9945
9946 2010-01-11  Doug Kwan  <dougkwan@google.com>
9947
9948         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9949         (Target_arm::do_finalize_sections): Define special EXIDX section
9950         symbols only if referenced.
9951         * gc.h (Garbage_collection::add_reference): New method.
9952         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9953         code duplication.
9954
9955 2010-01-11  Ian Lance Taylor  <iant@google.com>
9956
9957         * script.cc (Version_script_info::build_expression_list_lookup):
9958         Change complaing about duplicate wildcard match from error to
9959         warning.
9960
9961         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9962         of 2009-12-30.
9963         (Version_script_info::Version_script_info): Initialize globs_,
9964         default_version_, default_is_global_, and exact_.  Don't
9965         initialize globals_ or locals_.
9966         (Version_script_info::build_lookup_tables): Build local symbols
9967         first.
9968         (Version_script_info::unquote): New function.
9969         (Version_script_info::add_exact_match): New function.
9970         (Version_script_info::build_expression_list_lookup): Remove lookup
9971         parameter.  Add is_global parameter.  Change all callers.  Handle
9972         wildcard pattern specially.  Unquote pattern.  Call
9973         add_exact_match.
9974         (Version_script_info::get_name_to_match): New function.
9975         (Version_script_info::get_symbol_version): New function.
9976         (Version_script_info::get_symbol_version_helper): Remove.
9977         (Version_script_info::check_unmatched_names): Call unquote.
9978         * script.h (class Version_script_info): Change get_symbol_version
9979         to be non-inline and add is_global parameter; change all callers.
9980         Rewrite symbol_is_local.  Update declarations.  Define struct
9981         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9982         Remove globals_ and locals_ members.  Add exact_, globs_,
9983         default_version_, is_global_.
9984         (Version_script_info::Glob): Remove pattern, add expression and
9985         is_global.  Update constructor.  Change all callers.
9986         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9987         default version.
9988         (Versions::symbol_section_contents): If a symbol is undefined, or
9989         defined in a dynamic object, set the version index to
9990         VER_NDX_LOCAL.
9991         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9992         symbol_is_local.
9993         (Symbol_table::add_from_pluginobj): Likewise.
9994         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9995
9996 2010-01-11  Doug Kwan  <dougkwan@google.com>
9997
9998         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9999         (incremental_dump_LDADD): Add linking option for libintl.
10000         * Makefile.in: Regenerate.
10001
10002 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10003
10004         PR gold/11144
10005         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10006         instead of -Ds.
10007         * testsuite/Makefile.in: Regenerated.
10008
10009 2010-01-10  Doug Kwan  <dougkwan@google.com>
10010
10011         * options.h (DEFINE_var): Use parentheses around argument varname__
10012         in macro body to avoid any unintended subsequent substitutions.
10013
10014 2010-01-10  Ian Lance Taylor  <iant@google.com>
10015
10016         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10017         candidates before doing symbol resolution.
10018
10019         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10020         ODR candidates if only one is weak.
10021
10022 2010-01-08  Ian Lance Taylor  <iant@google.com>
10023
10024         * script.cc (Version_script_info::build_expression_list_lookup):
10025         Don't warn about ambiguous version, just record the ambiguity.
10026         (Version_script_info::get_symbol_version_helper): Give error if
10027         version is ambiguous.
10028
10029 2010-01-08  Doug Kwan  <dougkwan@google.com>
10030
10031         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10032         prev_data_size_ and prev_addralign_.  Remove initializer for
10033         deleted data member has_been_changed_.
10034         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10035         to determine if the table is empty.
10036         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10037         Remove.
10038         (Stub_table::add_reloc_stub): Define method in class definition
10039         instead of just declaring it there.
10040         (Stub_table::add_cortex_a8_stub): New method definition.
10041         (Stub_table::update_data_size_and_addralign): Ditto.
10042         (Stub_table::finalize_stubs): Ditto.
10043         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10044         (Stub_table::do_addralign_): Return address alignment in the
10045         (Stub_table::do_reset_address_and_file_offset): Define method in
10046         class definition instead of declaring it there.  Set current data
10047         size to be the data size of the previous pass.
10048         (Stub_table::set_final_data_size): Use current data size as the
10049         final data size.
10050         (Stub_table::relocate_stub): Change parameter type of stub from
10051         Reloc_stub pointer to Stub pointer.
10052         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10053         (Stub_table::Cortex_a8_stub_list): New typedef.
10054         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10055          Stub_table::prev_addralign_): New data member.
10056         (Arm_relobj::Arm_relobj): Initialize data member
10057         section_has_cortex_a8_workaround_.
10058         (Arm_relobj::section_has_cortex_a8_workaround,
10059          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10060          definitions.
10061         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10062         declarations.
10063         (Target_arm::relocate_stub): Change parameter type of stub from
10064         Reloc_stub pointer to Stub pointer.
10065         (Insn_template::size, Insn_template::alignment): Handle
10066         THUMB16_SPECIAL_TYPE.
10067         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10068          Stub_table::update_data_size_and_addralign,
10069          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10070         definitions.
10071         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10072         (Stub_table::do_write): Ditto.
10073         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10074
10075 2010-01-08  Ian Lance Taylor  <iant@google.com>
10076
10077         PR 11108
10078         * symtab.h (class Symbol): Remove fields is_target_special_ and
10079         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10080         (Symbol::is_defined_in_discarded_section): New function.
10081         (Symbol::set_is_defined_in_discarded_section): New function.
10082         (Symbol::has_plt_offset): Rewrite.
10083         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10084         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10085         Don't initialize is_target_special_ or has_plt_offset_.
10086         Initialize is_defined_in_discarded_section_.
10087         (Symbol_table::add_from_relobj): If appropriate, set
10088         is_defined_in_discarded_section.
10089         * resolve.cc (Symbol::override_base_with_special): Don't test
10090         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10091         * target-reloc.h (relocate_section): Do special handling for
10092         symbols defined in discarded sections for global symbols as well
10093         as local symbols.
10094
10095 2010-01-08  Ian Lance Taylor  <iant@google.com>
10096
10097         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10098         the SHT_SYMTAB case.
10099
10100 2010-01-08  Ian Lance Taylor  <iant@google.com>
10101
10102         * object.cc (Sized_relobj::do_layout): Don't get confused if
10103         layout_eh_frame returns NULL.
10104
10105 2010-01-08  Ian Lance Taylor  <iant@google.com>
10106
10107         PR 11084
10108         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10109         dynamic symbol table, use the normal symbol table.
10110         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10111         symbol table.
10112
10113 2010-01-08  Ian Lance Taylor  <iant@google.com>
10114
10115         PR 11072
10116         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10117         sections.
10118
10119 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10120
10121         * version.cc (print_version): Change to "Copyright 2010".
10122
10123 2010-01-08  Ian Lance Taylor  <iant@google.com>
10124
10125         PR 10287
10126         PR 11063
10127         * i386.cc (class Target_i386): Change return type of plt_section
10128         to be non-const.
10129         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10130         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10131         tls_desc_rel_ field.
10132         (Output_data_plt_i386::rel_tls_desc): New function.
10133         (Target_i386::rel_tls_desc_section): New function.
10134         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10135         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10136         R_386_TLS_DESC reloc in rel_tls_desc_section.
10137         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10138         Define struct Tlsdesc_info.
10139         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10140         (Target_x86_64::do_reloc_symbol_index): New function.
10141         (Target_x86_64::add_tlsdesc_info): New function.
10142         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10143         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10144         tlsdesc_rel_ field.
10145         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10146         all callers.
10147         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10148         (Target_x86_64::rela_tlsdesc_section): New function.
10149         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10150         handling.
10151         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10152         (Target_x86_64::do_reloc_addend): New function.
10153         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10154         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10155         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10156         (Output_reloc::type): New function.
10157         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10158         (Output_reloc::is_target_specific): New function.
10159         (Output_reloc::target_arg): New function.
10160         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10161         absolute relocs and target specific relocs.
10162         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10163         add_target_specific.
10164         (class Output_data_reloc) [SHT_RELA]: Likewise.
10165         * output.cc (Output_reloc::Output_reloc): Add four new versions
10166         for absolute relocs and target specific relocs.
10167         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10168         (Output_reloc::get_symbol_index): Likewise.
10169         (Output_reloc::local_section_offset): Check that local_sym_index_
10170         is not TARGET_CODE or 0.
10171         (Output_reloc::symbol_value): Likewise.
10172         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10173         reloc.
10174         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10175         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10176         functions.
10177         * layout.cc (add_target_dynamic_tags): Use output section for
10178         DT_PLTRELSZ and DT_JMPREL.
10179
10180 2010-01-07  Ian Lance Taylor  <iant@google.com>
10181
10182         PR 11061
10183         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10184         function.
10185         (class Output_data_reloc_generic): Define.
10186         (class Output_data_reloc_base): Change base class to
10187         Output_data_reloc_generic.  Change add() method to call
10188         bump_relative_reloc_count for a relative reloc.  Remove
10189         sort_relocs_ field.
10190         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10191         to sort_relocs().
10192         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10193         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10194         appropriate.
10195         * layout.h (class Layout): Update declaration.
10196
10197 2010-01-07  Ian Lance Taylor  <iant@google.com>
10198
10199         * output.h (class Output_data): Add const version of
10200         output_section and do_output_section.
10201         (class Output_section_data): Add const version of
10202         do_output_section.
10203         (class Output_section): Likewise.
10204         * layout.cc (Layout::add_target_dynamic_tags): New function.
10205         * layout.h (class Layout): Update declarations.
10206         * arm.cc (Target_arm::do_finalize_sections): Use
10207         add_target_dynamic_tags.
10208         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10209         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10210         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10211         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10212
10213 2010-01-07  Ian Lance Taylor  <iant@google.com>
10214
10215         PR 11042
10216         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10217         object as needed.
10218
10219 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10220             Ian Lance Taylor  <iant@google.com>
10221
10222         PR 11019
10223         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10224         Xindex::read_symtab_xindex.
10225
10226 2010-01-07  Doug Kwan  <dougkwan@google.com>
10227
10228         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10229         (Insn_template::thumb16_bcond_insn): New method declaration.
10230         (Insn_template): Fix spelling.
10231         (Stub::thumb16_special): New method declaration.
10232         (Stub::do_write): Define virtual method which was previously pure
10233         virtual.
10234         (Stub::do_thumb16_special): New method declaration.
10235         (Stub::do_fixed_endian_write): New template member.
10236         (Reloc_stub::do_write): Remove.
10237         (Reloc_stub::do_fixed_endian_write): Remove.
10238         (Cortex_a8_stub): New class definition.
10239         (Stub_factory::make_cortex_a8_stub): New method definition.
10240         (Stub_factory::Stub_factory): Add missing static storage class
10241         qualifier for elf32_arm_stub_a8_veneer_blx.
10242
10243 2010-01-07  Ian Lance Taylor  <iant@google.com>
10244
10245         PR 10980
10246         * options.h (class General_options): Add --warn-unresolved-symbols
10247         and --error-unresolved-symbols.
10248         * errors.cc (Errors::undefined_symbol): Implement
10249         --warn-unresolved-symbols.
10250
10251         * options.h (class General_options): Add -z text and -z textoff.
10252         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10253
10254 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10255
10256         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10257         (Garbage_collection::cident_sections): New function.
10258         (Garbage_collection::add_cident_section): New function.
10259         (Garbage_collection::cident_sections_): New member.
10260         (gc_process_relocs): Add references to sections whose names are C
10261         identifiers.
10262         * gold.h (cident_section_start_prefix): New constant.
10263         (cident_section_stop_prefix): New constant.
10264         (is_cident): New function.
10265         * layout.cc (Layout::define_section_symbols): Replace string constants
10266         with the newly defined constants.
10267         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10268         C identifiers.
10269         * testsuite/Makefile.am: Add gc_orphan_section_test.
10270         * testsuite/Makefile.in: Regenerate.
10271         * testsuite/gc_orphan_section_test.cc: New file.
10272         * testsuite/gc_orphan_section_test.sh: New file.
10273
10274 2010-01-06  Ian Lance Taylor  <iant@google.com>
10275
10276         PR 10980
10277         * options.h (class General_options): Add --warn-shared-textrel.
10278         * layout.cc (Layout::finish_dynamic_section): Implement
10279         --warn-shared-textrel.
10280
10281         PR 10980
10282         * options.h (class General_options): Add --warn-multiple-gp.
10283
10284 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10285
10286         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10287         $(THREADSLIB) and $(LIBDL).
10288         * Makefile.in: Rebuild.
10289
10290 2010-01-06  Ian Lance Taylor  <iant@google.com>
10291
10292         PR 10980
10293         * options.cc (General_options::parse_section_start): New function.
10294         (General_options::section_start): New function.
10295         (General_options::General_options): Initialize all members.
10296         * options.h: Include <map>
10297         (class General_options): Add --section-start.  Add section_starts_
10298         member.
10299         * layout.cc (Layout::attach_allocated_section_to_segment): If
10300         --section-start was used, set the address of the segment.  Remove
10301         local sort_sections.
10302         (Layout::relaxation_loop_body): If the address of the load segment
10303         has been set by --section-start, don't use it.
10304         * output.h (Output_segment::update_flags_for_output_section): New
10305         function.
10306         * output.cc (Output_segment::add_output_section): Call
10307         update_flags_for_output_section.
10308
10309 2010-01-05  Ian Lance Taylor  <iant@google.com>
10310
10311         PR 10980
10312         * options.h (class General_options): Add --undefined-version.
10313         * script.cc (struct Version_expression): Add was_matched_by_symbol
10314         field.
10315         (Version_script_info::matched_symbol): New function.
10316         (Version_script_info::get_symbol_version_helper): Call
10317         matched_symbol.
10318         (Version_script_info::check_unmatched_names): New function.
10319         * script.h (class Version_script_info): Update declarations.
10320         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10321
10322         * options.h (class General_options): Use DEFINE_bool_alias for
10323         allow_multiple_definition.
10324         * resolve.cc (Symbol_table::should_override): Don't test
10325         allow_multiple_definition.
10326
10327         PR 10980
10328         * options.h (class General_options): Add --cref.
10329         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10330         until after printing cref table.
10331         * cref.cc: Include "symtab.h".
10332         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10333         (Cref_table_compare::operator()): New function.
10334         (Cref_inputs::gather_cref): New function.
10335         (filecol): New static const.
10336         (Cref_inputs::print_cref): New function.
10337         (Cref::print_cref): New function.
10338         * cref.h: Include <cstdio>.
10339         (class Cref): Update declarations.
10340         * mapfile.h (Mapfile::file): New function.
10341         * object.h (class Object): Define Symbols.  Declare virtual
10342         do_get_global_symbols.
10343         (Object::get_global_symbols): New function.
10344         * object.cc (Input_objects::add_object): Pass object to cref_ if
10345         --cref.
10346         (Input_objects::archive_start): Likewise.
10347         (Input_objects::archive_stop): Likewise.
10348         (Input_objects::print_cref): New function.
10349         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10350         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10351         --cref.
10352         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10353         function.
10354         * plugin.h (class Sized_pluginobj): Update declarations.
10355
10356 2010-01-05  Ian Lance Taylor  <iant@google.com>
10357
10358         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10359         to is_default_version.  Rename insdef to insdefault.
10360         (Symbol_table::add_from_relobj): Rename def to is_default_version
10361         and local to is_forced_local.
10362         (Symbol_table::add_from_pluginobj): Likewise.
10363         (Symbol_table::add_from_dynobj): Likewise.
10364         (Symbol_table::define_special_symbol): Rename insdef to
10365         insdefault.
10366
10367 2010-01-04  Ian Lance Taylor  <iant@google.com>
10368
10369         PR 10980
10370         * options.h (class General_options): Add
10371         --allow-multiple-definition and -z muldefs.
10372         * resolve.cc (Symbol_table::should_override): Don't warn about a
10373         multiple symbol definition if --allow-multiple-definition or -z
10374         muldefs.
10375
10376         PR 10980
10377         * options.h (class General_options): Add --add-needed and
10378         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10379         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10380         error if --copy-dt-needed-entries aka --add-needed is used and
10381         would cause a change in behaviour.
10382
10383         PR 10980
10384         * options.h (class General_options): Add -G as a short version of
10385         --shared.  Add no-op options -assert, -g, and -i.
10386
10387 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10388
10389         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10390         check for .text or .gnu.linkonce.t sections.
10391         * icf.cc (Icf::find_identical_sections): Ditto.
10392         Change the detection for mangled function name within the section
10393         name.
10394         * icf.h (is_section_foldable_candidate): New function.
10395
10396 2009-12-30  Ian Lance Taylor  <iant@google.com>
10397
10398         PR 10980
10399         * options.h (class General_options): Permit two dashes with
10400         --retain-symbols-file.
10401
10402 2009-12-30  Ian Lance Taylor  <iant@google.com>
10403
10404         PR 10979
10405         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10406         don't put the file header and segment headers in the text
10407         segment.
10408
10409         PR 10979
10410         * common.cc (Sort_commons::operator()): Stabilize sort when both
10411         entries are NULL.
10412         (Symbol_table::do_allocate_commons_list): When allocating common
10413         symbols, skip a symbol which is no longer common.
10414         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10415         an object before checking its type.
10416         * testsuite/common_test_2.c: New file.
10417         * testsuite/common_test_3.c: New file.
10418         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10419         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10420         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10421         (common_test_2_pic.o, common_test_2.so): New targets.
10422         (common_test_3_pic.o, common_test_3.so): New targets.
10423         * testsuite/Makefile.in: Rebuild.
10424
10425         PR 10979
10426         * script.cc (read_input_script): If we see a new SECTIONS clause,
10427         and we have added an input section, give an error.
10428         * layout.h (class Layout): Add have_added_input_section function.
10429         Add have_added_input_section_ field.
10430         * layout.cc (Layout::Layout): Initialize
10431         have_added_input_section_.
10432         (Layout::layout): Set have_added_input_section_.
10433         (Layout::layout_eh_frame): Likewise.
10434
10435 2009-12-30  Ian Lance Taylor  <iant@google.com>
10436
10437         PR 10931
10438         * options.h (class General_options): Add --sort-common option.
10439         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10440         * common.cc (Sort_common): Add sort_order parameter to
10441         constructor.  Add sort_order_ field.
10442         (Sort_commons::operator): Check sort_order_.
10443         (Symbol_table::allocate_commons): Determine the sort order.
10444         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10445         Change all callers.
10446         (Symbol_table::do_allocate_commons_list): Likewise.
10447
10448 2009-12-30  Ian Lance Taylor  <iant@google.com>
10449
10450         PR 10916
10451         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10452         symbols from this object, don't change the visibility of an
10453         undefined symbol.
10454         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10455
10456 2009-12-30  Ian Lance Taylor  <iant@google.com>
10457
10458         PR 10861
10459         * script.h (class Version_script_info): Define Language enum.
10460         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10461         new fields globals_, locals_, and is_finalized_.
10462         * script.cc: Various formatting fixes.
10463         (class Parser_closure): Change language_stack_ from a vector of
10464         std::string to one of Version_script_info::Language.  Adjust all
10465         uses accordingly.
10466         (class Lazy_demangler): Remove.
10467         (struct Version_expression): Change language from std::string to
10468         Version_script_info::Language.
10469         (Version_script_info::Version_script_info): New function.
10470         (Version_script_info::~Version_script_info): Don't call clear.
10471         (Version_script_info::finalize): New function.
10472         (Version_script_info::build_lookup_tables): New function.
10473         (Version_script_info::build_expression_list_lookup): New
10474         function.
10475         (Version_script_info::get_symbol_version_helper): Rewrite to use
10476         lookup tables.
10477         (Version_script_info::print_expression_list): Adjust to use
10478         Version_script_info::Language.
10479         (script_push_lex_into_version_mode): Check that the version script
10480         has not been finalized.
10481         (version_script_push_lang): Change language string to
10482         Version_script_info::Language.
10483         * options.cc (Command_line::version_script): New function.
10484         * options.h (class General_options): Add finalize_dynamic_list
10485         function.  Change version_script from declaration to definition.
10486         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10487         * testsuite/version_script.map: Remove duplicate def of foo.
10488         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10489         version_script.map.
10490         * testsuite/Makefile.in: Rebuild.
10491
10492 2009-12-30  Ian Lance Taylor  <iant@google.com>
10493
10494         PR 10843
10495         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10496         if the input symbol index is 0, make the output symbol index 0.
10497
10498 2009-12-30  Ian Lance Taylor  <iant@google.com>
10499
10500         PR 10670
10501         * options.h (class General_options): Add -x/--discard-all.
10502         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10503         --discard-all.  If the local symbol needs a dynamic entry, check
10504         that before handling --discard-locals.
10505
10506 2009-12-30  Ian Lance Taylor  <iant@google.com>
10507
10508         PR 10450
10509         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10510         flags to PF_R.
10511         (Output_segment::add_output_section): Don't change the flags if
10512         the type is PT_TLS.
10513
10514         PR 10450
10515         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10516         GNU hash table if they need a dynamic value.  Otherwise, don't add
10517         them if they are defined in a dynamic object or are forced local.
10518
10519 2009-12-29  Ian Lance Taylor  <iant@google.com>
10520
10521         PR 10450
10522         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10523         .gnu.hash table for a 32-bit target.
10524
10525         PR 10450
10526         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10527         regular and a dynamic object only needs a dynamic symbol table
10528         entry if it is externally visible.
10529
10530         PR 10450
10531         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10532         constructor.  Add global_offset_table_ field.
10533         (Target_i386::got_section): Set global_offset_table_.
10534         (Target_i386::do_finalize_sections): Set global_offset_table_
10535         size.
10536         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10537         in constructor.  Add global_offset_table_ field.
10538         (Target_x86_64::got_section): Set global_offset_table_.
10539         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10540         size.
10541
10542         * layout.cc (Layout::Layout): Initialize increase_relro_.
10543         (Layout::get_output_section): Add is_relro, is_last_relro, and
10544         is_first_non_relro parameters.  Change all callers.
10545         (Layout::choose_output_section): Likewise.
10546         (Layout::add_output_section_data): Likewise.
10547         (Layout::make_output_section): Likewise.
10548         (Layout::set_segment_offsets): Clear increase_relro when using a
10549         linker script.
10550         * layout.h (class Layout): Add increase_relro method.  Add
10551         increase_relro_ field.  Update declarations.
10552         * output.cc (Output_section::Output_section): Initialize
10553         is_last_relro_ and is_first_non_relro_.
10554         (Output_segment::add_output_section): Group relro sections is
10555         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10556         (Output_segment::maximum_alignment): Remove relro handling.
10557         (Output_segment::set_section_addresses): Add increase_relro
10558         parameter.  Change all callers.  Add initial alignment to align
10559         relro sections on separate page.  Remove old relro handling.
10560         (Output_segment::set_section_list_addresses): Remove in_relro
10561         parameter.  Change all callers.
10562         (Output_segment::set_offset): Add increase parameter.  Change all
10563         callers.  Remove old relro handling.
10564         * output.h (class Output_section): Add new methods: is_last_relro,
10565         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10566         Add is_last_relro_ and is_first_non_relro_ fields.
10567         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10568         Create separate .got.plt section.  Call increase_relro.
10569         * x86_64.cc (Target_x86_64::got_section): Likewise.
10570         * testsuite/relro_script_test.t: Add .got.plt.
10571
10572         PR 10450
10573         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10574         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10575         (Layout::finalize): Call set_dynamic_symbol_size.
10576         (Layout::set_dynamic_symbol_size): New function.
10577         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10578         set_dynamic_symbol_size.
10579
10580         PR 10450
10581         * output.h (class Output_section): Add is_entsize_zero_ field.
10582         * output.cc (Output_section::Output_section): Initialize
10583         is_entsize_zero_.
10584         (Output_section::set_entsize): If two different entsizes are
10585         requested, force it to zero.
10586         (Output_section::add_input_section): Set flags for .debug_str
10587         before updating section flags.  Set entsize.
10588         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10589         and SHF_STRING if all input sections have those flags.
10590
10591 2009-12-29   Rafael Espindola  <espindola@google.com>
10592
10593         * main.cc (main): Fix the sys time reporting.
10594         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10595         reporting.
10596
10597 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10598
10599         * options.cc (General_options::parse_version): Allow -v to exit
10600         without an error if there is nothing to link.
10601
10602 2009-12-29  Ian Lance Taylor  <iant@google.com>
10603
10604         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10605         using a version of gcc before 4.1.
10606         * configure: Rebuild.
10607
10608 2009-12-28  Chris Demetriou  <cgd@google.com>
10609
10610         * attributes.cc (Output_attributes_section_data::do_write): Use
10611         std::vector::front rather than std::vector::data.
10612
10613 2009-12-28  Ian Lance Taylor  <iant@google.com>
10614
10615         * symtab.h (class Symbol_table): Add enum Defined.
10616         * resolve.cc (Symbol_table::should_override): Add defined
10617         parameter.  Change all callers.  Test whether object is NULL
10618         before calling a method on it.
10619         (Symbol_table::report_resolve_problem): Add defined parameter.
10620         Change all callers.
10621         (Symbol_table::should_override_with_special): Likewise.
10622         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10623         parameter.  Change all callers.
10624         (Symbol_table::do_define_in_output_data): Likewise.
10625         (Symbol_table::define_in_output_segment): Likewise.
10626         (Symbol_table::do_define_in_output_segment): Likewise.
10627         (Symbol_table::define_as_constant): Likewise.
10628         (Symbol_table::do_define_as_constant): Likewise.
10629         * script.h (class Symbol_assignment): Add is_defsym parameter to
10630         constructor; change all callers.
10631         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10632         parameter.  Change all callers.  Add is_defsym_ field.
10633         (class Parser_closure): Add parsing_defsym parameter to
10634         constructor; change all callers.  Add parsing_defsym accessor
10635         function.  Add parsing_defsym_ field.
10636
10637 2009-12-28  Ian Lance Taylor  <iant@google.com>
10638
10639         * gold.cc (queue_middle_tasks): Fix formatting.
10640         * object.cc (Relobj::is_section_name_included): Likewise.
10641
10642 2009-12-23  Ian Lance Taylor  <iant@google.com>
10643
10644         * i386.cc (Target_i386::do_calls_non_split): Recognize
10645         -fsplit-stack prologue for a function with a static chain.
10646         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10647         -fsplit-stack prologue when using %r11.
10648
10649 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10650
10651         * options.cc (General_options::parse_version): Make -v continue and do
10652         the link like GNU ld does.
10653
10654 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10655
10656         * Makefile.am (CCFILES): Add timer.cc.
10657         (HFILES): Add timer.h.
10658         * configure.ac: Check for sysconf and times.
10659         * main.cc: include timer.h.
10660         (main): Use Timer instead of get_run_time.
10661         * timer.cc: New.
10662         * timer.h: New.
10663         * workqueue.cc: include timer.h.
10664         (Workqueue::find_and_run_task):
10665         Report user, sys and wall time.
10666         * Makefile.in: Regenerate.
10667         * config.in: Regenerate.
10668         * configure: Regenerate.
10669
10670 2009-12-16  Doug Kwan  <dougkwan@google.com>
10671
10672         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10673         sections.
10674         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10675         relaxed input sections.
10676         * output.cc (Output_section::find_relaxed_input_section): Change
10677         return type to Output_relaxed_input_section pointer.  Adjust code
10678         for new type of relaxed_input_section_map_.
10679         * output.h (Output_section::find_relaxed_input_section): Change
10680         return type to Output_relaxed_input_section pointer.
10681         (Output_section::Output_relaxed_input_section_by_input_section_map):
10682         New type.
10683         (Output_section::relaxed_input_section_map_): Change type to
10684         Output_section::Output_relaxed_input_section_by_input_section_map.
10685         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10686         input section.
10687
10688 2009-12-15  Ian Lance Taylor  <iant@google.com>
10689
10690         * layout.cc (Layout::create_shstrtab): Only write out after input
10691         sections if we are compressing debug sections.
10692
10693 2009-12-15  Ian Lance Taylor  <iant@google.com>
10694
10695         * archive.cc (Archive::add_symbols): Only look up a symbol without
10696         a version if there is, in fact, a version.
10697
10698 2009-12-14  Ian Lance Taylor  <iant@google.com>
10699
10700         Revert -Wshadow changes, all changes from:
10701         2009-12-11  Doug Kwan  <dougkwan@google.com>
10702         2009-12-11  Nick Clifton  <nickc@redhat.com>
10703         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10704
10705 2009-12-11  Doug Kwan  <dougkwan@google.com>
10706
10707         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10708         due to -Wshadow.
10709         * attributes.cc (Object_attribute::size): Ditto.
10710         (Attributes_section_data::size): Ditto.
10711         (Attributes_section_data::Attributes_section_data): Ditto.
10712         (Output_attributes_section_data::do_write): Ditto.
10713         * attributes.h (Object_attribute::set_type): Ditto.
10714         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10715
10716 2009-12-11  Nick Clifton  <nickc@redhat.com>
10717
10718         * archive.cc: Fix shadowed variable warnings.
10719         * arm.cc: Likewise.
10720         * compressed_output.cc: Likewise.
10721         * compressed_output.h: Likewise.
10722         * configure: Likewise.
10723         * dwarf_reader.cc: Likewise.
10724         * dynobj.cc: Likewise.
10725         * dynobj.h: Likewise.
10726         * ehframe.cc: Likewise.
10727         * ehframe.h: Likewise.
10728         * errors.cc: Likewise.
10729         * expression.cc: Likewise.
10730         * fileread.cc: Likewise.
10731         * fileread.h: Likewise.
10732         * freebsd.h: Likewise.
10733         * i386.cc: Likewise.
10734         * icf.cc: Likewise.
10735         * incremental.h: Likewise.
10736         * layout.cc: Likewise.
10737         * layout.h: Likewise.
10738         * mapfile.cc: Likewise.
10739         * merge.cc: Likewise.
10740         * merge.h: Likewise.
10741         * object.cc: Likewise.
10742         * object.h: Likewise.
10743         * options.h: Likewise.
10744         * output.cc: Likewise.
10745         * output.h: Likewise.
10746         * parameters.cc: Likewise.
10747         * plugin.cc: Likewise.
10748         * powerpc.cc: Likewise.
10749         * reduced_debug_output.cc: Likewise.
10750         * reduced_debug_output.h: Likewise.
10751         * reloc.cc: Likewise.
10752         * reloc.h: Likewise.
10753         * resolve.cc: Likewise.
10754         * script-sections.cc: Likewise.
10755         * script.cc: Likewise.
10756         * script.h: Likewise.
10757         * sparc.cc: Likewise.
10758         * symtab.cc: Likewise.
10759         * symtab.h: Likewise.
10760         * target-select.cc: Likewise.
10761         * target-select.h: Likewise.
10762         * token.h: Likewise.
10763         * workqueue.cc: Likewise.
10764         * workqueue.h: Likewise.
10765         * x86_64.cc: Likewise.
10766
10767 2009-12-10  Doug Kwan  <dougkwan@google.com>
10768
10769         * arm.cc (attributes.h): New include.
10770         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10771         (Arm_relobj::~Arm_relobj): Delete object pointed by
10772         attributes_section_data_.
10773         (Arm_relobj::attributes_section_data): New method definition.
10774         (Arm_relobj::attributes_section_data_): New data member declaration.
10775         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10776         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10777         attributes_section_data_.
10778         (Arm_dynobj::attributes_section_data): New method definition.
10779         (Arm_dynobj::attributes_section_data_): New data member declaration.
10780         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10781         initialization value of may_use_blx_ to false.
10782         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10783         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10784         object attributes to compute results instead of hard-coding.
10785         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10786         Target_arm::get_secondary_compatible_arch,
10787         Target_arm::set_secondary_compatible_arch
10788         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10789         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10790         New method declarations.
10791         (Target_arm::get_aeabi_object_attribute): New method definition.
10792         (Target_arm::attributes_section_data_): New data member declaration.
10793         (read_arm_attributes_section): New template definition.
10794         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10795         (Arm_dynobj::do_read_symbols): Ditto.
10796         (Target_arm::do_finalize_sections): Merge attributes sections from
10797         input.  Check for BLX use after attributes section merging.
10798         Fix __exidx_start and __exidx_end visibility.  Create an
10799         .ARM.attributes section if necessary.
10800         (Target_arm::get_secondary_compatible_arch,
10801         Target_arm::set_secondary_compatible_arch,
10802         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10803         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10804         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10805         New method definitions.
10806
10807 2009-12-09  Ian Lance Taylor  <iant@google.com>
10808
10809         * plugin.cc (Plugin::load): Don't cast from void* to a function
10810         pointer.
10811
10812 2009-12-09  Ian Lance Taylor  <iant@google.com>
10813
10814         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10815         information fields.
10816
10817 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10818
10819         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10820         Replace two_file_shared_1.so with two_file_shared_2.so.
10821         * testsuite/Makefile.in: Regenerated.
10822
10823 2009-12-08  Doug Kwan  <dougkwan@google.com>
10824
10825         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10826         (HFILES): Add attributes.h and int_encoding.h.
10827         * Makefile.in: Regenerate.
10828         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10829         function definitions to int_encoding.cc
10830         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10831         prototypes to int_encoding.h
10832         * reduced_debug_output.cc (int_encoding.h): New include.
10833         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10834         function definitions to int_encoding.cc
10835         (insert_into_vector, read_from_pointer): Move template definitions to
10836         int_encoding.h
10837         * attributes.cc: New file.
10838         * attributes.h: New file.
10839         * int_encoding.cc: New file.
10840         * int_encoding.h: New file.
10841
10842 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10843
10844         PR gold/11055
10845         * incremental-dump.cc (dump_incremental_inputs): New.
10846         (main): Use dump_incremental_inputs.
10847
10848 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10849
10850         PR gold/10893
10851         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10852         checking elfcpp::STT_FUNC.
10853         (Target_i386::Relocate::relocate): Likewise.
10854         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10855
10856         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10857         symbols from shared libraries into normal FUNC symbols.
10858
10859         * symtab.h (Symbol): Add is_func and use it.
10860
10861 2009-12-05  Doug Kwan  <dougkwan@google.com>
10862
10863         * arm.cc (Target_arm::arm_info): Initialize new fields
10864         attributes_section and attributes_vendor.
10865         * i386.cc (Target_i386::i386_info): Same.
10866         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10867         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10868         fields attributes_section and attributes_vendor.
10869         * sparc.cc (Target_sparc::sparc_info): Same.
10870         * target.h (Target::attributes_section, Target::attributes_vendor,
10871         Target::is_attributes_section, Target::attribute_arg_type,
10872         Target::attributes_order): New method definitions.
10873         (Target::Target_info::attributes_section,
10874         Target::Target_info::attributes_vendor): New fields.
10875         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10876         virtual method definitions.
10877         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10878         attributes_section and attributes_vendor.
10879         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10880
10881 2009-12-05  Doug Kwan  <dougkwan@google.com>
10882
10883         * arm.cc: Update comments about interworking and stub generation.
10884         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10885         considered as non-PIC.
10886         (Arm_relocate_functions::base_abs): Fix formatting.
10887         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10888         of function to use GOT entry address instead of offset.
10889         (Target_arm::Scan::global): Issue an error if a symbol would need a
10890         PLT does not get one because it is untyped.  Remove code to create
10891         dynamic symbols for relative branches.
10892         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10893         takes unsigned integer instead of boolean.
10894
10895 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10896
10897         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10898         (two_file_test_LDADD): Likewise.
10899         (common_test_1_LDADD): Likewise.
10900         (exception_test_LDADD) Likewise.
10901         (weak_test_LDADD): Likewise.
10902         (many_sections_test_LDADD): Likewise.
10903         (initpri1_LDADD): Likewise.
10904         (script_test_1_LDADD): Likewise.
10905         (script_test_2_LDADD): Likewise.
10906         (justsyms_LDADD): Likewise.
10907         (binary_test_LDADD): Likewise.
10908         (large_LDADD): Likewise.
10909         * testsuite/Makefile.in: Regenerated.
10910
10911 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10912
10913         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10914         (Symbol_table::override_with_special): Likewise.
10915         (Symbol_table::add_from_object): Likewise.
10916
10917 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10918
10919         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10920         Don't set the data_offset twice.
10921
10922 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10923
10924         * testsuite/Makefile.in: Regenerate.
10925
10926 2009-12-03  Doug Kwan  <dougkwan@google.com>
10927
10928         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10929         (Target_arm::do_finalize_sections): Add parameter for symbol table
10930         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10931         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10932         parameter for symbol table pointer.
10933         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10934         an additional parameter for a pointer to symbol table.
10935         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10936         parameter for a symbol table pointer.
10937         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10938         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10939         Ditto.
10940         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10941         parameter for a symbol table pointer.
10942
10943 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10944
10945         * incremental.cc (Incremental_inputs_header)
10946         (Incremental_inputs_header_write, Incremental_inputs_entry)
10947         (Incremental_inputs_entry_write): Move ...
10948         * incremental.h (Incremental_inputs_header)
10949         (Incremental_inputs_header_write, Incremental_inputs_entry)
10950         (Incremental_inputs_entry_write): here.
10951
10952 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10953
10954         * incremental.cc (make_sized_incremental_binary): Set the target.
10955         Error if it is incompatible.
10956         * output.h (Output_file): Add filename method.
10957
10958 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10959
10960         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10961         from the get_* methods.
10962
10963 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10964
10965         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10966         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10967         Write 0 for the data_offset of scripts.
10968
10969 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10970
10971         * testsuite/Makefile.am: Add the incremental_test.sh test.
10972         * testsuite/incremental_test.sh: New.
10973         * testsuite/incremental_test_1.c: New.
10974         * testsuite/incremental_test_2.c: New.
10975
10976 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10977
10978         * incremental-dump.cc (main): Fix typos.
10979
10980 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10981
10982         PR gold/11025
10983         * incremental-dump.cc (main): Use llu to print 64 bit values.
10984
10985 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10986             H.J. Lu  <hongjiu.lu@intel.com>
10987
10988         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10989         $(LIBDL).
10990         (incremental_dump_LDADD): Likewise.
10991         * Makefile.in: Regenerated.
10992
10993 2009-11-25  Doug Kwan  <dougkwan@google.com>
10994
10995         Revert:
10996
10997         2009-11-25  Doug Kwan  <dougkwan@google.com>
10998
10999                 * arm.cc (Target_arm::Target_arm): Move method definition
11000                 outside of class definition.  Add code to handle
11001                 --target1-rel, --target1-abs and --target2= options.
11002                 (Target_arm::get_reloc_reloc_type): Change method to be
11003                 non-static and const.
11004                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11005                 New data member declaration.
11006                 (Target_arm::Scan::local, Target_arm::Scan::global,
11007                 Target_arm::Relocate::relocate,
11008                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11009                 Adjust call to Target_arm::get_real_reloc_type.
11010                 (Target_arm::get_real_reloc_type): Use command line options
11011                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11012                 * options.h (--target1-rel, --target1-abs, --target2): New
11013                 ARM-only options.
11014
11015 2009-11-25  Doug Kwan  <dougkwan@google.com>
11016
11017         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11018         class definition.  Add code to handle --target1-rel, --target1-abs
11019         and --target2= options.
11020         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11021         and const.
11022         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11023         member declaration.
11024         (Target_arm::Scan::local, Target_arm::Scan::global,
11025         Target_arm::Relocate::relocate,
11026         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11027         call to Target_arm::get_real_reloc_type.
11028         (Target_arm::get_real_reloc_type): Use command line options to
11029         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11030         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11031         options.
11032
11033 2009-11-25  Doug Kwan  <dougkwan@google.com>
11034
11035         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11036         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11037         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11038         formatting.
11039         (Arm_relocate_functions::thm_call): Replace body with a call to
11040         Arm_relocate_functions::thumb_branch_common.
11041         (Arm_relocate_functions::thm_jump24,
11042         Arm_relocate_functions::thm_xpc22): New method definitions.
11043         (Arm_relocate_functions::thumb_branch_common): New method definition.
11044         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11045         operator.
11046         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11047         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11048
11049 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11050
11051         * Makefile.am: Build incremental-dump
11052         * Makefile.in: Regenerate.
11053         * incremental-dump.cc: New.
11054         * incremental.cc (Incremental_inputs_header_data,
11055         Incremental_inputs_entry_data): Move to incremental.h
11056         * incremental.h: (Incremental_inputs_header_data,
11057         Incremental_inputs_entry_data): Move from incremental.cc
11058
11059 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11060
11061         * incremental.cc (Incremental_inputs_header,
11062         Incremental_inputs_header_write, Incremental_inputs_entry,
11063         Incremental_inputs_entry_write): Add a typedef with the data type.
11064
11065 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11066
11067         * incremental.cc (Incremental_inputs_header,
11068         Incremental_inputs_header_write, Incremental_inputs_entry,
11069         Incremental_inputs_entry_write): Update comment about which
11070         type has the filed descriptions.
11071
11072 2009-11-15  Doug Kwan  <dougkwan@google.com>
11073
11074         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11075         (Arm_relocate_functions::arm_branch_common): Change method defintion
11076         in class definition to a method declaration and update list of formal
11077         parameters.
11078         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11079         Arm_relocation_functions::jump24): Adjust call to
11080         Arm_relocate_functions::arm_branch_common.  Update list of formal
11081         parameters.
11082         (Arm_relocate_functions::xpc25): New method definition.
11083         (Arm_relocate_functions::arm_branch_common): Move method defintion
11084         out from class definition.  Use stubs for mode-switching and extending
11085         branch ranges.
11086         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11087         specially.  Change code to enable use of stubs in ARM branches.
11088
11089 2009-11-10  Doug Kwan  <dougkwan@google.com>
11090
11091         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11092         in method declaration.
11093         (Target_arm::relocate_stub): New method declaration.
11094         (Target_arm::default_target): Change to return a pointer instead of
11095         a const reference.
11096         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11097         Target_arm::default_target.
11098         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11099         method definition.
11100         (Target_arm::relocate_section): Adjust view.
11101         (Target_arm::relocate_stub): New method definition.
11102
11103 2009-11-10  Doug Kwan  <dougkwan@google.com>
11104
11105         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11106         a format warning.
11107         * incremental.cc (open_incremental_binary): Initialized local
11108         variables to avoid warnings.
11109         * object.cc (make_elf_object): Ditto.
11110         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11111         a format warning.
11112
11113 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11114
11115         PR gold/10930
11116         * testsuite/plugin_test.c: Include "config.h".
11117
11118 2009-11-09  Doug Kwan  <dougkwan@google.com>
11119
11120         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11121         (arm_symbol_value): Remove.
11122         (Arm_relocate_functions::arm_branch_common,
11123         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11124         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11125         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11126         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11127         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11128         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11129         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11130         Arm_relocate_functions::thm_mobw_abs_nc,
11131         Arm_relocate_functions::thm_mov_abs,
11132         Arm_relocate_functions::movw_prel_nc,
11133         Arm_relocate_functions::thm_movt_abs,
11134         Arm_relocate_functions::movt_prel,
11135         Arm_relocate_functions::thm_movw_prel_nc,
11136         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11137         (Target_arm::Relocate::relocate): Only decompose address into two
11138         parts if relocation type uses the thumb-bit and pass the actual
11139         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11140         calls to methods in Arm_relocate_functions for this change.
11141
11142 2009-11-08  Ian Lance Taylor  <iant@google.com>
11143
11144         PR 10925
11145         * reloc.cc: Instantiate
11146         Sized_relobj::initialize_input_to_output_maps and
11147         Sized_relobj:free_input_to_output_maps.
11148
11149 2009-11-06  Ian Lance Taylor  <iant@google.com>
11150
11151         PR 10876
11152         * defstd.cc (in_segment): Set only_if_ref true for "end".
11153
11154 2009-11-06  Doug Kwan  <dougkwan@google.com>
11155
11156         * arm.cc (class Reloc_stub): Correct a comment.
11157         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11158         (Target_arm::scan_section_for_stubs): New method declaration.
11159         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11160         Change methods from private to protected.
11161         (Target_arm::do_may_relax): New method definition.
11162         (Target_arm::do_relax, Target_arm::group_sections,
11163         Target_arm::scan_reloc_for_stub,
11164         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11165         (Target_arm::arm_input_section_map_): New data member declaration.
11166         (Target_arm::scan_reloc_for_stub,
11167         Target_arm::scan_reloc_section_for_stubs,
11168         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11169         Target_arm::do_relax): New method definitions.
11170
11171 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11172
11173         * configure.ac: Check for (struct stat)::st_mtim
11174         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11175         * config.in: Regenerate.
11176         * configure: Regenerate.
11177
11178 2009-11-05  Ian Lance Taylor  <iant@google.com>
11179
11180         PR 10910
11181         * output.cc (Output_segment::add_output_section): Add missing
11182         return statement.
11183
11184 2009-11-04  Ian Lance Taylor  <iant@google.com>
11185
11186         PR 10880
11187         * object.h (class Object): Add is_needed and set_is_needed
11188         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11189         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11190         defined in a dynamic object and referenced by a regular object,
11191         set is_needed for the dynamic object.
11192         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11193         if the file is marked with as_needed and it is not needed.
11194
11195 2009-11-04  Ian Lance Taylor  <iant@google.com>
11196
11197         PR 10887
11198         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11199         tags if data is discarded by linker script.
11200         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11201         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11202         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11203         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11204
11205 2009-11-04  Ian Lance Taylor  <iant@google.com>
11206
11207         * layout.cc (Layout::get_output_section): Add is_interp and
11208         is_dynamic_linker_section parameters.  Change all callers.
11209         (Layout::choose_output_section): Likewise.
11210         (Layout::make_output_section): Likewise.
11211         (Layout::add_output_section_data): Add is_dynamic_linker_section
11212         parameter.  Change all callers.
11213         * layout.h (class Layout): Update declarations.
11214         * output.h (class Output_section): Add is_interp, set_is_interp,
11215         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11216         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11217         generate_code_fills_at_write_ to a bitfield.
11218         * output.cc (Output_section::Output_sections): Initialize new
11219         fields.
11220         (Output_segment::add_output_section): Add do_sort parameter.
11221         Change all callers.
11222
11223 2009-11-03  Ian Lance Taylor  <iant@google.com>
11224
11225         PR 10860
11226         * options.h (class General_options): Add --warn-common.
11227         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11228         merging two common symbols.
11229         (Symbol_table::should_override): Handle --warn-common when merging
11230         a common symbol with a defined symbol.  Use report_resolve_problem
11231         for multiple definitions.
11232         (Symbol_table::report_resolve_problem): New function.
11233         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11234
11235 2009-11-03  Doug Kwan  <dougkwan@google.com>
11236
11237         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11238         stub_factory_.
11239         (Target_arm::stub_factory): New method definition.
11240         (Target_arm::new_arm_input_section,
11241         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11242         Target_arm::reloc_uses_thumb_bit): New method declarations.
11243         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11244         New type definitions.
11245         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11246         member declarations.
11247         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11248         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11249         New method definitions.
11250
11251 2009-11-03  Ian Lance Taylor  <iant@google.com>
11252
11253         * options.h (class General_options): Add --warn_constructors.
11254
11255 2009-11-03  Ian Lance Taylor  <iant@google.com>
11256
11257         PR 10893
11258         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11259         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11260
11261 2009-11-03  Ian Lance Taylor  <iant@google.com>
11262
11263         PR 10895
11264         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11265         --msgid-bugs-address.
11266         (install-pdf): New target.
11267         (install-data_yes): Look up one directory to find mkinstalldirs.
11268
11269 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11270
11271         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11272         tree.
11273
11274 2009-10-30  Doug Kwan  <dougkwan@google.com>
11275
11276         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11277
11278 2009-10-30  Doug Kwan  <dougkwan@google.com>
11279
11280         * arm.cc (Stub_addend_reader): New struct template definition
11281         and partial specializations.
11282         (Stub_addend_reader::operator()): New method definition for a
11283         partially specialized template.
11284
11285 2009-10-30  Doug Kwan  <dougkwan@google.com>
11286
11287         * arm.cc (Arm_relobj::processor_specific_flags): New method
11288         definition.
11289         (Arm_relobj::do_read_symbols): New method declaration.
11290         (Arm_relobj::processor_specific_flags_): New data member declaration.
11291         (Arm_dynobj): New class definition.
11292         (Target_arm::do_finalize_sections): Add input_objects parameter.
11293         (Target_arm::do_adjust_elf_header): New method declaration.
11294         (Target_arm::are_eabi_versions_compatible,
11295         (Target_arm::merge_processor_specific_flags): New method declaration.
11296         (Target_arm::do_make_elf_object): New overloaded method definitions
11297         and declaration.
11298         (Arm_relobj::do_read_symbols): New method definition.
11299         (Arm_dynobj::do_read_symbols): Ditto.
11300         (Target_arm::do_finalize_sections): Add input_objects parameters.
11301         Merge processor-specific flags from all input objects.
11302         (Target_arm::are_eabi_versions_compatible,
11303         Target_arm::merge_processor_specific_flags,
11304         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11305         New method definitions.
11306         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11307         Input_objects pointer type parameter.
11308         * layout.cc (Layout::finalize): Pass input objects to target's.
11309         finalize_sections function.
11310         * output.cc (Output_file_header::do_sized_write): Set ELF file
11311         header's processor-specific flags.
11312         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11313         Input_objects pointer type parameter.
11314         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11315         * target.h (Input_objects): New forward class declaration.
11316         (Target::processor_specific_flags,
11317         Target::are_processor_specific_flags_sect): New method definitions.
11318         (Target::finalize_sections): Add input_objects parameter.
11319         (Target::Target): Initialize processor_specific_flags_ and
11320         are_processor_specific_flags_set_.
11321         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11322         parameter.
11323         (Target::set_processor_specific_flags): New method definition.
11324         (Target::processor_specific_flags_,
11325         Target::are_processor_specific_flags_set_): New data member
11326         declarations.
11327         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11328         Input_objects pointer type parameter.
11329
11330 2009-10-30  Doug Kwan  <dougkwan@google.com>
11331
11332         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11333
11334 2009-10-28  Ian Lance Taylor  <iant@google.com>
11335
11336         * object.h (class Relobj): Drop options parameter from
11337         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11338         do_scan_relocs, do_relocate.  Change all callers.
11339         (class Sized_relobj): Drop options parameters from
11340         do_gc_process_relocs, do_scan_relocs, do_relocate,
11341         do_relocate_sections, relocate_sections, emit_relocs_scan,
11342         emit_relocs_scan_reltype.  Change all callers.
11343         (struct Relocate_info): Remove options field and all references to
11344         it.
11345         * reloc.h (class Read_relocs): Remove options constructor
11346         parameter and options_ field.  Change all callers.
11347         (class Gc_process_relocs, class Scan_relocs): Likewise.
11348         (class Relocate_task): Likewise.
11349         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11350         all callers.
11351         (scan_relocatable_relocs): Likewise.
11352         * target.h (class Sized_target): Remove options parameter from
11353         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11354         all callers.
11355         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11356         callers.
11357         * arm.cc: Update functions to remove options parameters.
11358         * i386.cc: Likewise.
11359         * powerpc.cc: Likewise.
11360         * sparc.cc: Likewise.
11361         * x86_64.cc: Likewise.
11362         * testsuite/testfile.cc: Likewise.
11363
11364 2009-10-28  Doug Kwan  <dougkwan@google.com>
11365
11366         * arm.cc (Arm_relobj): New class definition.
11367         (Arm_relobj::scan_sections_for_stubs,
11368         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11369         New method definitions.
11370
11371 2009-10-28  Cary Coutant  <ccoutant@google.com>
11372
11373         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11374         (Plugin::cleanup_done_): New member.
11375         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11376         (Plugin_manager::cleanup_done_): Remove.
11377         (Plugin_manager::add_input_file): Edit error message.
11378         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11379         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11380
11381 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11382
11383         * fileread.cc: (File_read::View::~View): Use the new
11384         data_ownership_ filed.
11385         (File_read::~File_read): Dispose the new whole_file_view_.
11386         (File_read::open): Mmap the whole file if needed.
11387         (File_read::open): Use whole_file_view_ instead of contents_.
11388         (File_read::find_view): Use whole_file_view_ if applicable.
11389         (File_read::do_read): Use whole_file_view_ instead of contents_.
11390         (File_read::make_view): Use whole_file_view_ instead of contents_,
11391         update File_read::View::View call.
11392         (File_read::find_or_make_view): Update File_read::View::View
11393         call.
11394         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11395         remove contents_
11396         (File_read::View::Data_ownership): New enum.
11397         (File_read::View::View): Replace bool mapped_ with Data_ownership
11398         argument.
11399         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11400         (File_read::View::data_ownership_): New field.
11401         (File_read::contents_): Remove (replaced by whole_file_view_).
11402         (File_read::whole_file_view_): New field.
11403         * options.h (class General_options): Add --keep-files-mapped.
11404
11405 2009-10-27  Cary Coutant  <ccoutant@google.com>
11406
11407         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11408         * testsuite/Makefile.am (plugin_test_5): New test case.
11409         * testsuite/Makefile.in: Regenerate.
11410
11411 2009-10-25  Doug Kwan  <dougkwan@google.com>
11412
11413         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11414         from private to protected to allow access by child class.
11415         (Sized_relobj::do_relocate_sections): New method declaration.
11416         (Sized_relobj::relocate_sections): Virtualize.
11417         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11418         Sized_relobj::relocate_sections.  Instantiate template explicitly
11419         for different target sizes and endianity.
11420
11421 2009-10-24  Doug Kwan  <dougkwan@google.com>
11422
11423         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11424         (Arm_input_section::as_arm_input_section): New method.
11425         (Arm_output_section): New class definition.
11426         (Arm_output_section::create_stub_group,
11427         Arm_output_section::group_sections): New method definitions.
11428
11429 2009-10-22  Doug Kwan  <dougkwan@google.com>
11430
11431         * arm.cc (Arm_input_section): New class definition.
11432         (Arm_input_section::init, Arm_input_section:do_write,
11433         Arm_input_section::set_final_data_size,
11434         Arm_input_section::do_reset_address_and_file_offset): New method
11435         definitions.
11436
11437 2009-10-21  Doug Kwan  <dougkwan@google.com>
11438
11439         * arm.cc (Stub_table, Arm_input_section): New forward class
11440         declarations.
11441         (Stub_table): New class defintion.
11442         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11443         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11444         New method definition.
11445
11446 2009-10-21  Doug Kwan  <dougkwan@google.com>
11447
11448         * arm.cc: Update copyright comments.
11449         (Target_arm): New forward class template declaration.
11450         (Arm_address): New type.
11451         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11452         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11453         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11454         constants.
11455         (Insn_template): Same.
11456         (DEF_STUBS): New macro.
11457         (Stub_type): New enum type.
11458         (Stub_template): New class definition.
11459         (Stub): Same.
11460         (Reloc_stub): Same.
11461         (Stub_factory): Same.
11462         (Target_arm::Target_arm): Initialize may_use_blx_ and
11463         should_force_pic_veneer_.
11464         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11465         Target_arm::should_force_pic_veneer,
11466         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11467         Target_arm::using_thumb_only, Target_arm:;default_target): New
11468         method defintions.
11469         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11470         New data member declarations.
11471         (Insn_template::size, Insn_template::alignment): New method defintions.
11472         (Stub_template::Stub_template): New method definition.
11473         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11474         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11475         (Stub_factory::Stub_factory): New method definition.
11476         * gold.h (string_hash): New template.
11477         * output.h (Input_section_specifier::hash_value): Use
11478         gold::string_hash.
11479         (Input_section_specifier::string_hash): Remove.
11480         * stringpool.cc (Stringpool_template::string_hash): Use
11481         gold::string_hash.
11482
11483 2009-10-20  Doug Kwan  <dougkwan@google.com>
11484
11485         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11486         symbols of relaxed input sections.
11487         * output.h (Output_section::find_relaxed_input_section): Make
11488         method public.
11489
11490 2009-10-16  Doug Kwan  <dougkwan@google.com>
11491
11492         * dynobj.cc (Versions::Versions): Initialize version_script_.
11493         Only insert base version symbol definition for a shared object
11494         if version script defines any version versions.
11495         (Versions::define_base_version): New method definition.
11496         (Versions::add_def): Check that base version is not needed.
11497         (Versions::add_need): Define base version lazily.
11498         * dynobj.h (Versions::define_base_version): New method declaration.
11499         (Versions::needs_base_version_): New data member declaration.
11500         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11501         (check_DATA): Add no_version_test.stdout.
11502         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11503         New make rules.
11504         * testsuite/Makefile.in: Regenerate.
11505         * testsuite/no_version_test.c: New file.
11506         * testsuite/no_version_test.sh: Ditto.
11507
11508 2009-10-16  Doug Kwan  <dougkwan@google.com>
11509
11510         * expression.cc (class Segment_start_expression): New class definition.
11511         (Segment_start_expression::value): New method definition.
11512         (script_exp_function_segment_start): Return a new
11513         Segment_start_expression.
11514         * gold/script-c.h (script_saw_segment_start_expression): New function
11515         prototype.
11516         * script-sections.cc (Script_sections::Script_sections): Initialize
11517         SAW_SEGMENT_START_EXPRESSION_ to false.
11518         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11519         and -Tbbs options to specify section addresses if given in
11520         command line and no SEGMENT_START expression is seen in a script.
11521         * script-sections.h (Script_sections::saw_segment_start_expression,
11522         Script_sections::set_saw_segment_start_expression): New method
11523         definition.
11524         (Script_sections::saw_segment_start_expression_): New data member
11525         declaration.
11526         * script.cc (script_saw_segment_start_expression): New function.
11527         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11528         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11529         script_test_7.sh and script_test_8.sh.
11530         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11531         script_test_8.stdout.
11532         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11533         (script_test_6, script_test_6.stdout, script_test_7,
11534         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11535         * Makefile.in: Regenerate.
11536         * testsuite/script_test_6.sh: New file.
11537         * testsuite/script_test_6.t: Same.
11538         * testsuite/script_test_7.sh: Same.
11539         * testsuite/script_test_7.t: Same.
11540         * testsuite/script_test_8.sh: Same.
11541
11542 2009-10-16  Doug Kwan  <dougkwan@google.com>
11543
11544         * output.cc (Output_segment::set_section_list_address): Cast
11545         expressions to unsigned long long type to avoid format warnings.
11546
11547 2009-10-15  Ian Lance Taylor  <iant@google.com>
11548
11549         * script.cc (Script_options::add_symbol_assignment): Always add a
11550         dot assignment to script_sections_.
11551         * script-sections.cc (Script_sections::add_dot_assignment):
11552         Initialize if necessary.
11553
11554         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11555         program headers with no load segment if there is a linker script.
11556
11557         * layout.cc (Layout::set_segment_offsets): Align the file offset
11558         to the segment aligment for -N or -n with no load segment.
11559         * output.cc (Output_segment::add_output_section): Don't crash if
11560         the first section is a TLS section.
11561         (Output_segment::set_section_list_addresses): Print an error
11562         message if the address moves backward in a linker script.
11563         * script-sections.cc
11564         (Output_section_element_input::set_section_addresses): Don't
11565         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11566         (Orphan_output_section::set_section_addresses): Likewise.
11567
11568 2009-10-15  Doug Kwan  <dougkwan@google.com>
11569
11570         * layout.cc (Layout::finish_dynamic_section): Generate tags
11571         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11572         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11573         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11574
11575 2009-10-14  Ian Lance Taylor  <iant@google.com>
11576
11577         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11578         fields.
11579         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11580         data_shdr fields of relinfo.
11581         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11582         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11583         R_386_TLS_LDO_32, adjust based on section flags.
11584         (Target_i386::Relocate::fix_up_ldo): Remove.
11585
11586 2009-10-13  Ian Lance Taylor  <iant@google.com>
11587
11588         Add support for -pie.
11589         * options.h (class General_options): Add -pie and
11590         --pic-executable.
11591         (General_options::output_is_position_independent): Test -pie.
11592         (General_options::output_is_executable): Return true if not shared
11593         and not relocatable.
11594         (General_options::output_is_pie): Remove.
11595         * options.cc (General_options::finalize): Reject incompatible uses
11596         of -pie.
11597         * gold.cc (queue_middle_tasks): A -pie link is not static.
11598         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11599         * symtab.cc (Symbol::final_value_is_known): Return false if
11600         output_is_position_independent.
11601         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11602         output_is_position_independent.
11603         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11604         output_is_position_independent.
11605         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11606         output_is_position_independent.
11607         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11608         two_file_pie_test.
11609         (basic_pie_test.o, basic_pie_test): New targets.
11610         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11611         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11612         (two_file_pie_test): New target.
11613         * testsuite/Makefile.in: Rebuild.
11614         * README: Remove note saying that -pie is not supported.
11615
11616 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11617
11618         * options.h (class General_options): Add -init and -fini.
11619         * layout.cc (Layout::finish_dynamic_section): Emit
11620         given init and fini functions.
11621
11622 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11623
11624         * gc.h (gc_process_relocs): Check if icf is enabled using new
11625         function.
11626         * gold.cc (queue_initial_tasks): Likewise.
11627         (queue_middle_tasks): Likewise.
11628         * object.cc (do_layout): Likewise.
11629         * symtab.cc (is_section_folded): Likewise.
11630         * main.cc (main): Likewise.
11631         * reloc.cc (Read_relocs::run): Likewise.
11632         (Sized_relobj::do_scan_relocs): Likewise.
11633         * icf.cc (is_function_ctor_or_dtor): New function.
11634         (Icf::find_identical_sections): Check if function is ctor or dtor when
11635         safe icf is chosen.
11636         * options.h (General_options::icf): Change option to be an enum.
11637         (Icf_status): New enum.
11638         (icf_enabled): New method.
11639         (icf_safe_folding): New method.
11640         (set_icf_status): New method.
11641         (icf_status_): New variable.
11642         * (options.cc) (General_options::finalize): Set icf_status_.
11643         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11644         icf_test and icf_keep_unique_test to use the --icf enum flag.
11645         * testsuite/icf_safe_test.sh: New file.
11646         * testsuite/icf_safe_test.cc: New file.
11647
11648 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11649
11650         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11651         includes to gc.h and icf.h.
11652         * arm.cc: Include gc.h.
11653         * gold.cc: Likewise.
11654         * i386.cc: Likewise.
11655         * powerpc.cc: Likewise.
11656         * sparc.cc: Likewise.
11657         * x86_64.cc: Likewise.
11658         * gc.h: Include icf.h.
11659
11660 2009-10-11  Ian Lance Taylor  <iant@google.com>
11661
11662         * plugin.cc: Include "gold.h" before other header files.
11663
11664 2009-10-10  Chris Demetriou  <cgd@google.com>
11665
11666         * options.h (Input_file_argument::Input_file_type): New enum.
11667         (Input_file_argument::is_lib_): Replace with...
11668         (Input_file_argument::type_): New member.
11669         (Input_file_argument::Input_file_argument): Take Input_file_type
11670         'type' rather than boolean 'is_lib' as second argument.
11671         (Input_file_argument::is_lib): Use type_.
11672         (Input_file_argument::is_searched_file): New function.
11673         (Input_file_argument::may_need_search): Handle is_searched_file.
11674         * options.cc (General_options::parse_library): Support -l:filename.
11675         (General_options::parse_just_symbols): Update for Input_file_argument
11676         changes.
11677         (Command_line::process): Likewise.
11678         * archive.cc (Archive::get_file_and_offset): Likewise.
11679         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11680         * script.cc (read_script_file, script_add_file): Likewise.
11681         * fileread.cc (Input_file::Input_file): Likewise.
11682         (Input_file::will_search_for): Handle is_searched_file.
11683         (Input_file::open): Likewise.
11684         * readsyms.cc (Read_symbols::get_name): Likewise.
11685         * testsuite/Makefile.am (searched_file_test): New test.
11686         * testsuite/Makefile.in: Regenerate.
11687         * testsuite/searched_file_test.cc: New file.
11688         * testsuite/searched_file_test_lib.cc: New file.
11689
11690 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11691             Ian Lance Taylor  <iant@google.com>
11692
11693         * descriptor.cc: Include <cstdio> and "binary-io.h".
11694         (Descriptors::open): Open the files in binary mode always.
11695         * script.cc (Lex::get_token): Treat \r as whitespace.
11696
11697 2009-10-09  Ian Lance Taylor  <iant@google.com>
11698
11699         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11700
11701 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11702             Ian Lance Taylor  <iant@google.com>
11703
11704         * configure.ac: Check for readv function also.
11705         * fileread.cc (readv): Define if not HAVE_READV.
11706         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11707         does not exist.
11708         * config.in: Regenerate.
11709         * configure: Regenerate.
11710
11711 2009-10-09  Doug Kwan  <dougkwan@google.com>
11712
11713         * layout.cc (Layout::make_output_section): Call target hook to make
11714         ordinary output section.
11715         (Layout::finalize): Adjust parameter list of call the
11716         Target::may_relax().
11717         * layout.h (class Layout::section_list): New method.
11718         * merge.h (Output_merge_base::entsize): Change visibility to public.
11719         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11720         New methods.
11721         (Output_merge_string::do_is_string): New method.
11722         * object.cc (Sized_relobj::do_setup): renamed from
11723         Sized_relobj::set_up.
11724         * object.h (Sized_relobj::adjust_shndx,
11725         Sized_relobj::initializ_input_to_output_maps,
11726         Sized_relobj::free_input_to_output_maps): Change visibilities to
11727         protected.
11728         (Sized_relobj::setup): Virtualize.
11729         (Sized_relobj::do_setup): New method declaration.
11730         (Sized_relobj::invalidate_section_offset,
11731         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11732         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11733         * options.cc (parse_int): New function.
11734         * options.h (parse_int): New declaration.
11735         (DEFINE_int): New macro.
11736         (stub_group_size): New option.
11737         * output.cc (Output_section::Output_section): Initialize memebers
11738         merge_section_map_, merge_section_by_properties_map_,
11739         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11740         (Output_section::add_input_section): Handled deferred code-fill
11741         generation and remove an old comment.
11742         (Output_section::add_relaxed_input_section): New method definition.
11743         (Output_section::add_merge_input_section): Use merge section by
11744         properties map to speed to search.  Update merge section maps
11745         as appropriate.
11746         (Output_section::build_relaxation_map): New method definition.
11747         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11748         Same.
11749         (Output_section::relax_input_section): Renamed to
11750         Output_section::convert_input_sections_to_relaxed_sections and change
11751         interface to take a vector of pointers to relaxed sections.
11752         (Output_section::find_merge_section,
11753         Output_section::find_relaxed_input_section): New method definitions.
11754         (Output_section::is_input_address_mapped,
11755         Output_section::output_offset, Output_section::output_address):
11756         Use output section data maps to speed up searching.
11757         (Output_section::find_starting_output_address): Add comments.
11758         (Output_section::do_write,
11759         Output_section::write_to_postprocessing_buffer): Do code-fill
11760         generation as appropriate.
11761         (Output_section::get_input_sections): Invalidate relaxed input section
11762         map.
11763         (Output_section::restore_states): Adjust type of checkpoint .
11764         Invalidate relaxed input section map.
11765         * output.h (Output_merge_base): New class declaration.
11766         (Input_section_specifier): New class defintion.
11767         (class Output_relaxed_input_section) Change base class to
11768         Output_section_data_build.
11769         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11770         base class initializer.
11771         (Output_section::add_relaxed_input_section): New method declaration.
11772         (Output_section::Input_section): Change visibility to protected.
11773         (Output_section::Input_section::relobj,
11774         Output_section::Input_section::shndx): Handle relaxed input sections.
11775         Output_section::input_sections) Change visibility to protected.  Also
11776         define overload to return a non-const pointer.
11777         (Output_section::Merge_section_properties): New class defintion.
11778         (Output_section::Merge_section_by_properties_map,
11779         Output_section::Output_section_data_by_input_section_map,
11780         Output_section::Relaxation_map): New types.
11781         (Output_section::relax_input_section): Rename method to
11782         Output_section::convert_input_sections_to_relaxed_sections and change
11783         interface to take a vector of relaxed section pointers.
11784         (Output_section::find_merge_section,
11785         Output_section::find_relaxed_input_section,
11786         Output_section::build_relaxation_map,
11787         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11788         New method declarations.
11789         (Output_section::merge_section_map_
11790         Output_section::merge_section_by_properties_map_,
11791         Output_section::relaxed_input_section_map_,
11792         Output_section::is_relaxed_input_section_map_valid_,
11793         Output_section::generate_code_fills_at_write_): New data members.
11794         * script-sections.cc
11795         (Output_section_element_input::set_section_addresses): Call
11796         current_data_size and addralign methods of relaxed input sections.
11797         (Orphan_output_section::set_section_addresses): Call current_data_size
11798         and addralign methods of relaxed input sections.
11799         * symtab.cc (Symbol_table::compute_final_value): Extract template
11800         from the body of Symbol_table::sized_finalize_symbol.
11801         (Symbol_table::sized_finalized_symbol): Call
11802         Symbol_table::compute_final_value.
11803         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11804         (Symbol_table::compute_final_value): New templated method declaration.
11805         * target.cc (Target::do_make_output_section): New method defintion.
11806         * target.h (Target::make_output_section): New method declaration.
11807         (Target::relax): Add more parameters for input objects, symbol table
11808         and layout.  Adjust call to do_relax.
11809         (Target::do_make_output_section): New method declaration.
11810         (Target::do_relax): Add parameters for input objects, symbol table
11811         and layout.
11812
11813 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11814
11815         * pread.c: Include stdio.h.
11816
11817 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11818
11819         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11820         defined.
11821
11822 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11823
11824         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11825         Change read_shndx type to unsigned int.
11826         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11827         int.
11828         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11829         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11830         Change read_shndx type to unsigned int.
11831         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11832         int.
11833         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11834         * layout.cc (Layout::create_symtab_sections): Cast the result of
11835         local_symcount * symsize to off_t in the gold_assert.
11836
11837 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11838
11839         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11840         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11841         R_ARM_BASE_ABS.
11842         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11843         (Arm_relocate_functions::thm_abs5): New function.
11844         (Arm_relocate_functions::abs12): New function.
11845         (Arm_relocate_functions::abs16): New function.
11846         (Arm_relocate_functions::base_abs): New function.
11847         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11848         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11849         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11850         R_ARM_BASE_ABS.
11851         (Scan::global): Likewise.
11852         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11853         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11854         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11855         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11856         R_ARM_BASE_ABS.
11857
11858 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11859
11860         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11861         (Arm_relocate_functions::movt_prel): New function.
11862         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11863         (Arm_relocate_functions::thm_movt_prel): New function.
11864         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11865         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11866         (Scan::global, Relocate::relocate): Likewise.
11867         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11868
11869 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11870
11871         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11872         Incremental_checker.
11873         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11874         unsigned int.
11875         (class Incremental_inputs_header): New class.
11876         (Incremental_inputs_header_writer): Edit comment.
11877         (Incremental_inputs_entry): New class.
11878         (Incremental_inputs_entry_writer): Edit comment.
11879         (Sized_incremental_binary::do_find_incremental_inputs_section):
11880         Add *strtab_shndx parameter, fill it.
11881         (Sized_incremental_binary::do_check_inputs): New method.
11882         (Incremental_checker::can_incrementally_link_output_file): Use
11883         Sized_incremental_binary::check_inputs.
11884         (Incremental_inputs::report_command_line): Save command line in
11885         command_line_.
11886         * incremental.h:
11887         (Incremental_binary::find_incremental_inputs_section): New
11888         method.
11889         (Incremental_binary::do_find_incremental_inputs_section): Add
11890         strtab_shndx parameter.
11891         (Incremental_binary::do_check_inputs): New pure virtual method.
11892         (Sized_incremental_binary::do_check_inputs): Declare.
11893         (Incremental_checker::Incremental_checker): Add incremental_inputs
11894         parameter, use it to initialize incremental_inputs_.
11895         (Incremental_checker::incremental_inputs_): New field.
11896         (Incremental_checker::command_line): New method.
11897         (Incremental_checker::inputs): New method.
11898         (Incremental_checker::command_line_): New field.
11899
11900 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11901
11902         * incremental.cc: Include <cstdarg> and "target-select.h".
11903         (vexplain_no_incremental): New function.
11904         (explain_no_incremental): New function.
11905         (Incremental_binary::error): New method.
11906         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11907         method.
11908         (make_sized_incremental_binary): New function.
11909         (open_incremental_binary): New function.
11910         (can_incrementally_link_file): Add checks if output is ELF and has
11911         inputs section.
11912         * incremental.h: Include "elfcpp_file.h" and "output.h".
11913         (Incremental_binary): New class.
11914         (Sized_incremental_binary): New class.
11915         (open_incremental_binary): Declare.
11916         * object.cc (is_elf_object): Use
11917         elfcpp::Elf_recognizer::is_elf_file.
11918         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11919         * output.h (Output_file::filesize): New method.
11920
11921 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11922
11923         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11924         New function.
11925         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11926         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11927         function.
11928         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11929         function.
11930         (Arm_relocate_functions::movw_abs_nc): New function.
11931         (Arm_relocate_functions::movt_abs): New function.
11932         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11933         (Arm_relocate_functions::thm_movt_abs): New function.
11934         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11935         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11936         (Scan::global): Likewise.
11937         (Relocate::relocate): Likewise.
11938         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11939
11940 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11941
11942         * arm.cc (Arm_relocate_functions::got_prel) New function.
11943         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11944         (Relocate::relocate): Likewise.
11945         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11946
11947 2009-10-06  Ian Lance Taylor  <iant@google.com>
11948
11949         * options.h (class General_options): Define
11950         split_stack_adjust_size parameter.
11951         * object.h (class Object): Add uses_split_stack_ and
11952         has_no_split_stack_ fields.  Add uses_split_stack and
11953         has_no_split_stack accessor functions.  Declare
11954         handle_split_stack_section.
11955         (class Reloc_symbol_changes): Define.
11956         (class Sized_relobj): Define Function_offsets.  Declare
11957         split_stack_adjust, split_stack_adjust_reltype, and
11958         find_functions.
11959         * object.cc (Object::handle_split_stack_section): New function.
11960         (Sized_relobj::do_layout): Call handle_split_stack_section.
11961         * dynobj.cc (Sized_dynobj::do_layout): Call
11962         handle_split_stack_section.
11963         * reloc.cc (Sized_relobj::relocate_sections): Call
11964         split_stack_adjust for executable sections in split_stack
11965         objects.  Pass reloc_map to relocate_section.
11966         (Sized_relobj::split_stack_adjust): New function.
11967         (Sized_relobj::split_stack_adjust_reltype): New function.
11968         (Sized_relobj::find_functions): New function.
11969         * target-reloc.h: Include "object.h".
11970         (relocate_section): Add reloc_symbol_changes parameter.  Change
11971         all callers.
11972         * target.h (class Target): Add calls_non_split method.  Declare
11973         do_calls_non_split virtual method.  Declare match_view and
11974         set_view_to_nop.
11975         * target.cc: Include "elfcpp.h".
11976         (Target::do_calls_non_split): New function.
11977         (Target::match_view): New function.
11978         (Target::set_view_to_nop): New function.
11979         * gold.cc (queue_middle_tasks): Give an error if mixing
11980         split-stack and non-split-stack objects with -r.
11981         * i386.cc (Target_i386::relocate_section): Add
11982         reloc_symbol_changes parameter.
11983         (Target_i386::do_calls_non_split): New function.
11984         * x86_64.cc (Target_x86_64::relocate_section): Add
11985         reloc_symbol_changes parameter.
11986         (Target_x86_64::do_calls_non_split): New function.
11987         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11988         parameter.
11989         * powerpc.cc (Target_powerpc::relocate_section): Add
11990         reloc_symbol_changes parameter.
11991         * sparc.cc (Target_sparc::relocate_section): Add
11992         reloc_symbol_changes parameter.
11993         * configure.ac: Call AM_CONDITIONAL for the default target.
11994         * configure: Rebuild.
11995         * testsuite/Makefile.am (TEST_AS): New variable.
11996         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11997         (check_DATA): Add split_i386 and split_x86_64 files.
11998         (SPLIT_DEFSYMS): Define.
11999         (split_i386_[1234n].o): New targets.
12000         (split_i386_[124]): New targets.
12001         (split_i386_[1234r].stdout): New targets.
12002         (split_x86_64_[1234n].o): New targets.
12003         (split_x86_64_[124]): New targets.
12004         (split_x86_64_[1234r].stdout): New targets.
12005         (MOSTLYCLEANFILES): Add new executables.
12006         * testsuite/split_i386.sh: New file.
12007         * testsuite/split_x86_64.sh: New file.
12008         * testsuite/split_i386_1.s: New file.
12009         * testsuite/split_i386_2.s: New file.
12010         * testsuite/split_i386_3.s: New file.
12011         * testsuite/split_i386_4.s: New file.
12012         * testsuite/split_i386_n.s: New file.
12013         * testsuite/split_x86_64_1.s: New file.
12014         * testsuite/split_x86_64_2.s: New file.
12015         * testsuite/split_x86_64_3.s: New file.
12016         * testsuite/split_x86_64_4.s: New file.
12017         * testsuite/split_x86_64_n.s: New file.
12018         * testsuite/testfile.cc (Target_test): Update relocation_section
12019         function.
12020         * testsuite/Makefile.in: Rebuild.
12021
12022 2009-10-06  Ian Lance Taylor  <iant@google.com>
12023
12024         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12025         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12026         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12027         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12028         the address on ldo_addrs_.
12029         (Target_i386::Relocate::fix_up_ldo): New function.
12030
12031 2009-10-06   Rafael Espindola  <espindola@google.com>
12032
12033         * plugin.cc (add_input_library): New.
12034         (Plugin::load): Add add_input_library to tv.
12035         (Plugin_manager::add_input_file): Add the is_lib argument.
12036         (add_input_file): Update call to Plugin_manager::add_input_file.
12037         (add_input_library): New.
12038         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12039
12040 2009-09-30  Doug Kwan  <dougkwan@google.com>
12041
12042         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12043         symbol and call Symbol::may_need_copy_reloc to determine if
12044         a copy reloc is needed.
12045         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12046         nocopyreloc is given in command line.
12047         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12048         given in command line.
12049         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12050         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12051         of the removed Target_i386::may_need_copy_reloc.
12052         * options.h (copyreloc): New option with default value false.
12053         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12054         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12055         instead of the removed Target_powerpc::may_need_copy_reloc.
12056         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12057         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12058         instead of the removed Target_sparc::may_need_copy_reloc.
12059         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12060         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12061         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12062         instead of the removed Target_x86_64::may_need_copy_reloc.
12063
12064 2009-09-30  Ian Lance Taylor  <iant@google.com>
12065
12066         * object.h (class Object): Remove target_ field, and target,
12067         sized_target, and set_target methods.
12068         (Object::sized_target): Remove.
12069         (class Sized_relobj): Update declarations.  Remove sized_target.
12070         * object.cc (Sized_relobj::setup): Remove target parameter.
12071         Change all callers.
12072         (Input_objects::add_object): Don't do anything with the target.
12073         (make_elf_sized_object): Add punconfigured parameter.  Change all
12074         callers.  Set or test parameter target.
12075         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12076         Change all callers.
12077         * parameters.cc (Parameters::set_target): Change parameter type to
12078         be non-const.
12079         (Parameters::default_target): Remove.
12080         (set_parameters_target): Change parameter type to be non-const.
12081         (parameters_force_valid_target): New function.
12082         (parameters_clear_target): New function.
12083         * parameters.h (class Parameters): Update declarations.  Remove
12084         default_target method.  Add sized_target and clear_target
12085         methods.  Change target_ to be non-const.
12086         (set_parameters_target): Update declaration.
12087         (parameters_force_valid_target): Declare.
12088         (parameters_clear_target): Declare.
12089         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12090         as NULL if we aren't searching.
12091         (Add_symbols::run): Don't check for compatible target.
12092         * fileread.cc (Input_file::open_binary): Call
12093         parameters_force_valid_target.
12094         * gold.cc (queue_middle_tasks): Likewise.
12095         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12096         set_target on object.
12097         * dynobj.h (class Sized_dynobj): Update declarations.
12098         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12099         make_elf_object returns NULL.
12100         (Archive::include_member): Don't check whether object target is
12101         compatible.
12102         * output.cc (Output_section::add_input_section): Get target from
12103         parameters.
12104         (Output_section::relax_input_section): Likewise.
12105         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12106         parameters.
12107         (Sized_relobj::do_scan_relocs): Likewise.
12108         (Sized_relobj::relocate_sections): Likewise.
12109         * resolve.cc (Symbol_table::resolve): Likewise.
12110         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12111         parameter.  Change all callers.
12112         (Symbol_table::add_from_object): Get target from parameters.
12113         (Symbol_table::add_from_relobj): Don't check object target.
12114         (Symbol_table::add_from_dynobj): Likewise.
12115         (Symbol_table::define_special_symbol): Get target from
12116         parameters.
12117         * symtab.h (class Symbol_table): Update declaration.
12118         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12119         parameter.  Change all callers.  Clear parameter target.
12120         (Binary_test): Test target here.
12121         * testsuite/object_unittest.cc (gold_testsuite): Remove
12122         target_test_pointer parameter.  Change all callers.
12123         (Object_test): Test target here.
12124
12125 2009-09-26  Ian Lance Taylor  <iant@google.com>
12126
12127         * testsuite/initpri1.c: Don't try to use constructor priorities if
12128         compiling with gcc before 4.3.
12129
12130 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12131
12132         * testsuite/retain_symbols_file_test.sh (check_present): Change
12133         output file name to retain_symbols_file_test.stdout.
12134         (check_absent): Likewise.
12135
12136 2009-09-18  Craig Silverstein  <csilvers@google.com>
12137
12138         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12139         * options.cc: Include <cerrno> and <fstream>.
12140         (General_options::finalize): Parse -retain-symbols-file tag.
12141         * options.h: New flag.
12142         (General_options): New method should_retain_symbol, new
12143         variable symbols_to_retain.
12144         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12145         should_retain_symbol map.
12146         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12147         * testsuite/Makefile.in: Regenerate.
12148         * testsuite/retain_symbols_file_test.sh: New file.
12149
12150 2009-09-18  Nick Clifton  <nickc@redhat.com>
12151
12152         * po/es.po: Updated Spanish translation.
12153
12154 2009-09-17  Doug Kwan  <dougkwan@google.com>
12155
12156         * debug.h (DEBUG_RELAXATION): New constant.
12157         (DEBUG_ALL): Add DEBUG_RELAXATION.
12158         (debug_string_to_enum): Add relaxation debug option.
12159         * layout.cc
12160         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12161         Layout::Relaxation_debug_check::read_sections,
12162         Layout::Relaxation_debug_check::read_sections): New method definitions.
12163         (Layout::Layout): Initialize data members
12164         record_output_section_data_from_scrips_,
12165         script_output_section_data_list_ and relaxation_debug_check_.
12166         (Layout::save_segments, Layout::restore_segments,
12167         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12168         Layout::relaxation_loop_body): New method definitions.
12169         (Layout::finalize): Support relaxation.  Move section layout code to
12170         Layout::relaxation_loop_body.
12171         (Layout::set_asection_address_from_script): Move code for orphan
12172         section placement out.
12173         (Layout::place_orphan_sections_in_script): New method definition.
12174         * layout.h (Output_segment_headers, Output_file_header):
12175         New forward class declarations.
12176         (Layout::~Layout): Define.
12177         (Layout::new_output_section_data_from_script): New method definition.
12178         (Layout::place_orphan_sections_in_script): New method declaration.
12179         (Layout::Segment_states): New type declaration.
12180         (Layout::save_segments, Layout::restore_segments,
12181         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12182         Layout::relaxation_loop_body): New method declarations.
12183         (Layout::Output_section_data_list): New type declaration.
12184         (Layout::Relaxation_debug_check): New class definition.
12185         (Layout::record_output_section_data_from_script_,
12186         Layout::script_output_section_data_list_, Layout::segment_states_,
12187         Layout::relaxation_debug_check_): New data members.
12188         * output.cc: (Output_section_headers::do_size): New method definition.
12189         (Output_section_headers::Output_section_headers): Move size
12190         computation to Output_section_headers::do_size.
12191         (Output_segment_headers::do_size): New method definition.
12192         (Output_file_header::Output_file_header): Move size computation to
12193         Output_file_header::do_size and call it.
12194         (Output_file_header::do_size): New method definition.
12195         (Output_data_group::Output_data_group): Adjust call to
12196         Output_section_data.
12197         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12198         (Output_symtab_xindex::do_write): Add array bound check.
12199         (Output_section::Input_section::print_to_mapfile): Handle
12200         RELAXED_INPUT_SECTION_CODE.
12201         (Output_section::Output_section): Initialize data member checkpoint_.
12202         (Output_section::~Output_section): Delete checkpoint object pointed
12203         by checkpoint_.
12204         (Output_section::add_input_section): Always add an Input_section if
12205         relaxing.
12206         (Output_section::add_merge_input_section): Add assert.
12207         (Output_section::relax_input_section): New method definition.
12208         (Output_section::set_final_data_size): Set load address to zero for
12209         an unallocated section.
12210         (Output_section::do_address_and_file_offset_have_reset_values):
12211         New method definition.
12212         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12213         Handle relaxed input section.
12214         (Output_section::sort_attached_input_sections): Checkpoint input
12215         section list lazily.
12216         (Output_section::get_input_sections): Change type of input_sections to
12217         list of Simple_input_section pointers.  Checkpoint input section list
12218         lazily.  Also handle relaxed input sections.
12219         (Output_section::add_input_section_for_script): Take a reference to
12220         a Simple_input_section object instead of Relobj pointer and section
12221         index as parameter.  Handle relaxed input sections.
12222         (Output_section::save_states, Output_section::restore_states): New
12223         method definitions.
12224         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12225         (Output_data::is_data_size_fixed): New method definition.
12226         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12227         if it is fixed.
12228         (Output_data::address_and_file_offset_have_reset_values): New method
12229         definition.
12230         (Output_data::do_address_and_file_offset_have_reset_values): New method
12231         definition.
12232         (Output_data::set_data_size): Check that data size is not fixed.
12233         (Output_data::fix_data_size): New method definition.
12234         (Output_data::is_data_size_fixed_): New data member.
12235         (Output_section_headers::set_final_data_size): New method definition.
12236         (Output_section_headers::do_size): New method declaration.
12237         (Output_segment_headers::set_final_data_size): New method definition.
12238         (Output_segment_headers::do_size): New method declaration.
12239         (Output_file_header::set_final_data_size)::New method definition.
12240         (Output_file_header::do_size)::New method declaration.
12241         (Output_section_data::Output_section_data): Add new parameter
12242         is_data_size_fixed and use it to fix data size.
12243         (Output_data_const::Output_data_const): Adjust call to base class
12244         constructor and fix data size.
12245         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12246         base class constructor and fix data size.
12247         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12248         base class constructor and fix data size.
12249         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12250         class constructor and fix data size.
12251         (Output_data_group::set_final_data_size): New method definition.
12252         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12253         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12254         class constructor and fix data size.
12255         (Output_relaxed_input_section): New class definition.
12256         (Output_section::Simple_input_section): New class definition.
12257         (Output_section::get_input_sections): Adjust parameter list.
12258         (Output_section::add_input_section_for_script): Same.
12259         (Output_section::save_states, Output_section::restore_states,
12260         Output_section::do_address_and_file_offset_have_reset_values,
12261         (Output_section::Input_section::Input_section): Handle
12262         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12263         Output_relaxed_input_section.
12264         (Output_section::Input_section::is_input_section,
12265         Output_section::Input_section::set_output_section): Handle relaxed
12266         input section.
12267         (Output_section::Input_section::is_relaxed_input_section,
12268         Output_section::Input_section::output_section_data,
12269         Output_section::Input_section::relaxed_input_section): New method
12270         definitions.
12271         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12272         value.
12273         (Output_section::Input_section::u1_): Update comments.
12274         (Output_section::Input_section::u2_): Add new union member poris.
12275         (Output_section::Checkpoint_output_section): New classs definition.
12276         (Output_section::relax_input_section): New method declaration.
12277         (Output_section::checkpoint_): New data member.
12278         (Output_segment): Update comments.
12279         (Output_segment::Output_segment): Un-privatize copy constructor.
12280         (Output_segment::operator=): Un-privatize.
12281         * script-sections.cc (Output_section_element::Input_section_list):
12282         Change element type to Output_section::Simple_input_section.
12283         (Output_section_element_dot_assignment::set_section_addresses):
12284         Register output section data for relaxation clean up.
12285         (Output_data_exression::Output_data_expression): Adjust call to base
12286         constructor to fix data size.
12287         (Output_section_element_data::set_section_addresses): Register
12288         Output_data_expression object for relaxation clean up.
12289         (struct Input_section_info): Replace Relobj pointer and section index
12290         pair with Output_section::Simple_input_section and Convert struct to a
12291         class.
12292         (Input_section_sorter::operator()): Adjust access to
12293         Input_section_info data member to use accessors.
12294         (Output_section_element_input::set_section_addresses): Use layout
12295         parameter.  Adjust code to use Output_section::Simple_input_section
12296         and Input_secction_info classes.  Register filler for relaxation
12297         clean up.
12298         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12299         and section index pair with Output_section::Simple_input_section
12300         class.  Adjust code accordingly.
12301         (Phdrs_element::release_segment): New method definition.
12302         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12303         segment list.
12304         (Script_sections::release_segments): New method definition.
12305         * gold/script-sections.h (Script_sections::release_segments): New
12306         method declaration.
12307         * gold/target.h (Target::may_relax, Target::relax,
12308         Target::do_may_relax, Target::do_relax): New method definitions.
12309
12310 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12311
12312         * arm.cc (has_signed_unsigned_overflow): New function.
12313         (Arm_relocate_functions::abs8): New function.
12314         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12315         (Target_arm::Scan::global): Likewise.
12316         (Target_arm::relocate::relocate): Likewise.
12317         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12318         Likewise.
12319
12320 2009-09-16  Cary Coutant  <ccoutant@google.com>
12321
12322         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12323         * testsuite/Makefile.in: Regenerate.
12324
12325 2009-09-11  Nick Clifton  <nickc@redhat.com>
12326
12327         * po/gold.pot: Updated by the Translation project.
12328
12329 2009-09-08  Cary Coutant  <ccoutant@google.com>
12330
12331         * output.cc (Output_file::open): Add execute permission to empty file.
12332         * testsuite/Makefile.am (permission_test): New test.
12333         * testsuite/Makefile.in: Regenerate.
12334
12335 2009-09-02  Ian Lance Taylor  <iant@google.com>
12336
12337         * output.cc (Output_file::resize): Call map_no_anonymous rather
12338         than map.
12339
12340 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12341
12342         * gold.cc: Include "incremental.h".
12343         (queue_initial_tasks): Call Incremental_checker methods.
12344         * incremental.cc: Include "output.h".
12345         (Incremental_checker::can_incrementally_link_output_file): New
12346         method.
12347         * incremental.h (Incremental_checker): New class.
12348
12349         * output.cc (Output_file::open_for_modification): New method.
12350         (Output_file::map_anonymous): Changed return type to bool.  Record
12351         map in base_ field.
12352         (Output_file::map_no_anonymous): New method, broken out of map.
12353         (Output_file::map): Use map_no_anonymous and map_anonymous.
12354         * output.h (class Output_file): Update declarations.
12355
12356 2009-08-24  Cary Coutant  <ccoutant@google.com>
12357
12358         * options.h (Command_line::Pre_options): New class.
12359         (Command_line::pre_options): New member.
12360         * options.cc (gold::options::ready_to_register): New variable.
12361         (One_option::register_option): Do nothing if not registering options.
12362         Assert if same short option registered twice.
12363         (General_options::General_options): Turn off option registration when
12364         done constructing.
12365         (Command_line::Pre_options::Pre_options): New constructor.
12366
12367 2009-08-24  Cary Coutant  <ccoutant@google.com>
12368
12369         * options.h (General_options::no_keep_memory): Remove incorrect
12370         short option.
12371
12372 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12373
12374         * Makefile.am (am__skiplex, am__skipyacc): New.
12375         * Makefile.in: Regenerate.
12376
12377 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12378
12379         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12380         (INCLUDES): ... this.
12381         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12382         (AM_CPPFLAGS): Renamed from ...
12383         (INCLUDE): ... this.
12384         * Makefile.in, testsuite/Makefile.in: Regenerate.
12385
12386         * Makefile.in: Regenerate.
12387         * aclocal.m4: Likewise.
12388         * config.in: Likewise.
12389         * configure: Likewise.
12390         * testsuite/Makefile.in: Likewise.
12391
12392         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12393         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12394         * Makefile.in: Regenerate.
12395         * testsuite/Makefile.in: Regenerate.
12396
12397 2009-08-19  Cary Coutant  <ccoutant@google.com>
12398
12399         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12400         symbols in shared libraries overridden by hidden or internal symbols
12401         in the main program.
12402
12403 2009-08-19  Chris Demetriou  <cgd@google.com>
12404
12405         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12406         checking source file names in error messages.
12407
12408 2009-08-18  Doug Kwan  <dougkwan@google.com>
12409
12410         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12411         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12412         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12413         an elfcpp::Ehdr as parameter.
12414         * object.cc (Object::set_target): Remove the version that looks up
12415         a target and sets it.
12416         (Sized_relobj::setup): Take a Target object instead of
12417         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12418         (make_elf_sized_object): Find target and ask target to
12419         make an ELF object.
12420         * object.h: (Object::set_target): Remove the version that looks up
12421         a target and sets it.
12422         (Sized_relobj::setup): Take a Target object instead of
12423         an elfcpp:Ehdr as parameter.
12424         * target.cc: Include dynobj.h.
12425         (Target::do_make_elf_object_implementation): New.
12426         (Target::do_make_elf_object): New.
12427         * target.h (Target::make_elf_object): New template declaration.
12428         (Target::do_make_elf_object): New method declarations.
12429         (Target::do_make_elf_object_implementation): New template declaration.
12430
12431 2009-08-14  Ian Lance Taylor  <iant@google.com>
12432
12433         * gold.h (FUNCTION_NAME): Define.
12434         (gold_unreachable): Use FUNCTION_NAME.
12435
12436 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12437
12438         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12439         symbol in the --keep-unique list is not found.
12440
12441 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12442
12443         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12444         been maked as --keep-unique.
12445         (Icf::unfold_section): New function.
12446         * icf.h (Icf::unfold_section): New function.
12447         * options.h (General_options::keep_unique): New option.
12448         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12449         * testsuite/Makefile.in: Regenerate.
12450         * testsuite/icf_keep_unique_test.sh: New file.
12451         * testsuite/icf_keep_unique_test.cc: New file.
12452
12453 2009-08-12  Cary Coutant  <ccoutant@google.com>
12454
12455         PR 10471
12456         * resolve.cc (Symbol_table::resolve): Check for references from
12457         dynamic objects to hidden and internal symbols.
12458         * testsuite/Makefile.am (hidden_test.sh): New test.
12459         * testsuite/Makefile.in: Regenerate.
12460         * testsuite/hidden_test.sh: New script.
12461         * testsuite/hidden_test_1.c: New test source.
12462         * testsuite/hidden_test_main.c: New test source.
12463
12464 2009-08-11  Doug Kwan  <dougkwan@google.com>
12465
12466         * arm.cc: Update comments.
12467         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12468         segment to locate the .ARM.exidx section if present.
12469
12470 2009-08-09  Doug Kwan  <dougkwan@google.com>
12471
12472         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12473         patch.
12474
12475 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12476         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12477         compiler warnings.
12478
12479 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12480
12481         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12482         valid tls_segment only for non-debug-section relocations.
12483         * testsuite/Makefile.am: Add gc_tls_test.
12484         * testsuite/Makefile.in: Regenerate.
12485         * testsuite/gc_tls_test.cc: New file.
12486         * testsuite/gc_tls_test.sh: New file.
12487
12488 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12489
12490         * icf.cc: New file.
12491         * icf.h: New file.
12492         * Makefile.am (CCFILES): Add icf.cc.
12493         (HFILES): Add icf.h
12494         * Makefile.in: Regenerate.
12495         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12496         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12497         section, symbol and addend information for the relocs.
12498         * gold.cc (queue_middle_tasks): Call identical code folding.
12499         * gold.h: Add defines for multimap.
12500         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12501         to the call of finalize_local_symbols.
12502         * main.cc (main): Create object of class Icf.
12503         * object.cc (Sized_relobj::do_layout): Allow this function to be
12504         called twice during icf.
12505         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12506         to sections marked as identical by icf.
12507         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12508         when available.
12509         (Sized_relobj::do_section_entsize): New function.
12510         * object.h (Object::section_entsize): New function.
12511         (Object::do_section_entsize): New pure virtual function.
12512         (Relobj::finalize_local_symbols): Add new parameter.
12513         (Relobj::do_section_entsize): New function.
12514         * options.h (General_options::icf): New option.
12515         (General_options::icf_iterations): New option.
12516         (General_options::print_icf_sections): New option.
12517         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12518         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12519         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12520         icf.
12521         * symtab.cc (Symbol_table::is_section_folded): New function.
12522         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12523         to sections marked as identical by icf.
12524         * symtab.h (Symbol_table::set_icf): New function.
12525         (Symbol_table::icf): New function.
12526         (Symbol_table::is_section_folded): New function.
12527         (Symbol_table::icf_): New data member.
12528         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12529         * testsuite/Makefile.am: Add commands to build icf_test.
12530         * testsuite/Makefile.in: Regenerate.
12531         * testsuite/icf_test.sh: New file.
12532         * testsuite/icf_test.cc: New file.
12533
12534 2009-07-24  Chris Demetriou  <cgd@google.com>
12535
12536         * layout.cc (is_compressible_debug_section): Fix incorrect
12537         comment about compressed section names.
12538
12539 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12540
12541         PR 10419
12542         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12543
12544 2009-07-16  Ian Lance Taylor  <iant@google.com>
12545
12546         PR 10400
12547         * layout.h: #include <map>.
12548         (class Kept_section): Change from struct to class.  Add accessors
12549         and setters.  Add section size to Comdat_group mapping.  Change
12550         Comdat_group to std::map.  Add is_comdat_ field.  Add
12551         linkonce_size field in union.
12552         (class Layout): Update declaration of find_or_add_kept_section.
12553         Don't declare find_kept_object.
12554         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12555         parameter.  Add object, shndx, is_comdat, and is_group_name
12556         parameters.  Change all callers.  Adjust for new Kept_section.
12557         (Layout::find_kept_object): Remove.
12558         * object.cc (Sized_relobj::include_section_group): Update use of
12559         Kept_section.  Rename secnum to shndx.  Only record
12560         Kept_comdat_section if sections are the same size.
12561         (Sized_relobj::include_linkonce_section): Update use of
12562         Kept_section.  Only record Kept_comdat_section if sections are the
12563         same size.  Set size of linkonce section.
12564         (Sized_relobj::map_to_kept_section): Update call to
12565         get_kept_comdat_section.
12566         * object.h (class Sized_relobj): Rename fields in
12567         Kept_comdat_section to drop trailing underscores; change object
12568         field to Relobj*.  Change Kept_comdat_section_table to store
12569         struct rather than pointer.
12570         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12571         Add kept_object and kept_shndx parameters.  Change all callers.
12572         (Sized_relobj::get_kept_comdat_section): Change return type to
12573         bool.  Add kept_object and kept_shndx parameters.  Change all
12574         callers.
12575         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12576         Layout::find_or_add_kept_section.
12577
12578 2009-07-09  Ian Lance Taylor  <iant@google.com>
12579
12580         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12581         Reserve space in the hash table.
12582
12583 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12584
12585         * fileread.cc (File_read::get_mtime): New method.
12586         * fileread.h (Timespec): New structure.
12587         (File_read::get_mtime): New method.
12588         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12589         Renamed from timestamp_nsec.
12590         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12591         Elf_Xword.
12592         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12593         timestamp_nsec.
12594         (Incremental_inputs::report_archive): Save mtime; style fix.
12595         (Incremental_inputs::report_obejct): Save mtime; style fix.
12596         (Incremental_inputs::report_script): Save mtime; style fix.
12597         (Incremental_inputs::finalize_inputs): Style fix.
12598         (Incremental_inputs::finalize): Style fix.
12599         (Incremental_inputs::create_input_section_data): Store inputs
12600         mtime.
12601         * incremental.h (Incremental_inputs::report_script): Add mtime
12602         argument.
12603         (Incremental_inputs::Input_info::Input_info): Intialize only one
12604         union member.
12605         (Incremental_inputs::Input_info::archive): Move to nameless
12606         union.
12607         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12608         (Incremental_inputs::Input_info::script): Move to nameless union.
12609         (Incremental_inputs::mtime): New field.
12610         * script.cc (read_input_script): Pass file mtime to
12611         Incremental_input.
12612         * script.h (Script_info::inputs): Style fix.
12613
12614 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12615
12616         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12617         instead of 32.
12618
12619 2009-06-24  Ian Lance Taylor  <iant@google.com>
12620
12621         PR 10156
12622         * layout.cc (Layout::choose_output_section): If we find an
12623         existing section, update the flags.
12624         (Layout::create_notes): New function, broken out of
12625         Layout::finalize.
12626         (Layout::finalize): Don't create note sections.
12627         (Layout::create_note): Don't crash if linker script discards
12628         section.
12629         (Layout::create_gold_note): Likewise.
12630         (Layout::create_build_id): Likewise.  Don't set
12631         after_input_sections on the section.
12632         (Layout::create_executable_stack_info): Remove target parameter.
12633         Change caller.
12634         * layout.h (class Layout): Declare create_notes.  Update
12635         declaration of create_executable_stack_info.
12636         * gold.cc (queue_middle_tasks): Call create_notes.
12637         * output.cc (Output_section::update_flags_for_input_section): Move
12638         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12639         invalid.
12640         * output.h (Output_data::mark_address_invalid): New function.
12641         (class Output_section): Only declare, not define,
12642         update_flags_for_input_section.  Remove set_flags.
12643
12644 2009-06-24  Ian Lance Taylor  <iant@google.com>
12645
12646         * script-sections.cc (Output_section_definition::
12647         set_section_addresses): Rename shadowing local load_address to
12648         laddr.
12649
12650 2009-06-24  Ian Lance Taylor  <iant@google.com>
12651
12652         PR 10244
12653         * reloc.cc (relocate_sections): Skip empty relocation sections.
12654
12655 2009-06-23  Ian Lance Taylor  <iant@google.com>
12656
12657         PR 10156
12658         * layout.cc (Layout::create_note): Use choose_output_section
12659         rather than make_output_section.
12660
12661 2009-06-23  Ian Lance Taylor  <iant@google.com>
12662
12663         PR 10237
12664         * options.cc (General_options::parse_V): Set printed_version_.
12665         (General_options::General_options): Initialize printed_version_.
12666         * options.h (class General_options): Add printed_version_ field.
12667         * gold.cc (queue_initial_tasks): If there are no input files,
12668         don't give a fatal error if we printed the version information.
12669         (queue_middle_tasks): If using -r with a shared object, give a
12670         fatal error rather than an ordinary error.
12671
12672 2009-06-23  Ian Lance Taylor  <iant@google.com>
12673
12674         PR 10219
12675         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12676         (Layout::make_output_section): Set have_stabstr_section_ if we see
12677         a .stab*str section.
12678         (Layout::finalize): Call link_stabs_sections.
12679         (Layout::link_stabs_sections): New file.
12680         * layout.h (class Layout): Add have_stabstr_section_ field.
12681         Declare link_stabs_sections.
12682
12683 2009-06-23  Doug Kwan  <dougkwan@google.com>
12684
12685         * Makefile.am (libgold_a_LIBADD): New.
12686         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12687         * Makefile.in: Regenerate.
12688         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12689         * configure: Regenerate.
12690         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12691         * fileread.cc: Include sys/state.h
12692         * gold.h: Declare memmem and strndup if found missing.
12693         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12694
12695 2009-06-23  Ian Lance Taylor  <iant@google.com>
12696
12697         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12698         * configure: Rebuild.
12699
12700 2009-06-23  Ian Lance Taylor  <iant@google.com>
12701
12702         PR 10147
12703         * object.cc (Object::section_contents): Don't try to get a view if
12704         the section has length zero.
12705         (Object::handle_gnu_warning_section): If the section is empty, use
12706         the name of the section as the warning.
12707
12708 2009-06-23  Ian Lance Taylor  <iant@google.com>
12709
12710         PR 10133
12711         * stringpool.h (class Stringpool_template): Add optimize_ field.
12712         (Stringpool_template::set_optimize): New function.
12713         * stringpool.cc (Stringpool_template::Stringpool_template):
12714         Initialize optimize_ field.
12715         (Stringpool_template::set_string_offsets): Test local optimize
12716         fild rather than parameter.
12717         * layout.cc (Layout::Layout): Call set_optimize on the section
12718         name stringpool.
12719
12720 2009-06-22  Ian Lance Taylor  <iant@google.com>
12721
12722         PR 10030
12723         * yyscript.y: Parse TARGET.
12724         * script.cc (script_set_target): New function.
12725         * script-c.h (script_set_target): Declare.
12726         * options.cc (General_options::string_to_object_format): Rename
12727         from string_to_object_format in anonymous namespace.  Change
12728         callers.
12729         * options.h (class General_options): Declare
12730         string_to_object_format.
12731
12732 2009-06-22  Ian Lance Taylor  <iant@google.com>
12733
12734         * script-sections.cc (Script_sections::create_segments): Don't put
12735         program headers in a PT_LOAD segment if -n or -N.
12736
12737 2009-06-22  Ian Lance Taylor  <iant@google.com>
12738
12739         PR 10141
12740         * options.h (class General_options): Add -z lazy and -z now.  Sort
12741         -z options into alphabetical order.
12742         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12743
12744 2009-06-21  Ian Lance Taylor  <iant@google.com>
12745
12746         * layout.cc (Layout::make_output_section): Call
12747         Target::new_output_section.
12748         (Layout::attach_allocated_section_to_segment): Put large section
12749         sections in a separate load segment with the large segment flag
12750         set.
12751         (Layout::segment_precedes): Sort large data segments after other
12752         load segments.
12753         (align_file_offset): New static function.
12754         (Layout::set_segment_offsets): Use align_file_offset.
12755         * output.h (class Output_section): Add is_small_section_ and
12756         is_large_section_ fields.
12757         (Output_section::is_small_section): New function.
12758         (Output_section::set_is_small_section):  New function.
12759         (Output_section::is_large_section): New function.
12760         (Output_section::set_is_large_section): New function.
12761         (Output_section::is_large_data_section): New function.
12762         (class Output_segment): Add is_large_data_segment_ field.
12763         (Output_segment::is_large_data_segment): New function.
12764         (Output_segment::set_is_large_data_segment): New function.
12765         * output.cc (Output_section::Output_section): Initialize new
12766         fields.
12767         (Output_segment::Output_segment): Likewise.
12768         (Output_segment::add_output_section): Add assertion that large
12769         data sections always go in large data segments.  Force small data
12770         sections to the end of the list of data sections.  Force small BSS
12771         sections to the start of the list of BSS sections.  For large BSS
12772         sections to the end of the list of BSS sections.
12773         * symtab.h (class Symbol): Declare is_common_shndx.
12774         (Symbol::is_defined): Check Symbol::is_common_shndx.
12775         (Symbol::is_common): Likewise.
12776         (class Symbol_table): Define enum Commons_section_type.  Update
12777         declarations.  Add small_commons_ and large_commons_ fields.
12778         * symtab.cc (Symbol::is_common_shndx): New function.
12779         (Symbol_table::Symbol_table): Initialize new fields.
12780         (Symbol_table::add_from_object): Put small and large common
12781         symbols in the right list.
12782         (Symbol_table::sized_finalized_symbol): Check
12783         Symbol::is_common_shndx.
12784         (Symbol_table::sized_write_globals): Likewise.
12785         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12786         common symbol lists.  Don't call do_allocate_commons_list if the
12787         list is empty.
12788         (Symbol_table::do_allocate_commons_list): Remove is_tls
12789         parameter.  Add comons_section_type parameter.  Change all
12790         callers.  Handle small and large common symbols.
12791         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12792         Symbol::is_common_shndx.
12793         * resolve.cc (symbol_to_bits): Likewise.
12794         * target.h (Target::small_common_shndx): New function.
12795         (Target::small_common_section_flags): New function.
12796         (Target::large_common_shndx): New function.
12797         (Target::large_common_section_flags): New function.
12798         (Target::new_output_section): New function.
12799         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12800         small_common_section_flags, and large_common_section_flags
12801         fields.
12802         (Target::do_new_output_section): New virtual function.
12803         * arm.cc (Target_arm::arm_info): Initialize new fields.
12804         * i386.cc (Target_i386::i386_info): Likewise.
12805         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12806         Likewise.
12807         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12808         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12809         (Target_x86_64::do_new_output_section): New function.
12810         * configure.ac: Define conditional MCMODEL_MEDIUM.
12811         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12812         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12813         (large_LDFLAGS): Define.
12814         * testsuite/large.c: New file.
12815         * testsuite/testfile.cc (Target_test::test_target_info):
12816         Initialize new fields.
12817         * configure, testsuite/Makefile.in: Rebuild.
12818
12819 2009-06-05  Doug Kwan  <dougkwan@google.com>
12820
12821         * Makefile.am (CCFILES): Add target.cc.
12822         * Makefile.in: Regenerate.
12823         * i386.cc (class Target_i386): Define new virtual method to
12824         override do_is_local_label_name in parent.
12825         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12826         local symbols if --discard-locals or -X is given.
12827         * options.h (class General_options): Declare new options
12828         '--discard-locals' and '-X' for discarding locals.
12829         * target.h (class Target): Define new methods is_local_label_name.
12830         Declare new virtual method do_is_local_label_name.
12831         * target.cc: New file.
12832         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12833         (check_SCRIPTS): Add discard_locals_test.sh.
12834         (check_DATA): Add discard_local_tests.syms.
12835         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12836         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12837         * testsuite/Makefile.in: Regenerate.
12838         * testsuite/discard_locals_test.c: New file.
12839         * testsuite/discard_locals_test.sh: Same.
12840
12841 2009-06-05  Doug Kwan  <dougkwan@google.com>
12842
12843         * object.cc (Sized_relobj::Sized_relobj): Initialize
12844         discarded_eh_frame_shndx_ to -1U.
12845         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12846         section.
12847         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12848         a discarded .eh_frame section.
12849         (Sized_relobj::do_finalize_local_symbols): Ditto.
12850         * object.h (class Sized_relobj): Declare new member
12851         discarded_eh_frame_shndx_.
12852         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12853         (local_labels_test.o, local_labels_test): New rules.
12854         * testsuite/Makefile.in: Regenerate.
12855
12856 2009-06-04  Doug Kwan  <dougkwan@google.com>
12857
12858         * layout.cc (Layout::section_name_mapping): Add mapping for
12859         special ARM sections.
12860
12861 2009-06-03  Doug Kwan  <dougkwan@google.com>
12862
12863         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12864         (utils::has_overflow): Same.
12865
12866 2009-06-03  Ian Lance Taylor  <iant@google.com>
12867
12868         * layout.cc (Layout::section_name_mapping): New array, replacing
12869         Layout::linkonce_mapping.
12870         (Layout::section_name_mapping_count): New variable, replacing
12871         Layout::linkonce_mapping_count.
12872         (Layout::linkonce_output_name): Remove.
12873         (Layout::output_section_name): Rewrite.
12874         * layout.h (class Layout): Rename Linkonce_mapping to
12875         Section_name_mapping, linkonce_mapping to section_name_mapping,
12876         linkonce_mapping_count to section_name_mapping_count.  Don't
12877         declare linkonce_output_name.
12878
12879 2009-06-03  Doug Kwan  <dougkwan@google.com>
12880
12881         * gold/arm.cc (namespace utils): New.
12882         (Target_arm::reloc_is_non_pic): Define new method.
12883         (class Arm_relocate_functions): New.
12884         (Target_arm::Relocate::relocate): Handle relocation types used by
12885         Android.
12886
12887 2009-06-03  Ian Lance Taylor  <iant@google.com>
12888
12889         * arm.cc (Target_arm::scan::global): Use || instead of |.
12890
12891 2009-06-02  Doug Kwan  <dougkwan@google.com>
12892
12893         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12894         issued_non_pic_error_.
12895         (class Target_arm::Scan): Declare new method check_non_pic.
12896         Define new method symbol_needs_plt_entry.
12897         Declare new data member issued_non_pic_error_.
12898         (class Target_arm::Relocate): Declare new method
12899         should_apply_static_reloc.
12900         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12901         (Target_arm::Scan::check_non_pic): Define new method.
12902         (Target_arm::Scan::local): Handle a small subset of reloc types used
12903         by Android.
12904         (Target_arm::Scan::local): Same.
12905         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12906
12907 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12908
12909         * incremental.cc (Incremental_inputs::report_command_line): Filter
12910         out --incremental-* options.
12911
12912 2009-05-29  Doug Kwan  <dougkwan@google.com>
12913
12914         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12915         template class.
12916         (class Target_arm): Update comment.
12917         (Target_arm::Target_arm): Initialize new data members GOT_,
12918         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12919         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12920         and Target_arm::rel_dyn_section.
12921         Declare new_enum Target_arm::Got_type.
12922         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12923         and DYNBSS_.
12924         Update commments for member do_dynsym_value.
12925         (Target_arm::got_size, Target_arm::plt_section,
12926         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12927         new methods inside class defintion.
12928         (Target_arm::got_section): Define new method.
12929         (Target_arm::rel_dyn_section): Same.
12930         (Output_data_plt_arm): New template class.
12931         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12932         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12933         (Output_data_plt_arm::add_entry): Same.
12934         (Output_data_plt_arm::first_plt_entry): Define new
12935         static data member for PLT instruction template.
12936         (Output_data_plt_arm::plt_entry): Same.
12937         (Output_data_plt_arm::do_write): Define new method.
12938         (Target_arm::make_plt_entry): Same.
12939         (Target_arm::do_finalize_sections): Same.
12940         (Target_arm::do_dynsym_value): Same.
12941
12942 2009-05-28  Doug Kwan  <dougkwan@google.com>
12943
12944         * Makefile.am (TARGETSOURCES): Add arm.cc.
12945         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12946         * Makefile.in: Regenerate.
12947         * arm.cc: New file.
12948         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12949
12950 2009-05-26  Doug Kwan  <dougkwan@google.com>
12951
12952         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12953         (General_options::check_excluded_libs): Strip off directories in
12954         archive name before matching like GNU ld does.
12955         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12956         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12957         (exclude_libs_test_LDFLAGS): Add linker option
12958         -Wl,--exclude-libs,libexclude_libs_test_3
12959         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12960         an explicit archive without using -l.
12961         (alt/libexclude_libs_test_3.a): New make rule.
12962         * testsuite/Makefile.in: Regenerate.
12963         * testsuite/exclude_libs_test.c : Declare lib3_default().
12964         (main): Call it.
12965         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12966         * exclude_libs_test_3.c: New file.
12967
12968 2009-05-26  Nick Clifton  <nickc@redhat.com>
12969
12970         * po/id.po: New Indonesian translation.
12971         * po/gold.pot: Updated template file.
12972
12973 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12974
12975         * testsuite/Makefile.am: Add -ffunction-sections to compile
12976         gc_comdat_test files.  Add -Wl,--gc-sections to build
12977         gc_comdat_test.
12978         * testsuite/Makefile.in: Regenerate.
12979         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12980
12981 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12982
12983         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12984         kept comdat section was garbage collected.
12985         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12986         * testsuite/Makefile.in: Regenerate.
12987         * testsuite/gc_comdat_test.sh: New file.
12988         * testsuite/gc_comdat_test_1.cc: New file.
12989         * testsuite/gc_comdat_test_2.cc: New file.
12990
12991 2009-05-19  Doug Kwan  <dougkwan@google.com>
12992
12993         * archive.cc (Archive::Archive): Move constructor from archive.h
12994         to here.  Initialize no_export_.
12995         (Archive::get_elf_object_for_member): Set no_export flag of object.
12996         * archive.h (Archive::Archive): Move constructor body to
12997         archive.cc.
12998         (Archive::no_export): New method.
12999         (Archive::no_export_): New field.
13000         * object.h (Object::Object): Initialize no_export_ to false.
13001         (Object::no_export, Object::set_no_export): New methods.
13002         (Object::no_export_): New field.
13003         * options.cc (General_options::parse_exclude_libs): New method.
13004         (General_options::check_excluded_libs) Same.
13005         * options.h (exclude_libs): New option.
13006         (General_options::check_excluded_libs): New method declaration.
13007         (General_options::excluded_libs_): New field.
13008         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13009         default or protected visibility if an object has no-export flag set.
13010         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13011         (check_SCRIPTS): Add exclude_libs_test.sh.
13012         (check_DATA): Add exclude_libs_test.syms.
13013         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13014         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13015         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13016         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13017         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13018         libexclude_libs_test_2.a): New rules.
13019         * testsuite/Makefile.in: Regenerate.
13020         * testsuite/exclude_libs_test.c: New file.
13021         * testsuite/exclude_libs_test.sh: Ditto.
13022         * testsuite/exclude_libs_test_1.c: Ditto.
13023         * testsuite/exclude_libs_test_2.c: Ditto.
13024
13025 2009-05-15  Ian Lance Taylor  <iant@google.com>
13026
13027         * configure.ac: Check for declarations for cases where libiberty.h
13028         checks HAVE_DECL_xxx.
13029         * configure, config.in: Rebuild.
13030
13031 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13032
13033         * gold.h (Incremental_argument_list): Remove (invalid) forward
13034         declaration.
13035         * incremental.cc (Incremental_inputs::report_achive): New method.
13036         (Incremental_inputs::report_object): New method.
13037         (Incremental_inputs::report_script): New method.
13038         (Incremental_inputs::finalize_inputs): New method.
13039         (Incremental_inputs::finalize): Call finalize_inputs().
13040         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13041         Create inputs entries.
13042         * incremental.h (Incremental_input_type): New enum.
13043         (Incremental_inputs::Incremental_input): Initialize new fields.
13044         (Incremental_inputs::report_inputs): New method.
13045         (Incremental_inputs::report_achive): New method.
13046         (Incremental_inputs::report_object): New method.
13047         (Incremental_inputs::report_script): New method.
13048         (Incremental_inputs::finalize_inputs): New method.
13049         (Incremental_inputs::Input_info): New struct.
13050         (Incremental_inputs::Input_info_map): New typedef.
13051         (Incremental_inputs::lock_): New field.
13052         (Incremental_inputs::Inputs_): New field.
13053         (Incremental_inputs::Inputs_map): New field.
13054         * main.cc (main): Call Incremental_input::report_inputs.
13055         * options.h (Input_argument_list): Typedef moved from
13056         Input_arguments.
13057         (Input_file_group::Files): Remove, use ::Input_argument_list.
13058         (Input_file_group::Input_argument_list): Remove, use
13059         ::Input_argument_list.
13060         * plugin.cc (Plugin_manager::add_input_file): Add error in
13061         incremental build.
13062         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13063         functions.
13064         * script.cc (read_input_script): Call
13065         Incremental_input::report_script.
13066         * script.h (Script_info): New class.
13067
13068 2009-04-27  Ian Lance Taylor  <iant@google.com>
13069
13070         * x86_64.cc (do_adjust_output_section): Set entsize to
13071         plt_entry_size.
13072
13073 2009-04-23  Elliott Hughes  <enh@google.com>
13074
13075         * output.cc (Output_file::close): After short writes, continue
13076         writing from the correct offset in the buffer being written.
13077
13078 2009-04-23  Chris Demetriou  <cgd@google.com>
13079
13080         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13081         * configure: Regenerate.
13082         * config.in: Regenerate.
13083         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13084         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13085
13086 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13087
13088         * incremental.cc (Incremental_inputs_header_data): Renamed from
13089         Incremental_input_header_data.
13090         (Incremental_inputs_header_data::data_size): New field.
13091         (Incremental_inputs_header_data::put_input_file_count): Renamed
13092         from input_file_count.
13093         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13094         from command_line_offset.
13095         (Incremental_inputs_header_data::put_reserved): Renamed from
13096         put_reserved.
13097         (Incremental_inputs_entry_data): Renamed from
13098         Incremental_input_entry_data.
13099         (Incremental_inputs_entry_data::data_size): New field.
13100         (Incremental_inputs::report_command_line): New method.
13101         (Incremental_inputs::finalize): New method.
13102         (Incremental_inputs::create_incremental_inputs_data): New method.
13103         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13104         * incremental.h: New file.
13105         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13106         (Layout::finalize): Create incremental inputs section in
13107         incremental builds.
13108         (Layout::create_incremental_info_sections): New method.
13109         * layout.h (Layout::incremental_inputs): New method.
13110         (Layout::create_incremental_info_sections): New method.
13111         (Layout::incremental_inputs_): New field.
13112         * main.cc (main): Notify Incremental_input of the command line.
13113
13114 2009-04-01  Ian Lance Taylor  <iant@google.com>
13115             Mikolaj Zalewski  <mikolajz@google.com>
13116
13117         * gold.h (reserve_unordered_map): Define, three versions, one for
13118         each version of Unordered_map.
13119         * layout.cc (Layout::Layout): Remove options parameter.  Add
13120         number_of_input_files parameter.  Don't initialize options_.
13121         Initialize number_of_input_files_ and resized_signatures_.  Move
13122         sections_are_attached_.
13123         (Layout::layout_group): Reserve space for group_signatures_.
13124         (Layout::find_or_add_kept_section): Change name parameter to be a
13125         reference.  Resize signatures_ map when it gets large enough.
13126         (Layout::layout_eh_frame): Use parameters->options() instead of
13127         this->options_.
13128         (Layout::make_output_section): Likewise.
13129         (Layout::attach_allocated_section_to_segment): Likewise.
13130         (Layout::finalize, Layout::create_executable_stack): Likewise.
13131         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13132         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13133         * layout.h (class Layout): Update declarations.  Remove options_
13134         field.  Add number_of_input_files_ and resized_signatures_
13135         fields.  Move sections_are_attached_ field.
13136         * main.cc (main): Pass number of input files to Layout
13137         constructor.  Don't pass options.
13138
13139 2009-03-30  Ian Lance Taylor  <iant@google.com>
13140
13141         * ffsll.c (ffsll): Correct implementation.
13142
13143 2009-03-27  Ian Lance Taylor  <iant@google.com>
13144
13145         * ffsll.c: New file.
13146         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13147         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13148         * ftruncate.c (ftruncate): Declare before definition.
13149         * mremap.c (mremap): Likewise.
13150         * pread.c (pread): Likewise.
13151         * configure, Makefile.in, config.in: Rebuild.
13152
13153         * mremap.c: New file.
13154         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13155         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13156         (mremap): Declare if HAVE_MREMAP is not defined.
13157         * configure, Makefile.in, config.in: Rebuild.
13158
13159 2009-03-27  Cary Coutant  <ccoutant@google.com>
13160
13161         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13162         position independent.
13163         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13164         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13165
13166 2009-03-24  Cary Coutant  <ccoutant@google.com>
13167
13168         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13169         an executable.
13170         (needs_dynamic_reloc): Likewise.
13171
13172 2009-03-24  Ian Lance Taylor  <iant@google.com>
13173
13174         * yyscript.y (file_cmd): Recognize EXTERN.
13175         (extern_name_list, extern_name_list_body): New nonterminals.
13176         * script.cc (script_add_extern): Define.
13177         * script-c.h (script_add_extern): Declare.
13178
13179 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13180
13181         * object.cc (is_elf_object): Define.
13182         * object.h (is_elf_object): Declare.
13183         * archive.cc (Archive::get_elf_object_for_member): Call
13184         is_elf_object.
13185         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13186
13187 2009-03-24  Elliott Hughes  <enh@google.com>
13188
13189         * output.cc (Output_file::map_anonymous): Define.
13190         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13191         try an anonymous one.  Report the size if the mmap fails.
13192         * output.h (class Output_file): Declare map_anonymous.
13193
13194 2009-03-24  Ian Lance Taylor  <iant@google.com>
13195
13196         * target-select.cc (instantiate_target): Don't acquire the lock if
13197         the instantiated_target_ field has already been set.
13198
13199 2009-03-23  Ian Lance Taylor  <iant@google.com>
13200
13201         * gold-threads.h (class Initialize_lock): Define.
13202         * gold-threads.cc (class Initialize_lock_once): Define.
13203         (initialize_lock_control): New static variable.
13204         (initialize_lock_pointer): New static variable.
13205         (initialize_lock_once): New static function.
13206         (Initialize_lock::Initialize_lock): Define.
13207         (Initialize_lock::initialize): Define.
13208         * target-select.h: Include "gold-threads.h".
13209         (class Target_selector): Add lock_ and initialize_lock_ fields.
13210         Don't define instantiate_target, just declare it.
13211         * target-select.cc (Target_selector::Target_selector): Initialize
13212         new fields.
13213         (Target_selector::instantiate_target): Define.
13214         * descriptors.h: Include "gold-threads.h".
13215         (class Descriptors): Add initialize_lock_ field.
13216         * descriptors.cc (Descriptors::Descriptors): Initialize new
13217         field.
13218         (Descriptors::open): Use initialize_lock_ field
13219         * errors.h (class Errors): Add initialize_lock_ field.
13220         * errors.cc (Errors::Errors): Initialize new field.
13221         (Errors::initialize_lock): Use initialize_lock_ field.
13222         * powerpc.cc (class Target_selector_powerpc): Remove
13223         instantiated_target_ field.  In do_recognize call
13224         instantiate_target rather than do_instantiate_target.  In
13225         do_instantiate_target just allocate a new target.
13226         * sparc.cc (class Target_selector_sparc): Likewise.
13227
13228         * freebsd.h: New file.
13229         * i386.cc: Include "freebsd.h".
13230         (Target_i386): Derive from Target_freebsd rather than
13231         Sized_target.
13232         (Target_selector_i386): Derive from Target_selector_freebsd rather
13233         than Target_selector.
13234         * x86_64.cc: Include "freebsd.h".
13235         (Target_x86_64): Derive from Target_freebsd rather than
13236         Sized_target.
13237         (Target_selector_x86_64): Derive from Target_selector_freebsd
13238         rather than Target_selector.
13239         * target.h (class Target): Add adjust_elf_header and
13240         do_adjust_elf_header.
13241         * output.cc (Output_file_header:: do_sized_write): Call target
13242         adjust_elf_header routine.
13243         * configure.tgt: Set targ_osabi.
13244         * configure.ac: Define GOLD_DEFAULT_OSABI.
13245         * parameters.cc (Parameters::default_target): Pass
13246         GOLD_DEFAULT_OSABI to select_target.
13247         * target-select.h (class Target_selector): Make instantiate_target
13248         protected rather than private.
13249         * Makefile.am (HFILES): Add freebsd.h.
13250         * configure, Makefile.in, config.in: Rebuild.
13251
13252         * merge.cc (do_add_input_section): Correct pend value.  Change
13253         message about last entry not being null terminated from error to
13254         warning.
13255
13256 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13257
13258         * incremental.cc: New file.
13259         * Makefile.am (CCFILES): Add incremental.cc.
13260         * Makefile.in: Rebuild.
13261
13262 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13263
13264         * layout.cc (Layout::output_section_name): Preserve names
13265         of '.note.' sections.
13266
13267 2009-03-19  Ian Lance Taylor  <iant@google.com>
13268
13269         * descriptors.cc (Descriptors::open): Check that the options are
13270         valid before using them.
13271
13272 2009-03-18  Ian Lance Taylor  <iant@google.com>
13273
13274         * script-sections.h: Include <list>.
13275         (class Script_sections): Change Sections_elements from std::vector
13276         to std::list.  Typedef public Elements_iterator.  Add
13277         orphan_section_placement_, data_segment_align_start_, and
13278         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13279         field.
13280         * script-sections.cc (class Orphan_section_placement): New class.
13281         (class Sections_element): Add virtual functions is_relro and
13282         orphan_section_init.  Remove virtual function place_orphan_here.
13283         (class Output_section_definition): Add is_relro and
13284         orphan_section_init.  Remove place_orphan_here.
13285         (class Orphan_output_section): Likewise.
13286         (Script_sections::Script_sections): Update for field changes.
13287         (Script_sections::data_segment_align): Set saw_data_segment_align_
13288         and data_segment_align_start_, not data_segment_align_index.
13289         (Script_sections::data_segment_relro_end): Check
13290         saw_data_segment_align_.  Use data_segment_align_start_ rather
13291         than data_segment_align_index_.
13292         (Script_sections::place_orphan): Rewrite to use
13293         Orphan_section_placement.
13294
13295 2009-03-17  Ian Lance Taylor  <iant@google.com>
13296
13297         * archive.cc (Archive::add_symbols): Check for a version attached
13298         to the symbol name in the archive map.
13299         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13300         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13301         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13302         (ver_test_11.a): New target.
13303         * testsuite/Makefile.in: Rebuild.
13304
13305         * configure.ac: Check for chsize and posix_fallocate.  Replace
13306         ftruncate.
13307         * ftruncate.c: New file, from gnulib.
13308         * output.cc (posix_fallocate): Define dummy version if not
13309         HAVE_POSIX_FALLOCATE.
13310         (Output_file::map): Call posix_fallocate rather than lseek and
13311         write.
13312         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13313         * configure, Makefile.in, config.in: Rebuild.
13314
13315 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13316
13317         * layout.h (Layout::create_note): Add section_name parameter.
13318         * layout.cc (Layout::create_note): Likewise.
13319         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13320
13321 2009-03-17  Ian Lance Taylor  <iant@google.com>
13322
13323         * descriptors.cc: Include "options.h".
13324         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13325         (Descriptors::open): Always use O_CLOEXEC when opening a new
13326         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13327         then set FD_CLOEXEC.
13328
13329         * sparc.cc (class Target_sparc): Add has_got_section.
13330         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13331         make sure we have a GOT section.
13332
13333         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13334         (Target_sparc::Scan::local): Likewise.
13335         (Target_sparc::Scan::global): Likewise.
13336         (Target_sparc::Relocate::relocate): Likewise.
13337         (Target_sparc::Relocate::relocate_tls): Likewise.
13338
13339         * symtab.cc (Symbol_table::define_default_version): New function,
13340         broken out of add_from_object.
13341         (Symbol_table::add_from_object): Call define_default_version.
13342         (Symbol_table::define_special_symbol): Add resolve_oldsym
13343         parameter.  Change all callers.  If the version for a symbol comes
13344         from a version script, resolve it with the symbol with the same
13345         name with no version.  Also add the symbol without a version if
13346         appropriate.
13347         (do_define_in_output_data): If resolving with oldsym, don't delete
13348         sym.
13349         (do_define_in_output_segment): Likewise.
13350         (do_define_as_constant): Likewise.
13351         * symtab.h (class Symbol_table): Update declarations.
13352
13353 2009-03-13  Ian Lance Taylor  <iant@google.com>
13354
13355         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13356         (Read_symbols::requeue): New function.
13357         (Read_symbols::do_read_symbols): If make_elf_object fails because
13358         the target type is not configured, and the file was searched for,
13359         issue a warning and retry with the next directory.
13360         (Add_symbols::run): If the file has an incompatible format, and
13361         it was searched for, requeue the Read_symbols task.  On error,
13362         release the object.
13363         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13364         dirindex parameter to constructor.  Change all callers.  Declare
13365         incompatible_warning and requeue.
13366         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13367         input_argument_ and input_group_ fields.  Add them to
13368         constructor.  Change all callers.
13369         (class Read_script): Add dirindex_ field.  Add it to constructor.
13370         Change all callers.
13371         * archive.cc (Archive::setup): Remove input_objects parameter.
13372         Change all callers.
13373         (Archive::get_file_and_offset): Likewise.
13374         (Archive::read_all_symbols): Likewise.
13375         (Archive::read_symbols): Likewise.
13376         (Archive::get_elf_object_for_member): Remove input_objects
13377         parameter.  Add punconfigured parameter.  Change all callers.
13378         (Archive::add_symbols): Change return type to bool.  Check return
13379         value of include_member.
13380         (Archive::include_all_members): Likewise.
13381         (Archive::include_member): Change return type to bool.  Return
13382         false if first included object has incompatible target.  Set
13383         included_member_ field.
13384         (Add_archive_symbols::run): If add_symbols returns false, requeue
13385         Read_symbols task.
13386         * archive.h (class Archive): Add included_member_ field.
13387         Initialize it in constructor.  Add input_file and searched_for
13388         methods.  Update declarations.
13389         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13390         input_argument_ fields.  Add them to constructor.  Change all
13391         callers.
13392         * script.cc: Include "target-select.h".
13393         (class Parser_closure): Add skip_on_incompatible_target_ and
13394         found_incompatible_target_ fields.  Add
13395         skip_on_incompatible_target parameter to constructor.  Change all
13396         callers.  Add methods skip_on_incompatible_target,
13397         clear_skip_on_incompatible_target, found_incompatible_target, and
13398         set_found_incompatible_target.
13399         (read_input_script): Add dirindex parameter.  Change all callers.
13400         If parser finds an incompatible target, requeue Read_symbols
13401         task.
13402         (script_set_symbol): Clear skip_on_incompatible_target in
13403         closure.
13404         (script_add_assertion, script_parse_option): Likewise.
13405         (script_start_sections, script_add_phdr): Likewise.
13406         (script_check_output_format): New function.
13407         * script.h (read_input_script): Update declaration.
13408         * script-c.h (script_check_output_format): Declare.
13409         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13410         (ignore_cmd): Remove OUTPUT_FORMAT.
13411         * fileread.cc (Input_file::Input_file): Add explicit this.
13412         (Input_file::will_search_for): New function.
13413         (Input_file::open): Add pindex parameter.  Change all callers.
13414         * fileread.h (class Input_file): Add input_file_argument method.
13415         Declare will_search_for.  Update declarations.
13416         * object.cc (make_elf_object): Add punconfigured parameter.
13417         Change all callers.
13418         * object.h (class Object): Make input_file public.  Add
13419         searched_for method.
13420         (make_elf_object): Update declaration.
13421         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13422         restart search.
13423         * dirsearch.h (class Dirsearch): Update declaration.
13424         * options.h (class General_options): Add --warn-search-mismatch.
13425         * parameters.cc (Parameters::is_compatible_target): New function.
13426         * parameters.h (class Parameters): Declare is_compatible_target.
13427         * workqueue.cc (Workqueue::add_blocker): New function.
13428         * workqueue.h (class Workqueue): Declare add_blocker.
13429
13430         * fileread.cc (Input_file::open): Remove options parameter.
13431         Change all callers.
13432         (Input_file::open_binary): Likewise.
13433         * script.cc (read_input_script): Likewise.
13434         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13435         options parameter from constructor.  Change all callers.
13436         (class Read_script): Likewise.
13437         * fileread.h (class Input_file): Update declarations.
13438         * script.h (read_input_script): Update declaration.
13439
13440 2009-03-10  Nick Clifton  <nickc@redhat.com>
13441
13442         * po/es.po: New Spanish translation.
13443
13444 2009-03-06  Cary Coutant  <ccoutant@google.com>
13445
13446         * options.cc (parse_short_option): Keep dash_z from registering itself.
13447
13448 2009-03-03  Ian Lance Taylor  <iant@google.com>
13449
13450         PR 9918
13451         * target-reloc.h (relocate_section): Pass output_section to
13452         relocate.
13453         * i386.cc (Target_i386::should_apply_static_reloc): Add
13454         output_section parameter.  Change all callers.
13455         (Target_i386::Relocate::relocate): Add output_section parameter.
13456         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13457         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13458         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13459         * testsuite/two_file_shared.sh: New script.
13460         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13461         (check_DATA): Add two_file_shared.dbg.
13462         (two_file_shared.dbg): New target.
13463         * testsuite/Makefile.in: Rebuild.
13464
13465 2009-03-01  Ian Lance Taylor  <iant@google.com>
13466
13467         * configure.ac: Check for byteswap.h.
13468         * configure: Rebuild.
13469         * config.in: Rebuild.
13470
13471 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13472
13473         * layout.cc (Layout::find_or_add_kept_section): New function.
13474         (Layout::add_comdat): Removed.
13475         * layout.h (struct Kept_section): Move out of class Layout.
13476         Remove trailing underscores from field names.  Add group_sections
13477         field.  Rename group_ field to is_group.  Change all uses.
13478         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13479         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13480         comdat_groups_ field.
13481         (Sized_relobj::include_section_group): Use
13482         find_or_add_kept_section and Kept_section::group_sections.
13483         (Sized_relobj::include_linkonce_section): Likewise.
13484         * object.cc (class Sized_relobj): Don't define Comdat_group or
13485         Comdat_group_table.  Remove find_comdat_group and
13486         add_comdat_group.  Remove comdat_groups_ field.
13487         * plugin.cc (include_comdat_group): Use
13488         Layout::find_or_add_kept_section.
13489
13490 2009-02-28  Ian Lance Taylor  <iant@google.com>
13491
13492         * README: --gc-sections and map files are now supported.  Document
13493         some build requirements.
13494
13495         PR 6992
13496         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13497         relocatable link set the value of the section symbol to zero.
13498         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13499         relocatable link don't include the section address in the local
13500         symbol value.
13501
13502 2009-02-27  Ian Lance Taylor  <iant@google.com>
13503
13504         PR 6811
13505         * options.h (class Search_directory): Add is_system_directory.
13506         (class General_options): Declare is_in_system_directory.
13507         * options.cc (get_relative_sysroot): Make static.
13508         (get_default_sysroot): Make static.
13509         (General_optoins::is_in_system_directory): New function.
13510         * fileread.cc (Input_file::is_in_system_directory): New function.
13511         * fileread.h (class Input_file): Declare is_in_system_directory.
13512         * object.h (class Object): Add is_in_system_directory.
13513         (class Input_objects): Remove system_library_directory_ field.
13514         * object.cc (Input_objects::add_object): Don't set
13515         system_library_directory_.
13516         (input_objects::found_in_system_library_directory): Remove.
13517         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13518         parameter.  Change all callers.
13519         (Symbol_table::sized_write_globals): Likewise.
13520         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13521         Call Object::is_in_system_directory.
13522         * symtab.h (class Symbol_table): Update declarations.
13523
13524         PR 5990
13525         * descriptors.h (Open_descriptor): Add is_on_stack field.
13526         * descriptors.cc (Descriptors::open): If the descriptor is on the
13527         top of the stack, remove it.  Initialize is_on_stack field.
13528         (Descriptors::release): Only add pod to stack if it is not on the
13529         stack already.
13530         (Descriptors::close_some_descriptor): Clear stack_next and
13531         is_on_stack fields.
13532
13533         PR 7091
13534         * output.cc (Output_section::find_starting_output_address): Rename
13535         from starting_output_address; add PADDR parameter; change return
13536         type.
13537         * output.h (class Output_section): Declare
13538         find_starting_output_address instead of starting_output_address.
13539         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13540         section symbol for which we can't find a merge section.
13541
13542         PR 9836
13543         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13544         hidden or internal, force the symbol to be local.
13545         * resolve.cc (Symbol::override_visibility): Define.
13546         (Symbol::override_base): Use override_visibility.
13547         (Symbol_table::resolve): Likewise.
13548         (Symbol::override_base_with_special): Likewise.
13549         (Symbol_table::override_with_special): If the visibility is hidden
13550         or internal, force the symbol to be local.
13551         * symtab.h (class Symbol): Add set_visibility and
13552         override_visibility.
13553         * testsuite/ver_test_1.sh: New file.
13554         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13555         (check_DATA): Add ver_test_1.syms.
13556         (ver_test_1.syms): New target.
13557         * testsuite/Makefile.in: Rebuild.
13558
13559 2009-02-25  Cary Coutant  <ccoutant@google.com>
13560
13561         * layout.cc (Layout::choose_output_section): Don't rename sections
13562         when using a linker script that has a SECTIONS clause.
13563         * Makefile.in: Regenerate.
13564
13565         * testsuite/Makefile.am (script_test_5.sh): New test case.
13566         * testsuite/Makefile.in: Regenerate.
13567         * testsuite/script_test_5.cc: New file.
13568         * testsuite/script_test_5.sh: New file.
13569         * testsuite/script_test_5.t: New file.
13570
13571 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13572
13573         * archive.cc (Archive::include_member): Update calls to add_symbols.
13574         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13575         the Layout argument.
13576         * dynobj.h (do_add_symbols): Add the Layout argument.
13577         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13578         Layout argument.
13579         * object.h (Object::add_symbols): Add the Layout argument.
13580         (Object::do_add_symbols): Add the Layout argument.
13581         (Sized_relobj::do_add_symbols): Add the Layout argument.
13582         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13583         Unify the two versions.
13584         (Add_plugin_symbols): Remove.
13585         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13586         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13587         (Add_plugin_symbols): Remove.
13588         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13589         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13590         (Add_symbols::run): Make it work with Pulginobj.
13591
13592 2009-02-06  Ian Lance Taylor  <iant@google.com>
13593
13594         * object.cc (Sized_relobj::do_layout): Make info message start
13595         with lower case letter.
13596
13597 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13598
13599         * binary.cc: Fix file comment.
13600
13601         * options.h (enum Incremental_disposition): Define.
13602         (class General_options): Add new options: --incremental,
13603         --incremental_changed, --incremental_unchanged,
13604         --incremental_unknown.  Add incremental_disposition_ and
13605         implicit_incremental_ fields.
13606         (General_options::incremental_disposition): New function.
13607         (class Position_dependent_options): Add incremental_disposition
13608         option.
13609         (Position_dependent_options::copy_from_options): Set incremental
13610         dispositions.
13611         * options.cc (General_options::parse_incremental_changed): New
13612         function.
13613         (General_options::parse_incremental_unchanged): New function.
13614         (General_options::parse_incremental_unknown): New function.
13615         (General_options::General_options): Initialize new fields
13616         incremental_disposition_ and implicit_incremental_.
13617         (General_options::finalize): Check for uasge of --incremental-*
13618         without --incremental.
13619
13620 2009-02-06  Chris Demetriou  <cgd@google.com>
13621
13622         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13623         pointer and to report location as the file name associated with
13624         the symbol.
13625         (gold_undefined_symbol_at_location): New function to replace the
13626         old gold_undefined_symbol functionality.
13627         * target-reloc.h (relocate_section): Update to use
13628         gold_undefined_symbol_at_location.
13629         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13630         Call gold_undefined_symbol function rather than gold_error.
13631         * errors.h (Errors::undefined_symbol): Take location as a
13632         string, rather than calculating it from a relocation.
13633         * errors.cc (Errors::fatal): Print "fatal error:" before the
13634         formatted message.
13635         (Errors::error, Errors::error_at_location): Print "error: "
13636         before the formatted message.
13637         (Errors::undefined_symbol): Take location as a string, rather
13638         than calculating it from a relocation.
13639         (gold_undefined_symbol_at_location): New function akin to
13640         old gold_undefined_symbol, calculates location from relocation.
13641         (gold_undefined_symbol): Change to take only a Symbol pointer
13642         and to report location as the file name associated with the symbol.
13643         * testsuite/debug_msg.sh: Update for changed error messages.
13644         * testsuite/undef_symbol.sh: Likewise.
13645
13646 2009-02-04  Duncan Sands  <baldrick@free.fr>
13647
13648         PR 9812
13649         * reduced_debug_output.h
13650         (Output_reduced_debug_abbrev_section::failed): Use format for
13651         gold_warning.
13652         (Output_reduced_debug_info_section::faild): Likewise.
13653
13654 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13655
13656         * script.cc (Lazy_demangler): New class.
13657         (Version_script_info::get_symbol_version_helper): Demangle a
13658         symbol only once.
13659
13660 2009-01-29  Cary Coutant  <ccoutant@google.com>
13661
13662         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13663         to __tls_get_addr.
13664         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13665
13666 2009-01-28  Ian Lance Taylor  <iant@google.com>
13667
13668         * version.cc (version_string): Bump to 1.9.
13669
13670         * gold.h: Include <cstring> and <stdint.h>.
13671         * version.cc: Include <cstdio>.
13672         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13673         warning.
13674         * reduced_debug_output.cc (insert_into_vector): Rename from
13675         Insert_into_vector; change all callers.  Use Swap_unaligned to
13676         avoid aliasing issue; remove union since it is unnecessary.
13677
13678 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13679
13680         * Makefile.am (CCFILES): Add gc.cc.
13681         (HFILES): Add gc.h.
13682         * Makefile.in: Regenerate.
13683         * gold.cc (Gc_runner): New class.
13684         (queue_initial_tasks): Call garbage collection related tasks
13685         when corresponding options are invoked.
13686         (queue_middle_gc_tasks): New function.
13687         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13688         processed early before laying out sections during garbage collection.
13689         * gold.h (queue_middle_gc_tasks): New function.
13690         (is_prefix_of): Move from "layout.cc".
13691         * i386.cc (Target_i386::gc_process_relocs): New function.
13692         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13693         * main.cc (main): Create object of class "Garbage_collection".
13694         * object.cc (Relobj::copy_symbols_data): New function.
13695         (Relobj::is_section_name_included): New function.
13696         (Sized_relobj::do_layout): Allow this function to be called twice
13697         during garbage collection and defer layout of section during the
13698         first call.
13699         * object.h (Relobj::get_symbols_data): New function.
13700         (Relobj::is_section_name_included): New function.
13701         (Relobj::copy_symbols_data): New function.
13702         (Relobj::set_symbols_data): New function.
13703         (Relobj::get_relocs_data): New function.
13704         (Relobj::set_relocs_data): New function.
13705         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13706         (Relobj::gc_process_relocs): New function.
13707         (Relobj::do_gc_process_relocs): New pure virtual function.
13708         (Relobj::sd_): New data member.
13709         (Sized_relobj::is_output_section_offset_invalid): New function.
13710         (Sized_relobj::do_gc_process_relocs): New function.
13711         * options.h (General_options::gc_sections): Modify to not be a no-op.
13712         (General_options::print_gc_sections): New option.
13713         * plugin.cc (Plugin_finish::run): Remove function call to
13714         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13715         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13716         * reloc.cc (Read_relocs::run): Add task to process relocs and
13717         determine unreferenced sections when doing garbage collection.
13718         (Gc_process_relocs): New class.
13719         (Sized_relobj::do_gc_process_relocs): New function.
13720         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13721         sections that are garbage collected.
13722         * reloc.h (Gc_process_relocs): New class.
13723         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13724         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13725         symbols whose corresponding sections are garbage collected.
13726         (Symbol_table::Symbol_table): Add new parameter for the garbage
13727         collection object.
13728         (Symbol_table::gc_mark_undef_symbols): New function.
13729         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13730         (Symbol_table::gc_mark_dyn_syms): New function.
13731         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13732         as garbage.
13733         (Symbol_table::add_from_object): Likewise.
13734         (Symbol_table::add_from_relobj): When building shared objects, do not
13735         treat externally visible symbols as garbage.
13736         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13737         table information for static and relocatable links.
13738         * symtab.h (Symbol_table::set_gc): New function.
13739         (Symbol_table::gc): New function.
13740         (Symbol_table::gc_mark_undef_symbols): New function.
13741         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13742         (Symbol_table::gc_mark_dyn_syms): New function.
13743         (Symbol_table::gc_): New data member.
13744         * target.h (Sized_target::gc_process_relocs): New pure virtual
13745         function.
13746         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13747         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13748
13749 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13750
13751         * options.h (General_options::gc_sections): Define as a no-op for now.
13752         (General_options::no_keep_memory): Ditto.
13753         (General_options::Bshareable): Define.
13754         * options.cc (General_options::finalize): Honor -Bshareable.
13755
13756 2009-01-20  Andreas Schwab  <schwab@suse.de>
13757
13758         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13759         read the value in the contents, since we don't use it.  Use the
13760         template endianness when writing.
13761         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13762
13763 2009-01-19  Andreas Schwab  <schwab@suse.de>
13764
13765         * configure.tgt (powerpc64-*): Fix targ_obj.
13766
13767 2009-01-15  Ian Lance Taylor  <iant@google.com>
13768
13769         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13770         local symbols when stripping all symbols.
13771
13772 2009-01-14  Cary Coutant  <ccoutant@google.com>
13773
13774         * output.cc (Output_reloc): Add explicit instantiations.
13775
13776 2009-01-14  Cary Coutant  <ccoutant@google.com>
13777
13778         * archive.cc (Archive::get_elf_object_for_member): Remove call
13779         to File_read::claim_for_plugin.
13780         * descriptors.cc (Descriptors::open): Remove reference to
13781         is_claimed.
13782         (Descriptors::claim_for_plugin): Remove.
13783         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13784         (Descriptors::is_claimed): Remove.
13785         (claim_descriptor_for_plugin): Remove.
13786         * fileread.cc (File_read::claim_for_plugin): Remove.
13787         * fileread.h (File_read::claim_for_plugin): Remove.
13788         (File_read::descriptor): Reopen descriptor if necessary.
13789         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13790         (Plugin_manager::all_symbols_read): Add task parameter. Change
13791         all callers.
13792         (Plugin_manager::get_input_file): New function.
13793         (Plugin_manager::release_input_file): New function.
13794         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13795         corresponding data member.
13796         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13797         and pass to base constructor. Change all callers.
13798         (get_input_file, release_input_file): New functions.
13799         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13800         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13801         (Plugin_manager::all_symbols_read): Add task parameter.
13802         (Plugin_manager::get_input_file): New function.
13803         (Plugin_manager::release_input_file): New function.
13804         (Plugin_manager::task_): New data member.
13805         (Pluginobj::Pluginobj): Add filesize parameter.
13806         (Pluginobj::filename): New function.
13807         (Pluginobj::descriptor): New function.
13808         (Pluginobj::filesize): New function.
13809         (Pluginobj::filesize_): New data member.
13810         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13811         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13812         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13813
13814         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13815         with archive libraries.
13816         * testsuite/Makefile.in: Regenerate.
13817         * testsuite/plugin_test.c (struct sym_info): New type.
13818         (get_input_file, release_input_file): New static variables.
13819         (onload): Capture new transfer vector entries.
13820         (claim_file_hook): Stop reading at end of file according to filesize.
13821         Factor out parsing of readelf output into separate function.
13822         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13823         APIs and get the source file name from the symbol table.  Convert
13824         source file name to corresponding object file name.  Print info
13825         message when adding new input files.
13826         (parse_readelf_line): New function.
13827         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13828         * testsuite/plugin_test_2.sh: Likewise.
13829         * testsuite/plugin_test_3.sh: Likewise.
13830         * testsuite/plugin_test_4.sh: New test case.
13831
13832 2009-01-07  Ian Lance Taylor  <iant@google.com>
13833
13834         * version.cc (version_string): Bump to 1.8.
13835
13836 2008-12-23  Cary Coutant  <ccoutant@google.com>
13837
13838         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13839         * plugin.cc (Plugin_manager::finish): Rename as
13840         layout_deferred_objects.  Move cleanup to separate function.
13841         (Plugin_manager::cleanup): New function.
13842         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13843         separately.
13844         * plugin.h (Plugin_manager::finish): Rename as
13845         layout_deferred_objects.
13846         (Plugin_manager::cleanup): New function.
13847         (Plugin_manager::cleanup_done): New field.
13848
13849 2008-12-23  Cary Coutant  <ccoutant@google.com>
13850
13851         * plugin.cc (is_visible_from_outside): New function.
13852         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13853         so we don't return "IR only" status for exported symbols or -r links.
13854
13855         * testsuite/Makefile.am (plugin_test_3): New test case.
13856         * testsuite/Makefile.in: Regenerate.
13857         * testsuite/plugin_test_3.sh: New file.
13858
13859 2008-12-22  Cary Coutant  <ccoutant@google.com>
13860
13861         * object.cc (Sized_relobj::layout_section): New function.
13862         (Sized_relobj::do_layout): Defer layout of input sections until after
13863         plugin has provided replacement files.
13864         (Sized_relobj::do_layout_deferred_sections): New function.
13865         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13866         (Relobj::layout_deferred_sections): New function.
13867         (Relobj::do_layout_deferred_sections): New function.
13868         (Sized_relobj::do_layout_deferred_sections): New function.
13869         (Sized_relobj::layout_section): New function.
13870         (Sized_relobj::Deferred_layout): New structure.
13871         (Sized_relobj::deferred_layout_): New field.
13872         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13873         Change all callers.  Layout deferred sections.
13874         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13875         references.
13876         (Plugin_hook::run): Move code from do_plugin_hook inline.
13877         (Plugin_hook::do_plugin_hook): Remove.
13878         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13879         (Plugin_manager::finish): Renamed, was cleanup.
13880         (Plugin_manager::should_defer_layout): New function.
13881         (Plugin_manager::add_deferred_layout_object): New function.
13882         (Plugin_manager::Deferred_layout_list): New type.
13883         (Plugin_manager::deferred_layout_objects_): New field.
13884         (Plugin_hook::do_plugin_hook): Remove.
13885
13886 2008-12-17  Ian Lance Taylor  <iant@google.com>
13887
13888         * options.h (class General_options): Add --no case for
13889         --export-dynamic.
13890
13891 2008-12-16  Cary Coutant  <ccoutant@google.com>
13892
13893         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13894         vector.
13895         (Plugin_manager::claim_file): Create plugin object even if
13896         plugin did not call the add_symbols callback.
13897         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13898         asking for more symbols than were added.
13899         * testsuite/Makefile.am (plugin_test_1): Add test case with
13900         no global symbols.
13901         (empty.syms): New target.
13902         * testsuite/Makefile.in: Regenerate.
13903         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13904         message. Don't call add_symbols if no globals.
13905         (all_symbols_read_hook): Don't provide replacement for empty
13906         claimed file.
13907
13908 2008-12-12  Ian Lance Taylor  <iant@google.com>
13909
13910         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13911         r_type == 0 for a local symbol with r_sym == 0.
13912         (scan_relocatable_relocs): Pass r_sym to
13913         local_non_section_strategy.
13914         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13915         r_sym parameter.
13916
13917         * configure.ac: Update test for TLS descriptors: they are
13918         supported as of glibc 2.9.
13919         * configure: Rebuild.
13920
13921 2008-12-11  Ian Lance Taylor  <iant@google.com>
13922
13923         PR 7091
13924         * target-reloc.h (Default_scan_relocatable_relocs): For each
13925         function, map r_type == 0 to RELOC_DISCARD.
13926
13927 2008-12-10  Cary Coutant  <ccoutant@google.com>
13928
13929         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13930         object to override a kept COMDAT group from a plugin object.
13931
13932 2008-12-09  Ian Lance Taylor  <iant@google.com>
13933
13934         PR 7088
13935         * yyscript.y (file_cmd): Handle INPUT.
13936
13937         * testsuite/initpri1.c: Change all declarations to be full
13938         prototypes by adding void, to avoid compiler warnings.
13939
13940 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13941
13942         * options.cc (General_options::parse_plugin_opt): New.
13943         (General_options::add_plugin): The argument now is just the filename.
13944         (General_options::add_plugin_option): New.
13945         * options.h (plugin_opt): New.
13946         (add_plugin): Change argument name.
13947         (add_plugin_option): New.
13948         * plugin.cc (Plugin::load): Don't parse the plugin option.
13949         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13950         (Plugin::add_option): New.
13951         (Plugin::args_): Change type.
13952         (Plugin::filename_): New.
13953         (Plugin_manager::add_plugin_option): New.
13954         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13955         * testsuite/Makefile.in: Regenerate.
13956
13957 2008-12-05  Cary Coutant  <ccoutant@google.com>
13958
13959         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13960         Handle --strip-lto-sections option.
13961         * options.h (strip_lto_sections): New option.
13962
13963 2008-12-01  Cary Coutant  <ccoutant@google.com>
13964
13965         * plugin.cc (ld_plugin_message): Change format parameter to const.
13966         Fix mismatch between new[] and delete.
13967
13968 2008-11-14  Cary Coutant  <ccoutant@google.com>
13969
13970         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13971         instead of -1U.
13972
13973 2008-11-05  Craig Silverstein  <csilvers@google.com>
13974
13975         * options.cc (General_options::parse_dynamic_list): New function.
13976         * options.h (General_options): New flags dynamic_list,
13977         dynamic_list_data, dynamic_list_cpp_new, and
13978         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13979         (General_options::in_dynamic_list): New function.
13980         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13981         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13982         (Lex::can_continue_name): Likewise.
13983         (yylex): Likewise.
13984         (read_script_file): New parameter script_options.
13985         (read_dynamic_list): New function.
13986         (Script_options::define_dynamic_list): New function.
13987         (dynamic_list_keyword_parsecodes): New variable.
13988         (dynamic_list_keywords): New variable.
13989         * script.h (Script_options::define_dynamic_list): New function
13990         prototype.
13991         (read_dynamic_list): New function prototype.
13992         * symtab.cc (strprefix): New macro.
13993         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13994         dynamic_list_data, dynamic_list_cpp_new, and
13995         dynamic_list_cpp_typeinfo.
13996         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13997         (dynamic_list_expr): New rule.
13998         (dynamic_list_nodes): Likewise.
13999         (dynamic_list_node): Likewise.
14000         * testsuite/Makefile.am (dynamic_list): New test.
14001         * testsuite/Makefile.in: Regenerated.
14002         * testsuite/dynamic_list.t: New file.
14003         * testsuite/dynamic_list.sh: New file.
14004
14005 2008-11-05  Craig Silverstein  <csilvers@google.com>
14006
14007         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14008         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14009         (t11_last): Likewise.
14010         * testsuite/ver_test_6.c (main): Likewise.
14011
14012 2008-10-07  Cary Coutant  <ccoutant@google.com>
14013
14014         * options.c (General_options::finalize): Add check for -static and
14015         -shared.
14016         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14017         is not empty.
14018
14019 2008-10-02  Cary Coutant  <ccoutant@google.com>
14020
14021         * plugin.cc (make_sized_plugin_object): Fix conditional
14022         compilation to work when not all targets are enabled.
14023
14024 2008-09-29  Cary Coutant  <ccoutant@google.com>
14025
14026         * archive.cc (Archive::get_file_and_offset): Use filename instead
14027         of name to get library path.
14028         (Archive::include_member): Unlock external member of a thin archive.
14029
14030         * testsuite/Makefile.am (TEST_AR): New variable.
14031         (thin_archive_test_1): New test.
14032         (thin_archive_test_2): New test.
14033         * testsuite/Makefile.in: Regenerate.
14034         * testsuite/thin_archive_main.cc: New file.
14035         * testsuite/thin_archive_test_1.cc: New file.
14036         * testsuite/thin_archive_test_2.cc: New file.
14037         * testsuite/thin_archive_test_3.cc: New file.
14038         * testsuite/thin_archive_test_4.cc: New file.
14039
14040 2008-09-29  Cary Coutant  <ccoutant@google.com>
14041
14042         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14043         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14044         instead of -1U.
14045         (Sized_relobj::do_finalize_local_symbols): Likewise.
14046         (Sized_relobj::map_to_kept_section): Likewise.
14047         * object.h (Sized_relobj::invalid_address): New constant.
14048         (Sized_relobj::do_output_section_offset): Check for invalid_address
14049         and return -1ULL.
14050         * output.cc (Output_reloc::local_section_offset): Use constant
14051         invalid_address instead of -1U.
14052         (Output_reloc::get_address): Likewise.
14053         (Output_section::output_address): Change -1U to -1ULL.
14054         * output.h (Output_reloc::invalid_address): New constant.
14055         * reloc.cc (Sized_relobj::write_sections): Use constant
14056         invalid_address instead of -1U.
14057         (Sized_relobj::relocate_sections): Likewise.
14058         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14059         values for merge sections.
14060         * target-reloc.h (relocate_for_relocatable): Use constant
14061         invalid_address instead of -1U.
14062
14063 2008-09-19  Cary Coutant  <ccoutant@google.com>
14064
14065         Add plugin functionality for link-time optimization (LTO).
14066         * configure.ac (plugins): Add --enable-plugins option.
14067         * configure: Regenerate.
14068         * config.in: Regenerate.
14069         * Makefile.am (LIBDL): New variable.
14070         (CCFILES): Add plugin.cc.
14071         (HFILES): Add plugin.h.
14072         (ldadd_var): Add LIBDL.
14073         * Makefile.in: Regenerate.
14074
14075         * archive.cc: Include "plugin.h".
14076         (Archive::setup): Don't preread archive symbols when using a plugin.
14077         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14078         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14079         files.
14080         (Archive::include_member): Add symbols from plugin objects.
14081         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14082         * descriptors.cc (Descriptors::open): Check for file descriptors
14083         abandoned by plugins.
14084         (Descriptors::claim_for_plugin): New function.
14085         * descriptors.h (Descriptors::claim_for_plugin): New function.
14086         (Open_descriptor::is_claimed): New field.
14087         (claim_descriptor_for_plugin): New function.
14088         * fileread.cc (File_read::claim_for_plugin): New function.
14089         * fileread.h (File_read::claim_for_plugin): New function.
14090         (File_read::descriptor): New function.
14091         * gold.cc: Include "plugin.h".
14092         (queue_initial_tasks): Add task to call plugin hooks for generating
14093         new object files.
14094         * main.cc: Include "plugin.h".
14095         (main): Load plugin libraries.
14096         * object.h (Pluginobj): Declare.
14097         (Object::pluginobj): New function.
14098         (Object::do_pluginobj): New function.
14099         (Object::set_target): New function.
14100         * options.cc: Include "plugin.h".
14101         (General_options::parse_plugin): New function.
14102         (General_options::General_options): Initialize plugins_ field.
14103         (General_options::add_plugin): New function.
14104         * options.h (Plugin_manager): Declare.
14105         (General_options): Add --plugin option.
14106         (General_options::has_plugins): New function.
14107         (General_options::plugins): New function.
14108         (General_options::add_plugin): New function.
14109         (General_options::plugins_): New field.
14110         * plugin.cc: New file.
14111         * plugin.h: New file.
14112         * readsyms.cc: Include "plugin.h".
14113         (Read_symbols::do_read_symbols): Check for archive before checking
14114         for ELF file.  Call plugin hooks to claim files.
14115         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14116         from a real object file; force override when processing replacement
14117         files.
14118         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14119         (Symbol::init_base_object): Likewise.
14120         (Symbol::init_base_output_data): Likewise.
14121         (Symbol::init_base_output_segment): Likewise.
14122         (Symbol::init_base_constant): Likewise.
14123         (Symbol::init_base_undefined): Likewise.
14124         (Symbol::output_section): Assert that object is not a plugin.
14125         (Symbol_table::add_from_pluginobj): New function.
14126         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14127         undefined.
14128         (Symbol_table::sized_write_globals): Likewise.
14129         (Symbol_table::add_from_pluginobj): Instantiate template.
14130         * symtab.h (Sized_pluginobj): Declare.
14131         (Symbol::in_real_elf): New function.
14132         (Symbol::set_in_real_elf): New function.
14133         (Symbol::in_real_elf_): New field.
14134         (Symbol_table::add_from_pluginobj): New function.
14135
14136         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14137         (LIBDL): New variable.
14138         (LDADD): Add LIBDL.
14139         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14140         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14141         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14142         (MOSTLYCLEANFILES): Likewise.
14143         * testsuite/Makefile.in: Regenerate.
14144         * testsuite/plugin_test.c: New file.
14145         * testsuite/plugin_test_1.sh: New file.
14146         * testsuite/plugin_test_2.sh: New file.
14147
14148 2008-09-16  Ian Lance Taylor  <iant@google.com>
14149
14150         * target-reloc.h (relocate_section): Check whether a symbol is
14151         defined by the ABI before reporting an undefined symbol error.
14152         * target.h (Target::is_defined_by_abi): Make parameter const.
14153         (Target::do_is_defined_by_abi): Likewise.
14154         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14155         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14156         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14157         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14158         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14159         * testsuite/Makefile.in: Rebuild.
14160
14161         * fileread.cc (make_view): Add casts to avoid warning.
14162
14163 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14164
14165         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14166         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14167
14168 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14169
14170         * options.h (General_options::output_is_executable): New.
14171         (General_options::output_is_pie): New.
14172         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14173         for shared libraries.
14174         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14175
14176 2008-09-11  Chris Demetriou  <cgd@google.com>
14177
14178         * options.h (origin): New -z option.
14179         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14180         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14181         in DT_FLAGS_1.
14182
14183 2008-09-05  Cary Coutant  <ccoutant@google.com>
14184
14185         * fileread.cc (File_read::make_view): Add check for attempt to map
14186         beyond end of file.
14187
14188 2008-09-05  Cary Coutant  <ccoutant@google.com>
14189
14190         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14191         explicit instantiations.
14192
14193 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14194
14195         PR gold/6858
14196         * options.cc (General_options::finalize): Allow undefined symbols
14197         in shlibs if linking -shared.
14198
14199         PR gold/6859
14200         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14201         symbols as not needing a dynsym entry.
14202
14203 2008-08-20  Craig Silverstein  <csilvers@google.com>
14204
14205         * fileread.cc (File_read::open): Do not lock the file unless it
14206         was successfully opened.
14207
14208 2008-08-14  Cary Coutant  <ccoutant@google.com>
14209
14210         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14211         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14212         * testsuite/tls_test.cc (struct int128): 128-bit struct
14213         for testing TLS relocs with non-zero addend.
14214         (v12): New TLS variable.
14215         (t12): New test.
14216         (t_last): Add check for v12.
14217         * testsuite/tls_test.h (t12): New function.
14218         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14219
14220 2008-08-13  Ian Lance Taylor  <iant@google.com>
14221
14222         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14223         set tls_segment_ or relro_segment_.
14224         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14225         when appropriate.
14226         * output.h (Output_section::clear_is_relro): New function.
14227         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14228         sections specially even when output_data_ is empty.
14229         (Output_segment::maximum_alignment): When first section is relro,
14230         only force alignment for PT_LOAD segments.
14231         * script.cc (script_data_segment_align): New function.
14232         (script_data_segment_relro_end): New function.
14233         * script-c.h (script_data_segment_align): Declare.
14234         (script_data_segment_relro_end): Declare.
14235         * script-sections.h (class Script_sections): Declare
14236         data_segment_align and data_segment_relro_end.  Add fields
14237         segment_align_index_ and saw_relro_end_.
14238         * script-sections.cc (class Sections_element): Add set_is_relro
14239         virtual function.  Add new bool* parameter to place_orphan_here.
14240         Add get_output_section virtual function.
14241         (class Output_section_definition): Add set_is_relro.  Add new
14242         bool* parameter to place_orphan_here.  Add get_output_section.
14243         Add is_relro_ field.
14244         (Output_section_definition::Output_section_definition): Initialize
14245         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14246         and is_relro_ fields.
14247         (Output_section_definition::place_orphan_here): Add is_relro
14248         parameter.
14249         (Output_section_definition::set_section_addresses): Set relro for
14250         output section.
14251         (Output_section_definition::alternate_constraint): Likewise.
14252         (class Orphan_output_section): Add new bool* parameter to
14253         place_orphan_here.  Add get_output_section.
14254         (Orphan_output_section::place_orphan_here): Add is_relro
14255         parameter.
14256         (Script_sections::Script_sections): Initialize
14257         data_segment_align_index_ and saw_relro_end_.
14258         (Script_sections::data_segment_align): New function.
14259         (Script_sections::data_segment_relro_end): New function.
14260         (Script_sections::place_orphan): Set or clear is_relro.
14261         (Script_sections::set_section_addresses): Force alignment of first
14262         TLS section.
14263         * yyscript.y (exp): Call script_data_segment_align and
14264         script_data_segment_relro_end.
14265         * testsuite/relro_script_test.t: New file.
14266         * testsuite/relro_test.cc (using_script): Declare.
14267         (t1, t2): Test using_script.
14268         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14269         (relro_script_test_SOURCES): Define.
14270         (relro_script_test_DEPENDENCIES): Define.
14271         (relro_script_test_LDFLAGS): Define.
14272         (relro_script_test_LDADD): Define.
14273         (relro_script_test.so): New target.
14274         * testsuite/Makefile.in: Rebuild.
14275
14276 2008-08-06  Cary Coutant <ccoutant@google.com>
14277
14278         * archive.cc (Archive::total_archives, Archive::total_members)
14279         (Archive::total_members_loaded): New variables.
14280         (Archive::setup): Add parameter.  Add option to preread
14281         archive symbols.
14282         (Archive::read_armap): Add counter.
14283         (Archive::get_file_and_offset): New function.
14284         (Archive::get_elf_object_for_member): New function.
14285         (Archive::read_all_symbols): New function.
14286         (Archive::read_symbols): New function.
14287         (Archive::add_symbols): Add counters.
14288         (Archive::include_all_members): Use armap to find members if it's
14289         already built.
14290         (Archive::include_member): Skip reading symbols if already read.
14291         Factored code into Archive::get_file_and_offset and
14292         Archive::get_elf_object_for_member.  Changed call to
14293         Mapfile::report_include_archive_member.
14294         (Archive::print_stats): New function.
14295         * archive.h: Declare Object and Read_symbols_data classes.
14296         (Archive::Archive): Add initializers for new members.
14297         (Archive::setup): Add parameter.
14298         (Archive::print_stats): New function.
14299         (Archive::total_archives, Archive::total_members)
14300         (Archive::total_members_loaded): New variables.
14301         (Archive::get_file_and_offset): New function.
14302         (Archive::get_elf_object_for_member): New function.
14303         (Archive::read_all_symbols): New function.
14304         (Archive::read_symbols): New function.
14305         (Archive::Archive_member): New class.
14306         (Archive::members_): New member.
14307         (Archive::num_members_): New member.
14308         * main.cc: Include archive.h.
14309         (main): Call Archive::print_stats.
14310         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14311         archive parameter; member_name is now the fully-decorated name.
14312         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14313         * options.h: (General_options): Add --preread-archive-symbols option.
14314         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14315         Archive::setup.
14316
14317 2008-08-04  Ian Lance Taylor  <iant@google.com>
14318
14319         * symtab.h (Symbol::use_plt_offset): New function.
14320         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14321         * powerpc.cc (Relocate::relocate): Likewise.
14322         * sparc.cc (Relocate::relocate): Likewise.
14323         * x86_64.cc (Relocate::relocate): Likewise.
14324         * testsuite/weak_plt.sh: New test.
14325         * testsuite/weak_plt_main.cc: New test.
14326         * testsuite/weak_plt_shared.cc: New test.
14327         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14328         (check_PROGRAMS): Add weak_plt.
14329         (check_DATA): Add weak_plt_shared.so.
14330         (weak_plt_main_pic.o, weak_plt): New targets.
14331         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14332         * testsuite/Makefile.in: Rebuild.
14333
14334         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14335         gcctestdir/ld.
14336         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14337         * testsuite/Makefile.in: Rebuild.
14338
14339 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14340
14341         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14342         * Makefile.in: Regenerate.
14343         * po/POTFILES.in: Regenerate.
14344
14345 2008-07-29  Ian Lance Taylor  <iant@google.com>
14346
14347         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14348         symbols before other symbols.
14349         * testsuite/script_test_2.cc (test_addr): Declare.
14350         (test_addr_alias): Declare.
14351         (main): Check that test_addr and test_addr_alias have the right
14352         values.
14353         * testsuite/script_test_2.t: Define test_addr_alias and
14354         test_addr.
14355
14356 2008-07-24  Ian Lance Taylor  <iant@google.com>
14357
14358         PR 5990
14359         * descriptors.cc: New file.
14360         * descriptors.h: New file.
14361         * gold-threads.h (class Hold_optional_lock): New class.
14362         * fileread.cc: Include "descriptors.h".
14363         (File_read::~File_read): Release descriptor rather than closing
14364         it.
14365         (File_read::open) [file]: Call open_descriptor rather than open.
14366         Set is_descriptor_opened_.
14367         (File_read::open) [memory]: Assert that descriptor is not open.
14368         (File_read::reopen_descriptor): New function.
14369         (File_read::release): Release descriptor.
14370         (File_read::do_read): Make non-const.  Reopen descriptor.
14371         (File_read::read): Make non-const.
14372         (File_read::make_view): Reopen descriptor.
14373         (File_read::do_readv): Likewise.
14374         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14375         Update declarations.
14376         * layout.cc: Include "descriptors.h".
14377         (Layout::create_build_id): Use open_descriptor rather than open.
14378         * output.cc: Include "descriptors.h".
14379         (Output_file::open): Use open_descriptor rather than open.
14380         * archive.cc (Archive::const_iterator): Change Archive to be
14381         non-const.
14382         (Archive::begin, Archive::end): Make non-const.
14383         (Archive::count_members): Likewise.
14384         * archive.h (class Archive): Update declarations.
14385         * object.h (Object::read): Make non-const.
14386         * Makefile.am (CCFILES): Add descriptors.cc.
14387         (HFILES): Add descriptors.h.
14388         * Makefile.in: Rebuild.
14389
14390         PR 6716
14391         * gold.h: Always include <clocale>.  Add Solaris workarounds
14392         following code in binutils/sysdep.h.
14393
14394         PR 6048
14395         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14396         this->eh_frame_hdr_ is NULL before using it.
14397
14398         * dynobj.cc (Versions::Versions): Update comment.
14399
14400         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14401         the base version name.
14402
14403         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14404         array size plus one.
14405         (Stringpool_template::set_string_offsets): Subtract one from key
14406         before using it as an array index.
14407         (Stringpool_template::get_offset_with_length): Likewise.
14408         (Stringpool_template::write_to_buffer): Likewise.
14409         * stringpool.h (Stringpool_template::get_offset_from_key):
14410         Likewise.
14411
14412 2008-07-23  Ian Lance Taylor  <iant@google.com>
14413
14414         PR 6658
14415         * object.h (Merged_symbol_value::value): Do our best to handle a
14416         negative addend.
14417
14418         PR 6647
14419         * script.cc (Version_script_info::get_versions): Don't add empty
14420         version tag to return value.
14421         (Version_script_info::get_symbol_version_helper): Change return
14422         type to bool.  Add pversion parameter.  Change all callers.
14423         (script_register_vers_node): Don't require a non-NULL tag.
14424         * script.h (class Version_script_info): Update declarations.
14425         (Version_script_info::get_symbol_version): Change return type to
14426         bool.  Add version parameter.  Change all callers.
14427         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14428         handling.  Handle an empty version from a version script.
14429         (Symbol_table::define_special_symbol): Likewise.
14430         * testsuite/ver_test_10.script: New file.
14431         * testsuite/ver_test_10.sh: New file.
14432         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14433         (check_DATA): Add ver_test_10.syms.
14434         (ver_test_10.syms, ver_test_10.so): New target.
14435         * testsuite/Makefile.in: Rebuild.
14436
14437 2008-07-23  Simon Baldwin  <simonb@google.com>
14438
14439         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14440         to zero for undefined symbols from dynamic libraries.
14441
14442 2008-07-23  Ian Lance Taylor  <iant@google.com>
14443
14444         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14445         Change all callers.
14446         * symtab.h (class Symbol_table): Update declaration.
14447         * testsuite/ver_test_9.cc: New file.
14448         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14449         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14450         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14451         (ver_test_9.so, ver_test_9.o): New targets.
14452         * testsuite/Makefile.in: Rebuild.
14453
14454 2008-07-22  Ian Lance Taylor  <iant@google.com>
14455
14456         * options.h (class General_options): Define --check-sections.
14457         * layout.cc (Layout::set_segment_offsets): Handle
14458         --check-sections.
14459
14460         * options.h (class General_options): Define -n/--nmagic and
14461         -N/--omagic.
14462         * options.cc (General_options::finalize): For -n/--nmagic or
14463         -N/--omagic, set -static.
14464         * layout.cc (Layout::attach_allocated_section_to_segment): If
14465         -N/--omagic, don't put read-only and read-write sections in
14466         different segments.
14467         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14468         finding a read-only segment.
14469         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14470         don't set the minimum segment alignment to the common page size,
14471         and don't set the file offset to the address modulo the page size.
14472         * script-sections.cc (Script_sections::create_segments): If
14473         -n/--omagic, don't put read-only and read-write sections in
14474         different segments.
14475
14476         * cref.cc: New file.
14477         * cref.h: New file.
14478         * options.h (class General_options): Add --print-symbol-counts.
14479         * main.cc (main): Issue defined symbol report if requested.
14480         * archive.cc (Archive::interpret_header): Make into a const member
14481         function.
14482         (Archive::add_symbols): Call Input_objects::archive_start and
14483         archive_stop.
14484         (Archive::const_iterator): Define new class.
14485         (Archive::begin, Archive::end): New functions.
14486         (Archive::include_all_members): Rewrite to use iterator.
14487         (Archive::count_members): New function.
14488         * archive.h (class Archive): Update declarations.
14489         (Archive::filename): New function.
14490         * object.cc: Include "cref.h".
14491         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14492         (Sized_relobj::do_get_global_symbol_counts): New function.
14493         (Input_objects::add_object): Add object to cross-referencer.
14494         (Input_objects::archive_start): New function.
14495         (Input_objects::archive_stop): New function.
14496         (Input_objects::print_symbol_counts): New function.
14497         * object.h: Declare Cref and Archive.
14498         (Object::get_global_symbol_counts): New function.
14499         (Object::do_get_global_symbol_counts): New pure virtual function.
14500         (class Sized_relobj): Add defined_count_ field.  Update
14501         declarations.
14502         (class Input_objects): Add cref_ field.  Update constructor.
14503         Update declarations.
14504         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14505         defined_count_.
14506         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14507         symbol counts.
14508         (Sized_dynobj::do_get_global_symbol_counts): New function.
14509         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14510         defined_count_.  Update declarations.  Define Symbols typedef.
14511         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14512         parameter.  Change all callers.
14513         (Symbol_table::add_from_dynobj): Add sympointers and defined
14514         parameters.  Change all callers.
14515         * symtab.h (class Symbol_table): Update declarations.
14516         * Makefile.am (CCFILES): Add cref.cc.
14517         (HFILES): Add cref.h.
14518         * Makefile.in: Rebuild.
14519
14520 2008-07-22  Simon Baldwin  <simonb@google.com>
14521
14522         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14523         to zero when writing undefined symbols.
14524
14525 2008-07-22  Ian Lance Taylor  <iant@google.com>
14526
14527         * output.cc (Output_section::add_input_section): Don't try to
14528         merge empty merge sections.
14529
14530 2008-07-21  Craig Silverstein  <csilvers@google.com>
14531
14532         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14533         Include symbol version in error message.
14534
14535 2008-07-20  Chris Demetriou  <cgd@google.com>
14536
14537         * configure.ac (gold_cv_c_random_seed): New configured variable.
14538         (RANDOM_SEED_CFLAGS): New substituted variable.
14539         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14540         * configure: Rebuild.
14541         * Makefile.in: Likewise.
14542         * testsuite/Makefile.in: Likewise.
14543
14544 2008-07-18  Ian Lance Taylor  <iant@google.com>
14545
14546         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14547         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14548         * testsuite/ver_test_main.cc (main): Call t4.
14549         (t4, t4_2a): Define.
14550         * testsuite/ver_test_2.cc (t4_2): Define.
14551         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14552         * testsuite/ver_test_4.cc (t4_2a): Define.
14553         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14554         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14555
14556 2008-07-17  Ian Lance Taylor  <iant@google.com>
14557
14558         * dynobj.cc (Versions::add_def): If we give an error about a
14559         missing version, go ahead and create the version anyhow.
14560
14561 2008-07-10  Ian Lance Taylor  <iant@google.com>
14562
14563         Handle output sections with more than 0x7fffffff bytes.
14564         * object.h (class Relobj): Change map_to_output_ to
14565         output_sections_, and just keep a section pointer.  Change all
14566         uses.  Move comdat group support to Sized_relobj.
14567         (Relobj::is_section_specially_mapped): Remove.
14568         (Relobj::output_section): Remove poff parameter.  Change all
14569         callers.
14570         (Relobj::output_section_offset): New function.
14571         (Relobj::set_section_offset): Rewrite.
14572         (Relobj::map_to_output): Remove.
14573         (Relobj::output_sections): New function.
14574         (Relobj::do_output_section_offset): New pure virtual function.
14575         (Relobj::do_set_section_offset): Likewise.
14576         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14577         group support from Relobj.  Update declarations.
14578         (Sized_relobj::get_output_section_offset): New function.
14579         (Sized_relobj::do_output_section_offset): New function.
14580         (Sized_relobj::do_set_section_offset): New function.
14581         * object.cc (Relobj::output_section_address): Remove.
14582         (Sized_relobj::Sized_relobj): Initialize new fields.
14583         (Sized_relobj::include_section_group): Cast find_kept_object to
14584         Sized_relobj.
14585         (Sized_relobj::include_linkonce_section): Likewise.
14586         (Sized_relobj::do_layout): Use separate arrays for output section
14587         and output offset.
14588         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14589         output_sections.
14590         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14591         output_sections and section_offsets.
14592         (Sized_relobj::write_local_symbols): Likewise.
14593         (map_to_kept_section): Compute output address directly.
14594         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14595         output_sections and section_offsets.
14596         (Sized_relobj::write_sections): Likewise.
14597         (Sized_relobj::relocate_sections): Likewise.
14598         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14599         * output.h (class Output_reloc): Update declarations.  Change
14600         u2_.relobj to Sized_relobj*.
14601         (class Output_data_reloc): Change add functions to use
14602         Sized_relobj*.
14603         * output.cc (Output_reloc::Output_reloc): Change relobj to
14604         Sized_relobj*.
14605         (Output_reloc::local_section_offset): Change return type to
14606         Elf_Addr.  Use get_output_section_offset.
14607         (Output_reloc::get_address): Likewise.
14608         (Output_section::is_input_address_mapped): Don't call
14609         is_section_specially_mapped.
14610         (Output_section::output_offset): Likewise.
14611         (Output_section::output_address): Likewise.
14612         (Output_section::starting_output_address): Likewise.
14613         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14614         parameter to Sized_relobj*.
14615         (Copy_relocs::need_copy_reloc): Likewise.
14616         (Copy_relocs::save): Likewise.
14617         * copy-relocs.h (class Copy_relocs): Update declarations.
14618         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14619         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14620         * target-reloc.h (relocate_for_relocatable): Change
14621         offset_in_output_section type to Elf_Addr.  Change code that uses
14622         it as well.
14623         * layout.cc (Layout::layout): Always set *off.
14624         * mapfile.cc (Mapfile::print_input_section): Use
14625         output_section_offset.
14626         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14627         Sized_relobj*.
14628         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14629         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14630         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14631
14632 2008-07-03  Ian Lance Taylor  <iant@google.com>
14633
14634         * layout.cc (Layout::include_section): Do not discard unrecognized
14635         SHT_STRTAB sections.
14636
14637 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14638
14639         * script.cc (Lex::can_continue_name): Make '?' allowable in
14640         version-script names.
14641         * testsuite/version_script.map: Change glob pattern to use '?'
14642
14643 2008-06-30  Manish Singh  <yosh@gimp.org>
14644
14645         PR 6585
14646         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14647         Correct typo.
14648
14649 2008-06-30  Ian Lance Taylor  <iant@google.com>
14650
14651         PR 6660
14652         PR 6682
14653         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14654         versions]: Don't try to read the value in the contents, since we
14655         don't use it.  Use the template endianness when writing.
14656
14657 2008-06-25  Cary Coutant  <ccoutant@google.com>
14658
14659         * fileread.cc (File_read::make_view): Assert on zero-length view.
14660         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14661         symbol table when there are no symbols to read.
14662
14663 2008-06-23  Craig Silverstein  <csilvers@google.com>
14664
14665         * version.cc (version_string): Bump to 1.7
14666
14667 2008-06-18  Craig Silverstein  <csilvers@google.com>
14668
14669         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14670         constant 0xFFFF to type Valtype.
14671         (Powerpc_relocate_functions::rel16_ha): Likewise.
14672
14673 2008-06-17  Ian Lance Taylor  <iant@google.com>
14674
14675         * output.h (Output_section::Input_section): Initialize p2align_ to
14676         zero for Output_section_data constructors.
14677         (Output_section::Input_section::addralign): If not an input
14678         section, return the alignment of the Output_section_data.
14679         * testsuite/copy_test.cc: New file.
14680         * testsuite/copy_test_1.cc: New file.
14681         * testsuite/copy_test_2.cc: New file.
14682         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14683         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14684         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14685         (copy_test_1_pic.o, copy_test_1.so): New targets.
14686         (copy_test_2_pic.o, copy_test_2.so): New targets.
14687         * testsuite/Makefile.in: Rebuild.
14688
14689         * script-sections.cc (Script_sections::place_orphan): Initialize
14690         local variable exact.
14691
14692 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14693
14694         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14695
14696 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14697             David S. Miller  <davem@davemloft.net>
14698
14699         * powerpc.cc: New file.
14700         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14701         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14702         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14703         * Makefile.in: Rebuild.
14704
14705 2008-06-09  Ian Lance Taylor  <iant@google.com>
14706
14707         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14708         <exception>.
14709         (throwing, orig_terminate): New static variables.
14710         (terminate_handler): New static function.
14711         (t2): Set terminate handler.
14712
14713 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14714
14715         PR 6584
14716         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14717         alignment.
14718
14719 2008-05-30  Cary Coutant  <ccoutant@google.com>
14720
14721         * archive.cc (Archive::include_all_members) Correct to step
14722         over symbol table and extended name table in thin archives.
14723
14724 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14725
14726         PR 6407
14727         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14728         calculation.
14729
14730 2008-05-28  Caleb Howe  <cshowe@google.com>
14731
14732         * reduced_debug_output.cc: New file.
14733         * reduced_debug_output.h: New file.
14734         * options.h (class General_options): Add --strip-debug-non-line.
14735         * options.cc (General_options::finalize): Add strip_debug_non_line
14736         to the strip heirarchy.
14737         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14738         fields.
14739         * layout.cc: Include "reduced_debug_output.h".
14740         (Layout::Layout): Initialize new fields.
14741         (line_only_debug_sections): New static array.
14742         (is_lines_only_debug_sections): New static inline function.
14743         (Layout::include_section): Handle --strip-debug-non-line.
14744         (Layout::make_output_section): If --strip-debug-non-line, build
14745         new output sections for .debug_abbrev and .debug_info.
14746         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14747         gold.  Warn about possible overflow.
14748         (read_signed_LEB_128): Likewise.
14749         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14750         (read_signed_LEB_128): Declare.
14751         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14752         (HFILES): Add reduced_debug_output.h.
14753         * Makefile.in: Rebuild.
14754
14755 2008-05-21  Ian Lance Taylor  <iant@google.com>
14756
14757         * mapfile.cc: New file.
14758         * mapfile.h: New file.
14759         * options.h (class General_options): Add -M/--print-map and -Map.
14760         * options.cc (General_options::finalize): Make -M equivalent to
14761         -Map -.
14762         * main.cc: Include <cstdio> and "mapfile.h".
14763         (main): Open mapfile if requested.
14764         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14765         constructor.  Change caller.
14766         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14767         (queue_middle_tasks): Likewise.
14768         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14769         declarations.
14770         * archive.cc: Include "mapfile.h".
14771         (Archive::add_symbols): Add mapfile parameter.  Change all
14772         callers.  Pass mapfile, symbol, and reason to include_member.
14773         (Archive::include_all_members): Add mapfile parameter.  Change all
14774         callers.
14775         (Archive::include_member): Add mapfile, sym, and why parameters.
14776         Change all callers.  Report inclusion to map file.
14777         * archive.h: Include "fileread.h".
14778         (class Archive): Update declarations.
14779         (Archive::file): New const method.
14780         (class Add_archive_symbols): Add mapfile_ field.  Update
14781         constructor.  Change all callers.
14782         * readsyms.h (class Read_symbols): Likewise.
14783         (class Finish_group): Likewise.
14784         (class Read_script): Likewise.
14785         * common.cc: Include "mapfile.h".
14786         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14787         all callers.
14788         (Symbol_table::do_allocate_commons): Likewise.
14789         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14790         symbol allocation to mapfile.
14791         * common.h (class Allocate_commons_task): Add mapfile_ field.
14792         Update constructor.  Change all callers.
14793         * symtab.h (class Symbol_table): Update declarations.
14794         * layout.cc: Include "mapfile.h".
14795         (Layout_task_runner::run): Print information to mapfile.
14796         (Layout::create_gold_note): Change Output_data_fixed_space to
14797         Output_data_zero_fill.
14798         (Layout::create_build_id): Likewise.
14799         (Layout::print_to_mapfile): New function.
14800         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14801         constructor.  Change caller.
14802         (class Layout): Declare print_to_mapfile.
14803         * output.cc (Output_section::Input_section::print_to_mapfile): New
14804         function.
14805         (Output_section::add_input_section): If producing a map, always
14806         add to input_sections_ list.
14807         (Output_section::do_print_to_mapfile): New function.
14808         (Output_segment::print_sections_to_mapfile): New function.
14809         (Output_segment::print_section_list_to_mapfile): New function.
14810         * output.h: Include "mapfile.h".
14811         (Output_data::print_to_mapfile): New function.
14812         (Output_data::do_print_to_mapfile): New virtual function.
14813         (Output_segment_headers::do_print_to_mapfile): New function.
14814         (Output_file_header::do_print_to_mapfile): New function.
14815         (Output_data_const::do_print_to_mapfile): New function.
14816         (class Output_data_const_buffer): Add map_name_ field.  Update
14817         constructor.  Change all callers.  Add do_print_to_mapfile
14818         function.
14819         (class Output_data_fixed_space): Likewise.
14820         (class Output_data_space): Likewise.
14821         (class Output_data_zero_fill): New class.
14822         (Output_data_strtab::do_print_to_mapfile): New function.
14823         (Output_data_reloc_base::do_print_to_mapfile): New function.
14824         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14825         (Output_data_group::do_print_to_mapfile): New function.
14826         (Output_data_got::do_print_to_mapfile): New function.
14827         (Output_data_dynamic::do_print_to_mapfile): New function.
14828         (Output_symtab_xindex::do_print_to_mapfile): New function.
14829         (class Output_section): Declare do_print_to_mapflie.  Declare
14830         print_to_mapfile in Input_section.
14831         (class Output_segment): Declare new functions.
14832         * object.h (Sized_relobj::symbol_count): New function.
14833         * script-sections.cc
14834         (Output_section_element_dot_assignment::set_section_addresses):
14835         Change Output_data_fixed_space to Output_data_zero_fill.
14836         (Output_data_expression::do_print_to_mapfile): New function.
14837         * script.cc (read_input_script): Add mapfile parameter.  Change
14838         all callers.
14839         * script.h (read_input_script): Update declaration.
14840         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14841         (Eh_frame::do_print_to_mapfile): New function.
14842         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14843         (Output_merge_string::do_print_to_mapfile): New function.
14844         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14845         function.
14846         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14847         function.
14848         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14849         function.
14850         * Makefile.am (CCFILES): Add mapfile.cc.
14851         (HFILES): Add mapfile.h.
14852         * Makefile.in: Rebuild.
14853
14854 2008-05-19  Ian Lance Taylor  <iant@google.com>
14855
14856         * options.h (class General_options): Add -z relro.
14857         * layout.cc (Layout::Layout): Initialize relro_segment_.
14858         (Layout::add_output_section_data): Return the output section.
14859         (Layout::make_output_section): Rcognize relro sections and mark
14860         them appropriately.
14861         (Layout::attach_allocated_section_to_segment): Put relro sections
14862         in a PT_GNU_RELRO segment.
14863         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14864         section as relro.
14865         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14866         PT_TLS segments.
14867         (Layout::linkonce_mapping): Map d.rel.ro.local to
14868         .data.rel.ro.local.
14869         (Layout::output_section_name): Us .data.rel.ro.local for any
14870         section which begins with that.
14871         * layout.h (class Layout): Update add_output_section_data
14872         declaration.  Add relro_segment_ field.
14873         * output.cc (Output_section::Output_section): Initialize is_relro_
14874         and is_relro_local_ fields.
14875         (Output_segment::add_output_section): Group relro sections.
14876         (Output_segment::is_first_section_relro): New function.
14877         (Output_segment::maximum_alignment): If there is a relro section,
14878         align the segment to the common page size.
14879         (Output_segment::set_section_addresses): Track whether we are
14880         looking at relro sections.  If the last section is a relro
14881         section, align to the common page size.
14882         (Output_segment::set_section_list_addresses): Add in_relro
14883         parameter.  Change all callers.  Align to the page size when
14884         moving from relro to non-relro section.
14885         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14886         segment.
14887         * output.h (class Output_section): Add is_relro_ and
14888         is_relro_local_ fields.
14889         (Output_section::is_relro): New function.
14890         (Output_section::set_is_relro): New function.
14891         (Output_section::is_relro_local): New function.
14892         (Output_section::set_is_relro_local): New function.
14893         (class Output_segment): Update declarations.
14894         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14895         * sparc.cc (Target_sparc::got_section): Likewise.
14896         * x86_64.cc (Target_x86_64::got_section): Likewise.
14897         * testsuite/relro_test_main.cc: New file.
14898         * testsuite/relro_test.cc: New file.
14899         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14900         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14901         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14902         (relro_test.so, relro_test_pic.o): New targets.
14903         * testsuite/Makefile.in: Rebuild.
14904
14905 2008-05-16  Ian Lance Taylor  <iant@google.com>
14906
14907         * output.cc (Output_segment::add_output_section): Remove front
14908         parameter.
14909         * output.h (class Output_segment): Remove
14910         add_initial_output_section and overloaded add_output_section.
14911         Update declaration of remaining add_output_section.
14912         * layout.cc (Layout::create_interp): Call add_output_section
14913         rather than add_initial_output_section.
14914         (Layout::finish_dynamic_section): Likewise.
14915
14916         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14917         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14918         know the dynamic type.
14919         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14920         field.  Initialize it in constructor.
14921         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14922         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14923         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14924         reloc.
14925
14926         * output.cc (Output_reloc::get_address): Change return type to
14927         Elf_Addr.
14928         * output.h (class Output_reloc): Update get_address declaration.
14929         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14930         for section addresses.
14931
14932 2008-05-09  Ian Lance Taylor  <iant@google.com>
14933
14934         PR 6493
14935         * gold.cc (gold_nomem): Use return value of write.
14936
14937 2008-05-08  Ian Lance Taylor  <iant@google.com>
14938
14939         * symtab.c (Symbol::init_base_output_data): Add version
14940         parameter.  Change all callers.
14941         (Symbol::init_base_output_segment): Likewise.
14942         (Symbol::init_base_constant): Likewise.
14943         (Symbol::init_base_undefined): Likewise.
14944         (Sized_symbol::init_output_data): Likewise.
14945         (Sized_symbol::init_output_segment): Likewise.
14946         (Sized_symbol::init_constant): Likewise.
14947         (Sized_symbol::init_undefined): Likewise.
14948         (Symbol_table::do_define_in_output_data): If the new symbol has a
14949         version, mark it as the default.
14950         (Symbol_table::do_define_in_output_segment): Likewise.
14951         (Symbol_table::do_define_as_constant): Likewise.
14952         * symtab.h (class Symbol): Update declarations.
14953         (class Sized_symbol): Likewise.
14954         * resolve.cc (Symbol::override_version): New function.
14955         (Symbol::override_base): Call override_version.
14956         (Symbol::override_base_with_special): Likewise.
14957         * testsuite/ver_script_8.script: New file.
14958         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14959         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14960         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14961         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14962
14963 2008-05-06  Ian Lance Taylor  <iant@google.com>
14964
14965         PR 6049
14966         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14967         functions.
14968         (class General_options): Remove existing --undefined, and add
14969         --no-undefined instead.  Add new --undefined as synonym for -u.
14970         * archive.cc (Archive::add_symbols): Check whether symbol was
14971         named with -u.
14972         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14973         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14974         all uses.  Add IS_UNDEFINED.  Update declarations to split
14975         different versions of init_base.  Declare init_base_undefined.
14976         (Symbol::is_defined): Handle IS_UNDEFINED.
14977         (Symbol::is_undefined): Likewise.
14978         (Symbol::is_weak_undefined): Call is_undefined.
14979         (Symbol::is_absolute): Handle IS_CONSTANT.
14980         (class Sized_symbol): Update declarations to split different
14981         versions of init.  Declare init_undefined.
14982         (class Symbol_table): Declare new functions.
14983         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14984         Change all callers.
14985         (Symbol::init_base_output_data): Likewise.
14986         (Symbol::init_base_output_segment): Likewise.
14987         (Symbol::init_base_constant): Likewise.
14988         (Symbol::init_base_undefined): New function.
14989         (Sized_symbol::init_object): Rename from init.  Change all
14990         callers.
14991         (Sized_symbol::init_output_data): Likewise.
14992         (Sized_symbol::init_output_segment): Likewise.
14993         (Sized_symbol::init_constant): Likewise.
14994         (Sized_symbol::init_undefined): New function.
14995         (Symbol_table::add_undefined_symbols_from_command_line): New
14996         function.
14997         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14998         function.
14999         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15000         (Symbol::output_section): Likewise.
15001         (Symbol::set_output_section): Likewise.
15002         (Symbol_table::sized_finalize_symbol): Likewise.
15003         (Symbol_table::sized_write_globals): Likewise.
15004         * resolve.cc (Symbol_table::should_override): Likewise.
15005         (Symbol::override_base_with_special): Likewise.
15006
15007         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15008         symbol, change it to have default visibility.
15009         * testsuite/protected_1.cc: New file.
15010         * testsuite/protected_2.cc: New file.
15011         * testsuite/protected_3.cc: New file.
15012         * testsuite/protected_main_1.cc: New file.
15013         * testsuite/protected_main_2.cc: New file.
15014         * testsuite/protected_main_3.cc: New file.
15015         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15016         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15017         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15018         (protected_1.so): New target.
15019         (protected_1_pic.o, protected_2_pic.o): New targets.
15020         (protected_3_pic.o): New target.
15021         (check_PROGRAMS): Add protected_2.
15022         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15023         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15024         * testsuite/Makefile.in: Rebuild.
15025
15026         * options.h (DEFINE_var): Add set_user_set_##varname__.
15027         (DEFINE_bool_alias): New macro.
15028         (class General_options): Define -Bstatic using DEFINE_bool_alias
15029         rather than DEFINE_special.  Add --undefined as an alias for -z
15030         defs.
15031         * options.cc (General_options::parse_Bstatic): Remove.
15032
15033         * options.h (class General_options): Add --fatal-warnings.
15034         * main.cc (main): Implement --fatal-warnings.
15035         * errors.h (Errors::warning_count): New function.
15036
15037         * options.h (class General_options): Add -Bsymbolic-functions.
15038         * symtab.h (Symbol::is_preemptible): Check for
15039         -Bsymbolic-functions.
15040
15041 2008-05-05  Ian Lance Taylor  <iant@google.com>
15042
15043         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15044         as noVARNAME rather than no-VARNAME.
15045         (class General_options): Add option -z combreloc.
15046         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15047         get_address.
15048         (Output_reloc::sort_before) [SHT_REL]: New function.
15049         (Output_reloc::sort_before) [SHT_RELA]: New function.
15050         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15051         Sort_relocs_comparison.
15052         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15053         parameter.  Change all callers.
15054         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15055         sort_relocs parameter.  Change all callers.
15056         * output.cc (Output_reloc::get_address): New function, broken out
15057         of write_rel.
15058         (Output_reloc::write_rel): Call it.
15059         (Output_reloc::compare): New function.
15060         (Output_data_reloc_base::do_write): Optionally sort relocs.
15061
15062         * configure.ac: If targ_extra_obj is set, link it in.
15063         * configure.tgt: Initialize all variables.
15064         (x86_64*): Set targ_extra_obj and targ_extra_size.
15065         * configure: Rebuild.
15066
15067         * object.cc (Sized_relobj::include_section_group): Adjust section
15068         indexes read from group data.  Build vector to pass to
15069         layout_group.
15070         * layout.cc (Layout::layout_group): Add flags and shndxes
15071         parameters.  Remove contents parameter.  Change caller.  Update
15072         explicit instantiations.
15073         * layout.h (class Layout): Update layout_group declaration.
15074         * output.cc (Output_data_group::Output_data_group): Add flags and
15075         input_shndxes parameters.  Remove contents parameter.  Change
15076         caller.
15077         (Output_data_group::do_write): Change input_sections_ to
15078         input_shndxes_.
15079         * output.h (class Output_data_group): Update constructor
15080         declaration.  Rename input_sections_ to input_shndxes_.
15081         * testsuite/many_sections_test.cc: Add template.
15082
15083 2008-04-30  Cary Coutant  <ccoutant@google.com>
15084
15085         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15086
15087         * layout.cc (Layout::include_section): Refactored check for debug
15088         info section.
15089         (Layout::add_comdat): Add new parameters.  Change type
15090         of signature parameter.  Add object and shndx to signatures table.
15091         (Layout::find_kept_object): New function.
15092         * layout.h: Include <cstring>.
15093         (Layout::is_debug_info_section): New function.
15094         (Layout::add_comdat): Add new parameters.
15095         (Layout::find_kept_object): New function.
15096         (Layout::Kept_section): New struct.
15097         (Layout::Signatures): Change type of map range.
15098         * object.cc (Relobj::output_section_address): New function.
15099         (Sized_relobj::include_section_group): Add new parameters.  Change
15100         calls to Layout::add_comdat.  Change to build table of kept comdat
15101         groups and table mapping discarded sections to kept sections.
15102         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15103         (Sized_relobj::do_layout): Change calls to include_section_group and
15104         include_linkonce_section.
15105         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15106         value to zero when section is discarded.
15107         (Sized_relobj::map_to_kept_section): New function.
15108         * object.h (Relobj::output_section_address): New function.
15109         (Relobj::Comdat_group): New type.
15110         (Relobj::find_comdat_group): New function.
15111         (Relobj::Comdat_group_table): New type.
15112         (Relobj::Kept_comdat_section): New type.
15113         (Relobj::Kept_comdat_section_table): New type.
15114         (Relobj::add_comdat_group): New function.
15115         (Relobj::set_kept_comdat_section): New function.
15116         (Relobj::get_kept_comdat_section): New function.
15117         (Relobj::comdat_groups_): New field.
15118         (Relobj::kept_comdat_sections_): New field.
15119         (Symbol_value::input_value): Update comment.
15120         (Sized_relobj::map_to_kept_section) New function.
15121         (Sized_relobj::include_linkonce_section): Add new parameter.
15122         * target-reloc.h (Comdat_behavior): New type.
15123         (get_comdat_behavior): New function.
15124         (relocate_section): Add code to map a discarded section to the
15125         corresponding kept section when applying a relocation.
15126
15127 2008-04-30  Craig Silverstein  <csilvers@google.com>
15128
15129         * dwarf_reader.cc (next_generation_count): New static var.
15130         (Addr2line_cache_entry): New struct.
15131         (addr2line_cache): New static var.
15132         (Dwarf_line_info::one_addr2line): Added caching.
15133         (Dwarf_line_info::clear_addr2line_cache): New function.
15134         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15135         cache-size parameter.
15136         (Dwarf_line_info::one_addr2line_cache): New function.
15137         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15138         new cache-size argument to one_addr2line(), and clear cache.
15139
15140 2008-04-28  Cary Coutant  <ccoutant@google.com>
15141
15142         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15143         R_386_PC8 relocations.
15144
15145 2008-04-23  Ian Lance Taylor  <iant@google.com>
15146
15147         * object.cc (Sized_relobj::include_section_group): Check for
15148         invalid section group.
15149
15150         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15151         header size.
15152
15153         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15154         than read for file header.
15155         * archive.cc (Archive::include_member): Likewise.
15156
15157 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15158
15159         * aclocal.m4: Regenerate.
15160         * configure: Regenerate.
15161
15162 2008-04-19  Ian Lance Taylor  <iant@google.com>
15163
15164         * version.cc (version_string): Bump to 1.6.
15165
15166         * testsuite/Makefile.am (many_sections_r_test): New target.
15167         (many_sections_r_test_SOURCES): Remove.
15168         (many_sections_r_test_DEPENDENCIES): Remove.
15169         (many_sections_r_test_LDFLAGS): Remove.
15170         (many_sections_r_test_LDADD): Remove.
15171
15172         * object.cc (Sized_relobj::do_add_symbols): Always pass
15173         local_symbol_count_ to add_from_relobj.
15174
15175         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15176         every thousand variables.
15177         * testsuite/Makefile.in: Rebuild.
15178
15179         * object.cc (Xindex::initialize_symtab_xindex): New function.
15180         (Xindex::read_symtab_xindex): New function.
15181         (Xindex::sym_xindex_to_shndx): New function.
15182         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15183         available.
15184         (Sized_relobj::do_initialize_xindex): New function.
15185         (Sized_relobj::do_read_symbols): Adjust section links.
15186         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15187         parameter.  Change all callers.
15188         (Sized_relobj::include_section_group): Adjust section links and
15189         symbol section indexes.
15190         (Sized_relobj::do_layout): Adjust section links.
15191         (Sized_relobj::do_count_local_symbols): Adjust section links and
15192         symbol section indexes.
15193         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15194         ordinary and special symbols.
15195         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15196         dynsym_xindex parameters.  Change all callers.  Adjust section
15197         links.  Use SHN_XINDEX when needed.
15198         (Sized_relobj::get_symbol_location_info): Adjust section links.
15199         Don't get fooled by special symbols.
15200         * object.h (class Xindex): Define.
15201         (class Object): Add xindex_ parameter.  Declare virtual functoin
15202         do_initialize_xindex.
15203         (Object::adjust_sym_shndx): New function.
15204         (Object::set_xindex): New protected function.
15205         (class Symbol_value): Add is_ordinary_shndx_ field.
15206         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15207         (Symbol_value::value): Assert ordinary section.
15208         (Symbol_value::initialize_input_to_output_map): Likewise.
15209         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15210         Change all callers.
15211         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15212         all callers.
15213         (class Sized_relobj): Update declarations.
15214         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15215         parameter.  Change all callers.
15216         (Sized_relobj::adjust_shndx): New function.
15217         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15218         field.
15219         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15220         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15221         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15222         (Sized_dynobj::read_dynsym_section): Adjust section links.
15223         (Sized_dynobj::read_dynamic): Likewise.
15224         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15225         section links.
15226         (Sized_dynobj::do_initialize_xindex): New function.
15227         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15228         do_initialize_xindex.
15229         (Sized_dynobj::adjust_shndx): New function.
15230         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15231         dynsym_xindex_ fields.
15232         (Layout::finalize): Add a call to set_section_indexes before
15233         creating the symtab sections.
15234         (Layout::set_section_indexes): Don't do anything if the section
15235         already has a section index.
15236         (Layout::create_symtab_sections): Add shnum parameter.  Change
15237         caller.  Create .symtab_shndx section if needed.
15238         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15239         caller.
15240         (Layout::allocated_output_section_count): New function.
15241         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15242         needed.
15243         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15244         fields.  Update declarations.
15245         (Layout::symtab_xindex): New function.
15246         (Layout::dynsym_xindex): New function.
15247         (class Write_symbols_task): Add layout_ field.
15248         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15249         Change caller.
15250         * output.cc (Output_section_headers::Output_section_headers): Add
15251         shstrtab_section parameter.  Change all callers.
15252         (Output_section_headers::do_sized_write): Store overflow values
15253         for section count and section string table section index in
15254         section header zero.
15255         (Output_file_header::do_sized_write): Check for overflow of
15256         section count and section string table section index.
15257         (Output_symtab_xindex::do_write): New function.
15258         (Output_symtab_xindex::endian_do_write): New function.
15259         * output.h (class Output_section_headers): Add shstrtab_section_.
15260         Update declarations.
15261         (class Output_symtab_xindex): Define.
15262         (Output_section::has_out_shndx): New function.
15263         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15264         field.
15265         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15266         Change all callers.
15267         (Sized_symbol::init): Likewise.
15268         (Symbol::output_section): Check for ordinary symbol.
15269         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15270         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15271         callers.
15272         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15273         Change all callers.  Simplify handling of symbols from sections
15274         not included in the link.
15275         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15276         distinction.
15277         (Weak_alias_sorter::operator()): Assert that symbols are
15278         ordinary.
15279         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15280         distinction.
15281         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15282         parameters.  Change all callers.
15283         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15284         symbol distinction.  Use SHN_XINDEX when needed.
15285         (Symbol_table::write_section_symbol): Add symtab_xindex
15286         parameter.  Change all callers.
15287         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15288         SHN_XINDEX when needed.
15289         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15290         declarations.
15291         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15292         (Symbol::is_defined): Check is_ordinary.
15293         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15294         (Symbol::is_absolute, Symbol::is_common): Likewise.
15295         (class Sized_symbol): Update declarations.
15296         (class Symbol_table): Update declarations.
15297         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15298         parameters.  Change all callers.
15299         (Sized_symbol::override): Likewise.
15300         (Symbol_table::override): Likewise.
15301         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15302         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15303         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15304         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15305         to be in an ordinary section.
15306         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15307         object and is_ordinary parameters.  Change all callers.
15308         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15309         Change all callers.  Don't add undefined or non-ordinary symbols
15310         to reloc_map_.
15311         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15312         Change all callers.
15313         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15314         declarations.
15315         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15316         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15317         (Sized_relobj::relocate_sections): Likewise.
15318         * target-reloc.h (scan_relocs): Adjust section symbol index.
15319         (scan_relocatable_relocs): Likewise.
15320         * i386.cc (Scan::local): Check for ordinary symbols.
15321         * sparc.cc (Scan::local): Likewise.
15322         * x86_64.cc (Scan::local): Likewise.
15323         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15324         to symbol_section_and_value.
15325         * testsuite/many_sections_test.cc: New file.
15326         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15327         (check_PROGRAMS): Add many_sections_test.
15328         (many_sections_test_SOURCES): Define.
15329         (many_sections_test_DEPENDENCIES): Define.
15330         (many_sections_test_LDFLAGS): Define.
15331         (BUILT_SOURCES): Add many_sections_define.h.
15332         (many_sections_define.h): New target.
15333         (BUILT_SOURCES): Add many_sections_check.h.
15334         (many_sections_check.h): New target.
15335         (check_PROGRAMS): Add many_sections_r_test.
15336         (many_sections_r_test_SOURCES): Define.
15337         (many_sections_r_test_DEPENDENCIES): Define.
15338         (many_sections_r_test_LDFLAGS): Define.
15339         (many_sections_r_test_LDADD): Define.
15340         (many_sections_r_test.o): New target.
15341         * testsuite/Makefile.in: Rebuild.
15342
15343 2008-04-17  Cary Coutant  <ccoutant@google.com>
15344
15345         * errors.cc (Errors::info): New function.
15346         (gold_info): New function.
15347         * errors.h (Errors::info): New function.
15348         * gold.h (gold_info): New function.
15349         * object.cc (Input_objects::add_object): Print trace output.
15350         * options.cc (options::parse_set): New function.
15351         (General_options::parse_wrap): Deleted.
15352         (General_options::General_options): Deleted initializer.
15353         * options.h (options::String_set): New typedef.
15354         (options::parse_set): New function.
15355         (DEFINE_set): New macro.
15356         (General_options::wrap): Changed to use DEFINE_set. Changed
15357         callers of any_wrap_symbols and is_wrap_symbol.
15358         (General_options::trace, General_options::trace_symbol):
15359         New options.
15360         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15361         (General_options::wrap_symbols_): Deleted.
15362         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15363
15364 2008-04-17  David S. Miller  <davem@davemloft.net>
15365
15366         * options.cc (General_options::parse_V): New function.
15367         * options.h: Add entries for -V and -Qy.
15368
15369 2008-04-17  Ian Lance Taylor  <iant@google.com>
15370
15371         * common.cc (Symbol_table::allocate_commons): Remove options
15372         parameter.  Change caller.
15373         (Symbol_table::do_allocate_commons): Remove options parameter.
15374         Change caller.  Just call do_allocate_commons_list twice.
15375         (Symbol_table::do_allocate_commons_list): New function, broken out
15376         of do_allocate_commons.
15377         * common.h (class Allocate_commons_task): Remove options_ field.
15378         Update constructor.
15379         * symtab.cc (Symbol_table::Symbol_table): Initialize
15380         tls_commons_.
15381         (Symbol_table::add_from_object): Put TLS common symbols on
15382         tls_commons_ list.
15383         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15384         which are IN_OUTPUT_DATA.
15385         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15386         allocate_commons and do_allocate_commons declarations.  Declare
15387         do_allocate_commons_list.
15388         * gold.cc (queue_middle_tasks): Update creation of
15389         Allocate_commons_task to not pass options.
15390         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15391         (TLS_TEST_C_FLAGS): New variable.
15392         (tls_test_c_pic.o): New target.
15393         (tls_test_shared.so): Link in tls_test_c_pic.o.
15394         (tls_test_c_pic_ie.o): New target.
15395         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15396         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15397         (tls_test_c.o): New target.
15398         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15399         (tls_pic_test_LDADD): Likewise.
15400         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15401         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15402         (tls_test_c_gnu2.o): New target.
15403         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15404         tls_test_c_gnu2.o.
15405         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15406         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15407         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15408         * testsuite/tls_test.cc: Include "config.h".
15409         (t_last): Call t11_last.
15410         * testsuite/tls_test.h (t11, t11_last): Declare.
15411         * testsuite/tls_test_c.c: New file.
15412         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15413         * configure.ac: Check for OpenMP support.
15414         * configure, config.in, Makefile.in: Rebuild.
15415         * testsuite/Makefile.in: Rebuild.
15416
15417 2008-04-16  Cary Coutant  <ccoutant@google.com>
15418
15419         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15420         (Target_i386::tls_base_symbol_defined_): New field.
15421         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15422         (Target_i386::Scan::global): Likewise.
15423         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15424         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15425         (Target_x86_64::tls_base_symbol_defined_): New field.
15426         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15427         (Target_x86_64::Scan::global): Likewise.
15428
15429 2008-04-16  Cary Coutant  <ccoutant@google.com>
15430
15431         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15432         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15433         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15434         building shared libraries.
15435         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15436         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15437         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15438         * testsuite/Makefile.in: Rebuild.
15439         * testsuite/weak_undef.h: New file.
15440         * testsuite/weak_undef_file1.cc: Add extra test cases.
15441         * testsuite/weak_undef_file2.cc: Likewise.
15442         * testsuite/weak_undef_test.cc: Likewise.
15443
15444 2008-04-16  David S. Miller  <davem@davemloft.net>
15445
15446         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15447         Add issued_non_pic_error_ field.  Declare check_non_pic.
15448         (Target_sparc::Scan::check_non_pic): New function.
15449         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15450         (Target_sparc::Scan::global): Likewise.
15451
15452         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15453         * configure: Rebuild.
15454
15455         * options.h (DEFINE_enable): New macro.
15456         (new_dtags): New enable option.
15457         (initfirst, interpose, loadfltr, nodefaultlib,
15458         nodelete, nodlopen, nodump): New -z options.
15459         * layout.cc (Layout:finish_dynamic_section): If new
15460         dtags enabled, emit DT_RUNPATH.  Also, emit a
15461         DT_FLAGS_1 containing any specified -z flags.
15462
15463 2008-04-16  Ian Lance Taylor  <iant@google.com>
15464
15465         * copy-relocs.cc: New file.
15466         * copy-relocs.h: New file.
15467         * reloc.cc: Remove Copy_relocs code.
15468         * reloc.h: Likewise.
15469         * reloc-types.h (struct Reloc_types) [both versions]: Add
15470         get_reloc_addend_noerror.
15471         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15472         variants of add_global which take an addend which must be zero.
15473         * i386.cc: Include "copy-relocs.h".
15474         (class Target_i386): Change type of copy_relocs_ to variable,
15475         update initializer.
15476         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15477         Change all callers.
15478         (Target_i386::do_finalize_sections): Change handling of
15479         copy_relocs_.
15480         * sparc.cc: Include "copy-relocs.h".
15481         (class Target_sparc): Change type of copy_relocs_ to variable,
15482         update initializer.
15483         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15484         Change all callers.
15485         (Target_sparc::do_finalize_sections): Change handling of
15486         copy_relocs_.
15487         * x86_64.cc: Include "copy-relocs.h".
15488         (class Target_x86_64): Change type of copy_relocs_ to variable,
15489         update initializer.
15490         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15491         class.  Change all callers.
15492         (Target_x86_64::do_finalize_sections): Change handling of
15493         copy_relocs_.
15494         * Makefile.am (CCFILES): Add copy-relocs.cc.
15495         (HFILES): Add copy-relocs.h.
15496
15497         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15498
15499         * testsuite/script_test_4.sh: Permit leading zeroes.
15500
15501 2008-04-15  Ian Lance Taylor  <iant@google.com>
15502
15503         * script-sections.cc (Script_sections::create_segments): Use
15504         header_size_adjustment even when there is enough room for the
15505         headers.
15506         * testsuite/script_test_4.sh: New file.
15507         * testsuite/script_test_4.t: New file.
15508         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15509         (check_DATA): Add script_test_4.stdout.
15510         (MOSTLYCLEANFILES): Likewise.
15511         (script_test_4): New target.
15512         (script_test_4.stdout): New target.
15513         * testsuite/Makefile.in: Rebuild.
15514
15515         * sparc.cc: Add definitions for Output_data_plt_sparc class
15516         constants.
15517
15518 2008-04-14  David S. Miller  <davem@davemloft.net>
15519
15520         * sparc.cc: New file.
15521         * Makefile.am (TARGETSOURCES): Add sparc.cc
15522         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15523         * configure.tgt: Document targ_extra_size and
15524         targ_extra_big_endian.  Add entries for sparc-* and
15525         sparc64-*.
15526         * configure.ac: Handle targ_extra_size and
15527         targ_extra_big_endian.
15528         * Makefile.in: Rebuild.
15529         * configure: Likewise.
15530         * po/POTFILES.in: Likewise.
15531         * po/gold.pot: Likewise.
15532
15533 2008-04-14  Ian Lance Taylor  <iant@google.com>
15534
15535         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15536         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15537         in the name/type/flags to section mapping.  Don't call
15538         allocate_output_section.
15539         (Layout::choose_output_section): Change parameter from adjust_name
15540         to is_input_section.  Don't permit input sections after sections
15541         are attached to segments.  Don't call allocate_output_section.
15542         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15543         not write_enable_output_section.
15544         (Layout::make_output_section): Don't push to
15545         unattached_section_list_ nor call attach_to_segment.  Call
15546         attach_section_to_segment if sections are attached.
15547         (Layout::attach_sections_to_segments): New function.
15548         (Layout::attach_section_to_segment): New function.
15549         (Layout::attach_allocated_section_to_segment): Rename from
15550         attach_to_segment.  Remove flags parameter.
15551         (Layout::allocate_output_section): Remove function.
15552         (Layout::write_enable_output_section): Remove function.
15553         * layout.h (class Layout): Update for above changes.  Add new
15554         field sections_are_attached_.
15555         * output.h (Output_section::update_flags_for_input_section): New
15556         function.
15557         * output.cc (Output_section::add_input_section): Call
15558         update_flags_for_input_section.
15559         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15560
15561 2008-04-11  Cary Coutant  <ccoutant@google.com>
15562
15563         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15564         thought unnecessary.
15565         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15566
15567 2008-04-11  Ian Lance Taylor  <iant@google.com>
15568
15569         * output.h (class Output_section_data): Remove inline definition
15570         of set_addralign.
15571         * output.cc (Output_section_data::set_addralign): New function.
15572
15573 2008-04-11  Cary Coutant  <ccoutant@google.com>
15574
15575         Add support for TLS descriptors for i386 and x86_64.
15576         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15577         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15578         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15579         GOT_TYPE_TLS_DESC.
15580         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15581         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15582         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15583         relocations.
15584         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15585         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15586         Fix problem with initial-exec relocations.
15587         (Target_i386::Relocate::relocate_tls): Likewise.
15588         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15589         relaxation.
15590         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15591         support for section-plus-offset dynamic table entries.
15592         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15593         (Output_data_dynamic::Dynamic_entry): Add support for
15594         section-plus-offset dynamic table entries.
15595         (Output_data_dynamic::Classification): Likewise.
15596         (Output_data_dynamic::classification_): Renamed offset_.
15597         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15598         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15599         (Target_x86_64::make_plt_section): New function.
15600         (Target_x86_64::reserve_tlsdesc_entries): New function.
15601         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15602         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15603         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15604         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15605         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15606         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15607         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15608         add extra PLT entry for TLS descriptors.
15609         (Output_data_plt_x86_64::got_): New field.
15610         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15611         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15612         fields.
15613         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15614         descriptors.
15615         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15616         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15617         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15618         R_386_TLS_DESC_CALL relocations.
15619         (Target_x86_64::Scan::global): Likewise.
15620         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15621         for TLS descriptors.
15622         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15623         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15624         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15625         GD-to-IE relaxation.
15626         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15627         and TLS_DESCRIPTORS.
15628         * Makefile.in: Rebuild.
15629         * configure: Rebuild.
15630         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15631         (tls_test_shared2.so): New target.
15632         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15633         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15634         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15635         (tls_shared_gd_to_ie_test_LDADD): New variable.
15636         (tls_shared_gnu2_gd_to_ie_test): New target.
15637         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15638         New targets.
15639         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15640         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15641         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15642         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15643         (tls_shared_gnu2_test): New target.
15644         (tls_test_gnu2_shared.so): New target.
15645         (tls_shared_gnu2_test_SOURCES): New variable.
15646         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15647         (tls_shared_gnu2_test_LDFLAGS): New variable.
15648         (tls_shared_gnu2_test_LDADD): New variable.
15649         * testsuite/Makefile.in: Rebuild.
15650         * testsuite/Makefile.
15651
15652 2008-04-11  Ian Lance Taylor  <iant@google.com>
15653
15654         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15655         justsyms.t.
15656         * testsuite/Makefile.in: Rebuild.
15657
15658         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15659         long.
15660         * testsuite/script_test_2.cc (main): Adjust test.
15661
15662 2008-04-11  David S. Miller  <davem@davemloft.net>
15663             Ian Lance Taylor  <iant@google.com>
15664
15665         * options.h (General_options): Add entries for '-Y' and
15666         '-relax'.
15667         * options.cc (General_options:finalize): If -Y was used, add those
15668         entries to the library path instead of the default "/lib" and
15669         "/usr/lib".
15670
15671 2008-04-11  David S. Miller  <davem@davemloft.net>
15672
15673         * testsuite/justsyms.t: Start at 0x100.
15674         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15675         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15676         long.
15677         * testsuite/script_test_2.cc: Adjust string and section length
15678         checks.
15679
15680 2008-04-09  Ian Lance Taylor  <iant@google.com>
15681
15682         PR gold/5996
15683         * script-sections.cc (Sections_element::allocate_to_segment): Add
15684         orphan parameter.
15685         (Output_section_definition::allocate_to_segment): Likewise.
15686         (Orphan_output_section::allocate_to_segment): Likewise.
15687         (Script_sections::attach_sections_using_phdrs_clause): Don't
15688         propagate non-PT_LOAD segments to orphan sections.
15689         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15690         readelf rather than objdump.
15691         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15692         .interp section and PT_INTERP segment are the same size.
15693         * testsuite/Makefile.in: Rebuild.
15694
15695         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15696         aliases for symbols defined in the same object.
15697         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15698         (weak_alias_test_SOURCES): New variable.
15699         (weak_alias_test_DEPENDENCIES): New variable.
15700         (weak_alias_test_LDFLAGS): New variable.
15701         (weak_alias_test_LDADD): New variable.
15702         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15703         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15704         (weak_alias_test_3.o): New target.
15705         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15706         * testsuite/weak_alias_test_main.cc: New file.
15707         * testsuite/weak_alias_test_1.cc: New file.
15708         * testsuite/weak_alias_test_2.cc: New file.
15709         * testsuite/weak_alias_test_3.cc: New file.
15710
15711 2008-04-08  Ian Lance Taylor  <iant@google.com>
15712
15713         * options.h (class General_options): Add --noinhibit-exec option.
15714         * main.cc (main): Check --noinhibit-exec.
15715
15716         * options.h (class General_options): Define --wrap as a special
15717         option.  Add wrap_symbols_ field.
15718         (General_options::any_wrap_symbols): New function.
15719         (General_options::is_wrap_symbol): New function.
15720         * options.cc (General_options::parse_wrap): New function.
15721         (General_options::General_options): Initialize wrap_symbols_.
15722         * symtab.cc (Symbol_table::wrap_symbol): New function.
15723         (Symbol_table::add_from_object): Handle --wrap.
15724         * symtab.h (class Symbol_table): Declare wrap_symbol.
15725         * target.h (Target::wrap_char): New function.
15726         (Target::Target_info): Add wrap_char field.
15727         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15728         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15729         * testsuite/testfile.cc (Target_test::test_target_info):
15730         Likewise.
15731
15732         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15733         there is one.
15734
15735         * layout.h (class Layout): Add added_eh_frame_data_ field.
15736         * layout.cc (Layout::Layout): Initialize new field.
15737         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15738         output section until we find a section we merged successfully.
15739         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15740         that the size be non-zero.
15741
15742         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15743         qualifier.
15744
15745 2008-04-08  Craig Silverstein  <csilvers@google.com>
15746
15747         * configure.ac: Export new conditional variable HAVE_ZLIB.
15748         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15749         on HAVE_ZLIB.
15750         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15751         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15752
15753 2008-04-07  Ian Lance Taylor  <iant@google.com>
15754
15755         * version.cc (version_string): Set to "1.5".
15756
15757         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15758         Add issued_non_pic_error_ field.  Declare check_non_pic.
15759         (Target_x86_64::Scan::check_non_pic): New function.
15760         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15761         (Target_x86_64::Scan::global): Likewise.
15762
15763         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15764         addend parameter.  Change caller.  Handle merge sections.
15765         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15766         Address to Addend.  Don't add in the result of
15767         local_section_offset, pass down the addend and use the returned
15768         value.
15769         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15770         Update declarations of local_section_offset and symbol_value.
15771         * testsuite/two_file_test_1.cc (t18): New function.
15772         * testsuite/two_file_test_2.cc (f18): New function.
15773         * testsuite/two_file_test_main.cc (main): Call t18.
15774         * testsuite/two_file_test.h (t18, f18): Declare.
15775
15776         * configure.ac: Don't test for objdump, c++filt, or readelf.
15777         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15778         conditionals.
15779         (TEST_READELF): New variable.
15780         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15781         (check_PROGRAMS): Add two_file_strip_test.
15782         (two_file_strip_test): New target.
15783         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15784         (two_file_same_shared_strip_test_SOURCES): New variable.
15785         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15786         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15787         (two_file_same_shared_strip_test_LDADD): New variable.
15788         (two_file_shared_strip.so): New target.
15789         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15790         (ver_test_5.syms, ver_test_7.syms): Likewise.
15791         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15792         (strip_test_3.stdout): Use TEST_OBJDUMP.
15793         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15794
15795 2008-04-04  Cary Coutant  <ccoutant@google.com>
15796
15797         * symtab.h (Symbol::is_weak_undefined): New function.
15798         (Symbol::is_strong_undefined): New function.
15799         (Symbol::is_absolute): New function.
15800         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15801         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15802         absolute symbols.
15803         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15804         (weak_undef_test): New target.
15805         * testsuite/Makefile.in: Rebuild.
15806         * testsuite/weak_undef_file1.cc: New file.
15807         * testsuite/weak_undef_file2.cc: New file.
15808         * testsuite/weak_undef_test.cc: New file.
15809
15810 2008-04-03  Craig Silverstein  <csilvers@google.com>
15811
15812         * compressed_output.h (class Output_compressed_section): Use
15813         unsigned buffer.
15814         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15815         add zlib header.
15816         (zlib_compressed_suffix): Removed.
15817         (Output_compressed_section::set_final_data_size): Use unsigned
15818         buffers.
15819         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15820         Fix linker invocation.
15821         (flagstest_o_specialfile_and_compress_debug_sections):
15822         Likewise.
15823         * testsuite/Makefile.in: Regenerated.
15824
15825 2008-04-02  David S. Miller  <davem@davemloft.net>
15826
15827         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15828         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15829
15830 2008-04-02  Craig Silverstein  <csilvers@google.com>
15831
15832         * TODO: New file.
15833
15834 2008-04-02  Ian Lance Taylor  <iant@google.com>
15835
15836         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15837         parameters.  Update for new key type to views_.  Change all
15838         callers.
15839         (File_read::read): Adjust for byteshift in returned view.
15840         (File_read::add_view): New function, broken out of
15841         find_and_make_view.
15842         (File_read::make_view): New function, broken out of
15843         find_and_make_view.
15844         (File_read::find_or_make_view): Add offset and aligned
15845         parameters.  Rewrite accordingly.  Change all callers.
15846         (File_read::get_view): Add offset and aligned parameters.  Adjust
15847         for byteshift in return value.
15848         (File_read::get_lasting_view): Likewise.
15849         * fileread.h (class File_read): Update declarations.
15850         (class File_read::View): Add byteshift_ field.  Add byteshift to
15851         constructor.  Add byteshift method.
15852         * archive.h (Archive::clear_uncached_views): New function.
15853         (Archive::get_view): Add aligned parameter.  Change all callers.
15854         * object.h (Object::get_view): Add aligned parameter.  Change all
15855         callers.
15856         (Object::get_lasting_view): Likewise.
15857
15858         * fileread.cc (File_read::release): Don't call clear_views if
15859         there are multiple objects.
15860         * fileread.h (File_read::clear_uncached_views): New function.
15861         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15862         on the archive.
15863
15864 2008-03-31  Cary Coutant  <ccoutant@google.com>
15865
15866         Add thin archive support.
15867         * archive.cc (Archive::armagt): New const.
15868         (Archive::setup): Remove task parameter and calls to unlock.
15869         (Archive::unlock_nested_archives): New function.
15870         (Archive::read_header): Add nested_off parameter. Change
15871         all callers.
15872         (Archive::interpret_header): Likewise.
15873         (Archive::include_all_members): Change to handle thin
15874         archives.
15875         (Archive::include_member): Likewise.
15876         * archive.h (Archive::Archive): Add new parameters and
15877         initializers.
15878         (Archive::armagt): New const.
15879         (Archive::setup): Remove task parameter.
15880         (Archive::unlock_nested_archives): New function.
15881         (Archive::read_header): Add nested_off parameter.
15882         (Archive::interpret_header): Likewise.
15883         (Archive::Nested_archive_table): New typedef.
15884         (Archive::is_thin_archive_): New field.
15885         (Archive::nested_archives_): New field.
15886         (Archive::options_): New field.
15887         (Archive::dirpath_): New field.
15888         (Archive::task_): New field.
15889         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15890         for thin archives.  Pass additional parameters to
15891         Archive::Archive.  Unlock the archive file after calling
15892         Archive::setup.
15893
15894 2008-03-29  Ian Lance Taylor  <iant@google.com>
15895
15896         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15897         version symbol to be local.
15898         * testsuite/ver_test_4.sh: New file.
15899         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15900         (check_DATA): Add ver_test_4.syms.
15901         (ver_test_4.syms): New target.
15902         * testsuite/Makefile.in: Rebuild.
15903
15904         * output.cc
15905         (Output_section::Input_section_sort_entry::has_priority): New
15906         function.
15907         (Output_section::Input_section_sort_entry::match_file_name): New
15908         function.
15909         (Output_section::Input_section_sort_entry::match_section_name):
15910         Remove.
15911         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15912         Remove.
15913         (Output_section::Input_section_sort_entry::match_section_file):
15914         Remove.
15915         (Output_section::Input_section_sort_compare::operator()): Rewrite
15916         using new Input_section_sort_entry functions.  Sort crtbegin and
15917         crtend first.  Sort sections with no priority before sections with
15918         a priority.
15919         * testsuite/initpri1.c (d3): Check j != 4.
15920         (cd5): New constructor/destructor function.
15921         (main): Check j != 2.
15922
15923         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15924         new symbol when resolving, don't call set_is_default.
15925         * testsuite/ver_test_7.cc: New file.
15926         * testsuite/ver_test_7.sh: New file.
15927         * testsuite/Makefile.am (ver_test_7.so): New target.
15928         (ver_test_7.o): New target.
15929         (check_SCRIPTS): Add ver_test_7.sh.
15930         (check_DATA): Add ver_test_7.syms.
15931         (ver_test_7.syms): New target.
15932
15933 2008-03-28  Ian Lance Taylor  <iant@google.com>
15934
15935         * layout.cc (Layout::layout): If we see an input section with a
15936         name that needs sorting, set the must_sort flag for the output
15937         section.
15938         (Layout::make_output_section): If the name of the output section
15939         indicates that it might require sorting, set the may_sort flag.
15940         * output.h (Output_section::may_sort_attached_input_sections): New
15941         function.
15942         (Output_section::set_may_sort_attached_input_sections): New
15943         function.
15944         (Output_section::must_sort_attached_input_sections): New
15945         function.
15946         (Output_section::set_must_sort_attached_input_sections): New
15947         function.
15948         (class Output_section): Declare Input_section_sort_entry.  Define
15949         Input_section_sort_compare.  Declare
15950         sort_attached_input_sections.  Add new fields:
15951         may_sort_attached_input_sections_,
15952         must_sort_attached_input_sections_,
15953         attached_input_sections_are_sorted_.
15954         * output.cc (Output_section::Output_section): Initialize new
15955         fields.
15956         (Output_section::add_input_section): Add an entry to
15957         input_sections_ if may_sort or must_sort are true.
15958         (Output_section::set_final_data_size): Call
15959         sort_attached_input_sections if necessary.
15960         (Output_section::Input_section_sort_entry): Define new class.
15961         (Output_section::Input_section_sort_compare::operator()): New
15962         function.
15963         (Output_section::sort_attached_input_sections): New function.
15964         * configure.ac: Check whether the compiler supports constructor
15965         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15966         * testsuite/initpri1.c: New file.
15967         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15968         CONSTRUCTOR_PRIORITY.
15969         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15970         (initpri1_LDFLAGS): New variable.
15971         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15972
15973 2008-03-27  Ian Lance Taylor  <iant@google.com>
15974
15975         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15976         * testsuite/common_test_1.c: New file.
15977         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15978         (common_test_1_SOURCES): New variable.
15979         (common_test_1_DEPENDENCIES): New variable.
15980         (common_test_1_LDFLAGS): New variable.
15981
15982         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15983         and commons_ correctly when NAME/VERSION does not override
15984         NAME/NULL.
15985         * testsuite/ver_test_6.c: New file.
15986         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15987         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15988         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15989
15990 2008-03-26  Ian Lance Taylor  <iant@google.com>
15991
15992         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15993         of an undefined symbol from a version script.
15994         * testsuite/Makefile.am (ver_test_5.so): New target.
15995         (ver_test_5.o): New target.
15996         (check_SCRIPTS): Add ver_test_5.sh.
15997         (check_DATA): Add ver_test_5.syms.
15998         (ver_test_5.syms): New target.
15999         * testsuite/ver_test_5.cc: New file.
16000         * testsuite/ver_test_5.script: New file.
16001         * testsuite/ver_test_5.sh: New file.
16002         * Makefile.in, testsuite/Makefile.in: Rebuild.
16003
16004         PR gold/5986
16005         Fix problems building gold with gcc 4.3.0.
16006         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16007         (gold_error_at_location, gold_warning_at_location): Use it.
16008         * configure.ac: Check whether we can compile and use a template
16009         function with a printf attribute.
16010         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16011         when jumping over bytes.
16012         * object.cc: Instantiate Object::read_section_data.
16013         * debug.h: Include <cstring>
16014         * dwarf_reader.cc: Include <algorithm>
16015         * main.cc: Include <cstring>.
16016         * options.cc: Include <cstring>.
16017         * output.cc: Include <cstring>.
16018         * script.cc: Include <cstring>.
16019         * script.h: Include <string>.
16020         * symtab.cc: Include <cstring> and <algorithm>.
16021         * target-select.cc: Include <cstring>.
16022         * version.cc: Include <string>.
16023         * testsuite/testmain.cc: Include <cstdlib>.
16024         * configure, config.in: Rebuild.
16025
16026 2008-03-25  Ian Lance Taylor  <iant@google.com>
16027
16028         * options.cc: Include "../bfd/bfdver.h".
16029         (options::help): Print bug reporting address.
16030
16031         * version.cc (print_version): Adjust output for current value of
16032         BFD_VERSION_STRING.
16033
16034         * NEWS: New file.
16035
16036         * options.cc (options::help): Print list of supported targets.
16037         * target-select.h: Include <vector>.
16038         (class Target_selector): Make machine_, size_, and is_big_endian_
16039         fields const.  Add bfd_name_ and instantiated_target_ fields.
16040         (Target_selector::Target_selector): Add bfd_name parameter.
16041         (Target_selector::recognize): Make non-virtual, call
16042         do_recognize.
16043         (Target_selector::recognize_by_name): Make non-virtual, call
16044         do_recognize_by_name.
16045         (Target_selector::supported_names): New function.
16046         (Target_selector::bfd_name): New function.
16047         (Target_selector::do_instantiate_target): New pure virtual
16048         function.
16049         (Target_selector::do_recognize): New virtual function.
16050         (Target_selector::do_recognize_by_name): New virtual function.
16051         (Target_selector::instantiate_target): New private function.
16052         (supported_target_names): Declare.
16053         * target-select.cc (Target_selector::Target_selector): Update for
16054         new parameter and fields.
16055         (select_target_by_name): Check that the name matches before
16056         calling recognize_by_name.
16057         (supported_target_names): New function.
16058         * i386.cc (class Target_selector_i386): Update Target_selector
16059         constructor call.  Remove recognize and recognize_by_name.  Add
16060         do_instantiate_target.
16061         * x86_64.cc (class Target_selector_x86_64): Likewise.
16062         * testsuite/testfile.cc (class Target_selector_test): Update for
16063         changes to Target_selector.
16064
16065         * README: Rewrite, with some notes on unsupported features.
16066
16067 2008-03-24  Cary Coutant  <ccoutant@google.com>
16068
16069         * i386.cc (Target_i386::Got_type): New enum declaration.
16070         (Target_i386::Scan::local): Updated callers of Output_data_got
16071         member functions.
16072         (Target_i386::Scan::global): Likewise.
16073         (Target_i386::Relocate::relocate): Likewise.
16074         (Target_i386::Relocate::relocate_tls): Likewise.
16075         * object.h (Got_offset_list): New class.
16076         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16077         (Sized_relobj::local_got_offset): Likewise.
16078         (Sized_relobj::set_local_got_offset): Likewise.
16079         (Sized_relobj::local_has_tls_got_offset): Removed.
16080         (Sized_relobj::local_tls_got_offset): Removed.
16081         (Sized_relobj::set_local_tls_got_offset): Removed.
16082         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16083         * output.cc (Output_data_got::add_global): Added got_type parameter.
16084         (Output_data_got::add_global_with_rel): Likewise.
16085         (Output_data_got::add_global_with_rela): Likewise.
16086         (Output_data_got::add_global_pair_with_rel): New function.
16087         (Output_data_got::add_global_pair_with_rela): New function.
16088         (Output_data_got::add_local): Added got_type parameter.
16089         (Output_data_got::add_local_with_rel): Likewise.
16090         (Output_data_got::add_local_with_rela): Likewise.
16091         (Output_data_got::add_local_pair_with_rel): New function.
16092         (Output_data_got::add_local_pair_with_rela): New function.
16093         (Output_data_got::add_global_tls): Removed.
16094         (Output_data_got::add_global_tls_with_rel): Removed.
16095         (Output_data_got::add_global_tls_with_rela): Removed.
16096         (Output_data_got::add_local_tls): Removed.
16097         (Output_data_got::add_local_tls_with_rel): Removed.
16098         (Output_data_got::add_local_tls_with_rela): Removed.
16099         * output.h (Output_data_got::add_global): Added got_type parameter.
16100         (Output_data_got::add_global_with_rel): Likewise.
16101         (Output_data_got::add_global_with_rela): Likewise.
16102         (Output_data_got::add_global_pair_with_rel): New function.
16103         (Output_data_got::add_global_pair_with_rela): New function.
16104         (Output_data_got::add_local): Added got_type parameter.
16105         (Output_data_got::add_local_with_rel): Likewise.
16106         (Output_data_got::add_local_with_rela): Likewise.
16107         (Output_data_got::add_local_pair_with_rel): New function.
16108         (Output_data_got::add_local_pair_with_rela): New function.
16109         (Output_data_got::add_global_tls): Removed.
16110         (Output_data_got::add_global_tls_with_rel): Removed.
16111         (Output_data_got::add_global_tls_with_rela): Removed.
16112         (Output_data_got::add_local_tls): Removed.
16113         (Output_data_got::add_local_tls_with_rel): Removed.
16114         (Output_data_got::add_local_tls_with_rela): Removed.
16115         * resolve.cc (Symbol::override_base_with_special): Removed
16116         reference to has_got_offset_ field.
16117         * symtab.cc (Symbol::init_fields): Replaced initialization
16118         of got_offset_ with got_offsets_.  Removed initialization
16119         of has_got_offset_
16120         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16121         (Symbol::got_offset): Likewise.
16122         (Symbol::set_got_offset): Likewise.
16123         (Symbol::has_tls_got_offset): Removed.
16124         (Symbol::tls_got_offset): Removed.
16125         (Symbol::set_tls_got_offset): Removed.
16126         (Symbol::got_offset_): Removed.
16127         (Symbol::tls_mod_got_offset_): Removed.
16128         (Symbol::tls_pair_got_offset_): Removed.
16129         (Symbol::got_offsets_): New field.
16130         (Symbol::has_got_offset): Removed.
16131         (Symbol::has_tls_mod_got_offset): Removed.
16132         (Symbol::has_tls_pair_got_offset): Removed.
16133         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16134         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16135         member functions.
16136         (Target_x86_64::Scan::global): Likewise.
16137         (Target_x86_64::Relocate::relocate): Likewise.
16138         (Target_x86_64::Relocate::relocate_tls): Likewise.
16139
16140 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16141
16142         * yyscript.y: Fix spelling error in comment.
16143
16144 2008-03-24  Ian Lance Taylor  <iant@google.com>
16145
16146         * options.h (class General_options): Define build_id option.
16147         * layout.h (class Layout): Declare write_build_id, create_note,
16148         create_build_id.  Add build_id_note_ member.
16149         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16150         "libiberty.h", "md5.h", "sha1.h".
16151         (Layout::Layout): Initialize eh_frame_data_,
16152         eh_frame_hdr_section_, and build_id_note_.
16153         (Layout::finalize): Call create_build_id.
16154         (Layout::create_note): New function, broken out of
16155         Layout::create_gold_note.
16156         (Layout::create_gold_note): Call create_note.
16157         (Layout::create_build_id): New function.
16158         (Layout::write_build_id): New function.
16159         (Close_task_runner::run): Call write_build_id.
16160
16161         * x86_64.cc: Correct license to GPLv3.
16162
16163 2008-03-23  Ian Lance Taylor  <iant@google.com>
16164
16165         * options.cc: Include "demangle.h".
16166         (parse_optional_string): New function.
16167         (parse_long_option): Handle takes_optional_argument.
16168         (parse_short_option): Update dash_z initializer.  Handle
16169         takes_optional_argument.
16170         (General_options::General_options): Initialize do_demangle_.
16171         (General_options::finalize): Set do_demangle_.  Handle demangling
16172         style.
16173         * options.h (parse_optional_string): Declare.
16174         (struct One_option): Add optional_arg field.  Update constructor.
16175         Update call constructor calls.  Add takes_optional_argument
16176         function.
16177         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16178         (DEFINE_optional_string): Define.
16179         (General_options::demangle): Change from DEFINE_bool to
16180         DEFINE_optional_string.
16181         (General_options::no_demangle): New function.
16182         (General_options::do_demangle): New function.
16183         (General_options::set_do_demangle): New function.
16184         (General_options::execstack_status_): Move definition to end of
16185         class definition.
16186         (General_options::static_): Likewise.
16187         (General_options::do_demangle_): New field.
16188         * object.cc (big_endian>::get_symbol_location_info): Call
16189         Options::do_demangle, not Options::demangle.
16190         * symtab.cc (demangle): Likewise.
16191
16192 2008-03-22  Ian Lance Taylor  <iant@google.com>
16193
16194         * gold.h: Include <cstddef> and <sys/types.h>
16195         * options.h: Include <cstring>.
16196
16197 2008-03-21  Ian Lance Taylor  <iant@google.com>
16198
16199         * Added source code to GNU binutils.
16200 \f
16201 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16202
16203 Copying and distribution of this file, with or without modification,
16204 are permitted in any medium without royalty provided the copyright
16205 notice and this notice are preserved.
16206
16207 Local Variables:
16208 mode: change-log
16209 left-margin: 8
16210 fill-column: 74
16211 version-control: never
16212 End: