Hardcode host-specific name for LTO plugin
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-12-04  Alan Modra  <amodra@gmail.com>
2
3         * Powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
4         addend of PLTREL24 reloc when not generating a plt stub.  Make
5         max_branch_offset an "Address".
6         (Target_powerpc::Relocate::relocate): Make max_branch_offset
7         an "Address".
8
9 2014-12-04  Alan Modra  <amodra@gmail.com>
10
11         PR 17670
12         * symtab.cc (Symbol::set_undefined): Remove assertion.
13         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
14         on symbols defined in discarded sections, instead return false.
15         Rearrange params, update all callers.
16         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
17         branches to syms in discarded sections.
18         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
19         undefined and flag as discarded.
20         (Target_powerpc::Relocate::relocate): Localize variable.
21
22 2014-12-03  Alan Modra  <amodra@gmail.com>
23
24         PR 17566
25         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
26         when adding dynamic relocations against section symbols.
27
28 2014-11-26  Alan Modra  <amodra@gmail.com>
29
30         * powerpc.cc (Stub_control::set_output_and_owner): New function.
31         (Target_powerpc::group_sections): Use it.
32
33 2014-11-25  Cary Coutant  <ccoutant@google.com>
34
35         PR gold/17639
36         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
37         (Sized_relobj_file::do_layout): Handle deferred sections properly
38         during GC pass 1. Don't add reloc sections to deferred list twice.
39         * object.h (Sized_relobj_file::is_deferred_layout): New function.
40         (Sized_relobj_file::is_deferred_layout_): New data member.
41
42 2014-11-21  Alan Modra  <amodra@gmail.com>
43
44         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
45         for undefined weaks.
46
47 2014-11-20  Alan Modra  <amodra@gmail.com>
48
49         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
50         from --stub-group-size parameter divided by 1024.
51         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
52         template parameter.  Update all uses.
53         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
54         has_stub_value.  Set for long branches.  Don't report overflow for
55         branch to undefined weak symbols.  Print info message on
56         overflowing branch to stub.
57
58 2014-11-20  Alan Modra  <amodra@gmail.com>
59
60         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
61
62 2014-10-28  Alan Modra  <amodra@gmail.com>
63
64         Apply trunk patches
65         2014-10-22  Alan Modra  <amodra@gmail.com>
66         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
67         thread_starter.
68
69 2014-09-30  Cary Coutant  <ccoutant@google.com>
70
71         PR gold/17432
72         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
73
74 2014-09-30  Kito Cheng  <kito@0xlab.org>
75
76         PR gold/13597
77         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
78         hash table before sysv-style hash table.
79
80 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
81
82         * options.h (--pic-executable): Add negative to alias to -no-pie.
83
84 2014-09-26  Cary Coutant  <ccoutant@google.com>
85
86         PR gold/16773
87         * object.cc (Sized_relobj_file): Compute value of section symbols
88         for TLS sections the same as TLS symbols.
89
90 2014-09-25  Cary Coutant  <ccoutant@google.com>
91
92         PR gold/17432
93         * resolve.cc (Symbol_table::resolve): Override common placeholder
94         symbols, but adjust sizes.
95         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
96         symbols to common lists.
97
98 2014-09-24  Alan Modra  <amodra@gmail.com>
99
100         * po/POTFILES.in: Regenerate.
101
102 2014-09-23  Taiju Tsuiki  <tzik@google.com>
103             Cary Coutant  <ccoutant@google.com>
104
105         PR gold/14860
106         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
107         on input_sections_blocker.
108         * layout.cc (Write_sections_task::locks): Unblock
109         input_sections_blocker_.
110         * layout.h (Write_sections_task::Write_sections_task): Add
111         input_sections_blocker.
112         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
113         to DEPENDENCIES.
114         * testsuite/Makefile.in: Regenerate.
115
116 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
117
118         * testsuite/Makefile.am (plugin_test_10): New test.
119         * testsuite/Makefile.in: Regenerate
120         * testsuite/plugin_common_test_2.c (c1): Align to 8.
121         * testsuite/plugin_test_10.sh: New file.
122
123 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
124
125         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
126         * resolve.cc (Symbol_table::resolve): Don't override common symbols
127         during the replacement phase.
128
129 2014-09-17  Han Shen  <shenhan@google.com>
130             Jing Yu  <jingyu@google.com>
131
132         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
133         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
134         * aarch64.cc (Target_aarch64): Add data members
135         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
136         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
137         constructor.
138         (Target_aarch64::do_reloc_symbol_index): New method.
139         (Target_aarch64::do_reloc_addend): New method.
140         (Target_aarch64::add_tlsdesc_info): New method.
141         (Target_aarch64::do_dynsym_value): New method.
142         (Target_aarch64::do_make_data_plt): Add new parameters: got,
143         got_irelative. Pass them to Output_data_plt_aarch64_standard.
144         (Target_aarch64::make_data_plt): Add new parameters: got,
145         got_irelative. Pass them to do_make_data_plt.
146         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
147         (Target_aarch64::Relocate:tls_gd_to_le): New method.
148         (Target_aarch64::Relocate:tls_ie_to_le): New method.
149         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
150         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
151         (Target_aarch64::got_tlsdesc_section): New method.
152         (Target_aarch64::make_local_ifunc_plt_entry): New method.
153         (Target_aarch64::define_tls_base_symbol): New method.
154         (Target_aarch64::reserve_tlsdesc_entries): New method.
155         (Target_aarch64::got_mod_index_entry): New method.
156         (Target_aarch64::rela_tlsdesc_section): New method.
157         (Target_aarch64::rela_irelative_section): New method.
158         (Target_aarch64::Tlsdesc_info): New struct.
159         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
160         relocations and tlsdesc relocations.
161         (Target_aarch64::optimize_tls_reloc): Implement method.
162         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
163         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
164         in constructor.
165         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
166         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
167         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
168         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
169         (Output_data_plt_aarch64::rela_tlsdesc): New method.
170         (Output_data_plt_aarch64::rela_irelative): New method.
171         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
172         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
173         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
174         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
175         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
176         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
177         (Output_data_plt_aarch64_standard): New member variables:
178         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
179         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
180         New parameter: got, got_irelative.
181         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
182         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
183         (Output_data_plt_aarch64::do_write): Replace got_address with
184         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
185         (AArch64_relocate_functions::update_movnz): New method.
186         (AArch64_relocate_functions): Correct format.
187         (AArch64_relocate_functions::movnz): New method.
188         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
189         before the switch. Add new cases to switch.
190         Check ie_to_le relaxation on tlsie relocations. Add code handling
191         tlsgd tlsdesc cases.
192         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
193         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
194         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
195         Call reloc_name_in_error_message to print unsupported reloc.
196         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
197         make_data_plt.
198         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
199         relocs. Fill in some more dynamic tags.
200         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
201         Skip call tls_get_addr when tlsgd is relaxed.
202         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
203         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
204         tlsdesc->ie relaxation.
205
206 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
207
208         * mips.cc (Target_mips_nacl): New class.
209         (Target_selector_mips_nacl): New class.
210         (target_selector_mips32): Rename from target_selector_mips32be and use
211         Target_selector_mips_nacl instead of Target_selector_mips.
212         (target_selector_mips32el): Rename from target_selector_mips32 and use
213         Target_selector_mips_nacl instead of Target_selector_mips.
214         (target_selector_mips64): Rename from target_selector_mips64be and use
215         Target_selector_mips_nacl instead of Target_selector_mips.
216         (target_selector_mips64el): Rename from target_selector_mips64 and use
217         Target_selector_mips_nacl instead of Target_selector_mips.
218         (Target_mips::mips_info): Add const attribute.
219
220 2014-09-02  Cary Coutant  <ccoutant@google.com>
221
222         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
223         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
224         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
225         (Sized_incr_dynobj::do_section_name): Likewise.
226         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
227         (Sized_incr_dynobj::do_section_name): Likewise.
228         * object.h (Object::section_name): Likewise.
229         (Object::do_section_name): Likewise.
230         (Sized_relobj_file::do_section_name): Likewise.
231         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
232         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
233
234 2014-09-02  Cary Coutant  <ccoutant@google.com>
235
236         PR gold/17005
237         * ehframe.cc (Fde::write): Add output_offset parameter.
238         (Cie::write): Likewise.
239         (Eh_frame::set_final_data_size): Account for offset within output
240         section.
241         (Eh_frame::do_sized_write): Likewise.
242         * ehframe.h (Fde::write): Add output_offset parameter.
243         (Cie::write): Likewise.
244         * output.cc (Output_section::Input_section_sort_entry): Remove
245         section_has_name_; add output_section_name parameter. Use
246         output section name for non-input sections.
247         (Output_section::Input_section_sort_entry::section_has_name): Remove.
248         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
249         (Output_section::Input_section_sort_compare): Remove logic for
250         sections without names.
251         (Output_section::Input_section_sort_init_fini_compare): Likewise.
252         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
253         Likewise.
254         (Output_section::Input_section_sort_section_name_compare): Likewise.
255
256 2014-08-29 Han Shen <shenhan@google.com>
257            Jing Yu <jingyu@google.com>
258
259         * aarch64-reloc-property.cc
260         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
261         reference reloc property in the table.
262         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
263         3 other entries.
264         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
265         2 new overloaded methods.
266         (Output_data_got_aarch64::do_write): Add code to write out
267         static relocs.
268         (class Output_data_got_aarch64::Static_reloc): New class to wrap
269         static relocs.
270         (Output_data_got_aarch64::static_relocs): New vector to
271         hold static relocs.
272         (Target_aarch64::TCB_SIZE): New const static memeber.
273         (Target_aarch64::tcb_size): New method.
274         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
275         (Target_aarch64::Relocate::relocate_tls): New method.
276         (Target_aarch64::Scan::local): Add code handling new reloc types.
277         (Target_aarch64::Scan::global): Add code handling new reloc types.
278
279 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
280
281         * options.h (-no-pie): Add option.
282
283 2014-08-08  Jing Yu  <jingyu@google.com>
284             Han Shen  <shenhan@google.com>
285
286         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
287         (DEFFILES): add aarch64-reloc.def.
288         (TARGETSOURCES): Add aarch64-reloc-property.cc.
289         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
290         * Makefile.in: Regenerate.
291         * aarch64-reloc-property.cc: New file.
292         * aarch64-reloc-property.h: New file.
293         * aarch64-reloc.def: New file.
294         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
295         with tab to make the format consistent.
296         (Output_data_got_aarch64::symbol_table_): New method.
297         (Target_aarch64::do_plt_address_for_global): New method.
298         (Target_aarch64::do_plt_address_for_local): New method.
299         (Target_aarch64::do_select_as_default_target): New method.
300         (Target_aarch64::do_make_data_plt): New method.
301         (Target_aarch64::make_data_plt): New method.
302         (Output_data_plt_aarch64::has_irelative_section): New method.
303         (Output_data_plt_aarch64::address_for_global): New method.
304         (Output_data_plt_aarch64::address_for_local): New method.
305         (Output_data_plt_aarch64::irelative_rel_): New parameter.
306         (Output_data_plt_aarch64::add_entry): Implement contents.
307         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
308         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
309         the got_pov entry to plt0.
310         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
311         Implement contents.
312         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
313         (AArch64_howto): New struct.
314         (aarch64_howto[]): New static const array.
315         (AArch64_relocate_functions): New class.
316         (Target_aarch64::Scan::get_reference_flags): Remove method.
317         (Target_aarch64::Scan::local): Implement to support a few relocations.
318         (Target_aarch64::Scan::global): Implement to support a few relocations.
319         (Target_aarch64::make_plt_section): Implement contents.
320         (Target_aarch64::make_plt_entry): Implement contents.
321         (Target_aarch64::do_finalize_sections): Implement contents.
322         (Target_aarch64::Relocate::relocate): Implement a few relocations.
323         (Target_aarch64::relocate_section): Implement contents.
324
325 2014-08-06  Alan Modra  <amodra@gmail.com>
326
327         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
328
329 2014-08-06  Alan Modra  <amodra@gmail.com>
330
331         PR 13227
332         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
333
334 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
335
336         * object.cc (Relobj::is_section_name_included): Add
337         ".rodata.nptl_version" to not garbage collect this section.
338
339 2014-07-08  Cary Coutant  <ccoutant@google.com>
340
341         * expression.cc (struct Expression::Expression_eval_info): Add
342         new fields type_pointer, vis_pointer, and nonvis_pointer.
343         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
344         nonvis_pointer parameters. Adjust all calls.
345         (Symbol_expression::value): Update type, visibility, and nonvis bits
346         in caller.
347         * script.cc (Symbol_assignment::sized_finalize): Update type,
348         visibility, and remaining st_other bits for new symbol.
349         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
350         vis_pointer, and nonvis_pointer parameters.
351         * symtab.h (Symbol::set_type): New method.
352
353         * testsuite/Makefile.am (defsym_test): New test.
354         * testsuite/Makefile.in: Regenerate.
355         * testsuite/defsym_test.c: New file.
356         * testsuite/defsym_test.sh: New file.
357
358 2014-07-08  Cary Coutant  <ccoutant@google.com>
359
360         PR gold/15639
361         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
362         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
363         (Sized_dynobj::base_read_symbols): ...new method.
364         * object.h (Sized_relobj_file::base_read_symbols): New method.
365         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
366         (Sized_relobj_file::base_read_symbols): ...new method.
367         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
368         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
369         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
370
371 2014-07-04  Alan Modra  <amodra@gmail.com>
372
373         * po/POTFILES.in: Regenerate.
374
375 2014-07-02  Jing Yu  <jingyu@google.com>
376
377         * aarch64.cc: New file
378         * Makefile.am (TARGETSOURCES): Add aarch64.cc
379         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
380         * Makefile.in: Regenerate.
381         * configure.tgt: Add entries for aarch64*.
382         * configure.ac:  Likewise.
383         * configure: Likewise.
384
385 2014-06-27  Alan Modra  <amodra@gmail.com>
386
387         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
388
389 2014-06-24  Cary Coutant  <ccoutant@google.com>
390
391         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
392         sections.
393         (Dwo_file::sized_read_unit_index): Likewise.
394
395 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
396
397         * mips.cc: New file.
398         * Makefile.am (TARGETSOURCES): Add mips.cc
399         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
400         * configure.tgt: Add entries for mips*.
401         * configure.ac: Likewise.
402         * Makefile.in: Regenerate.
403         * configure: Likewise.
404
405 2014-06-09  Cary Coutant  <ccoutant@google.com>
406
407         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
408         unit_length is within section bounds.
409
410 2014-06-09  Cary Coutant  <ccoutant@google.com>
411
412         PR gold/16980
413         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
414         map.
415
416 2014-06-07  Alan Modra  <amodra@gmail.com>
417
418         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
419
420 2014-06-06  Cary Coutant  <ccoutant@google.com>
421
422         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
423         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
424         (Dwarf_pubnames_table::read_header): Likewise.
425         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
426         .debug_gnu_pubtypes.
427
428 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
429
430         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
431         * Makefile.in, configure: Regenerate.
432
433 2014-06-03  Alan Modra  <amodra@gmail.com>
434
435         * powerpc.cc (addis_12_2): Define.
436         (Stub_table::do_write): Support fusion on ELFv2 stubs.
437
438 2014-06-03  Alan Modra  <amodra@gmail.com>
439
440         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
441         st_other output.
442
443 2014-06-02  Alan Modra  <amodra@gmail.com>
444
445         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
446         Only ignore relocs on ELFv1.
447         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
448
449 2014-05-30  Cary Coutant  <ccoutant@google.com>
450
451         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
452         * testsuite/Makefile.in: Regenerate.
453         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
454
455 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
456
457         PR gold/16945
458         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
459         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
460
461 2014-05-15  Alan Modra  <amodra@gmail.com>
462
463         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
464         Compare FDE contents with DW_CFA_nop rather than 0.
465
466 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
467
468         * symtab.h (may_need_copy_reloc): Remove check for position independent
469         code.
470         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
471         position independence before pc absolute may_need_copy_reloc call.
472         Add check for executable output befor pc relative may_need_copy_reloc
473         call.
474         * i386.cc: Ditto.
475         * arm.cc: Ditto.
476         * sparc.cc: Ditto.
477         * tilegx.cc: Ditto.
478         * powerpc.cc: Add check for no position independence before
479         may_need_copy_reloc calls.
480         * testsuite/pie_copyrelocs_test.cc: New file.
481         * testsuite/pie_copyrelocs_shared_test.cc: New file.
482         * Makefile.am (pie_copyrelocs_test): New test.
483         * Makefile.in: Regenerate.
484
485 2014-05-08  Martin Liška  <mliska@suse.cz>
486
487         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
488
489 2014-05-06  Cary Coutant  <ccoutant@google.com>
490
491         PR gold/16900
492         * i386.cc (Output_data_got_plt_i386): New class.
493         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
494         parameter. Change all callers.
495         (Output_data_plt_i386::layout_): Remove.
496         (Output_data_plt_i386::got_plt_): Change type.
497         (Target_i386::got_plt_): Change type. Change all references.
498         (Target_i386::got_section): Create instance of new class.
499         (Output_data_got_plt_i386::do_write): New function.
500         * x86_64.cc (Output_data_got_plt_x86_64): New class.
501         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
502         parameter. Change all callers.
503         (Output_data_plt_x86_64::layout_): Remove.
504         (Output_data_plt_x86_64::got_plt_): Change type.
505         (Target_x86_64::got_plt_): Change type. Change all references.
506         (Target_x86_64::got_section): Create instance of new class.
507         (Output_data_got_plt_x86_64::do_write): New function.
508         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
509         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
510         class.
511
512 2014-05-05  Cary Coutant  <ccoutant@google.com>
513
514         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
515         if we have pubnames/pubtypes.
516
517 2014-05-02  Cary Coutant  <ccoutant@google.com>
518
519         * defstd.cc (in_segment): Define __ehdr_start here...
520         * layout.cc (Layout::finalize): ...Instead of here.  Set the
521         output segment when known.
522         * resolve.cc (Symbol::override_base_with_special): Remember
523         the original binding.
524         * symtab.cc (Symbol::set_output_segment): New function.
525         (Symbol::set_undefined): New function.
526         * symtab.h (Symbol::is_weak_undefined): Check original undef
527         binding.
528         (Symbol::is_strong_undefined): New function.
529         (Symbol::set_output_segment): New function.
530         (Symbol::set_undefined): New function.
531         * target-reloc.h (is_strong_undefined): Remove.
532         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
533         Check for hidden undefs.
534         (relocate_section): Call Symbol::is_strong_undefined.
535
536         * testsuite/Makefile.am (ehdr_start_test_1)
537         (ehdr_start_test_2, ehdr_start_test_3)
538         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
539         * testsuite/Makefile.in: Regenerate.
540         * testsuite/ehdr_start_def.cc: New source file.
541         * testsuite/ehdr_start_test.cc: New source file.
542         * testsuite/ehdr_start_test.t: New linker script.
543         * testsuite/ehdr_start_test_4.sh: New shell script.
544
545 2014-04-23  Cary Coutant  <ccoutant@google.com>
546
547         PR gold/16870
548         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
549
550 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
551
552         * layout.cc (Layout::include_section): Allow a target to decide
553         whether to include a section.
554         * target.h (Target::should_include_section): New function.
555         (Target::do_should_include_section): New function.
556
557 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
558
559         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
560         inline into ...
561         (Copy_relocs::emit): ... here.
562         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
563         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
564         (Copy_reloc_entry::entries_): Change from private to protected.
565
566 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
567
568         * icf.cc (get_section_contents): Replace copies of reloc
569         vectors with const references.
570
571 2014-04-02  Cary Coutant  <ccoutant@google.com>
572
573         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
574         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
575         * configure: Regenerate.
576         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
577         -fno-use-linker-plugin.
578         (LINK1, CXXLINK1): Add it to the link command.
579         * testsuite/Makefile.in: Regenerate.
580
581 2014-03-12  Alan Modra  <amodra@gmail.com>
582
583         * Makefile.in: Regenerate.
584
585 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
586
587         * symtab.h (Symbol::set_nonvis): New function.
588
589 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
590
591         * symtab.cc (Sized_symbol<32>::init_output_data):
592         Instantiate the template.
593         (Sized_symbol<64>::init_output_data): Likewise.
594
595 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
596
597         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
598         adjust dynamic symbol value.
599         * target.h (Target::adjust_dyn_symbol): New function.
600         (Target::do_adjust_dyn_symbol): New function.
601
602 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
603
604         * output.cc (Output_data_dynamic::Dynamic_entry::write):
605         Get the value of DYNAMIC_CUSTOM dynamic entry.
606         * output.h (Output_data_dynamic::add_custom): New function.
607         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
608         dynamic entry.
609         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
610         * target.h (Target::dynamic_tag_custom_value): New function.
611         (Target::do_dynamic_tag_custom_value): New function.
612
613 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
614
615         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
616         dynsym indexes.
617         * target.h (Target::has_custom_set_dynsym_indexes): New function.
618         (Target::do_has_custom_set_dynsym_indexes): New function.
619         (Target::set_dynsym_indexes): New function.
620         (Target::do_set_dynsym_indexes): New function.
621
622 2014-03-07  Alan Modra  <amodra@gmail.com>
623
624         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
625         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
626         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
627         (Powerpc_relocate_functions::has_overflow_bitfield,
628         overflowed): Use the above.
629         (Target_powerpc::Relocate::relocate): Correct overflow checking
630         for a number of relocations.  Modify overflow test for 16-bit
631         fields in instructions to signed/unsigned according to whether
632         the field takes a signed or unsigned value.
633
634 2014-03-05  Alan Modra  <amodra@gmail.com>
635
636         Update copyright years.
637
638 2014-03-05  Alan Modra  <amodra@gmail.com>
639
640         * powerpc.cc (Target_powerpc::Scan::local, global): Support
641         R_PPC64_ADDR64_LOCAL.
642         (Target_powerpc::Relocate::relocate): Likewise.
643
644 2014-03-03  Alan Modra  <amodra@gmail.com>
645
646         * dwp.cc (print_version): Update copyright year to current.
647
648 2014-02-10  Alan Modra  <amodra@gmail.com>
649
650         * po/gold.pot: Regenerate.
651
652 2014-02-06  Cary Coutant  <ccoutant@google.com>
653
654         Fix problem where -u is ignored when a weak undef is seen.
655
656         * archive.cc (Library_base::should_include_member): Reorder
657         code to check for -u option if a weak undef has already been seen.
658         * testsuite/Makefile.am (weak_undef_test_2): New test case.
659         * testsuite/Makefile.in: Regenerate.
660         * testsuite/weak_undef_file3.cc: New file.
661         * testsuite/weak_undef_file4.cc: New file.
662         * testsuite/weak_undef_test_2.cc: New file.
663
664 2014-02-05  Cary Coutant  <ccoutant@google.com>
665
666         Fix issues with gold undefined symbol diagnostics.
667
668         PR binutils/15435
669         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
670         check to here.
671         * target-reloc.h (is_strong_undefined): New function.
672         (relocate_section): Move undef vtable symbol check from here.
673         Check for is_strong_undefined.
674
675 2014-02-05  Cary Coutant  <ccoutant@google.com>
676
677         Fix problems with the --dynamic-list option.
678
679         PR gold/13577
680         * options.cc (General_options::parse_dynamic_list):
681         Set have_dynamic_list_.
682         (General_options::General_options): Initialize have_dynamic_list_.
683         (General_options::finalize): Turn off -Bsymbolic and
684         -Bsymbolic-functions if --dynamic-list provided.
685         * options.h (General_options::have_dynamic_list): New function.
686         (General_options::have_dynamic_list_): New data member.
687         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
688         correctly.
689
690         PR gold/16530
691         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
692         in --dynamic-list, mark it.
693
694         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
695         (dynamic_list_2): New test case.
696         * testsuite/Makefile.in: Regenerate.
697         * testsuite/dynamic_list_2.cc: New file.
698         * testsuite/dynamic_list_2.t: New file.
699         * testsuite/dynamic_list_lib1.cc: New file.
700         * testsuite/dynamic_list_lib2.cc: New file.
701         * testsuite/gc_dynamic_list_test.c: New file.
702         * testsuite/gc_dynamic_list_test.sh: New file.
703         * testsuite/gc_dynamic_list_test.t: New file.
704
705 2014-01-28  Cary Coutant  <ccoutant@google.com>
706
707         Add .gdb_index version 7 support.
708
709         * gold/dwarf_reader.cc: include <utility> (for make_pair).
710         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
711         debug sections.
712         (Dwarf_ranges_table::read_ranges_table): Likewise.
713         (Dwarf_pubnames_table::read_section): Check for GNU-style
714         sections, and for compressed debug sections.
715         (Dwarf_pubnames_table::read_header): Compute end address of table.
716         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
717         for end of list by offset, not by offset == 0.
718         (Dwarf_info_reader::do_read_string_table): Check for compressed
719         debug sections.
720         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
721         Initialize new data members.
722         (Dwarf_pubnames_table::next_name): return flag_byte.
723         (Dwarf_pubnames_table::end_of_table_): New data member.
724         (Dwarf_pubnames_table::is_gnu_style_): New data member.
725         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
726         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
727         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
728         read skeleton type unit DIEs.
729         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
730         (Gdb_index::do_write): Write flag_byte.
731         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
732         (Gdb_index::Cu_vector): Store flags along with cu indexes.
733         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
734         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
735
736 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
737
738         * version.cc (print_version): Update copyright year to 2014.
739
740 2013-12-19  Dimitry Andric  <dimitry@andric.com>
741
742         * stringpool.cc (Stringpool_template::reserve): Add
743         HAVE_UNORDERED_MAP case.
744         * stringpool.cc (Stringpool_template::print_stats): Likewise.
745
746 2013-12-18  Cary Coutant  <ccoutant@google.com>
747
748         * configure.ac: Check for <unordered_set> and <unordered_map>.
749         * config.in: Regenerate.
750         * configure: Regenerate.
751         * system.h: Use <unordered_set> and <unordered_map> if available.
752
753 2013-12-10  Roland McGrath  <mcgrathr@google.com>
754
755         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
756         with $(INSTALL_PROGRAM_ENV).
757         * Makefile.in: Regenerate.
758
759 2013-11-22  Cary Coutant  <ccoutant@google.com>
760
761         * configure.ac: Add check for which library is needed for
762         dlopen.
763         * configure: Regenerate.
764
765 2013-11-22  Cary Coutant  <ccoutant@google.com>
766
767         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
768         assembler.
769         * testsuite/Makefile.in: Regenerate.
770
771 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
772
773         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
774         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
775         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
776         (Target_x86_64<size>::Scan::local): Likewise.
777         (Target_x86_64<size>::Scan::global): Likewise.
778         (Target_x86_64<size>::Relocate::relocate): Likewise.
779         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
780         Likewise.
781         (Target_x86_64<size>::Scan::check_non_pic(): Handle
782         R_X86_64_PC32_BND.
783
784         * testsuite/Makefile.am (check_PROGRAMS): Add
785         exception_x86_64_bnd_test.
786         (exception_x86_64_bnd_test_SOURCES): New macro.
787         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
788         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
789         (exception_x86_64_bnd_test_LDADD): Likewise.
790         (exception_x86_64_bnd_1.o): New rule.
791         (exception_x86_64_bnd_2.o): Likewise.
792         * testsuite/Makefile.in: Regenerated.
793
794 2013-11-15  Alan Modra  <amodra@gmail.com>
795
796         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
797         accessor.
798         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
799         Only call ppc64_local_entry_offset for 64-bit.  Restrict
800         symval_for_branch lookup to ELFv1.
801         (Stub_table::add_plt_call_entry): Use unsigned int off.
802         (Output_data_glink::Address, invalid_address): New.
803         (Output_data_glink::add_eh_frame): Move out of line.  Add
804         support for ELFv2.
805         (Output_data_glink::add_global_entry, find_global_entry,
806         global_entry_address): New functions.
807         (Output_data_glink::global_entry_stubs_, end_branch_table_,
808         ge_size): New variables.
809         (Output_data_glink::set_final_data_size): Add global entry
810         stub sizing.
811         (Output_data_glink::do_write): Write global entry stubs.
812         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
813         parameter.  Return true for ELFv2.  Adjust callers.
814         (Target_powerpc::Scan::local, global): Restrict opd lookup to
815         ELFv1.  Similarly for ifunc and dynamic relocation processing
816         specific to ELFv1.  Recognize that symbols are defined on
817         their plt entries for ELFv2.
818         (Target_powerpc::symval_for_branch): Assert if called for
819         ELFv2 or ppc32.
820         (Target_powerpc::Relocate::relocate): Use global entry plt
821         stub for symbol value if such exists on ELFv2.
822         (Target_powerpc::Relocate::relocate): Don't call
823         symval_for_branch when ELFv2.  Do adjust for local entry
824         offset when ELFv2.
825         (Target_powerpc::do_dynsym_value): Set symbols to global entry
826         plt stub for ELFv2.
827         (Target_powerpc::do_plt_address_for_global): Similarly.
828
829 2013-11-14  Cary Coutant  <ccoutant@google.com>
830
831         Revert patch -- this did not fix the problem, and there is
832         no race there.
833
834         2013-11-14  Cary Coutant  <ccoutant@google.com>
835
836             PR gold/14860
837             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
838             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
839             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
840             updating fde_offsets_.
841             (Eh_frame_hdr::lock_): New data member.
842
843 2013-11-14  Cary Coutant  <ccoutant@google.com>
844
845         * dwp.cc (Dwo_file_entry): New type.
846         (File_list): Use Dwo_file_entry.
847         (Dwo_file::verify): New function.
848         (Dwo_file::verify_dwo_list): New function.
849         (Dwo_file::sized_verify_dwo_list): New function.
850         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
851         list.
852         (Dwp_options): New enum type.
853         (dwp_options): Add --verify-only.
854         (usage): Likewise.
855         (main): Likewise.
856         * dwp.h (gold_info): Add declaration.
857
858 2013-11-14  Cary Coutant  <ccoutant@google.com>
859
860         PR gold/14860
861         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
862         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
863         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
864         updating fde_offsets_.
865         (Eh_frame_hdr::lock_): New data member.
866
867 2013-11-06  Cary Coutant  <ccoutant@google.com>
868
869         PR gold/15758
870         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
871         before reloc sections.
872
873 2013-11-04  Alan Modra  <amodra@gmail.com>
874
875         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
876         (Symbol::needs_dynamic_reloc): Test new flag.
877         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
878         (Target_powerpc::Scan::get_reference_flags): Add target param.
879         Return FUNC_DESC_ABI for 64-bit ELFv1.
880         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
881         call.
882         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
883         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
884
885 2013-10-31  Cary Coutant  <ccoutant@google.com>
886
887         Restore support for dwp v2 DWARF package file format.
888
889         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
890         tu_length parameter.  Adjust all callers.
891         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
892         * dwp.cc: Include dwarf.h.
893         (Section_bounds): New struct type.
894         (Unit_set): New struct type.
895         (Dwo_file::Dwo_file): Initialize new data member.
896         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
897         Combine and rename to...
898         (Dwo_file::read_unit_index): ...this.
899         (Dwo_file::sized_read_compunit_index)
900         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
901         (Dwo_file::sized_read_unit_index): ...this.
902         (Dwo_file::copy_section): Remove section_name, is_str_offsets
903         parameters; add section_id parameter.
904         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
905         (Dwo_file::add_unit_set): ...this.
906         (Dwo_file::shndx_map_): Remove.
907         (Dwo_file::sect_offsets_): New data member.
908         (Dwp_output_file::Dwp_output_file): Initialize new data members.
909         (Dwp_output_file::add_section): Rename to...
910         (Dwp_output_file::add_contribution): ...this.
911         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
912         (Dwp_output_file::add_tu_set): Likewise.
913         (Dwp_output_file::Contribution): New type.
914         (Dwp_output_file::Section::contributions): New data member.
915         (Dwp_output_file::Cu_or_tu_set): Remove.
916         (Dwp_output_file::Section::Section): New ctor.
917         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
918         (Dwp_output_file::Dwp_index::Section_table): New type.
919         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
920         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
921         parameter.
922         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
923         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
924         (Dwp_output_file::Dwp_index::section_table): New member function.
925         (Dwp_output_file::Dwp_index::section_table_end): New member function.
926         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
927         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
928         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
929         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
930         (Dwp_output_file::Dwp_index::section_table_): New data member.
931         (Dwp_output_file::Dwp_index::section_mask_): New data member.
932         (Dwp_output_file::add_output_section): New member function.
933         (Dwp_output_file::write_new_section): New member function.
934         (Dwp_output_file::write_contributions): New member function.
935         (Dwp_output_file::section_id_map_): New data member.
936         (class Dwo_id_info_reader): Remove.
937         (class Unit_reader): New class.
938         (get_dwarf_section_name): New function.
939         (Dwo_file::read_executable): Adjust initializations of class data.
940         (Dwo_file::read): Add support for v2 package file format.
941         (Dwo_file::read_unit_index): Likewise.
942         (Dwo_file::sized_read_unit_index): Likewise.
943         (Dwo_file::copy_section): Likewise.
944         (Dwo_file::add_unit_set): Likewise.
945         (Dwp_output_file::add_output_section): Likewise.
946         (Dwp_output_file::add_contribution): Likewise.
947         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
948         for empty slot.
949         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
950         file format.
951         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
952         slot.
953         (Dwp_output_file::initialize): Remove unused function.
954         (Dwp_output_file::finalize): Add support for v2 package file format.
955         (Dwp_output_file::write_index): Likewise.
956         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
957         function prototype.
958
959 2013-10-31  Cary Coutant  <ccoutant@google.com>
960
961         * configure.ac: Fix check for -fmerge-constants.
962         * configure.ac: Regenerate.
963
964 2013-10-30  Roland McGrath  <mcgrathr@google.com>
965
966         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
967         Correct 9-byte nop sequence to match what the assembler generates.
968
969 2013-10-30  Alan Modra  <amodra@gmail.com>
970
971         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
972         ppc64_local_entry_offset, ppc64_local_entry_offset,
973         do_read_symbols): New functions.
974         (Powerpc_relobj::e_flags_, st_other_): New vars.
975         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
976         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
977         (Powerpc_relobj::e_flags_): New var.
978         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
979         and adjust for ELFv2.
980         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
981         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
982         (Powerpc_dynobj::do_find_special_sections): Likewise.
983         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
984         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
985         to ELFv2 local entry.
986         (Target_powerpc::do_relax): No thread safe barriers needed for
987         ELFv2.
988         (Output_data_plt_powerpc::initial_plt_entry_size_,
989         plt_entry_size): Delete.  Replace all uses with
990         first_plt_entry_offset() and plt_entry_size().
991         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
992         reserved_size parm.  Update callers.
993         (Output_data_plt_powerpc::entry_count): Update.
994         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
995         and use Target_powerpc::first_plt_entry_offset().
996         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
997         rename to plt_entry_size.
998         (Output_data_plt_powerpc::add_ifunc_entry,
999         add_local_ifunc_entry): Adjust reloc for ELFv2.
1000         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
1001         (glink_eh_frame_fde_64v2): New.
1002         (Stub_table::plt_call_size): Support ELFv2 sizing.
1003         (Output_data_glink::add_eh_frame): Use the new FDE.
1004         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
1005         (Stub_table::do_write): Write ELFv2 stubs and glink.
1006         (Target_powerpc::Relocate::relocate): Replaces nop after call
1007         with ld 2,24(1) and adjust local offset destination for ELFv2.
1008
1009 2013-10-30  Alan Modra  <amodra@gmail.com>
1010
1011         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
1012         (Target_powerpc::Scan::global, local): Likewise.
1013         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
1014         on all ppc64 @h and @ha relocs.
1015
1016 2013-10-14  Alan Modra  <amodra@gmail.com>
1017
1018         * output.h (Output_data_got::add_constant): Tidy.
1019         (Output_data_got::add_constant_pair): New function.
1020         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
1021         methods used so as to first call reserve_ent().
1022
1023 2013-10-11  Roland McGrath  <mcgrathr@google.com>
1024
1025         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
1026         add_got_entry and add_got_entry_pair.
1027
1028         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
1029         (HAVE_PUBNAMES): Likewise.
1030         * configure: Regenerate.
1031
1032         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1033         * testsuite/Makefile.in: Regenerate.
1034
1035         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1036         Remove const from declaration.
1037         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1038         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1039         * output.h (Output_file_header): Remove const from member target_
1040         and corresponding constructor argument.
1041         * output.cc (Output_file_header::Output_file_header): Update prototype.
1042         (Output_file_header::do_sized_write): Use this->target_ in place
1043         of parameters()->target().
1044
1045         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1046
1047         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1048         * configure: Regenerate.
1049         * Makefile.in: Regenerate.
1050         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1051         * testsuite/merge_string_literals_2.c: Likewise.
1052         * testsuite/Makefile.am
1053         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1054         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1055         literal -fmerge-constants.
1056         * testsuite/Makefile.in: Regenerate.
1057
1058         * i386.cc (Target_i386): Remove unused member dynbss_.
1059         * arm.cc (Target_arm): Likewise.
1060         * powerpc.cc (Target_powerpc): Likewise.
1061         * sparc.cc (Target_sparc): Likewise.
1062         * tilegx.cc (Target_tilegx): Likewise.
1063         * x86_64.cc (Target_x86_64): Likewise.
1064         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1065         type_signature_, type_offset_.
1066         * plugin.h (Plugin_hook): Remove unused member layout_.
1067         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1068         mapfile_.
1069         (Read_member): Remove unused members input_objects_, symtab_,
1070         mapfile_, layout_.
1071         (Check_library): Remove unused member symtab_.
1072         * archive.h (Lib_group): Remove unused member lib_.
1073         * archive.cc (Lib_group::Lib_group): Update initializer.
1074         * incremental.h (Incremental_binary): Remove unused member target_.
1075         (Incremental_script_entry): Removed unused member script_.
1076         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1077         * icf.h (Icf): Remove unused member num_tracked_relocs.
1078
1079         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1080         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1081         its only use.
1082         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1083
1084         * archive.h: Use struct rather than class for forward declaration
1085         of Read_symbols_data.
1086
1087 2013-10-07  Cary Coutant  <ccoutant@google.com>
1088
1089         PR gold/16010
1090         * testsuite/Makefile.am (icf_test): Fix dependencies.
1091         (icf_safe_test): Likewise.
1092         (icf_safe_so_test): Likewise.
1093         (large_symbol_alignment): Add empty _LDADD rule.
1094         * testsuite/Makefile.in: Regenerate.
1095
1096 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1097
1098         PR gold/15927
1099         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1100         relocation for R_X86_64_32 on x32.
1101
1102 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1103
1104         * output.cc (Output_segment::set_section_addresses): Take new
1105         Target* argument.  If target->isolate_execinstr() and the segment
1106         is executable and starts at a target->abi_pagesize() boundary,
1107         pad its end out to a target->abi_pagesize() boundary with code fill.
1108         * output.h (Output_segment::set_section_addresses): Update decl.
1109         * layout.h (Layout::check_output_data_for_reset_values): Take new
1110         argument RELAX_OUTPUTS.
1111         (Layout): New member relax_output_list_.
1112         (Layout::add_relax_output): New method.
1113         * layout.cc (Layout::Layout): Update constructor.
1114         (Layout::reset_relax_output): New method.
1115         (Layout::clean_up_after_relaxation): Call it.
1116         (Layout::prepare_for_relaxation): Update caller.
1117         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1118         Call reset_relax_output before re-processing segments for
1119         isolate_execinstr case.
1120         (Layout::write_data): Handle relax_output_list_.
1121         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1122         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1123
1124 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1125
1126         PR binutils/15834
1127         * object.h: Fix typos.
1128
1129 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1130
1131         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1132         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1133
1134 2013-08-07  Cary Coutant  <ccoutant@google.com>
1135
1136         Revert support for v2 DWP files:
1137
1138         2013-03-01  Cary Coutant  <ccoutant@google.com>
1139
1140             Add dwp support for v2 DWARF package file format.
1141             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1142             tu_length parameter.  Adjust all callers.
1143             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1144             * dwp.cc: Include dwarf.h.
1145             (Section_bounds): New struct type.
1146             (Unit_set): New struct type.
1147             (Dwo_file::Dwo_file): Initialize new data member.
1148             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1149             Combine and rename to...
1150             (Dwo_file::read_unit_index): ...this.
1151             (Dwo_file::sized_read_compunit_index)
1152             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1153             (Dwo_file::sized_read_unit_index): ...this.
1154             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1155             parameters; add section_id parameter.
1156             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1157             (Dwo_file::add_unit_set): ...this.
1158             (Dwo_file::shndx_map_): Remove.
1159             (Dwo_file::sect_offsets_): New data member.
1160             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1161             (Dwp_output_file::add_section): Rename to...
1162             (Dwp_output_file::add_contribution): ...this.
1163             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1164             (Dwp_output_file::add_tu_set): Likewise.
1165             (Dwp_output_file::Contribution): New type.
1166             (Dwp_output_file::Section::contributions): New data member.
1167             (Dwp_output_file::Cu_or_tu_set): Remove.
1168             (Dwp_output_file::Section::Section): New ctor.
1169             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1170             (Dwp_output_file::Dwp_index::Section_table): New type.
1171             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1172             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1173             parameter.
1174             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1175             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1176             (Dwp_output_file::Dwp_index::section_table): New member function.
1177             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1178             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1179             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1180             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1181             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1182             (Dwp_output_file::Dwp_index::section_table_): New data member.
1183             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1184             (Dwp_output_file::add_output_section): New member function.
1185             (Dwp_output_file::write_new_section): New member function.
1186             (Dwp_output_file::write_contributions): New member function.
1187             (Dwp_output_file::section_id_map_): New data member.
1188             (class Dwo_id_info_reader): Remove.
1189             (class Unit_reader): New class.
1190             (get_dwarf_section_name): New function.
1191             (Dwo_file::read_executable): Adjust initializations of class data.
1192             (Dwo_file::read): Add support for v2 package file format.
1193             (Dwo_file::read_unit_index): Likewise.
1194             (Dwo_file::sized_read_unit_index): Likewise.
1195             (Dwo_file::copy_section): Likewise.
1196             (Dwo_file::add_unit_set): Likewise.
1197             (Dwp_output_file::add_output_section): Likewise.
1198             (Dwp_output_file::add_contribution): Likewise.
1199             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1200             for empty slot.
1201             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1202             file format.
1203             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1204             slot.
1205             (Dwp_output_file::initialize): Remove unused function.
1206             (Dwp_output_file::finalize): Add support for v2 package file format.
1207             (Dwp_output_file::write_index): Likewise.
1208             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1209             function prototype.
1210
1211 2013-07-31  Cary Coutant  <ccoutant@google.com>
1212
1213         * object.cc (Sized_relobj::do_output_section_address): New function.
1214         (Sized_relobj): Instantiate explicitly.
1215         * object.h (Object::output_section_address): New function.
1216         (Object::do_output_section_address): New function.
1217         (Sized_relobj::do_output_section_address): New function.
1218         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1219
1220 2013-07-30  Cary Coutant  <ccoutant@google.com>
1221             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1222
1223         * parameters.cc (Parameters::entry): Return target-specific entry
1224         symbol name.
1225         * target.h (Target::entry_symbol_name): New function.
1226         (Target_info::entry_symbol_name): New data member.
1227
1228         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1229         * i386.cc (Target_i386::i386_info): Likewise.
1230         (Target_i386_nacl::i386_nacl_info): Likewise.
1231         * sparc.cc (Target_sparc::sparc_info): Likewise.
1232         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1233         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1234         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1235         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1236
1237 2013-07-22  Sterling Augustine  <saugustine@google.com>
1238
1239         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1240         Convert parameter shndx to local variable. Add parameters symtab
1241         and symtab_size.  Scan over section names.  Find relocation
1242         section corresponding to current section.  Create and initialize
1243         reloc_mapper_ and reloc_type_.
1244         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1245         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1246         cu_offset_.
1247         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1248         Initialize new fields unit_length_ and cu_offset_.
1249         (Dwarf_pubnames_table::read_section): Update prototype.
1250         (Dwarf_pubnames_table::cu_offset): New member function.
1251         (Dwarf_pubnames_table::subsection_size): Likewise.
1252         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1253         New fields.
1254         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1255         member functions public.
1256         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1257         Update comment.  Rework logic.  Move repeated parts to...
1258         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1259         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1260         pubtypes_table_, and stmt_list_offset.
1261         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1262         Gdb_index::find_pubtype_offset,
1263         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1264         (Gdb_index::pubnames_read): Update prototype and rework logic.
1265         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1266         Forward declare.
1267         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1268         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1269         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1270         Gdb_index::map_pubtable_to_dies):
1271         Declare functions.
1272         (Gdb_index::pubnames_read): Update declaration.
1273         (Gdb_index::Pubname_offset_map): New type.
1274         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1275         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1276         Gdb_index::stmt_list_offset): Declare.
1277         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1278         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1279         Gdb_index::pubtypes_offset_): Remove.
1280
1281 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1282
1283         * options.h (General_options): Add -Trodata-segment option.
1284         * parameters.cc (Parameters::check_rodata_segment): New function.
1285         (Parameters::set_target_once): Call it.
1286         * parameters.h (Parameters): Declare it (private member function).
1287         * layout.cc (load_seg_unusable_for_headers): New function, broken
1288         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1289         then validate rodata segment rather than text segment.
1290         (relaxation_loop_body): Call that.
1291         (is_text_segment): New function.  Don't admit a non-executable
1292         segment if TARGET->isolate_execinstr().
1293         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1294
1295 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1296
1297         PR gold/15070
1298         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1299         * nacl.h (Sniff_file::View::View): Request aligned view.
1300
1301 2013-07-11  Cary Coutant  <ccoutant@google.com>
1302
1303         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1304         correct BRLT entry size.
1305
1306 2013-07-03  Alan Modra  <amodra@gmail.com>
1307
1308         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1309         comment.
1310
1311 2013-07-01  Cary Coutant  <ccoutant@google.com>
1312
1313         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1314         reloc_type_.
1315         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1316         (Dwarf_ranges_table::lookup_reloc): New function.
1317         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1318         reloc_type_.
1319         (Dwarf_ranges_table::lookup_reloc): New function.
1320         (Dwarf_ranges_table::reloc_type_): New data member.
1321
1322 2013-06-27  Jing Yu  <jingyu@google.com>
1323
1324         PR gold/15662
1325         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1326         function.
1327         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1328         (Target_powerpc::do_relax): Call the above.
1329
1330 2013-06-27  Cary Coutant  <ccoutant@google.com>
1331
1332         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1333         on garbage collected .opd section.
1334
1335 2013-06-27  Alan Modra  <amodra@gmail.com>
1336
1337         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1338         is non-zero.
1339         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1340         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1341
1342 2013-06-14  Cary Coutant  <ccoutant@google.com>
1343
1344         * resolve.cc (Symbol::override_base): Don't override st_type
1345         from plugin placeholder symbols.
1346         (Symbol_table::resolve): Likewise.
1347         (Symbol_table::should_override): Don't complain about TLS mismatch
1348         if the TO symbol is a plugin placeholder.
1349         * testsuite/Makefile.am (plugin_test_tls): New test.
1350         * testsuite/Makefile.in: Regenerate.
1351         * testsuite/plugin_test_tls.sh: New test script.
1352         * testsuite/two_file_test_2_tls.cc: New test source.
1353         * testsuite/two_file_test_tls.cc: New test source.
1354
1355 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1356
1357         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1358         the maximum segment alignment is larger than the page size.
1359         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1360         correctly aligns the symbols with large alignemnt.
1361         * testsuite/Makefile.in: Regenerate.
1362         * testsuite/large_symbol_alignment.cc: New file.
1363
1364 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1365             Sriraman Tallam  <tmsriram@google.com>
1366
1367         * options.h (sort_section): New option.
1368         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1369         Rename from Input_section_sort_section_name_special_ordering_compare.
1370         (Input_section_sort_section_name_compare): New struct.
1371         * output.cc (Output_section::Input_section_sort_section_name_compare::
1372         operator()): New function.
1373         (Output_section::sort_attached_input_sections): Use new sort function
1374         for .text if --sort-section=name is specified.
1375         * layout.cc (Layout::make_output_section):
1376         Add sorting by name when --sort-section=name is specified.
1377         * testsuite/Makefile.am (text_section_grouping): Test option
1378         --sort-section=name.
1379         * testsuite/Makefile.in: Regenerate.
1380         * testsuite/section_sorting_name.cc: New file.
1381         * testsuite/section_sorting_name.sh: New file.
1382
1383 2013-05-21  Cary Coutant  <ccoutant@google.com>
1384
1385         * symtab.h (Symbol::is_cxx_vtable): New function.
1386         * target-reloc.h (relocate_section): Check for vtable symbol.
1387         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1388         * testsuite/Makefile.in: Regenerate.
1389         * testsuite/missing_key_func.cc: New test source.
1390         * testsuite/missing_key_func.sh: New test script.
1391
1392 2013-05-21  Cary Coutant  <ccoutant@google.com>
1393
1394         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1395         type of enclosing symbol.
1396         (Relocate_info::location): Check symbol type when describing symbol.
1397         * object.h (Symbol_location_info): Remove unused line_number;
1398         add enclosing_symbol_type.
1399         * testsuite/debug_msg.sh: Adjust expected output.
1400
1401 2013-05-13  Cary Coutant  <ccoutant@google.com>
1402
1403         * configure.ac: Export DEFAULT_TARGET.
1404         * configure: Regenerate.
1405         * Makefile.in: Regenerate.
1406         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1407         * testsuite/Makefile.in: Regenerate.
1408         * testsuite/debug_msg.sh: Delete duplicate tests.
1409         Don't check undef_int error message match for powerpc where the
1410         source file and line number aren't available.
1411
1412 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1413
1414         * options.h (General_options): Add --rosegment-gap option.
1415         * options.cc (finalize): --rosegment-gap implies --rosegment.
1416         * layout.cc (set_segment_offsets): Let user option override
1417         target->rosegment_gap().
1418
1419 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1420
1421         * options.h (General_options): Remove leading space from help
1422         messages for -nostdlib and --rosegment.
1423
1424 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1425
1426         PR ld/15365
1427         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1428
1429 2013-05-03  Alan Modra  <amodra@gmail.com>
1430
1431         * merge.cc (Output_merge_string::do_add_input_section): Correct
1432         scan for number of strings.  Rename vars to avoid shadowing.
1433         Include missing terminator in input_size_.
1434
1435 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1436
1437         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1438         Restore empty string handling.
1439
1440 2013-05-01  Cary Coutant  <ccoutant@google.com>
1441
1442         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1443         uninitialized warning.
1444
1445 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1446
1447         * output.cc (Output_section::add_merge_input_section): Allow
1448         to merge sections if the alignment is more than character size.
1449         * merge.h (Output_merge_string::Output_merge_string): Remove
1450         assert.
1451         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1452         only not-null strings. Check the alignment of strings.
1453         * stringpool.h
1454         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1455         alignment as the argument.
1456         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1457         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1458         Align non-zero length strings according to the addralign_.
1459         (Stringpool_template<Stringpool_char>::set_string_offsets):
1460         Updating offsets according to the given alignment.
1461         * testsuite/Makefile.am (text_section_grouping): Test if string
1462         literals are getting merged.
1463         * testsuite/Makefile.in: Regenerate.
1464         * testsuite/merge_string_literals_1.c: New file.
1465         * testsuite/merge_string_literals_2.c: Ditto.
1466         * testsuite/merge_string_literals.sh: Ditto.
1467
1468 2013-04-26  Ian Lance Taylor  <iant@google.com>
1469
1470         * target-reloc.h (relocate_section): If the reloc offset is out of
1471         range, pass VIEW as NULL to relocate.relocate.
1472         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1473         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1474         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1475         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1476         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1477         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1478
1479 2013-04-26  Geoff Pike  <gpike@chromium.org>
1480
1481         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1482         * layout.cc (Hash_task): New class.
1483         (Layout::queue_build_id_tasks): New function.
1484         (Layout::write_build_id): Handle single-thread portion of build ID
1485         computation.  (In some cases, all of it is single-threaded.)  Replace
1486         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1487         functionality in fewer lines of code.
1488         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1489         * options.h (General_options): make "--build-id" default to tree
1490         rather than sha1.  Add two new options related to --build-id=tree:
1491         --build-id-chunk-size-for-treehash and
1492         --build-id-min-file-size-for-treehash.
1493         * Makefile.am: add testing of --build-id=tree and related new options
1494         (these tests will be invoked by "make check").
1495         * Makefile.in: Regenerate.
1496
1497 2013-04-25  Alan Modra  <amodra@gmail.com>
1498
1499         * configure.tgt: Add powerpcle and powerpc64le.
1500
1501 2013-04-22  Alan Modra  <amodra@gmail.com>
1502
1503         PR gold/15355
1504         * layout.cc (Layout::segment_precedes): Allow more than one
1505         segment with the same type and flags.
1506
1507 2013-04-15  Cary Coutant  <ccoutant@google.com>
1508
1509         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1510         allocate space in file for BSS sections.
1511
1512 2013-04-15  Cary Coutant  <ccoutant@google.com>
1513
1514         * script-sections.cc (Orphan_output_section): Reset address
1515         to zero after each orphaned section for relocatable links.
1516
1517 2013-04-15  Cary Coutant  <ccoutant@google.com>
1518
1519         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1520         section starting address for relocatable link.
1521         * testsuite/Makefile.am (script_test_11): New test.
1522         * testsuite/Makefile.in: Regenerate.
1523         * testsuite/script_test_11.c: New source file.
1524         * testsuite/script_test_11.t: New linker script.
1525
1526 2013-04-13  Alan Modra  <amodra@gmail.com>
1527
1528         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1529         owner when sections are not adjacent and exceed group size.
1530         (Target_powerpc::group_sections): Handle corner case.
1531         (Target_powerpc::Branch_info::make_stub): Handle case where
1532         stub table doesn't exist due to branches in non-exec sections.
1533         (Target_powerpc::Relocate::relocate): Likewise.
1534
1535 2013-04-11  Alan Modra  <amodra@gmail.com>
1536
1537         PR gold/15354
1538         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1539         .branch_lt to match bfd ld.  Adjust comments throughout file.
1540
1541 2013-04-04  Ian Lance Taylor  <iant@google.com>
1542
1543         GCC PR c++/56840
1544         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1545         sections before checking whether they are included in the link.
1546
1547 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1548
1549         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1550         object before calling the plugin claim_file handler.  Pass the elf
1551         object of the archive to the plugin. Delete the elf object if the
1552         plugin claims the file.
1553
1554 2013-03-21  Alan Modra  <amodra@gmail.com>
1555
1556         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1557         segment when omagic.
1558
1559 2013-03-21  Alan Modra  <amodra@gmail.com>
1560
1561         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1562         comparison warning.
1563         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1564         uninitialized" warning.
1565
1566 2013-03-20  Alan Modra  <amodra@gmail.com>
1567
1568         * symtab.h (Symbol::clear_version): New function.
1569         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1570         is_needed by weak references.  Clear version for symbols defined
1571         in as-needed objects that are not needed.
1572
1573 2013-03-15  Alan Modra  <amodra@gmail.com>
1574
1575         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1576         static and public.  Add report_err param.  Return false for data refs.
1577         (Target_powerpc::rela_dyn_section): New overloaded function.
1578         (Target_powerpc::plt_, iplt_): Elucidate.
1579         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1580         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1581         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1582         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1583         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1584         push_branch and make_plt_entry for ifunc syms when
1585         reloc_needs_plt_for_ifunc.
1586         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1587         for ifunc unless reloc_needs_plt_for_ifunc.
1588
1589 2013-03-15  Alan Modra  <amodra@gmail.com>
1590
1591         * gc.h (gc_process_relocs): Don't look through function descriptors.
1592         * icf.cc (get_section_contents): Do so here instead.
1593
1594 2013-03-13  Alan Modra  <amodra@gmail.com>
1595
1596         * powerpc.cc (is_branch_reloc): Forward declare.
1597         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1598         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1599         false for 64-bit, true for 32-bit non-branch relocs.
1600         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1601         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1602         nm output.
1603         (icf_safe_test): Generate linker map file as well as nm output.
1604         (icf_safe_so_test): Likewise.
1605         * testsuite/Makefile.in: Regenerate.
1606         * testsuite/icf_test.sh: Parse linker map file to determine
1607         section folding.
1608         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1609         * testsuite/icf_safe_so_test.sh: Likewise.
1610         (X86_32_or_ARM_specific_safe_fold): Merge into..
1611         (arch_specific_safe_fold): ..this.
1612         (X86_64_specific_safe_fold): Delete unused function.
1613
1614 2013-03-12  Alan Modra  <amodra@gmail.com>
1615
1616         * gc.h (gc_process_relocs): Look through function descriptors
1617         to determine shndx, symvalue and addend used by ICF.  Tidy
1618         variable duplication.
1619
1620 2013-03-11  Alan Modra  <amodra@gmail.com>
1621
1622         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1623         * layout.cc (Layout_task_runner::run): ..to here.
1624         * symtab.h (struct Symbol_location): Extract from..
1625         (class Symbol_table): ..here.
1626         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1627         * target.h (class Target): Add function_location and
1628         do_function_location functions.
1629         (class Sized_target): Add do_function_location.
1630         * object.h (class Sized_relobj_file): Move find_shdr..
1631         (class Object): ..to here.
1632         * object.cc: Likewise.  Update to suit.  Instantiate.
1633         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1634         * powerpc.cc (class Powerpc_dynobj): New.
1635         (Target_powerpc::do_function_location): New function.
1636         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1637         (Powerpc_dynobj::do_read_symbols): New function.
1638         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1639
1640 2013-03-08  Ian Lance Taylor  <iant@google.com>
1641
1642         * options.cc (General_options::string_to_object_format): Accept
1643         "default".
1644
1645 2013-03-08  Alan Modra  <amodra@gmail.com>
1646
1647         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1648         pointer to Post_fde.
1649         (struct Post_fde): Move definition to here..
1650         * ehframe.cc (struct Post_fde): ..from here.
1651         (Cie::write): Don't alloc Post_fde.
1652         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1653
1654 2013-03-07  Alan Modra  <amodra@gmail.com>
1655
1656         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1657         relocation referencing .LC0.
1658         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1659
1660 2013-03-07  Alan Modra  <amodra@gmail.com>
1661
1662         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1663         always_inline.  Add assembly for powerpc to avoid GOT.
1664
1665 2013-03-07  Alan Modra  <amodra@gmail.com>
1666
1667         * testsuite/script_test_10.sh: Don't test .bss section
1668         header number.
1669
1670 2013-03-06  Alan Modra  <amodra@gmail.com>
1671
1672         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1673         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1674         all callers.  Handle folded sections.
1675         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1676         to Powerpc_relobj.
1677         (Global_symbol_visitor_opd::operator()): Likewise.
1678
1679 2013-03-04  Alan Modra  <amodra@gmail.com>
1680
1681         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1682         * testsuite/Makefile.in: Regenerate.
1683
1684 2013-03-01  Cary Coutant  <ccoutant@google.com>
1685
1686         Add dwp support for v2 DWARF package file format.
1687         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1688         tu_length parameter.  Adjust all callers.
1689         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1690         * dwp.cc: Include dwarf.h.
1691         (Section_bounds): New struct type.
1692         (Unit_set): New struct type.
1693         (Dwo_file::Dwo_file): Initialize new data member.
1694         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1695         Combine and rename to...
1696         (Dwo_file::read_unit_index): ...this.
1697         (Dwo_file::sized_read_compunit_index)
1698         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1699         (Dwo_file::sized_read_unit_index): ...this.
1700         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1701         parameters; add section_id parameter.
1702         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1703         (Dwo_file::add_unit_set): ...this.
1704         (Dwo_file::shndx_map_): Remove.
1705         (Dwo_file::sect_offsets_): New data member.
1706         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1707         (Dwp_output_file::add_section): Rename to...
1708         (Dwp_output_file::add_contribution): ...this.
1709         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1710         (Dwp_output_file::add_tu_set): Likewise.
1711         (Dwp_output_file::Contribution): New type.
1712         (Dwp_output_file::Section::contributions): New data member.
1713         (Dwp_output_file::Cu_or_tu_set): Remove.
1714         (Dwp_output_file::Section::Section): New ctor.
1715         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1716         (Dwp_output_file::Dwp_index::Section_table): New type.
1717         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1718         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1719         parameter.
1720         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1721         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1722         (Dwp_output_file::Dwp_index::section_table): New member function.
1723         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1724         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1725         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1726         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1727         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1728         (Dwp_output_file::Dwp_index::section_table_): New data member.
1729         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1730         (Dwp_output_file::add_output_section): New member function.
1731         (Dwp_output_file::write_new_section): New member function.
1732         (Dwp_output_file::write_contributions): New member function.
1733         (Dwp_output_file::section_id_map_): New data member.
1734         (class Dwo_id_info_reader): Remove.
1735         (class Unit_reader): New class.
1736         (get_dwarf_section_name): New function.
1737         (Dwo_file::read_executable): Adjust initializations of class data.
1738         (Dwo_file::read): Add support for v2 package file format.
1739         (Dwo_file::read_unit_index): Likewise.
1740         (Dwo_file::sized_read_unit_index): Likewise.
1741         (Dwo_file::copy_section): Likewise.
1742         (Dwo_file::add_unit_set): Likewise.
1743         (Dwp_output_file::add_output_section): Likewise.
1744         (Dwp_output_file::add_contribution): Likewise.
1745         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1746         for empty slot.
1747         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1748         file format.
1749         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1750         slot.
1751         (Dwp_output_file::initialize): Remove unused function.
1752         (Dwp_output_file::finalize): Add support for v2 package file format.
1753         (Dwp_output_file::write_index): Likewise.
1754         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1755         function prototype.
1756
1757 2013-03-01  Cary Coutant  <ccoutant@google.com>
1758
1759         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1760         function into class definition in header file.
1761         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1762         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1763         New function.
1764         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1765
1766 2013-02-28  Alan Modra  <amodra@gmail.com>
1767
1768         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1769         * target.cc (Target::do_plt_fde_location): New function.
1770         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1771         accessor function, and constructor param.
1772         (struct Post_fde, Post_fdes): Declare.
1773         (Cie::write): Add post_fdes param.
1774         * ehframe.cc (Fde::write): Use plt_fde_location.
1775         (struct Post_fde): Define.
1776         (Cie::write): Stash FDEs added post merge mapping.
1777         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1778         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1779         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1780         other FDEs.
1781         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1782         (Target_powerpc::has_glink): New function.
1783         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1784         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1785         glink_eh_frame_fde_32, default_fde): New data.
1786         (Stub_table::eh_frame_added_): New var.
1787         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1788         Make const.
1789         (Stub_table::add_eh_frame): New function.
1790         (Output_data_glink::add_eh_frame): New function.
1791         (Target_powerpc::make_glink_section): Call add_eh_frame.
1792
1793 2013-02-15  Ian Lance Taylor  <iant@google.com>
1794
1795         * options.h (DEFINE_uint64_alias): Define.
1796         (class General_options): Add -Ttext-segment as an alias for
1797         -Ttext.
1798
1799 2013-02-15  Alan Modra  <amodra@gmail.com>
1800
1801         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1802         (Stub_table::do_write): ..here, two places.
1803         (Stub_table::plt_call_size): Use it here too.
1804
1805 2013-02-11  Ian Lance Taylor  <iant@google.com>
1806
1807         * descriptors.cc (Descriptors::close_all): New function.
1808         * descriptors.h (class Descriptors): Declare close_all.
1809         (close_all_descriptors): New inline function.
1810         * plugin.cc: Include "descriptors.h".
1811         (Plugin_manager::cleanup): Call close_all_descriptors.
1812
1813 2013-02-06  Alan Modra  <amodra@gmail.com>
1814
1815         * README: Update coding style link.
1816
1817 2013-01-28  Cary Coutant  <ccoutant@google.com>
1818
1819         * dwp.cc (File_list): New typedef.
1820         (Dwo_name_info_reader): New class.
1821         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1822         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1823         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1824         (Dwo_file::read_executable): New function.
1825         (Dwo_file::read): Move common setup code to ...
1826         (Dwo_file::make_object): ... here.
1827         (dwp_options): Add --exec/-e.
1828         (usage): Likewise.
1829         (main): Likewise.
1830
1831 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1832
1833         * layout.cc (Layout::layout): Check for option text_reorder.
1834         (Layout::make_output_section): Ditto.
1835         * options.h (text_reorder): New option.
1836         * output.cc (Input_section_sort_compare): Remove special ordering
1837         of section names.
1838         (Output_section::
1839          Input_section_sort_section_name_special_ordering_compare::
1840          operator()): New function.
1841         (Output_section::sort_attached_input_sections): Use new sort function
1842         for .text.
1843         * output.h (Input_section_sort_section_name_special_ordering_compare):
1844         New struct.
1845         * testsuite/Makefile.am (text_section_grouping): Test option
1846         --no-text-reorder
1847         * testsuite/Makefile.in: Regenerate.
1848         * testsuite/text_section_grouping.sh: Check order of functions without
1849         default text reordering.
1850
1851 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1852
1853         * options.h (General_options): Change default to true for new_dtags.
1854
1855 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1856
1857         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1858         when enable_new_dtags is false.  Only add DT_RUNPATH when
1859         enable_new_dtags is true.
1860
1861 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1862
1863         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1864         used in declaration and definition consistent.
1865         (Target_powerpc::symval_for_branch): Ditto.
1866
1867 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1868
1869         * testsuite/plugin_final_layout.cc: Fix comment.
1870
1871 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1872
1873         * layout.cc (Layout::layout): Do not do default sorting for
1874         text sections when section ordering is specified.
1875         (make_output_section): Ditto.
1876         * testsuite/plugin_final_layout.cc: Name the function sections
1877         to catch reordering issues.
1878
1879 2013-01-15  Alan Modra  <amodra@gmail.com>
1880
1881         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1882         plt-thread-safe.
1883
1884 2013-01-15  Alan Modra  <amodra@gmail.com>
1885
1886         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1887         * testsuite/Makefile.in: Regenerate.
1888
1889 2013-01-14  Alan Modra  <amodra@gmail.com>
1890
1891         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1892         * testsuite/Makefile.in: Regenerate.
1893
1894 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1895
1896         PR bfd/14430
1897         Fix mingw gold build with plugins enabled
1898         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1899         * configure.ac: Export DLOPEN_LIBS and add headers check.
1900         * plugin.cc: Handle non-dlfcn case.
1901         * Makefile.in: Regenerate.
1902         * config.in: Regenerate.
1903         * configure: Regenerate.
1904         * testsuite/Makefile.in: Regenerate.
1905
1906 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1907
1908         * output.h (sort_attached_input_sections): Change to be public.
1909         * script-sections.cc
1910         (Output_section_definition::set_section_addresses): Sort
1911         attached input sections according to section order before linker
1912         script assigns section addresses.
1913         (Orphan_output_section::set_section_addresses): Sort
1914         attached input sections according to section order before linker
1915         script assigns section addresses.
1916         * Makefile.am (final_layout.sh): Use a simple linker script to
1917         check if section ordering still works.
1918         * Makefile.in: Regenerate.
1919
1920 2013-01-09  Ben Cheng  <bccheng@google.com>
1921
1922         * arm.cc (Target_arm::attributes_accept_div): New function.
1923         (Target_arm::attributes_forbid_div): New function.
1924         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1925         attribute using the same new functions as what bfd/elf32_arm.c
1926         does.
1927
1928 2013-01-07  Cary Coutant  <ccoutant@google.com>
1929
1930         PR gold/14993
1931         * output.cc (Output_section::add_input_section): For incremental
1932         updates, don't track input sections that are allocated from patch
1933         space.
1934
1935 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1936             Ian Lance Taylor  <iant@google.com>
1937
1938         PR gold/14897
1939         * configure.ac (--enable-ld): Removed.
1940         (install_as_default): Set to yes only for --enable-gold=default
1941         or --disable-ld.
1942         * configure: Regenerated.
1943
1944 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1945
1946         * options.h (General_options): Add -fuse-ld= for GCC linker
1947         option compatibility.
1948
1949 2013-01-04  Cary Coutant  <ccoutant@google.com>
1950
1951         * configure.ac: Fix typo restoring CXXFLAGS.
1952         * configure: Regenerate.
1953
1954 2013-01-04  Cary Coutant  <ccoutant@google.com>
1955
1956         * testsuite/Makefile.am (CXXLINK_S): New macro.
1957         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1958         * testsuite/Makefile.in: Regenerate.
1959
1960 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1961
1962         * version.cc (print_version): Update copyright year to 2013.
1963
1964 2012-12-20  Ian Lance Taylor  <iant@google.com>
1965
1966         * layout.cc (Layout::special_ordering_of_input_section): New
1967         function.
1968         (Layout::layout): If input section requires special ordering, must
1969         sort input sections.
1970         (Layout::make_output_section): May sort .text input sections.
1971         (Layout::is_section_name_prefix_grouped): Remove.
1972         * layout.h (class Layout): Declare
1973         special_ordering_of_input_section.  Don't declare
1974         is_section_name_prefix_grouped.
1975         * output.cc (Output_section::add_input_section): Revert last
1976         change.
1977         (Output_section::Input_section_sort::match_file_name): Don't crash
1978         if called on output section data.
1979         (Output_section::Input_section_sort_compare): Sort based on
1980         special ordering.
1981         (Output_section::Input_section_sort_section_order_index_compare):
1982         Revert last patch.
1983         (Output_section::sort_attached_input_sections): Likewise.
1984
1985 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1986
1987         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1988         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1989         * output.cc (Output_section::add_input_section): Check if section
1990         name contains special prefix.  Keep input sections to sort such
1991         sections.
1992         (Output_section::Input_section_sort_section_order_index_compare
1993          ::operator()): Group sections according to prefixes.
1994         (Output_section::sort_attached_input_sections): Add condition to
1995         Input_section_entry constructor call.
1996         * testsuite/Makefile.am (text_section_grouping): New test.
1997         * testsuite/Makefile.in: Regenerate.
1998         * testsuite/text_section_grouping.cc: New file.
1999         * testsuite/text_section_grouping.sh: New file.
2000
2001 2012-12-17  Nick Clifton  <nickc@redhat.com>
2002
2003         * Makefile.am: Add copyright notice.
2004         * NEWS: Likewise.
2005         * README: Likewise.
2006         * configure.ac: Likewise.
2007         * ftruncate.c: Likewise.
2008         * Makefile.in: Regenerate.
2009
2010 2012-12-14  Cary Coutant  <ccoutant@google.com>
2011
2012         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
2013         --no-as-needed flag.
2014         (exception_separate_shared_12_test): Likewise.
2015         (incremental_copy_test): Likewise.
2016         * testsuite/Makefile.in: Regenerate.
2017
2018 2012-12-14  Cary Coutant  <ccoutant@google.com>
2019
2020         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
2021         (Dwp_output_file::Dwp_index::enter_set): Add assert.
2022
2023 2012-12-12  Alan Modra  <amodra@gmail.com>
2024
2025         * powerpc.cc (class Track_tls): New.
2026         (class Relocate, class Scan): Inherit Track_tls.
2027         (Target_powerpc::Scan::local, global): Track tls optimization
2028         and avoid creating plt entry for __tls_get_addr if all uses
2029         are optimized away.
2030         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
2031
2032 2012-12-12  Alan Modra  <amodra@gmail.com>
2033
2034         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2035         Replace no_toc_optimize with toc_optimize.
2036         * output.h (Output_section::input_sections): Provide non-const variant.
2037         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2038         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2039         accessors.
2040         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2041         (class Sort_toc_sections): New.
2042         (Target_powerpc::do_finalize_sections): Sort toc sections.
2043         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2044
2045 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2046
2047         * testsuite/binary_unittest.cc (read_all): New function.
2048         (Sized_binary_test): Use it instead of ::read.
2049         * fileread.cc (do_read): Don't assume pread always reads the whole
2050         amount in a single call.
2051
2052 2012-12-10  Alan Modra  <amodra@gmail.com>
2053
2054         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2055         Set EM_PPC64 or EM_PPC here.
2056         (Target_selector_powerpc::do_recognize): Delete.
2057
2058 2012-12-10  Alan Modra  <amodra@gmail.com>
2059
2060         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2061         stub_table_.
2062         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2063
2064 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2065
2066         * testsuite/binary_unittest.cc (Sized_binary_test):
2067         Use open_descriptor rather than ::open.
2068
2069 2012-12-07  Alan Modra  <amodra@gmail.com>
2070
2071         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2072         typedef and invalid_address constant.
2073         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2074         instantiate constants.
2075
2076 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2077
2078         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2079         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2080         * aclocal.m4: Regenerate.
2081         * configure: Regenerate.
2082         * Makefile.in: Regenerate.
2083         * testsuite/Makefile.in: Regenerate.
2084
2085 2012-12-07  Alan Modra  <amodra@gmail.com>
2086
2087         * options.h (General_options): Add no_toc_optimize.
2088         * powerpc.cc (ok_lo_toc_insn): New function.
2089         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2090
2091 2012-12-06  Alan Modra  <amodra@gmail.com>
2092
2093         * options.h (General_options): Add plt_align, plt_static_chain,
2094         plt_thread_safe.  Update stub_group_size help text.
2095         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2096         for new plt_thread_safe_ var.
2097         (use_plt_offset): Correct comments.
2098         (Target_powerpc::do_relax): Look for thread creation symbols to
2099         determine default plt_thread_safe value.  Clear plt call stubs
2100         as well as branch stubs each iteration.
2101         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2102         insn constants.
2103         (l, hi, ha, write_insn): Move earlier.
2104         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2105         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2106         plt stubs too.
2107         (Stub_table::update_size): Adjust.
2108         (Stub_table::prev_size, set_prev_size): Delete.
2109         (Stub_table::stub_align): Let --plt-align affect result.
2110         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2111         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2112         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2113         (Stub_table::do_write): Support more stub variants.
2114
2115 2012-12-04  Alan Modra  <amodra@gmail.com>
2116
2117         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2118         (Target_powerpc::do_define_standard_symbols): New function.
2119
2120 2012-12-03  Alan Modra  <amodra@gmail.com>
2121
2122         * output.h: Formatting, whitespace.
2123
2124 2012-12-03  Alan Modra  <amodra@gmail.com>
2125
2126         * layout.h (Layout::get_executable_sections): Declare.
2127         * layout.cc (Layout::get_executable_sections): New function.
2128         * arm.cc (Target_arm::group_sections): Use it.
2129         (Arm_output_section::group_sections): Delete now redundant test.
2130         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2131         param to handle relative relocs.
2132         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2133         (Output_data_reloc::add_absolute): Adjust.
2134         (Output_data_reloc::add_relative): New function.
2135         (Output_data::reset_data_size): New function.
2136         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2137         (Output_section::set_addralign): New function.
2138         (Output_section::checkpoint_set_addralign): New function.
2139         (Output_section::clear_section_offsets_need_adjustment): New function.
2140         (Output_section::input_sections): Make public.
2141         * powerpc.cc (class Output_data_brlt_powerpc): New.
2142         (class Stub_table, class Stub_control): New.
2143         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2144         stub_table_, set_stub_table, stub_table): New vectors and accessor
2145         functions.
2146         (Target_powerpc::do_may_relax, do_relax, push_branch,
2147         new_stub_table, stub_tables, brlt_section, group_sections,
2148         add_branch_lookup_table, find_branch_lookup_table,
2149         write_branch_lookup_table, make_brlt_section): New functions.
2150         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2151         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2152         branch_info_): New vars.
2153         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2154         make call stubs here.
2155         (Output_data_glink): Remove all call stub handling from this class.
2156         (Target_powerpc::Scan::local, global): Save interesting branch
2157         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2158         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2159         functions on final link.
2160         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2161         Handle long branch destinations too.
2162         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2163         do_plt_address_for_local): Adjust lookup of plt call stubs.
2164
2165 2012-11-30  Alan Modra  <amodra@gmail.com>
2166
2167         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2168         relocs against protected symbols when building 32-bit shared libs.
2169
2170 2012-11-30  Alan Modra  <amodra@gmail.com>
2171
2172         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2173         param.  Call got_section() to make .got.  Update all callers
2174         and their callers and so on.
2175
2176 2012-11-30  Alan Modra  <amodra@gmail.com>
2177
2178         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2179         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2180         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2181         value if it already exists.
2182
2183 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2184
2185         PR gold/14858
2186         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2187
2188 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2189
2190         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2191         than bfc instruction for data sandboxing.
2192
2193 2012-11-08  Alan Modra  <amodra@gmail.com>
2194
2195         * po/POTFILES.in: Regenerate.
2196
2197 2012-11-05  Alan Modra  <amodra@gmail.com>
2198
2199         * configure.ac: Apply 2012-09-10 change to config.in here.
2200         * configure: Regenerate.
2201
2202 2012-11-05  Alan Modra  <amodra@gmail.com>
2203
2204         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2205         (struct Opd_ent): Use "Address" rather than "Offset".
2206         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2207         (Target_powerpc::got_section): Make public.
2208         (Target_powerpc::scan_relocs): Move code setting symbols..
2209         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2210         Create _SDA_BASE_ only when referenced.
2211
2212 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2213
2214         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2215         from last change.
2216
2217 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2218
2219         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2220         for offset_in_output_section parameter.
2221         (Sized_target::relocate_special_relocatable): Likewise.
2222         * arm.cc (Target_arm::relocate_relocs): Likewise.
2223         (Target_arm::relocate_special_relocatable): Likewise.
2224         * i386.cc (Target_i386::relocate_relocs): Likewise.
2225         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2226         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2227         * target-reloc.h (relocate_relocs): Likewise.
2228         * testsuite/testfile.cc (Target_test): Likewise.
2229         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2230         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2231
2232         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2233         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2234
2235         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2236         parameter, which is unused in the [!F_SETFD] case.
2237
2238         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2239         SYMNDX to off_t before comparing it to this->data_size().
2240         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2241         * incremental.cc (Output_section_incremental_inputs::do_write):
2242         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2243
2244         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2245
2246 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2247
2248         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2249         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2250         in EABI_VER5.
2251
2252 2012-10-29  Cary Coutant  <ccoutant@google.com>
2253
2254         * dwp.cc (usage): Add file and exit status parameters;
2255         add --help and --version options.
2256         (print_version): New function.
2257         (main): Add --help and --version options.
2258
2259 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2260
2261         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2262         final_layout_sequence.txt.
2263         * testsuite/Makefile.in: Regenerated.
2264
2265 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2266
2267         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2268         COMPILE generated by automake.
2269         (LINK1): Likewise.
2270         (CXXCOMPILE1): Likewise.
2271         (CXXLINK1): Likewise.
2272         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2273         (LINK): Likewise.
2274         (CXXCOMPILE): Likewise.
2275         (CXXLINK): Likewise.
2276         * testsuite/Makefile.in: Regenerated.
2277
2278 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2279
2280         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2281         on bad fwrite return.
2282
2283 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2284
2285         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2286         on val.
2287
2288 2012-10-23  Cary Coutant  <ccoutant@google.com>
2289
2290         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2291         * testsuite/Makefile.in: Regenerate.
2292         * testsuite/dwp_test.h: New source file.
2293         * testsuite/dwp_test_1.cc: New source file.
2294         * testsuite/dwp_test_1.s: New source file.
2295         * testsuite/dwp_test_1.sh: New source file.
2296         * testsuite/dwp_test_1b.cc: New source file.
2297         * testsuite/dwp_test_1b.s: New source file.
2298         * testsuite/dwp_test_2.cc: New source file.
2299         * testsuite/dwp_test_2.s: New source file.
2300         * testsuite/dwp_test_2.sh: New source file.
2301         * testsuite/dwp_test_main.cc: New source file.
2302         * testsuite/dwp_test_main.s: New source file.
2303
2304 2012-10-23  Cary Coutant  <ccoutant@google.com>
2305
2306         * dwp.h: New header file.
2307         * dwp.cc: New source file.
2308         * gold.h: Move shared declarations to system.h.
2309         * system.h: New header file.
2310         * Makefile.am: Add dwp.
2311         * Makefile.in: Regenerate.
2312
2313 2012-10-23  Cary Coutant  <ccoutant@google.com>
2314
2315         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2316         Dwarf_info_reader::read_from_pointer.
2317         (Dwarf_pubnames_table::read_header): Likewise.
2318         (Dwarf_pubnames_table::next_name): Likewise.
2319         (Dwarf_die::read_attributes): Likewise.
2320         (Dwarf_die::skip_attributes): Likewise.
2321         (Dwarf_info_reader::read_from_pointer): New function template.
2322         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2323         (Dwarf_pubnames_table): Likewise.
2324         (Dwarf_info_reader::read_from_pointer): New function template.
2325         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2326         Dwarf_pubnames_table ctor.
2327
2328 2012-10-23  Cary Coutant  <ccoutant@google.com>
2329
2330         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2331         abbrev_shndx.
2332         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2333         abbrev_shndx_.
2334         (Dwarf_info_reader::set_abbrev_shndx): New method.
2335         (Dwarf_info_reader::abbrev_shndx_): New data member.
2336
2337 2012-10-23  Cary Coutant  <ccoutant@google.com>
2338
2339         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2340         from object, not parameters.
2341         (Dwarf_info_reader::parse): Likewise.
2342         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2343         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2344         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2345         methods.
2346
2347 2012-10-23  Cary Coutant  <ccoutant@google.com>
2348
2349         * fileread.cc (Input_file::Input_file): New constructor.
2350         * fileread.h (class Input_file): Add new constructor.
2351
2352 2012-10-18  Alan Modra  <amodra@gmail.com>
2353
2354         PR gold/14727
2355         * object.cc (Relobj::is_section_name_included): Also match
2356         .sdata personality section.
2357
2358 2012-10-18  Alan Modra  <amodra@gmail.com>
2359
2360         * target-reloc.h (class Default_comdat_behavior): New, package up..
2361         (get_comdat_behaviour): ..this.
2362         (relocate_section): Add Relocate_comdat_behavior template arg,
2363         adjust code to suit.
2364         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2365         (Target_arm::scan_reloc_section): Likewise.
2366         * i386.cc (Target_i386::relocate_section): Likewise.
2367         * sparc.cc (Target_sparc::relocate_section): Likewise.
2368         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2369         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2370         * powerpc.cc (class Relocate_comdat_behavior): New.
2371         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2372         gold::relocate_section with new template arg.
2373
2374 2012-10-18  Alan Modra  <amodra@gmail.com>
2375
2376         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2377         dynamic relocs for GOT_TPREL got entries, without symbol if
2378         resolving locally.
2379         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2380         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2381         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2382
2383 2012-10-17  Alan Modra  <amodra@gmail.com>
2384
2385         PR gold/14726
2386         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2387
2388 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2389
2390         * layout.cc (Layout::include_section): Keep sections marked
2391         SHF_EXCLUDE when doing relocatable links.
2392
2393 2012-10-16  Alan Modra  <amodra@gmail.com>
2394
2395         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2396         (Target_powerpc::do_finalize_sections): Call it.
2397         (Output_data_save_res): New class and supporting functions.
2398         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2399         normal symbols defined in object files.
2400
2401 2012-10-12  Alan Modra  <amodra@gmail.com>
2402
2403         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2404         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2405         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2406         section if scan_opd_relocs not yet called.
2407         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2408
2409 2012-10-12  Alan Modra  <amodra@gmail.com>
2410
2411         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2412         add_local_ifunc_entry): Revert last change.
2413         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2414
2415 2012-10-05  Alan Modra  <amodra@gmail.com>
2416
2417         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2418         do_plt_address_for_global): New functions.
2419         (Output_data_got_powerpc::do_write): Don't segfault when linking
2420         statically.
2421         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2422         add_local_ifunc_entry): Return true on adding entry..
2423         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2424         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2425         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2426         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2427         set up symbols here.
2428         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2429         syms here.  Do so even when no .iplt.  Don't segfault when linking
2430         statically.
2431         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2432         new variants without reloc param.
2433         (Glink_sym_ent::Glink_sym_ent): Likewise.
2434         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2435         reloc when refs will resolve to plt call stub.
2436         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2437         R_PPC_PLTREL24 to resolve locally.
2438         (Target_powerpc::Scan::global): Correct ifunc handling.
2439         (Target_powerpc::Relocate::relocate): Correct local sym glink
2440         lookup.  Don't destroy "value" when we have a plt call stub,
2441         and when checking plt call validity.
2442         (Target_powerpc::do_dynsym_value): Simplify.
2443
2444 2012-10-05  Alan Modra  <amodra@gmail.com>
2445
2446         * i386.cc (Output_data_plt_i386::address_for_global,
2447         address_for_local): Add plt offset to returned value.  Adjust uses.
2448         * sparc.cc (Output_data_plt_sparc::address_for_global,
2449         address_for_local): Likewise.
2450         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2451         address_for_local): Likewise.
2452         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2453         address_for_local): Likewise.
2454         * target.h (Target::plt_address_for_global, plt_address_for_local):
2455         Update comment.
2456         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2457         (Output_data_got::Got_entry::write): Nor here.
2458         * output.h: Comment fix.
2459
2460 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2461
2462         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2463         global_offset_table_ value for larget got.
2464         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2465
2466 2012-09-29  Alan Modra  <amodra@gmail.com>
2467
2468         * powerpc.cc (Target_powerpc::iplt_): New output section.
2469         (Target_powerpc::iplt_section, make_iplt_section,
2470         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2471         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2472         Target_powerpc::plt_entry_count): Count iplt entries too.
2473         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2474         reloc section in constructor.  New params.
2475         (Target_powerpc::make_plt_section): Create reloc section here instead.
2476         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2477         functions.
2478         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2479         (Output_data_glink::add_entry, find_entry): New functions to
2480         deal with local syms.
2481         (Glink_sym_ent): Add support for local syms.
2482         (Output_data_glink::do_write): Handle ifunc plt entries.
2483         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2484         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2485         (Target_powerpc::Relocate::relocate): Likewise.
2486         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2487
2488 2012-09-25  Alan Modra  <amodra@gmail.com>
2489
2490         * object.h (Sized_relobj_file::adjust_local_symbol,
2491         do_adjust_local_symbol): New functions.
2492         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2493         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2494         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2495         and irregular opd entry spacing.
2496         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2497         (Global_symbol_visitor_opd): New functor.
2498         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2499         on deleted opd entries.
2500
2501 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2502
2503         * tilegx.cc: New file.
2504         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2505         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2506         * configure.tgt: Add entries for tilegx*.
2507         * configure.ac: Likewise.
2508         * Makefile.in: Rebuild.
2509         * configure: Likewise.
2510         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2511         tilegx.
2512
2513 2012-09-13  Alan Modra  <amodra@gmail.com>
2514
2515         * target-reloc.h (scan_relocs): Call scan.local for relocs
2516         against symbols in discarded sections.  Pass is_discarded
2517         param.
2518         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2519         Add is_discarded param.
2520         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2521         is_discarded to flag opd entry as discarded.  Don't emit dyn
2522         relocs on such entries.
2523         (Target_powerpc::Scan::global): Similarly detect and handle
2524         such opd entries.
2525         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2526         opd_ent_.  Update all uses.
2527         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2528         (Target_powerpc::relocate_section): Zero out discarded opd
2529         entry relocs.
2530
2531 2012-09-12  Ian Lance Taylor  <iant@google.com>
2532
2533         PR gold/14570
2534         * output.cc: Rename Output_data_got template parameter from size
2535         to got_size for all functions.  Compile all variants of
2536         Output_data_got.
2537         (Output_data_got::Got_entry::write): Correct use of size for
2538         symbol value.  Use local_is_tls rather than casting to
2539         Sized_relobj_file.
2540         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2541         (class Sized_relobj_file): Add do_local_is_tls.
2542         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2543
2544 2012-09-11  Alan Modra  <amodra@gmail.com>
2545
2546         PR gold/14566
2547         * layout.cc (Layout::set_segment_offsets): When using
2548         common-page-size alignment, ensure we are on a new max-page-size
2549         page.
2550         * output.cc (Output_segment::set_section_addresses): Use
2551         abi_pagesize, not common_pagesize for relro boundary.
2552         (Output_segment::set_offset): Likewise.
2553
2554 2012-09-11  Alan Modra  <amodra@gmail.com>
2555
2556         * output.h (Output_data_got::add_global_tls, add_local_tls,
2557         add_local_tls_pair): New functions.
2558         (Output_data_got::add_local_pair_with_rel): Remove second
2559         reloc param.  Expand comment.
2560         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2561         use_plt_or_tls_offset_, similarly for constructor param.
2562         (Output_data_got::Got_entry::write): Add got_index param.
2563         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2564         add_local_tls_pair): New functions.
2565         (Output_data_got::Got_entry::write): Handle tls symbols
2566         with use_plt_or_tls_offset_ set specially.
2567         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2568         (Output_data_got::do_write): Replace iterator with index, pass
2569         index to entry write function.
2570         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2571         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2572         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2573         call.
2574         * i386.cc (Target_i386::Scan::local): Likewise.
2575         * sparc.cc (Target_sparc::Scan::local): Likewise.
2576         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2577         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2578         do_tls_offset_for_global): New functions.
2579         (Target_powerpc::Scan::local): Correct TLS relocations and got
2580         entry values.
2581         (Target_powerpc::Scan::global): Don't emit unnecessary
2582         dynamic relocations on TLS GOT entries.
2583
2584 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2585
2586         * config.in: Disable sanity check for kfreebsd.
2587
2588 2012-09-10  Sterling Augustine  <saugustine@google.com>
2589
2590         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2591         (Gdb_index::pubtypes_read): New parameter.
2592         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2593         to calls.
2594         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2595         pubtypes_object_.
2596
2597 2012-09-09  Alan Modra  <amodra@gmail.com>
2598
2599         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2600         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2601         * gc.h (gc_process_relocs): Call target gc_add_reference.
2602         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2603         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2604         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2605         unnecessary cast.
2606         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2607         to cater for when we don't need code offset.  Update use.
2608         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2609         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2610         set_opd_valid): New functions.
2611         (Target_powerpc::do_gc_add_reference): New function.
2612         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2613         stashed refs.
2614         (Target_powerpc::do_gc_mark_symbol): New function.
2615
2616 2012-09-06  Cary Coutant  <ccoutant@google.com>
2617
2618         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2619         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2620         (Dwarf_die::skip_attributes): Likewise.
2621         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2622         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2623         (main): Call it.
2624         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2625
2626 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2627
2628         * testsuite/script_test_3.t: Add .got.plt output section
2629         statement.
2630         * testsuite/script_test_4.t: Likewise.
2631
2632 2012-09-05  Alan Modra  <amodra@gmail.com>
2633
2634         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2635         update all uses and lose "enum" when using type.
2636
2637 2012-09-05  Alan Modra  <amodra@gmail.com>
2638
2639         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2640         * configure: Regenerate.
2641         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2642         (plugin_final_layout.stdout): Likewise.
2643         (memory_test): Set page sizes to 0x1000.
2644         * testsuite/Makefile.in: Regenerate.
2645         * testsuite/discard_locals_test.sh: Add FIXME comment.
2646         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2647         * testsuite/pr14265.t: Add .got output section statement.
2648         * testsuite/script_test_2.t: Likewise.
2649         * testsuite/script_test_3.t: Likewise.
2650         * testsuite/script_test_4.t: Likewise.
2651         * testsuite/script_test_5.t: Likewise.
2652         * testsuite/script_test_6.t: Likewise.
2653         * testsuite/script_test_7.t: Likewise.
2654         * testsuite/script_test_9.t: Likewise.
2655
2656 2012-09-05  Alan Modra  <amodra@gmail.com>
2657
2658         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2659         (Powerpc_relocate_functions::Status): New typedef.
2660         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2661         (Target_powerpc::Scan::local): Handle REL64.
2662         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2663         for REL32 and REL64.
2664         (Target_powerpc::symval_for_branch): New function, extracted from..
2665         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2666         checks.  Report overflow errors.
2667
2668 2012-09-05  Alan Modra  <amodra@gmail.com>
2669
2670         * object.h (Sized_relobj_file::emit_relocs): Delete.
2671         (Sized_relobj_file::emit_relocs_reltype): Delete.
2672         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2673         relocate_relocs for --emit-relocs.
2674         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2675         * output.h: Update comment.
2676         (Output_segment::first_section): New function.
2677         (Output_segment::first_section_load_address): Use first_section.
2678         * output.cc (Output_segment::first_section): New function extracted..
2679         (Output_segment::first_section_load_address): ..from here.  Delete.
2680         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2681         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2682         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2683         adjust call to target.h function.
2684         * i386.cc (Target_i386): Likewise.
2685         * sparc.cc (Target_sparc): Likewise.
2686         * x86_64.cc (Target_x86_64): Likewise.
2687         * powerpc.cc (Target_powerpc): Likewise.
2688         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2689         first tls section has section symbol for optimised local dynamic
2690         output relocs.
2691         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2692         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2693         optimised tls code.
2694         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2695         Rename to relocate_relocs.  Update error message.
2696
2697 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2698
2699         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2700         --just-symbols.
2701
2702 2012-08-31  Alan Modra  <amodra@gmail.com>
2703
2704         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2705         (Powerpc_relobj::toc_base_offset): New stub function.
2706         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2707         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2708         (Target_powerpc::Relocate::enum skip_tls): New.
2709         (Target_powerpc::call_tls_get_addr_): New var.
2710         (Target_powerpc::is_branch_reloc): Move to file scope.
2711         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2712         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2713         New functions.
2714         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2715         (powerpc_info): Correct common_pagesize for ppc64.
2716         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2717         (Powerpc_relocate_functions): Add overflow check enums and functions.
2718         Add non-shift version of rela, rela_ua.  Delete all rel public
2719         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2720         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2721         addr16_ha3, addr14 functions.
2722         (Output_data_got_powerpc::add_constant_pair): New function.
2723         (Output_data_got_powerpc::got_base_offset): Likewise.
2724         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2725         (instruction constants): Sort, add some more.
2726         (Output_data_glink::do_write): Add and use Address typedef.  Use
2727         object->toc_base_offset() stub for 64-bit.
2728         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2729         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2730         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2731         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2732         Always treat .opd relocs as against locally defined symbol.
2733         Correct condition for RELATIVE relocs.
2734         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2735         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2736         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2737         calculations.  Handle TLS relocs, and more.  Add overflow
2738         checking and adjust for Powerpc_relocate_functions changes.
2739         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2740         Reinstate --emit-relocs code with FIXME.
2741
2742 2012-08-30  Alan Modra  <amodra@gmail.com>
2743
2744         * layout.cc (Layout::set_segment_offsets): Set p_align to
2745         abi_pagesize, not common_pagesize.
2746         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2747         to determine whether file header can go in segment.
2748
2749 2012-08-30  Alan Modra  <amodra@gmail.com>
2750
2751         * output.h (Output_reloc::Output_reloc <output section>): Add
2752         is_relative param.  Adjust calls.
2753         (Output_reloc::add_output_section_relative): New functions.
2754         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2755         is_relative.
2756         (Output_reloc::symbol_value): Handle SECTION_CODE.
2757
2758 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2759
2760         * gold.cc (queue_middle_tasks): Call layout again when unique
2761         segments for sections is desired.
2762         * layout.cc (Layout::Layout): Initialize new members.
2763         (Layout::get_output_section_flags): New function.
2764         (Layout::choose_output_section): Call get_output_section_flags.
2765         (Layout::layout): Make output section for mapping to a unique segment.
2766         (Layout::insert_section_segment_map): New function.
2767         (Layout::attach_allocated_section_to_segment): Make unique segment for
2768         output sections marked so.
2769         (Layout::segment_precedes): Check for unique segments when sorting.
2770         * layout.h (Layout::Unique_segment_info): New struct.
2771         (Layout::Section_segment_map): New typedef.
2772         (Layout::insert_section_segment_map): New function.
2773         (Layout::get_output_section_flags): New function.
2774         (Layout::is_unique_segment_for_sections_specified): New function.
2775         (Layout::set_unique_segment_for_sections_specified): New function.
2776         (Layout::unique_segment_for_sections_specified_): New member.
2777         (Layout::section_segment_map_): New member.
2778         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2779         Rename is_gc_pass_one to is_pass_one.
2780         Rename is_gc_pass_two to is_pass_two.
2781         Rename is_gc_or_icf to is_two_pass.
2782         Check for which pass based on whether symbols data is present.
2783         Make it two pass when unique segments for sections is desired.
2784         * output.cc (Output_section::Output_section): Initialize new
2785         members.
2786         * output.h (Output_section::is_unique_segment): New function.
2787         (Output_section::set_is_unique_segment): New function.
2788         (Output_section::is_unique_segment_): New member.
2789         (Output_section::extra_segment_flags): New function.
2790         (Output_section::set_extra_segment_flags): New function.
2791         (Output_section::extra_segment_flags_): New member.
2792         (Output_section::segment_alignment): New function.
2793         (Output_section::set_segment_alignment): New function.
2794         (Output_section::segment_alignment_): New member.
2795         (Output_segment::Output_segment): Initialize is_unique_segment_.
2796         (Output_segment::is_unique_segment): New function.
2797         (Output_segment::set_is_unique_segment): New function.
2798         (Output_segment::is_unique_segment_): New member.
2799         * plugin.cc (allow_unique_segment_for_sections): New function.
2800         (unique_segment_for_sections): New function.
2801         (Plugin::load): Add new functions to transfer vector.
2802         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2803         * Makefile.in: Regenerate.
2804         * testsuite/plugin_final_layout.sh: Check if unique segment
2805         functionality works.
2806         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2807         are available.
2808         (allow_unique_segment_for_sections): New global.
2809         (unique_segment_for_sections): New global.
2810         (claim_file_hook): Call allow_unique_segment_for_sections.
2811         (all_symbols_read_hook): Call unique_segment_for_sections.
2812
2813 2012-08-22  Cary Coutant  <ccoutant@google.com>
2814
2815         * layout.cc (Layout::include_section): Don't assert on GROUP
2816         sections with --emit-relocs.
2817
2818 2012-08-21  Cary Coutant  <ccoutant@google.com>
2819
2820         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2821         if --export-dynamic-symbol names an undef symbol.
2822
2823 2012-08-18  Alan Modra  <amodra@gmail.com>
2824
2825         * powerpc.cc: Formatting and white space.
2826         (Powerpc_relobj): Rename got2_section_ to special_.
2827         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2828         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2829         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2830         (Target_powerpc): Add Address typedef and invalid_address.  Use
2831         throughout.
2832         (Target_powerpc::is_branch_reloc): New function.
2833         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2834         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2835         for dst_mask, value and addend.
2836         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2837         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2838         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2839         uint16_t for 24-bit offset.  Use get_output_section_offset and
2840         check return.
2841         (Target_powerpc::Scan::local): Handle more relocs.
2842         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2843         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2844         Plug in toc restoring insn after plt calls.  Translate branches
2845         to function descriptor symbols to corresponding entry point.
2846         (Target_powerpc::relocate_for_relocatable): Check return from
2847         get_output_section_offset.
2848         * symtab.h: Comment typo.
2849
2850 2012-08-14  Ian Lance Taylor  <iant@google.com>
2851
2852         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2853         unsupported_relocal_local to call unsupported_reloc_global.
2854
2855 2012-08-14  Nick Clifton  <nickc@redhat.com>
2856
2857         PR ld/14265
2858         * script-sections.cc (Sections_element::output_section_name): Add
2859         keep return parameter.
2860         (Output_section_element::match_name): Add keep return parameter.
2861         Return the value of the keep_ member.
2862         * script-sections.h (class Output_section): Update
2863         output_section_name prototype.
2864         * layout.cc (Layout::keep_input_section): New public member
2865         function.
2866         (Layout::choose_output_section): Pass keep parameter to
2867         output_section_name.
2868         * layout.h (class Layout): Add keep_input_section.
2869         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2870         sections.
2871         * testsuite/Makefile.am: Add a test.
2872         * testsuite/Makefile.in: Regenerate.
2873         * testsuite/pr14265.c: Source file for the test.
2874         * testsuite/pr14265.t: Linker script for the test.
2875         * testsuite/pr14265.sh: Shell script for the test.
2876
2877 2012-08-14  Alan Modra  <amodra@gmail.com>
2878
2879         * target.h (Target::output_section_name): New function.
2880         (Target::do_output_section_name): New function.
2881         * layout.cc (Layout::choose_output_section): Call the above.
2882         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2883
2884 2012-08-14  Alan Modra  <amodra@gmail.com>
2885
2886         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2887         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2888         for replace_constant call.
2889         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2890         (Output_data_glink::do_print_to_mapfile): New function.
2891         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2892         (Target_powerpc::Relocate::relocate): Likewise.
2893
2894 2012-08-14  Alan Modra  <amodra@gmail.com>
2895
2896         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2897         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2898         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2899         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2900         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2901         here.
2902         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2903         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2904         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2905         here.
2906         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2907         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2908
2909 2012-08-12  Alan Modra  <amodra@gmail.com>
2910
2911         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2912         (glink insn constants): Use uint32_t.
2913         (Output_data_glink::add_entry): Use insert, not [] operator.
2914
2915 2012-08-11  Alan Modra  <amodra@gmail.com>
2916
2917         * object.h (Sized_relobj_file::find_shdr): New function.
2918         (Sized_relobj_file::find_special_sections): New function.
2919         * object.cc (Sized_relobj_file::find_shdr): New function.
2920         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2921         (Sized_relobj_file::find_special_sections): New function, split out..
2922         (Sized_relobj_file::do_read_symbols): ..from here.
2923         * output.h (Output_data_got::replace_constant): New function.
2924         (Output_data_got::num_entries): New function.
2925         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2926         (Output_data_got::got_offset): Protected rather than private.
2927         (Output_data_got::replace_got_entry): New function.
2928         * output.cc (Output_data_got::replace_got_entry): New function.
2929         * powerpc.cc (class Powerpc_relobj): New.
2930         (class Powerpc_relocate_functions): Delete all psymval variants or
2931         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2932         Implement _ha functions using corresponding _hi function.
2933         (Powerpc_relobj::find_special_sections): New function.
2934         (Target_powerpc::do_make_elf_object): New function.
2935         (class Output_data_got_powerpc): New.
2936         (class Output_data_glink): New.
2937         (class Powerpc_scan_relocatable_reloc): New.
2938         Many more changes througout file.
2939
2940 2012-08-09  Nick Clifton  <nickc@redhat.com>
2941
2942         * po/vi.po: Updated Vietnamese translation.
2943
2944 2012-08-07  Ian Lance Taylor  <iant@google.com>
2945
2946         * layout.cc (Layout::add_target_dynamic_tags): If
2947         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2948         plt_rel.
2949
2950 2012-07-30  Nick Clifton  <nickc@redhat.com>
2951
2952         * po/gold.pot: Updated template.
2953         * po/es.po: Updated Spanish translation.
2954
2955 2012-07-18  Cary Coutant  <ccoutant@google.com>
2956
2957         PR gold/14344
2958         * configure.ac: Add check for -gpubnames support.
2959         * configure: Regenerate.
2960         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2961         support; force -gno-pubnames.
2962         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2963         support.
2964         (gdb_index_test_4): New test.
2965         * testsuite/Makefile.in: Regenerate.
2966         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2967         * testsuite/gdb_index_test_2.sh: Likewise.
2968         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2969         * testsuite/gdb_index_test_4.sh: New script.
2970         * testsuite/gdb_index_test_comm.sh: New script with common code;
2971         don't look for space after colon.
2972
2973 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2974
2975         * gold.cc (queue_middle_tasks): Update function order only after
2976         deferred objects due to plugins are processed.
2977
2978 2012-07-11  Ian Lance Taylor  <iant@google.com>
2979
2980         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2981         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2982         (Target_arm::scan_reloc_for_stub): Likewise.
2983         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2984         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2985         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2986         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2987         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2988
2989 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2990             Ian Lance Taylor  <iant@google.com>
2991
2992         PR gold/14309
2993         * configure.ac: Test whether std::tr1::hash<off_t> works.
2994         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2995         needed.
2996         * output.h (class Output_fill): Add virtual destructor.
2997         * configure, config.in: Rebuild.
2998
2999 2012-06-22  Roland McGrath  <mcgrathr@google.com>
3000
3001         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
3002
3003 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
3004
3005         * plugin.cc (Plugin::load): Handle position independent executables.
3006
3007 2012-06-06  Cary Coutant  <ccoutant@google.com>
3008
3009         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
3010         add .debug_macro.
3011         (lines_only_debug_sections): Likewise.
3012         (gdb_fast_lookup_sections): New static array.
3013         (is_gdb_debug_section): Rename formal parameter.
3014         (is_lines_only_debug_section): Likewise.
3015         (is_gdb_fast_lookup_section): New function.
3016         (Layout::include_section): Check for ".zdebug_" prefix; pass
3017         section name suffix to is_gdb_debug_section, et al.; check for
3018         fast-lookup sections when building .gdb_index.
3019         * options.h (--strip-debug-gdb): Update GDB version number.
3020
3021 2012-06-06  Cary Coutant  <ccoutant@google.com>
3022
3023         * configure.ac: Add check for fallocate.
3024         * configure: Regenerate.
3025         * config.in: Regenerate.
3026
3027         * options.h (class General_options): Add --mmap-output-file and
3028         --posix-fallocate options.
3029         * output.cc: (posix_fallocate): Remove; replace with...
3030         (gold_fallocate): New function.
3031         (Output_file::map_no_anonymous): Call gold_fallocate.
3032         (Output_file::map): Check --mmap-output-file option.
3033
3034 2012-06-05  Jing Yu  <jingyu@google.com>
3035
3036         * gold.h (textdomain): Add do {} to empty while(0).
3037         (bindtextdomain): Likewise.
3038
3039 2012-06-04  Cary Coutant  <ccoutant@google.com>
3040
3041         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3042         has_dynsym_index.
3043
3044 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3045
3046         * symtab.cc (Symbol_table::define_special_symbol):
3047         Initialize *poldsym to prevent uninitialized variable errors.
3048
3049 2012-05-23  Cary Coutant  <ccoutant@google.com>
3050
3051         * layout.cc (Layout::section_name_mapping): Add rules to handle
3052         exact match on .data.rel.ro.local or .data.rel.ro.
3053         (Layout::output_section_name): Check for exact matches.
3054
3055 2012-05-23  Cary Coutant  <ccoutant@google.com>
3056
3057         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3058         more carefully.
3059
3060 2012-05-22  Cary Coutant  <ccoutant@google.com>
3061
3062         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3063         object before exporting symbol.
3064
3065 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3066
3067         * testsuite/tls_test.cc: Include "config.h" first.
3068         * testsuite/tls_test_c.c: Likewise.
3069
3070 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3071             Nick Clifton  <nickc@redhat.com>
3072
3073         PR 14072
3074         * configure.in: Add check that sysdep.h has been included before
3075         any system header files.
3076         * configure: Regenerate.
3077         * config.in: Regenerate.
3078
3079 2012-05-14  Cary Coutant  <ccoutant@google.com>
3080
3081         * layout.cc (Layout::make_output_section): Mark .tdata section
3082         as RELRO.
3083         * testsuite/relro_test.cc: Add a TLS variable.
3084
3085 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3086
3087         PR gold/14091
3088         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3089         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3090         R_X86_64_64.
3091
3092 2012-05-08  Cary Coutant  <ccoutant@google.com>
3093
3094         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3095         (lines_only_debug_sections): Likewise.
3096
3097 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3098
3099         * nacl.cc: New file.
3100         * nacl.h: New file.
3101         * Makefile.am (CCFILES, HFILES): Add them.
3102         * Makefile.in: Regenerate.
3103         * i386.cc (Output_data_plt_i386_nacl): New class.
3104         (Output_data_plt_i386_nacl_exec): New class.
3105         (Output_data_plt_i386_nacl_dyn): New class.
3106         (Target_i386_nacl): New class.
3107         (Target_selector_i386_nacl): New class.
3108         (target_selector_i386): Use it instead of Target_selector_i386.
3109         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3110         (Target_x86_64_nacl): New class.
3111         (Target_selector_x86_64_nacl): New class.
3112         (target_selector_x86_64, target_selector_x32): Use it instead of
3113         Target_selector_x86_64.
3114         * arm.cc (Output_data_plt_arm_nacl): New class.
3115         (Target_arm_nacl): New class.
3116         (Target_selector_arm_nacl): New class.
3117         (target_selector_arm, target_selector_armbe): Use it instead of
3118         Target_selector_arm.
3119
3120         * target-select.cc (select_target): Take new Input_file* and off_t
3121         arguments, pass them on to recognize method of selector.
3122         * object.cc (make_elf_sized_object): Update caller.
3123         * parameters.cc (parameters_force_valid_target): Likewise.
3124         * incremental.cc (make_sized_incremental_binary): Likewise.
3125         * target-select.h: Update decl.
3126         (Target_selector::recognize): Take new Input_file* argument,
3127         pass it on to do_recognize.
3128         (Target_selector::do_recognize): Take new Input_file* argument.
3129         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3130         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3131         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3132         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3133
3134         * target.h (Target::Target_info): New members isolate_execinstr
3135         and rosegment_gap.
3136         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3137         * arm.cc (Target_arm::arm_info): Update initializer.
3138         * i386.cc (Target_i386::i386_info): Likewise.
3139         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3140         * sparc.cc (Target_sparc::sparc_info): Likewise.
3141         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3142         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3143         * layout.cc (Layout::attach_allocated_section_to_segment):
3144         Take new const Target* argument.  If target->isolate_execinstr(), act
3145         like --rosegment.
3146         (Layout::find_first_load_seg): Take new const Target* argument;
3147         if target->isolate_execinstr(), reject PF_X segments.
3148         (Layout::relaxation_loop_body): Update caller.
3149         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3150         reset file offset to zero when we hit LOAD_SEG, and then do a second
3151         loop over the segments before LOAD_SEG to reassign offsets after
3152         addresses have been determined.  Handle target->rosegment_gap().
3153         (Layout::attach_section_to_segment): Take new const Target* argument;
3154         pass it to attach_allocated_section_to_segment.
3155         (Layout::make_output_section): Update caller.
3156         (Layout::attach_sections_to_segments): Take new const Target* argument;
3157         pass it to attach_section_to_segment.
3158         * gold.cc (queue_middle_tasks): Update caller.
3159         * layout.h (Layout): Update method decls with new arguments.
3160
3161         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3162         Target_info pointer to use.
3163         (Target_arm::do_make_data_plt): New virtual method.
3164         (Target_arm::make_data_plt): New method that calls it.
3165         (Target_arm::make_plt_entry): Use it.
3166         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3167         for the section alignment.
3168         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3169         method.
3170         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3171         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3172         method.
3173         (Output_data_plt_arm::get_plt_entry_size): Call it.
3174         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3175         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3176         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3177         method.
3178         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3179         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3180         method instead of sizeof(plt_entry).
3181         (Output_data_plt_arm::add_entry): Likewise.
3182         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3183         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3184         than static method.
3185         (Target_arm::plt_entry_size): Likewise.
3186         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3187         Move to ...
3188         (Output_data_plt_arm_standard): ... here, new class.
3189         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3190         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3191         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3192
3193         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3194         Take additional argument for the PLT entry size.
3195         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3196         Use get_plt_entry_size method rather than plt_entry_size variable.
3197         (Output_data_plt_x86_64::reserve_slot): Likewise.
3198         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3199         (Output_data_plt_x86_64::add_entry): Likewise.
3200         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3201         (Output_data_plt_x86_64::address_for_global): Likewise.
3202         (Output_data_plt_x86_64::address_for_local): Likewise.
3203         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3204         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3205         Make method non-static.
3206         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3207         method.
3208         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3209         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3210         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3211         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3212         virtual method.
3213         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3214         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3215         virtual method.
3216         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3217         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3218         virtual method.
3219         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3220         (Output_data_plt_x86_64::plt_entry_size)
3221         (Output_data_plt_x86_64::first_plt_entry)
3222         (Output_data_plt_x86_64::plt_entry)
3223         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3224         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3225         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3226         (Output_data_plt_x86_64_standard): ... here, new class.
3227         (Target_x86_64::Target_x86_64): Take optional argument for the
3228         Target_info pointer to use.
3229         (Target_x86_64::do_make_data_plt): New virtual method.
3230         (Target_x86_64::make_data_plt): New method to call it.
3231         (Target_x86_64::init_got_plt_for_update): Use that.
3232         Call this->plt_->add_eh_frame method here.
3233         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3234         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3235         rather than static method.
3236         (Target_x86_64::plt_entry_size): Likewise.
3237         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3238         rather than plt_entry_size variable.  Move guts of PLT filling to...
3239         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3240         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3241         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3242
3243         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3244         additional argument for the section alignment.
3245         Don't do add_eh_frame_for_plt here.
3246         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3247         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3248         variable.
3249         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3250         method.
3251         (Output_data_plt_i386::get_plt_entry_size): Call it.
3252         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3253         (Output_data_plt_i386::add_eh_frame): New method to call it.
3254         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3255         method.
3256         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3257         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3258         method.
3259         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3260         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3261         method instead of plt_entry_size.
3262         (Output_data_plt_i386::plt_entry_size)
3263         (Output_data_plt_i386::plt_eh_frame_fde_size)
3264         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3265         (Output_data_plt_i386_standard): ... here, new class.
3266         (Output_data_plt_i386_exec): New class.
3267         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3268         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3269         (Output_data_plt_i386::exec_plt_entry): Move to ...
3270         (Output_data_plt_i386_exec::plt_entry): ... here.
3271         (Output_data_plt_i386_dyn): New class.
3272         (Output_data_plt_i386::first_plt_entry): Move to ...
3273         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3274         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3275         (Output_data_plt_i386_dyn::plt_entry): ... here.
3276         (Target_i386::Target_i386): Take optional argument for the Target_info
3277         pointer to use.
3278         (Target_i386::do_make_data_plt): New virtual method.
3279         (Target_i386::make_data_plt): New method to call it.
3280         (Target_i386::make_plt_section): Use that.
3281         Call this->plt_->add_eh_frame method here.
3282         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3283         rather than plt_entry_size variable.
3284         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3285         (Output_data_plt_i386::address_for_local): Likewise.
3286         (Output_data_plt_i386::do_write): Likewise.
3287         Move guts of PLT filling to...
3288         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3289         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3290         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3291         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3292
3293 2012-05-01  Cary Coutant  <ccoutant@google.com>
3294
3295         * dwarf_reader.cc (Dwarf_die::read_attributes)
3296         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3297         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3298         * reduced_debug_output.cc
3299         (Output_reduced_debug_info_section::get_die_end): Remove
3300         DW_FORM_GNU_ref_index.  Add default case.
3301
3302 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3303
3304         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3305         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3306         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3307         DW_AT_high_pc as offset from DW_AT_low_pc.
3308
3309         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3310         * testsuite/Makefile.in: Regenerate.
3311         * testsuite/gdb_index_test_3.c: New test source file.
3312         * testsuite/gdb_index_test_3.sh: New test source file.
3313
3314 2012-04-25  Ian Lance Taylor  <iant@google.com>
3315
3316         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3317         pointer.
3318         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3319         as a class, not a struct.
3320         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3321         (Target_arm::apply_cortex_a8_workaround): Likewise.
3322         * gc.h: Declare Reloc_types as a struct, not a class.
3323         * object.h: Declare Symbols_data as a struct.
3324         * reloc.h: Declare Read_relocs_data as a struct.
3325         * target.h: Declare Relocate_info as a struct.
3326
3327 2012-04-24  David S. Miller  <davem@davemloft.net>
3328
3329         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3330         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3331         and R_SPARC_WPLT30.
3332
3333 2012-04-24  Cary Coutant  <ccoutant@google.com>
3334
3335         * incremental-dump.cc (find_input_containing_global): Replace
3336         magic number with symbolic constant.
3337         (dump_incremental_inputs): Update version number.
3338         * incremental.cc (Output_section_incremental_inputs): Update version
3339         number; import symbolic constants from Incremental_inputs_reader.
3340         (Incremental_inputs::create_data_sections): Align relocations
3341         section correctly for 64-bit targets.
3342         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3343         constants; add padding.
3344         (Output_section_incremental_inputs::write_header): Add assert for
3345         header_size.
3346         (Output_section_incremental_inputs::write_input_files): Add assert
3347         for input_entry_size.
3348         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3349         add assert for object_info_size, input_section_entry_size,
3350         global_sym_entry_size.
3351         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3352         for data structure sizes; use them.
3353         (Incremental_input_entry_reader): Import symbolic constants from
3354         Incremental_inputs_reader; use them.
3355
3356 2012-04-23  David S. Miller  <davem@davemloft.net>
3357
3358         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3359         and elf_flags_set_.
3360         (Target_sparc::Target_sparc): Initialize new fields.
3361         (Target_sparc::do_make_elf_object): New function.
3362         (Target_sparc::do_adjust_elf_header): New function.
3363
3364 2012-04-23  Cary Coutant  <ccoutant@google.com>
3365
3366         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3367         CU range table of gdb index.
3368
3369 2012-04-20  David S. Miller  <davem@davemloft.net>
3370
3371         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3372         instead of false.
3373
3374 2012-04-16  David S. Miller  <davem@davemloft.net>
3375
3376         * sparc.cc (Target_sparc::got_address): New function.
3377         (Sparc_relocate_functions::gdop_hix22): New function.
3378         (Sparc_relocate_functions::gdop_lox10): New function.
3379         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3380         relocs.
3381         (Target_sparc::Scan::local): Likewise if the global symbol is not
3382         preemptible and is not IFUNC.
3383         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3384         transformations for local and non-preemptible non-IFUNC global
3385         symbols.
3386
3387         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3388         writing out 64-bit part of ranges.
3389
3390         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3391         -fpic and -fpie respectively.
3392         * Makefile.in: Regenerate.
3393
3394         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3395         (Target_sparc::Target_sparc): Initialize new field.
3396         (Target_sparc::do_plt_section_for_global): New function.
3397         (Target_sparc::do_plt_section_for_local): New function.
3398         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3399         (Target_sparc::make_plt_section): New function, broken out of
3400         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3401         (Target_sparc::make_plt_entry): Call make_plt_section.
3402         (Target_sparc::make_local_ifunc_plt_entry): New function.
3403         (Target_sparc::rela_ifunc_section): New function.
3404         (Target_sparc::plt_section): Remove const.
3405         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3406         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3407         and ifunc_count_ fields.
3408         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3409         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3410         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3411         (Output_data_plt_sparc::rela_ifunc): New function.
3412         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3413         (Output_data_plt_sparc::has_ifunc_section): New function.
3414         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3415         (Output_data_plt_sparc::address_for_global): New function.
3416         (Output_data_plt_sparc::address_for_local): New function.
3417         (Output_data_plt_sparc::plt_index_to_offset): New function.
3418         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3419         and entry_count.
3420         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3421         entry_count.
3422         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3423         R_SPARC_JMP_IREL to switch.
3424         (Target_sparc::Scan::check_non_pic): Likewise.
3425         (Target_sparc::Scan::local): Handle IFUNC symbols.
3426         (Target_sparc::Scan::local): Likewise.
3427         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3428         and plt_address_for_local.
3429         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3430         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3431
3432         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3433         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3434         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3435         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3436         global relocs too.
3437         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3438         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3439         calls.
3440         * sparc.cc (Target_sparc::Scan::global): Likewise.
3441         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3442
3443 2012-04-16  Cary Coutant  <ccoutant@google.com>
3444
3445         * archive.cc (Library_base::should_include_member): Check for
3446         --export-dynamic-symbol.
3447         * options.h (class General_options): Add --export-dynamic-symbol.
3448         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3449         --export-dynamic-symbol.
3450         (Symbol_table::gc_mark_undef_symbols): Likewise.
3451         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3452
3453 2012-04-12  David S. Miller  <davem@davemloft.net>
3454
3455         * sparc.cc (Reloc::wdisp10): New relocation method.
3456         (Reloc::h34): Likewise.
3457         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3458         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3459         R_SPARC_WDISP10.
3460         (Target_sparc::Scan::local): Likewise.
3461         (Target_sparc::Scan::global): Likewise.
3462         (Target_sparc::Relocate::relocate): Likewise.
3463
3464 2012-04-09  Cary Coutant  <ccoutant@google.com>
3465
3466         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3467         low_pc == 0.
3468
3469 2012-04-06  Ian Lance Taylor  <iant@google.com>
3470
3471         * timer.cc: #include <unistd.h>.
3472
3473 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3474
3475         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3476         * config.in: Regenerate.
3477         * configure: Regenerate.
3478
3479 2012-04-05  Nick Clifton  <nickc@redhat.com>
3480
3481         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3482         (AM_LC_MESSAGES): Add.
3483         * aclocal.m4: Regenerate.
3484         * config.in: Regenerate.
3485         * configure: Regenerate.
3486
3487 2012-03-21  Cary Coutant  <ccoutant@google.com>
3488
3489         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3490         * Makefile.in: Regenerate.
3491         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3492         (Sized_elf_reloc_mapper::symbol_section): New function.
3493         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3494         (make_elf_reloc_mapper): New function.
3495         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3496         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3497         (Dwarf_abbrev_table::do_get_abbrev): New function.
3498         (Dwarf_ranges_table::read_ranges_table): New function.
3499         (Dwarf_ranges_table::read_range_list): New function.
3500         (Dwarf_pubnames_table::read_section): New function.
3501         (Dwarf_pubnames_table::read_header): New function.
3502         (Dwarf_pubnames_table::next_name): New function.
3503         (Dwarf_die::Dwarf_die): New function.
3504         (Dwarf_die::read_attributes): New function.
3505         (Dwarf_die::skip_attributes): New function.
3506         (Dwarf_die::set_name): New function.
3507         (Dwarf_die::set_linkage_name): New function.
3508         (Dwarf_die::attribute): New function.
3509         (Dwarf_die::string_attribute): New function.
3510         (Dwarf_die::int_attribute): New function.
3511         (Dwarf_die::uint_attribute): New function.
3512         (Dwarf_die::ref_attribute): New function.
3513         (Dwarf_die::child_offset): New function.
3514         (Dwarf_die::sibling_offset): New function.
3515         (Dwarf_info_reader::check_buffer): New function.
3516         (Dwarf_info_reader::parse): New function.
3517         (Dwarf_info_reader::do_parse): New function.
3518         (Dwarf_info_reader::do_read_string_table): New function.
3519         (Dwarf_info_reader::lookup_reloc): New function.
3520         (Dwarf_info_reader::get_string): New function.
3521         (Dwarf_info_reader::visit_compilation_unit): New function.
3522         (Dwarf_info_reader::visit_type_unit): New function.
3523         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3524         Sized_elf_reloc_mapper.
3525         (Sized_dwarf_line_info::symbol_section): Remove function.
3526         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3527         (Sized_dwarf_line_info::read_line_mappings): Remove object
3528         parameter, adjust callers.
3529         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3530         * dwarf_reader.h: Include <sys/types.h>.
3531         (class Track_relocs): Remove forward declaration.
3532         (class Elf_reloc_mapper): New class.
3533         (class Sized_elf_reloc_mapper): New class.
3534         (class Dwarf_abbrev_table): New class.
3535         (class Dwarf_range_list): New class.
3536         (class Dwarf_ranges_table): New class.
3537         (class Dwarf_pubnames_table): New class.
3538         (class Dwarf_die): New class.
3539         (class Dwarf_info_reader): New class.
3540         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3541         (Sized_dwarf_line_info::symbol_section): Remove member function.
3542         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3543         base class.
3544         * gdb-index.cc: New source file.
3545         * gdb-index.h: New source file.
3546         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3547         and .debug_types sections, call Layout::add_to_gdb_index.
3548         (Sized_relobj_incr::do_section_name): Implement.
3549         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3550         return type; Implement.
3551         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3552         return type.
3553         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3554         parameter list and return type.
3555         (Sized_incr_dynobj::do_section_contents): Likewise.
3556         * layout.cc: Include gdb-index.h.
3557         (Layout::Layout): Initialize gdb_index_data_.
3558         (Layout::init_fixed_output_section): Check for .gdb_index section.
3559         (Layout::add_to_gdb_index): New function. Instantiate.
3560         * layout.h: Add forward declaration for class Gdb_index.
3561         (Layout::add_to_gdb_index): New member function.
3562         (Layout::gdb_index_data_): New data member.
3563         * main.cc: Include gdb-index.h.
3564         (main): Print statistics for gdb index.
3565         * object.cc (Object::section_contents): Move code into
3566         do_section_contents.
3567         (need_decompressed_section): Check for sections needed when building
3568         gdb index.
3569         (build_compressed_section_map): Likewise.
3570         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3571         gdb index.
3572         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3573         sections; call Layout::add_to_gdb_index.
3574         (Sized_relobj_file::do_decompressed_section_contents): Call
3575         do_section_contents directly.
3576         * object.h (Object::do_section_contents): Adjust parameter list and
3577         return type.
3578         (Object::do_decompressed_section_contents): Call do_section_contents
3579         directly.
3580         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3581         return type.
3582         * options.h (class General_options): Add --gdb-index option.
3583         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3584         list and return type.
3585         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3586         * reloc.h (Track_relocs::checkpoint): New function.
3587         (Track_relocs::reset): New function.
3588
3589         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3590         New test cases.
3591         * testsuite/Makefile.in: Regenerate.
3592         * testsuite/gdb_index_test.cc: New test source file.
3593         * testsuite/gdb_index_test_1.sh: New test source file.
3594         * testsuite/gdb_index_test_2.sh: New test source file.
3595
3596 2012-03-19  Doug Kwan  <dougkwan@google.com>
3597
3598         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3599         (Target_arm::do_finalize_sections): Remove code which defines
3600         __exidx_start and __exidx_end.  Make symbol table parameter
3601         anonymous as it is not used.
3602         * gold.cc (queue_middle_tasks): Call target hook to define any
3603         target-specific symbols.
3604         * target.h (Target::define_standard_symbols): New method.
3605         (Target::do_define_standard_symbols): Same.
3606         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3607         * testsuite/Makefile.in: Regenerate.
3608         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3609         and __exidx_end.
3610         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3611         relocations are generated for __exidx_start and __exidx_end.
3612
3613 2012-03-16  Doug Kwan  <dougkwan@google.com>
3614
3615         * testsuite/Makefile.am: Disable test initpri3b.
3616         * testsuite/Makefile.in: Regenerate.
3617
3618 2012-03-15  Doug Kwan  <dougkwan@google.com>
3619
3620         * arm.cc (Target_arm::got_section): Make .got section read-only
3621         if -z now is given.
3622
3623 2012-03-15  Ian Lance Taylor  <iant@google.com>
3624
3625         PR gold/13850
3626         * layout.cc (Layout::make_output_section): Correctly mark
3627         SHT_INIT_ARRAY, et. al., as relro.
3628
3629 2012-03-14  Doug Kwan  <dougkwan@google.com>
3630
3631         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3632         dynamic relocations for protected symbols in shared objects.
3633
3634 2012-03-13  Ian Lance Taylor  <iant@google.com>
3635
3636         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3637         keep the larger alignment.
3638
3639 2012-03-12  Cary Coutant  <ccoutant@google.com>
3640
3641         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3642         handling of DW_LNE_define_file.
3643
3644 2012-03-12  Cary Coutant  <ccoutant@google.com>
3645
3646         * reduced_debug_output.cc
3647         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3648         codes to switch.
3649
3650 2012-02-29  Cary Coutant  <ccoutant@google.com>
3651
3652         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3653
3654 2012-02-29  Cary Coutant  <ccoutant@google.com>
3655
3656         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3657         Call Object::decompressed_section_contents.
3658         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3659         New dtor.
3660         (Sized_dwarf_line_info::buffer_start_): New data member.
3661         * merge.cc (Output_merge_data::do_add_input_section): Call
3662         Object::decompressed_section_contents.
3663         (Output_merge_string::do_add_input_section): Likewise.
3664         * object.cc (need_decompressed_section): New function.
3665         (build_compressed_section_map): Decompress sections needed later.
3666         (Sized_relobj_file::do_decompressed_section_contents): New function.
3667         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3668         * object.h (Object::decompressed_section_contents): New function.
3669         (Object::discard_decompressed_sections): New function.
3670         (Object::do_decompressed_section_contents): New function.
3671         (Object::do_discard_decompressed_sections): New function.
3672         (Compressed_section_info): New type.
3673         (Compressed_section_map): Include decompressed section contents.
3674         (Sized_relobj_file::do_decompressed_section_contents): New function.
3675         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3676
3677 2012-02-16  Cary Coutant  <ccoutant@google.com>
3678
3679         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3680         * testsuite/Makefile.in: Regenerate.
3681
3682 2012-02-14  Cary Coutant  <ccoutant@google.com>
3683
3684         * options.cc (General_options::finalize): Disallow -pie and -static.
3685
3686 2012-02-03  Doug Kwan  <dougkwan@google.com>
3687
3688         * arm.cc (Arm_relocate_functions::abs8,
3689         Arm_relocate_functions::abs16): Use
3690         Bits::has_signed_unsigned_overflow32.
3691         (Arm_relocate_functions::thm_abs8): Correct range of
3692         overflow check.
3693         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3694         in assertions.
3695
3696 2012-02-02  Doug Kwan  <dougkwan@google.com>
3697
3698         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3699         position independent outputs, not just shared objects.
3700
3701 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3702
3703         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3704         * configure: Regenerated.
3705
3706 2012-01-27  Ian Lance Taylor  <iant@google.com>
3707
3708         * reloc.h (Bits): New class with static functions, copied from
3709         namespace utils in arm.cc.
3710         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3711         instead.
3712
3713 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3714
3715         * incremental.cc (write_info_blocks): Correct relocation offset.
3716
3717 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3718
3719         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3720         (Relocate::tls_gd_to_le): Likewise.
3721
3722 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3723
3724         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3725
3726 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3727
3728         * configure.ac: Check if -mcmodel=medium works.
3729         * configure: Regenerated.
3730
3731 2012-01-24  Cary Coutant  <ccoutant@google.com>
3732
3733         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3734         definition and ...
3735         (read_unsigned_LEB_128_x): ... this new function.
3736         (read_signed_LEB_128): Replaced with inline definition and ...
3737         (read_signed_LEB_128_x): ... this new function.
3738         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3739         (read_unsigned_LEB_128): Add inline definition.
3740         (read_signed_LEB_128_x): New function.
3741         (read_signed_LEB_128): Add inline definition.
3742         * testsuite/Makefile.am (leb128_unittest): New unit test.
3743         * testsuite/Makefile.in: Regenerate.
3744         * testsuite/leb128_unittest.cc: New unit test.
3745
3746 2012-01-23  Ian Lance Taylor  <iant@google.com>
3747
3748         PR gold/13617
3749         * i386.cc (Target_i386::do_code_fill): When using a jmp
3750         instruction, pad with nop instructions.
3751         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3752
3753 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3754
3755         * x86_64.cc (gc_process_relocs): Add typename on types used in
3756         template.
3757         (scan_relocs): Likewise.
3758         (relocate_section): Likewise.
3759         (apply_relocation): Likewise.
3760
3761 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3762
3763         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3764         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3765         under x32.
3766
3767 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3768
3769         * x86_64.cc: Initial support for x32.
3770
3771 2012-01-03  Cary Coutant  <ccoutant@google.com>
3772
3773         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3774         Use abstract base class for GOT.
3775         * gold/output.h (class Output_data_got_base): New abstract base class.
3776         (class Output_data_got): Derive from new base class, adjust ctors.
3777         (Output_data_got::reserve_slot): Make virtual; rename to
3778         do_reserve_slot; Adjust callers.
3779         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3780         pointer to abstract base class.
3781         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3782
3783 2011-12-18  Ian Lance Taylor  <iant@google.com>
3784
3785         * object.h (Relobj::local_symbol_value): New function.
3786         (Relobj::local_plt_offset): New function.
3787         (Relobj::local_has_got_offset): New function.
3788         (Relobj::local_got_offset): New function.
3789         (Relobj::set_local_got_offset): New function.
3790         (Relobj::do_local_symbol_value): New pure virtual function.
3791         (Relobj::do_local_plt_offset): Likewise.
3792         (Relobj::do_local_has_got_offset): Likewise.
3793         (Relobj::do_local_got_offset): Likewise.
3794         (Relobj::do_set_local_got_offset): Likewise.
3795         (Sized_relobj::do_local_has_got_offset): Rename from
3796         local_has_got_offset.
3797         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3798         (Sized_relobj::do_set_local_got_offset): Rename from
3799         set_local_got_offset.
3800         (Sized_relobj_file::do_local_plt_offset): Rename from
3801         local_plt_offset.
3802         (Sized_relobj_file::do_local_symbol_value): New function.
3803         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3804         local_plt_offset.
3805         * output.cc (Output_data_got::Got_entry::write): Change object to
3806         Relobj.  Use local_symbol_value.
3807         (Output_data_got::add_global_with_rel): Change rel_dyn to
3808         Output_data_reloc_generic*.  Use add_global_generic.
3809         (Output_data_got::add_global_with_rela): Remove.  Change all
3810         callers to use add_global_with_rel.
3811         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3812         Output_data_reloc_generic*.  Use add_global_generic.
3813         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3814         callers to use add_global_pair_with_rel.
3815         (Output_data_got::add_local): Change object to Relobj*.
3816         (Output_data_got::add_local_plt): Likewise.
3817         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3818         change rel_dyn to Output_data_reloc_generic*.  Use
3819         add_local_generic.
3820         (Output_data_got::add_local_with_rela): Remove.  Change all
3821         callers to use all_local_with_rel.
3822         (Output_data_got::add_local_pair_with_rel): Change object to
3823         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3824         add_output_section_generic.
3825         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3826         callers to use add_local_pair_with_rel.
3827         (Output_data_got::reserve_local): Change object to Relobj*.
3828         * output.h: (class Output_data_reloc_generic): Add pure virtual
3829         declarations for add_global_generic, add_local_generic,
3830         add_output_section_generic.
3831         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3832         functions for Output_data_reloc_generic.  Update declarations for
3833         changes listed in output.cc.
3834         (class Output_data_got): Change template parameter to got_size.
3835         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3836         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3837         function.
3838         (Sized_relobj_incr::do_local_plt_offset): New function.
3839         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3840         add_global_generic.
3841
3842 2011-12-17  Cary Coutant  <ccoutant@google.com>
3843
3844         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3845         * resolve.cc (Symbol_table::resolve): Likewise.
3846         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3847         arrays.
3848         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3849
3850 2011-12-16  Ian Lance Taylor  <iant@google.com>
3851
3852         * output.h (Output_data_reloc_generic::add): Only call
3853         add_dynamic_reloc if this is a dynamic reloc section.
3854
3855 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3856
3857         PR gold/13505
3858         * target-reloc.h (apply_relocation): Replace <64, false> with
3859         <size, big_endian>.
3860
3861 2011-11-25  Nick Clifton  <nickc@redhat.com>
3862
3863         * po/it.po: New Italian translation.
3864
3865 2011-11-17  Sterling Augustine  <saugustine@google.com>
3866
3867         * script.cc (script_include_directive): Implement.
3868         (read_script_file): New local variables name and search_path. Update
3869         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3870         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3871         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3872
3873 2011-11-11  Sterling Augustine  <saugustine@google.com>
3874
3875         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3876         (file_or_sections_cmd): Likewise.
3877
3878 2011-11-11  Doug Kwan  <dougkwan@google.com>
3879
3880         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3881         if --just-symbols is given.
3882
3883 2011-11-10  Doug Kwan  <dougkwan@google.com>
3884
3885         PR gold/13362
3886         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3887         when processing data relocs.
3888         * reloc.h (Relocate_functions::rel_unaligned): New method.
3889         (Relocate_functions::pcrel_unaligned): Ditto.
3890         (Relocate_functions::rel32_unaligned): Ditto.
3891         (Relocate_functions::pcrel32_unaligned): Ditto.
3892
3893 2011-11-09  Doug Kwan  <dougkwan@google.com>
3894
3895         PR gold/13362
3896         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3897         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3898         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3899         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3900         (Relocate_functions::rel_unaligned): New.
3901         (Relocate_functions::rel32_unaligned): New.
3902         * target-reloc.h (relocate_for_relocatable): Add code to handle
3903         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3904         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3905         arm_unaligned_reloc_r): New targets.
3906         * testsuite/Makefile.in: Regenerate.
3907         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3908         linking.
3909
3910 2011-11-02  Ian Lance Taylor  <iant@google.com>
3911
3912         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3913         NATIVE_LINKER.
3914         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3915         * options.cc (General_options::finalize): Use library search path
3916         from configure script if specified.  If not native and no sysroot,
3917         only search TOOLLIBDIR.
3918         * options.h (Search_directory::Search_directory): Change name to
3919         const std::string&.
3920         (General_options::add_to_library_path_with_sysroot): Change arg to
3921         const std::string&.
3922         * configure, Makefile.in, config.in: Rebuild.
3923
3924 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3925
3926         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3927         we are working around the ARM1176 Erratum.
3928         * options.h (General_options::fix_arm1176): Add option.
3929         * testsuite/Makefile.am: Add testcases, and keep current ones
3930         working.
3931         * testsuite/Makefile.in: Regenerate.
3932         * testsuite/arm_fix_1176.s: New file.
3933         * testsuite/arm_fix_1176.sh: Likewise.
3934
3935 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3936
3937         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3938         may_use_blx_.
3939         (Target_arm::may_use_blx): Remove method.
3940         (Target_arm::set_may_use_blx): Likewise.
3941         (Target_arm::may_use_v4t_interworking): New method.
3942         (Target_arm::may_use_v5t_interworking): Likewise.
3943         (Target_arm::may_use_blx_): Remove member variable.
3944         (Arm_relocate_functions::arm_branch_common): Check for v5T
3945         interworking.
3946         (Arm_relocate_functions::thumb_branch_common): Likewise.
3947         (Reloc_stub::stub_type_for_reloc): Likewise.
3948         (Target_arm::do_finalize_sections): Correct interworking checks.
3949         * testsuite/Makefile.am: Add new tests.
3950         * testsuite/Makefile.in: Regenerate.
3951         * testsuite/arm_farcall_arm_arm.s: New test.
3952         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3953         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3954         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3955         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3956         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3957         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3958         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3959
3960 2011-10-31  Cary Coutant  <ccoutant@google.com>
3961
3962         PR gold/13023
3963         * expression.cc (Expression::eval_with_dot): Add
3964         is_section_dot_assignment parameter.
3965         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3966         absolute and assigning to dot within a section.
3967         * script-sections.cc
3968         (Output_section_element_assignment::set_section_addresses): Pass
3969         dot_section to set_if_absolute.
3970         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3971         as is_section_dot_assignment flag to eval_with_dot.
3972         (Output_section_element_dot_assignment::set_section_addresses):
3973         Likewise.
3974         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3975         parameter.  Also set value if relative to dot_section; set the
3976         symbol's output_section.
3977         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3978         parameter.  Adjust all callers.
3979         (Expression::eval_maybe_dot): Likewise.
3980         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3981         Adjust all callers.
3982         * testsuite/script_test_2.t: Test assignment of an absolute value
3983         to dot within an output section element.
3984
3985 2011-10-31  Cary Coutant  <ccoutant@google.com>
3986
3987         * options.h (class General_options): Add --[no-]gnu-unique options.
3988         * symtab.cc (Symbol_table::sized_write_globals): Convert
3989         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3990
3991 2011-10-31  Cary Coutant  <ccoutant@google.com>
3992
3993         PR gold/13359
3994         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3995         unnecessary assertion.
3996         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3997
3998 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3999
4000         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4001         gc_mark_symbol.
4002         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
4003         gc_mark_symbol.
4004         Change to just keep the section associated with symbol.
4005         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
4006         they are externally visible and --export-dynamic is turned on.
4007         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
4008
4009 2011-10-19  Ian Lance Taylor  <iant@google.com>
4010
4011         PR gold/13163
4012         * script-sections.cc
4013         (Output_section_element_dot_assignment::needs_output_section): New
4014         function.
4015
4016 2011-10-19  Ian Lance Taylor  <iant@google.com>
4017
4018         PR gold/13204
4019         * layout.cc (Layout::segment_precedes): Don't assert failure if a
4020         --section-start option was seen.
4021         * options.h (General_options::any_section_start): New function.
4022
4023 2011-10-18  David S. Miller  <davem@davemloft.net>
4024
4025         PR binutils/13301
4026         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
4027         member to track relocation locations that have moved during TLS
4028         reloc optimizations.
4029         (Target_sparc::Relocate::Relocate): Initialize to NULL.
4030         (Target_sparc::Relocate::relocate): Adjust view down by 4
4031         bytes if it matches reloc_adjust_addr_.
4032         (Target_sparc::Relocate::relocate_tls): Always move the
4033         __tls_get_addr call delay slot instruction forward 4 bytes when
4034         performing relaxation.
4035
4036 2011-10-18  Cary Coutant  <ccoutant@google.com>
4037
4038         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4039         (Output_file::map_no_anonymous): Check for non-zero
4040         return code from posix_fallocate.
4041
4042 2011-10-17  Cary Coutant  <ccoutant@google.com>
4043
4044         PR gold/13245
4045         * plugin.cc (is_visible_from_outside): Check for symbols
4046         referenced from dynamic objects.
4047         * resolve.cc (Symbol_table::resolve): Don't count references
4048         from dynamic objects as references from real ELF files.
4049         * testsuite/plugin_test_2.sh: Adjust expected result.
4050
4051 2011-10-17  Cary Coutant  <ccoutant@google.com>
4052
4053         * gold.cc: Include timer.h.
4054         (queue_middle_tasks): Stamp time.
4055         (queue_final_tasks): Likewise.
4056         * main.cc (main): Store timer in parameters.  Print timers
4057         for each pass.
4058         * parameters.cc (Parameters::Parameters): Initialize timer_.
4059         (Parameters::set_timer): New function.
4060         (set_parameters_timer): New function.
4061         * parameters.h (Parameters::set_timer): New function.
4062         (Parameters::timer): New function.
4063         (Parameters::timer_): New data member.
4064         (set_parameters_timer): New function.
4065         * timer.cc (Timer::stamp): New function.
4066         (Timer::get_pass_time): New function.
4067         * timer.h (Timer::stamp): New function.
4068         (Timer::get_pass_time): New function.
4069         (Timer::pass_times_): New data member.
4070
4071 2011-10-17  Cary Coutant  <ccoutant@google.com>
4072
4073         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4074         task for members of lib groups.
4075
4076 2011-10-17  Cary Coutant  <ccoutant@google.com>
4077
4078         PR gold/13288
4079         * fileread.cc (File_read::find_view): Add assert.
4080         (File_read::make_view): Move bounds check (replace with assert)...
4081         (File_read::find_or_make_view): ... to here.
4082
4083 2011-10-12  Cary Coutant  <ccoutant@google.com>
4084
4085         * output.cc (Output_file::open_base_file): Handle case where
4086         ::read returns less than requested size.
4087
4088 2011-10-10  Cary Coutant  <ccoutant@google.com>
4089
4090         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4091         Initialize defined_count_.
4092         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4093         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4094         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4095         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4096         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4097         * incremental.h (Sized_relobj_incr::defined_count_): New data
4098         member.
4099         (Sized_incr_dynobj::defined_count_): New data member.
4100         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4101         Return zeroes instead of internal error.
4102
4103 2011-10-10  Cary Coutant  <ccoutant@google.com>
4104
4105         PR gold/13249
4106         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4107         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4108         * output.h (class Output_reloc): Add use_plt_offset flag.
4109         (Output_reloc::type_): Adjust size of bit field.
4110         (Output_reloc::use_plt_offset_): New bit field.
4111         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4112         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4113         flag.  Adjust all callers.
4114         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4115         creating RELATIVE relocations.
4116
4117 2011-10-10  Nick Clifton  <nickc@redhat.com>
4118
4119         * po/es.po: Updated Spanish translation.
4120         * po/fi.po: Updated Finnish translation.
4121
4122 2011-10-03   Diego Novillo  <dnovillo@google.com>
4123
4124         * options.cc (parse_uint): Fix dereference of RETVAL.
4125
4126 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4127
4128         * layout.h (section_order_map_): New member.
4129         (get_section_order_map): New member function.
4130         * output.cc (Output_section::add_input_section): Check for patterns
4131         only when --section-ordering-file is specified.
4132         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4133         output_sections have been formed.
4134         * layout.cc (Layout_Layout): Initialize section_order_map_.
4135         * plugin.cc (update_section_order): Store order in order_map. Do not
4136         update the order.
4137         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4138         * testsuite/Makefile.in: Regenerate.
4139         * testsuite/plugin_section_order.c: New file.
4140         * testsuite/plugin_final_layout.cc: New file.
4141         * testsuite/plugin_final_layout.sh: New file.
4142
4143 2011-09-29  Cary Coutant  <ccoutant@google.com>
4144
4145         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4146         Check for NULL.
4147         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4148         symbols during incremental update.
4149         (Symbol_table::add_from_dynobj): Likewise.
4150
4151 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4152             Ian Lance Taylor  <iant@google.com>
4153
4154         * symtab.cc (Symbol_table::define_special_symbol): Always
4155         canonicalize version string.
4156
4157 2011-09-26  Cary Coutant  <ccoutant@google.com>
4158
4159         * gold.cc (queue_initial_tasks): Move option checks ...
4160         * options.cc (General_options::finalize): ... to here. Disable
4161         some options; make others fatal.
4162
4163 2011-09-26  Cary Coutant  <ccoutant@google.com>
4164
4165         gcc PR lto/47247
4166         * plugin.cc (get_symbols_v2): New function.
4167         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4168         (is_referenced_from_outside): New function.
4169         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4170         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4171         (get_symbols): Pass version parameter.
4172         (get_symbols_v2): New function.
4173         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4174         parameter.
4175         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4176         (onload): Add LDPT_GET_SYMBOLS_V2.
4177         (all_symbols_read_hook): Use get_symbols_v2; check for
4178         LDPR_PREVAILING_DEF_IRONLY_EXP.
4179         * testsuite/plugin_test_3.sh: Update expected results.
4180
4181 2011-09-23  Simon Baldwin  <simonb@google.com>
4182
4183         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4184         configuration options.
4185         * configure: Regenerate.
4186         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4187         * Makefile.in: Regenerate.
4188         * testsuite/Makefile.in: Regenerate.
4189
4190 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4191
4192         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4193
4194 2011-09-19  Cary Coutant  <ccoutant@google.com>
4195
4196         * incremental.cc (can_incremental_update): Fix typo in comment.
4197         * incremental.h (can_incremental_update): Likewise.
4198
4199 2011-09-18  Cary Coutant  <ccoutant@google.com>
4200
4201         * incremental.cc (can_incremental_update): New function.
4202         * incremental.h (can_incremental_update): New function.
4203         * layout.cc (Layout::init_fixed_output_section): Call it.
4204         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4205         * object.cc (Sized_relobj_file::do_layout): Call
4206         can_incremental_update.
4207
4208 2011-09-13  Cary Coutant  <ccoutant@google.com>
4209
4210         * configure.ac: Check for glibc support for gnu_indirect_function
4211         support with static linking, setting automake conditional
4212         IFUNC_STATIC.
4213         * Makefile.in: Regenerate.
4214         * configure: Regenerate.
4215
4216         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4217         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4218         for IFUNC_STATIC.
4219         * testsuite/Makefile.in: Regenerate.
4220
4221 2011-09-13  Cary Coutant  <ccoutant@google.com>
4222
4223         * incremental.cc (Sized_relobj_incr::do_layout): Call
4224         report_comdat_group for kept comdat sections.
4225         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4226         * testsuite/Makefile.in: Regenerate.
4227         * testsuite/incr_comdat_test_1.cc: New source file.
4228         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4229         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4230         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4231
4232 2011-09-13  Ian Lance Taylor  <iant@google.com>
4233
4234         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4235         variable external_symbols_offset.
4236
4237 2011-09-12  Ian Lance Taylor  <iant@google.com>
4238
4239         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4240         triggered if object has no symbols.
4241
4242 2011-09-09  David S. Miller  <davem@davemloft.net>
4243
4244         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4245         (Output_fill_debug_line::do_write): Likewise.
4246
4247 2011-08-29  Cary Coutant  <ccoutant@google.com>
4248
4249         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4250         casts to match formatting specs.
4251         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4252
4253 2011-08-26  Cary Coutant  <ccoutant@google.com>
4254
4255         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4256         remaining hole size when allocating.
4257         (Layout::make_output_section): Set fill methods for debug sections.
4258         * layout.h (Free_list::Free_list_node): Move from private to
4259         public.
4260         (Free_list::set_min_hole_size): New function.
4261         (Free_list::begin, Free_list::end): New functions.
4262         (Free_list::min_hole_): New data member.
4263         * output.cc: Include dwarf.h.
4264         (Output_fill_debug_info::do_minimum_hole_size): New function.
4265         (Output_fill_debug_info::do_write): New function.
4266         (Output_fill_debug_line::do_minimum_hole_size): New function.
4267         (Output_fill_debug_line::do_write): New function.
4268         (Output_section::Output_section): Initialize new data member.
4269         (Output_section::set_final_data_size): Ensure patch space is larger
4270         than minimum hole size.
4271         (Output_section::do_write): Fill holes in debug sections.
4272         * output.h (Output_fill): New class.
4273         (Output_fill_debug_info): New class.
4274         (Output_fill_debug_line): New class.
4275         (Output_section::set_free_space_fill): New function.
4276         (Output_section::free_space_fill_): New data member.
4277         * testsuite/Makefile.am (incremental_test_3): Add
4278         --incremental-patch option.
4279         (incremental_test_4): Likewise.
4280         (incremental_test_5): Likewise.
4281         (incremental_test_6): Likewise.
4282         (incremental_copy_test): Likewise.
4283         (incremental_common_test_1): Likewise.
4284         * testsuite/Makefile.in: Regenerate.
4285
4286 2011-08-26  Nick Clifton  <nickc@redhat.com>
4287
4288         * po/es.po: Updated Spanish translation.
4289
4290 2011-08-01  Cary Coutant  <ccoutant@google.com>
4291
4292         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4293         * gold/testsuite/Makefile.in: Regenerate.
4294         * gold/testsuite/justsyms_exec.c: New source file.
4295         * gold/testsuite/justsyms_lib.c: New source file.
4296
4297 2011-08-01  Cary Coutant  <ccoutant@google.com>
4298
4299         * layout.cc (Layout::set_segment_offsets): Don't realign text
4300         segment if -Ttext was specified.
4301         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4302         file type.
4303         * object.h (Sized_relobj_file::e_type): New function.
4304         (Sized_relobj_file::e_type_): New data member.
4305         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4306         base address for ET_EXEC files.
4307         * target.cc (Target::do_make_elf_object_implementation): Allow
4308         ET_EXEC files with --just-symbols option.
4309
4310 2011-07-28  Cary Coutant  <ccoutant@google.com>
4311
4312         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4313         Add thread_number parameter.
4314         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4315         * workqueue-threads.cc
4316         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4317         current thread if its thread number is greater than desired thread
4318         count.
4319         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4320         Add thread_number parameter.
4321         (Workqueue::should_cancel_thread): Likewise.
4322         (Workqueue::find_runnable_or_wait): Pass thread_number to
4323         should_cancel_thread.
4324         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4325         parameter.
4326
4327 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4328
4329         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4330         only after checking if it cannot be forced local.
4331         * symtab.h (is_externally_visible): Check if the symbol is not forced
4332         local.
4333
4334 2011-07-15  Ian Lance Taylor  <iant@google.com>
4335
4336         * options.h (class General_options): Add --print-output-format.
4337         Move -EL next to -EB, for  better --help output.
4338         * target-select.cc: Include <cstdio>, "options.h", and
4339         "parameters.h".
4340         (Target_selector::do_target_bfd_name): New function.
4341         (print_output_format): New function.
4342         * target-select.h (class Target_selector): Update declarations.
4343         (Target_selector::target_bfd_name): New function.
4344         (print_output_format): Declare.
4345         * main.cc: Include "target-select.h".
4346         (main): Handle --print-output-format.
4347         * gold.cc: Include "target-select.h".
4348         (queue_initial_tasks): Handle --print-output-format when there are
4349         no input files.
4350         * parameters.cc (parameters_force_valid_target): Give a better
4351         error message if -EB/-EL does not match target.
4352         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4353         function.
4354
4355 2011-07-15  Ian Lance Taylor  <iant@google.com>
4356
4357         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4358         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4359         (Output_data_plt_i386::do_write): Write address of .dynamic
4360         section to first entry in .got.plt section.
4361         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4362         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4363         Initialize layout_.
4364         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4365         section to first entry in .got.plt section.
4366         * layout.h (Layout::dynamic_section): New function.
4367
4368 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4369
4370         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4371         to claim_file call.
4372         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4373         input_section_position_, and input_section_glob_.
4374         (read_layout_from_file): Call function section_ordering_specified.
4375         * layout.h (is_section_ordering_specified): New function.
4376         (section_ordering_specified): New function.
4377         (section_ordering_specified_): New boolean member.
4378         * main.cc(main): Call load_plugins after layout object is defined.
4379         * output.cc (Output_section::add_input_section): Use
4380         function section_ordering_specified to check if section ordering is
4381         needed.
4382         * output.cc (Output_section::add_relaxed_input_section): Use
4383         function section_ordering_specified to check if section ordering is
4384         needed.
4385         (Output_section::update_section_layout): New function.
4386         (Output_section::sort_attached_input_sections): Check if input section
4387         must be reordered.
4388         * output.h (Output_section::update_section_layout): New function.
4389         * plugin.cc (get_section_count): New function.
4390         (get_section_type): New function.
4391         (get_section_name): New function.
4392         (get_section_contents): New function.
4393         (update_section_order): New function.
4394         (allow_section_ordering): New function.
4395         (Plugin::load): Add the new interfaces to the transfer vector.
4396         (Plugin_manager::load_plugins): New parameter.
4397         (Plugin_manager::all_symbols_read): New parameter.
4398         (Plugin_manager::claim_file): New parameter. Save the elf object for
4399         unclaimed objects.
4400         (Plugin_manager::get_elf_object): New function.
4401         (Plugin_manager::get_view): Change to directly use the bool to check
4402         if get_view is called from claim_file_hook.
4403         * plugin.h (input_objects): New function
4404         (Plugin__manager::load_plugins): New parameter.
4405         (Plugin_manager::claim_file): New parameter.
4406         (Plugin_manager::get_elf_object): New function.
4407         (Plugin_manager::in_claim_file_handler): New function.
4408         (Plugin_manager::in_claim_file_handler_): New member.
4409         (layout): New function.
4410         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4411         handler with an extra parameter. Make the elf object before calling
4412         claim_file handler.
4413         * testsuite/plugin_test.c (get_section_count): New function pointer.
4414         (get_section_type): New function pointer.
4415         (get_section_name): New function pointer.
4416         (get_section_contents): New function pointer.
4417         (update_section_order): New function pointer.
4418         (allow_section_ordering): New function pointer.
4419         (onload): Check if the new interfaces exist.
4420
4421 2011-07-13  Ian Lance Taylor  <iant@google.com>
4422
4423         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4424         relro section.
4425         * x86_64.cc (Target_x86_64::got_section): Likewise.
4426         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4427         (relro_now_test_SOURCES): New variable.
4428         (relro_now_test_DEPENDENCIES): New variable.
4429         (relro_now_test_LDFLAGS): New variable.
4430         (relro_now_test_LDADD): New variable.
4431         (relro_now_test.so): New target.
4432         * testsuite/Makefile.in: Rebuild.
4433
4434 2011-07-12  Ian Lance Taylor  <iant@google.com>
4435
4436         PR gold/12980
4437         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4438         GLOB_DAT relocation rather than a RELATIVE relocation for a
4439         protected symbol when creating a shared library.
4440         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4441         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4442         * testsuite/protected_main_1.cc (main): Test that protected
4443         function has same address.
4444
4445 2011-07-11  Ian Lance Taylor  <iant@google.com>
4446
4447         PR gold/12979
4448         * options.h (class General_options): Add -Bgroup.
4449         * options.cc (General_options::finalize): If -Bgroup is set,
4450         default to --unresolved-symbols=report-all.
4451         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4452         * target-reloc.h (issue_undefined_symbol_error): Handle
4453         --unresolved-symbols=report-all.
4454
4455 2011-07-08  Ian Lance Taylor  <iant@google.com>
4456
4457         PR gold/11985
4458         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4459         if linker script discards key sections.
4460         (Layout::create_dynamic_symtab): Likewise.
4461         (Layout::assign_local_dynsym_offsets): Likewise.
4462         (Layout::sized_create_version_sections): Likewise.
4463         (Layout::create_interp): Likewise.
4464         (Layout::finish_dynamic_section): Likewise.
4465         (Layout::set_dynamic_symbol_size): Likewise.
4466
4467 2011-07-08  Ian Lance Taylor  <iant@google.com>
4468
4469         PR gold/12386
4470         * options.h (class General_options): Add --unresolved-symbols.
4471         * target-reloc.h (issue_undefined_symbol_error): Check
4472         --unresolved-symbols.  Add comments.
4473
4474 2011-07-08  Ian Lance Taylor  <iant@google.com>
4475
4476         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4477         expression more complex.
4478
4479 2011-07-08  Ian Lance Taylor  <iant@google.com>
4480
4481         PR gold/11317
4482         * target-reloc.h (issue_undefined_symbol_error): New inline
4483         function, broken out of relocate_section.
4484         (relocate_section): Call issue_undefined_symbol_error.
4485         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4486         there is no TLS segment if we are about to issue an undefined
4487         symbol error.
4488         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4489
4490 2011-07-08  Ian Lance Taylor  <iant@google.com>
4491
4492         PR gold/12279
4493         * resolve.cc (Symbol_table::should_override): Add fromtype
4494         parameter.  Change all callers.  Give error when linking together
4495         TLS and non-TLS symbol.
4496         (Symbol_table::should_override_with_special): Add fromtype
4497         parameter.  Change all callers.
4498         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4499         there is no TLS segment if we have reported some errors.
4500         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4501
4502 2011-07-08  Ian Lance Taylor  <iant@google.com>
4503
4504         PR gold/12372
4505         * target.h (Target::plt_address_for_global): New function.
4506         (Target::plt_address_for_local): New function.
4507         (Target::plt_section_for_global): Remove.
4508         (Target::plt_section_for_local): Remove.
4509         (Target::do_plt_address_for_global): New virtual function.
4510         (Target::do_plt_address_for_local): New virtual function.
4511         (Target::do_plt_section_for_global): Remove.
4512         (Target::do_plt_section_for_local): Remove.
4513         (Target::register_global_plt_entry): Add Symbol_table and Layout
4514         parameters.
4515         * output.cc (Output_data_got::Got_entry::write): Use
4516         plt_address_for_global and plt_address_for_local.
4517         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4518         address of output section.
4519         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4520         got_irelative_, and irelative_count_ fields.  Update
4521         declarations.
4522         (Output_data_plt_i386::has_irelative_section): New function.
4523         (Output_data_plt_i386::entry_count): Add irelative_count_.
4524         (Output_data_plt_i386::set_final_data_size): Likewise.
4525         (class Target_i386): Add got_irelative_ and rel_irelative_
4526         fields.  Update declarations.
4527         (Target_i386::Target_i386): Initialize new fields.
4528         (Target_i386::do_plt_address_for_global): New function replacing
4529         do_plt_section_for_global.
4530         (Target_i386::do_plt_address_for_local): New function replacing
4531         do_plt_section_for_local.
4532         (Target_i386::got_section): Create got_irelative_.
4533         (Target_i386::rel_irelative_section): New function.
4534         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4535         fields.  Don't define __rel_iplt_{start,end}.
4536         (Output_data_plt_i386::add_entry): Add symtab and layout
4537         parameters.  Change all callers.  Use different PLT and GOT for
4538         IFUNC symbols.
4539         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4540         layout parameters.  Change all callers.  Use different PLT and
4541         GOT.
4542         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4543         (Output_data_plt_i386::rel_irelative): New function.
4544         (Output_data_plt_i386::address_for_global): New function.
4545         (Output_data_plt_i386::address_for_local): New function.
4546         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4547         IRELATIVE GOT when changing IFUNC GOT entries.
4548         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4549         reloc.
4550         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4551         if we didn't create an IRELATIVE GOT.
4552         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4553         plt_address_for_local.
4554         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4555         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4556         got_irelative_, and irelative_count_ fields.  Update
4557         declarations.
4558         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4559         Initialize new fields.  Remove symtab parameter.  Change all
4560         callers.
4561         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4562         irelative_count_.
4563         (Output_data_plt_x86_64::has_irelative_section): New function.
4564         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4565         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4566         fields.  Update declarations.
4567         (Target_x86_64::Target_x86_64): Initialize new fields.
4568         (Target_x86_64::do_plt_address_for_global): New function replacing
4569         do_plt_section_for_global.
4570         (Target_x86_64::do_plt_address_for_local): New function replacing
4571         do_plt_section_for_local.
4572         (Target_x86_64::got_section): Create got_irelative_.
4573         (Target_x86_64::rela_irelative_section): New function.
4574         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4575         all callers.  Don't create __rel_iplt_{start,end}.
4576         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4577         parameters.  Change all callers.  Use different PLT and GOT for
4578         IFUNC symbols.
4579         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4580         layout parameters.  Change all callers.  Use different PLT and
4581         GOT.
4582         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4583         parameters.  Change all callers.  Use different PLT and GOT for
4584         IFUNC symbols.
4585         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4586         (Output_data_plt_x86_64::rela_irelative): New function.
4587         (Output_data_plt_x86_64::address_for_global): New function.
4588         (Output_data_plt_x86_64::address_for_local): New function.
4589         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4590         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4591         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4592         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4593         parameters.
4594         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4595         reloc.
4596         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4597         symbols if we didn't create an IRELATIVE GOT.
4598         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4599         plt_address_for_local.
4600         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4601         * testsuite/ifuncvar1.c: New test file.
4602         * testsuite/ifuncvar2.c: New test file.
4603         * testsuite/ifuncvar3.c: New test file.
4604         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4605         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4606         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4607         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4608         * testsuite/Makefile.in: Rebuild.
4609
4610 2011-07-07  Cary Coutant  <ccoutant@google.com>
4611
4612         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4613         (two_file_test_1_ndebug.o): Likewise.
4614         (two_file_test_1b_ndebug.o): Likewise.
4615         (two_file_test_2_ndebug.o): Likewise.
4616         (two_file_test_main_ndebug.o): Likewise.
4617         (incremental_test_2): Link with no-debug versions.
4618
4619 2011-07-06  Cary Coutant  <ccoutant@google.com>
4620
4621         * gold/incremental.cc
4622         (Output_section_incremental_inputs::write_info_blocks): Check for
4623         hidden and internal symbols.
4624
4625 2011-07-06  Cary Coutant  <ccoutant@google.com>
4626
4627         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4628         Check disposition for startup file.
4629         (Incremental_inputs::report_command_line): Ignore
4630         --incremental-startup-unchanged option.
4631         * options.cc (General_options::parse_incremental_startup_unchanged):
4632         New function.
4633         (General_options::General_options): Initialize new data member.
4634         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4635         (General_options): Add --incremental-startup-unchanged option.
4636         (General_options::incremental_startup_disposition): New function.
4637         (General_options::incremental_startup_disposition_): New data member.
4638
4639 2011-07-06  Cary Coutant  <ccoutant@google.com>
4640
4641         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4642         input file index to Script_info ctor.
4643         (Sized_incremental_binary::do_file_has_changed): Find the
4644         command-line argument for files named in scripts.
4645         * incremental.h (Script_info::Script_info): New ctor
4646         with input file index.
4647         (Script_info::input_file_index): New function.
4648         (Script_info::input_file_index_): New data member.
4649         (Incremental_binary::get_library): Add const.
4650         (Incremental_binary::get_script_info): Add const.
4651         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4652         * testsuite/Makefile.am (incremental_test_5): New test case.
4653         (incremental_test_6): New test case.
4654         * testsuite/Makefile.in: Regenerate.
4655
4656 2011-07-06  Cary Coutant  <ccoutant@google.com>
4657
4658         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4659         debug output when command lines differ.
4660
4661 2011-07-06  Cary Coutant  <ccoutant@google.com>
4662
4663         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4664         --incremental-patch option.
4665         * layout.cc (Free_list::allocate): Extend allocation beyond original
4666         end if enabled.
4667         (Layout::make_output_section): Mark sections that should get
4668         patch space.
4669         * options.cc (parse_percent): New function.
4670         * options.h (parse_percent): New function.
4671         (DEFINE_percent): New macro.
4672         (General_options): Add --incremental-patch option.
4673         * output.cc (Output_section::Output_section): Initialize new data
4674         members.
4675         (Output_section::add_input_section): Print section name when out
4676         of patch space.
4677         (Output_section::add_output_section_data): Likewise.
4678         (Output_section::set_final_data_size): Add patch space when
4679         doing --incremental-full.
4680         (Output_section::do_reset_address_and_file_offset): Remove patch
4681         space.
4682         (Output_segment::set_section_list_addresses): Print debug output
4683         only if --incremental-update.
4684         * output.h (Output_section::set_is_patch_space_allowed): New function.
4685         (Output_section::is_patch_space_allowed_): New data member.
4686         (Output_section::patch_space_): New data member.
4687         * parameters.cc (Parameters::incremental_full): New function.
4688         * parameters.h (Parameters::incremental_full): New function
4689         * testsuite/Makefile.am (incremental_test_2): Add test for
4690         --incremental-patch option.
4691         * testsuite/Makefile.in: Regenerate.
4692         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4693         (t18): Remove function body.
4694
4695 2011-07-05  Doug Kwan  <dougkwan@google.com>
4696
4697         PR gold/12771
4698         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4699         Arm_Address type for relocation result.
4700         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4701         overflow check.
4702         (Arm_relocate_functions::abs32): Use unaligned access.
4703         (Arm_relocate_functions::rel32): Ditto.
4704         (Arm_relocate_functions::prel31): Ditto.
4705         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4706         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4707         static data relocations.
4708         * testsuite/Makefile.in: Regnerate.
4709         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4710
4711 2011-07-05  Ian Lance Taylor  <iant@google.com>
4712
4713         PR gold/12392
4714         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4715         symbols if necessary.
4716         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4717
4718 2011-07-05  Ian Lance Taylor  <iant@google.com>
4719
4720         PR gold/12952
4721         * resolve.cc (Symbol::override_base_with_special): Simply override
4722         version with special symbol version, ignoring previous version.
4723
4724 2011-07-05  Ian Lance Taylor  <iant@google.com>
4725
4726         * object.cc (Sized_relobj_file::include_section_group): Add
4727         information to comment about signature location.
4728
4729 2011-07-02  Ian Lance Taylor  <iant@google.com>
4730
4731         PR gold/12957
4732         * options.h (class General_options): Add -f and -F.
4733         * options.cc (General_options::finalize): Fatal error if -f/-F
4734         are used without -shared.
4735         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4736
4737 2011-07-02  Ian Lance Taylor  <iant@google.com>
4738
4739         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4740
4741 2011-07-01  Ian Lance Taylor  <iant@google.com>
4742
4743         PR gold/12525
4744         PR gold/12952
4745         * resolve.cc (Symbol::override_base_with_special): Don't override
4746         the version if the overriding symbol has a different name.
4747         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4748         all callers.  If we give an error about an undefined version,
4749         define the base version if necessary.
4750         * dynobj.h (class Versions): Update declaration.
4751         * testsuite/weak_alias_test_5.cc: New file.
4752         * testsuite/weak_alias_test.script: New file.
4753         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4754         and versioned_alias have the right value, and call t2.
4755         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4756         weak_alias_test_5.so.
4757         (weak_alias_test_LDADD): Likewise.
4758         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4759         * testsuite/Makefile.in: Rebuild.
4760
4761 2011-07-01  Ian Lance Taylor  <iant@google.com>
4762
4763         PR gold/12525
4764         * options.h (class General_options): Support -z notext.
4765         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4766         -Wl,-z,notext.
4767         (two_file_shared_nonpic.so): Likewise.
4768         (two_file_shared_mixed.so): Likewise.
4769         (two_file_shared_mixed_1.so): Likewise.
4770         (weak_undef_lib_nonpic.so): Likewise.
4771         (alt/weak_undef_lib_nonpic.so): Likewise.
4772         (tls_test_shared_nonpic.so): Likewise.
4773         * testsuite/Makefile.in: Rebuild.
4774
4775 2011-07-01  Ian Lance Taylor  <iant@google.com>
4776
4777         PR gold/12525
4778         * configure.ac: Test whether static linking works, setting
4779         the automake conditional HAVE_STATIC.
4780         * testsuite/Makefile.am: Disable tests using -static if
4781         HAVE_STATIC is not true.
4782         * configure, testsuite/Makefile.in: Rebuild.
4783
4784 2011-07-01  Ian Lance Taylor  <iant@google.com>
4785
4786         PR gold/12525
4787         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4788         Assert if we see DW_EH_PE_indirect.
4789         * target.h (Target::ehframe_datarel_base): New function.
4790         (Target::do_ehframe_datarel_base): New target function.
4791         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4792         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4793         function.
4794
4795 2011-07-01  Ian Lance Taylor  <iant@google.com>
4796
4797         PR gold/12571
4798         * options.h (class General_options): Add
4799         --ld-generated-unwind-info.
4800         * ehframe.cc (Fde::write): Add address parameter.  Change all
4801         callers.  If associated with PLT, fill in address and size.
4802         (Cie::set_output_offset): Only add merge mapping if there is an
4803         object.
4804         (Cie::write): Add address parameter.  Change all callers.
4805         (Eh_frame::add_ehframe_for_plt): New function.
4806         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4807         input_offset_ fields into union u_, with new plt field.
4808         (Fde::Fde): Adjust for new union field.
4809         (Fde::Fde) [Output_data version]: New constructor.
4810         (Fde::add_mapping): Only add merge mapping if there is an object.
4811         (class Cie): Update declarations.
4812         (class Eh_frame): Declare add_ehframe_for_plt.
4813         * layout.cc (Layout::layout_eh_frame): Break out code into
4814         make_eh_frame_section, and call it.
4815         (Layout::make_eh_frame_section): New function.
4816         (Layout::add_eh_frame_for_plt): New function.
4817         * layout.h (class Layout): Update declarations.
4818         * merge.cc (Merge_map::add_mapping): Add assertion.
4819         * i386.cc: Include "dwarf.h".
4820         (class Output_data_plt_i386): Make first_plt_entry,
4821         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4822         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4823         and plt_eh_frame_fde.
4824         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4825         boundary.  Call add_eh_frame_for_plt if appropriate.
4826         * x86_64.cc: Include "dwarf.h".
4827         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4828         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4829         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4830         and plt_eh_frame_fde.
4831         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4832         appropriate.
4833
4834 2011-06-29  Ian Lance Taylor  <iant@google.com>
4835
4836         PR gold/12629
4837         * object.cc (Sized_relobj_file::layout_section): Change shdr
4838         parameter to be const.
4839         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4840         out of do_layout.
4841         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4842         appropriate.  Call layout_eh_frame_section.
4843         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4844         sections.
4845         * object.h (class Sized_relobj_file): Update declarations.
4846
4847 2011-06-29  Ian Lance Taylor  <iant@google.com>
4848
4849         PR gold/12652
4850         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4851         modifier.
4852         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4853
4854 2011-06-29  Ian Lance Taylor  <iant@google.com>
4855
4856         PR gold/12675
4857         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4858         SHT_X86_64_UNWIND.
4859         * layout.cc (Layout::layout_eh_frame): Likewise.
4860
4861 2011-06-29  Ian Lance Taylor  <iant@google.com>
4862
4863         PR gold/12695
4864         * layout.cc (Layout::symtab_section_shndx): New function.
4865         * layout.h (class Layout): Declare symtab_section_shndx.
4866         * output.cc (Output_section::write_header): Call it.
4867
4868 2011-06-29  Ian Lance Taylor  <iant@google.com>
4869
4870         PR gold/12818
4871         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4872         symbols which are not used in a relocation.
4873
4874 2011-06-28  Ian Lance Taylor  <iant@google.com>
4875
4876         PR gold/12898
4877         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4878         script create indistinguishable segments.
4879         (Layout::set_segment_offsets): Use stable_sort when sorting
4880         segments.  Pass this to Compare_segments constructor.
4881         * layout.h (class Layout): Make segment_precedes non-static.
4882         (class Compare_segments): Change from struct to class.  Add
4883         layout_ field.  Add constructor.
4884         * script-sections.cc
4885         (Script_sections::attach_sections_using_phdrs_clause): Rename
4886         local orphan to is_orphan.  Don't report failure to put empty
4887         section in segment.  On attachment failure, report name of
4888         section, and attach to first PT_LOAD segment.
4889
4890 2011-06-28  Ian Lance Taylor  <iant@google.com>
4891
4892         PR gold/12934
4893         * target-select.cc (Target_selector::Target_selector): Add
4894         emulation parameter.  Change all callers.
4895         (select_target_by_bfd_name): Rename from select_target_by_name.
4896         Change all callers.
4897         (select_target_by_emulation): New function.
4898         (supported_emulation_names): New function.
4899         * target-select.h (class Target_selector): Add emulation_ field.
4900         Update declarations.
4901         (Target_selector::recognize_by_bfd_name): Rename from
4902         recognize_by_name.  Change all callers.
4903         (Target_selector::supported_bfd_names): Rename from
4904         supported_names.  Change all callers.
4905         (Target_selector::recognize_by_emulation): New function.
4906         (Target_selector::supported_emulations): New function.
4907         (Target_selector::emulation): New function.
4908         (Target_selector::do_recognize_by_bfd_name): Rename from
4909         do_recognize_by_name.  Change all callers.
4910         (Target_selector::do_supported_bfd_names): Rename from
4911         do_supported_names.  Change all callers.
4912         (Target_selector::do_recognize_by_emulation): New function.
4913         (Target_selector::do_supported_emulations): New function.
4914         (select_target_by_bfd_name): Change name in declaration.
4915         (select_target_by_emulation): Declare.
4916         (supported_emulation_names): Declare.
4917         * parameters.cc (parameters_force_valid_target): Try to find
4918         target based on emulation from -m option.
4919         * options.h (class General_options): Change doc string for -m.
4920         * options.cc (help): Print emulations.
4921         (General_options::parse_V): Likewise.
4922         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4923         Add emulation parameter.  Change all callers.
4924
4925 2011-06-28  Ian Lance Taylor  <iant@google.com>
4926
4927         * target.h (class Target): Add osabi_ field.
4928         (Target::osabi): New function.
4929         (Target::set_osabi): New function.
4930         (Target::Target): Initialize osabi_.
4931         (Target::do_adjust_elf_header): Make pure virtual.
4932         (Sized_target::do_adjust_elf_header): Declare.
4933         * target.cc (Sized_target::do_adjust_elf_header): New function.
4934         (class Sized_target): Instantiate all versions.
4935         * freebsd.h (class Target_freebsd): Remove.
4936         (Target_selector_freebsd::do_recognize): Call set_osabi on
4937         Target.
4938         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4939         (Target_selector_freebsd::set_osabi): Remove.
4940         * i386.cc (class Target_i386): Inherit from Sized_target rather
4941         than Target_freebsd.
4942         * x86_64.cc (class Target_x86_64): Likewise.
4943
4944 2011-06-28  Ian Lance Taylor  <iant@google.com>
4945
4946         * target.h (Target::can_check_for_function_pointers): Rewrite.
4947         Make non-virtual.
4948         (Target::can_icf_inline_merge_sections): Likewise.
4949         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4950         (Target::Target_info): Add can_icf_inline_merge_sections field.
4951         (Target::do_can_check_for_function_pointers): New virtual
4952         function.
4953         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4954         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4955         from can_check_for_function_pointers, move in file.
4956         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4957         section_may_have_icf_unsafe_poineters, move in file.
4958         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4959         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4960         Rename from can_check_for_function_pointers, move in file.
4961         (Target_i386::can_icf_inline_merge_sections): Remove.
4962         (Target_i386::i386_info): Initialize
4963         can_icf_inline_merge_sections.
4964         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4965         Initialize can_icf_inline_merge_sections.
4966         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4967         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4968         Rename from can_check_for_function_pointers, move in file.
4969         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4970         (Target_x86_64::x86_64_info): Initialize
4971         can_icf_inline_merge_sections.
4972         * testsuite/testfile.cc (Target_test::test_target_info):
4973         Likewise.
4974         * icf.cc (get_section_contents): Correct formatting.
4975
4976 2011-06-27  Ian Lance Taylor  <iant@google.com>
4977
4978         * symtab.cc (Symbol::versioned_name): New function.
4979         (Symbol_table::add_to_final_symtab): Use versioned_name when
4980         appropriate.
4981         (Symbol_table::sized_write_symbol): Likewise.
4982         * symtab.h (class Symbol): Declare versioned_name.
4983         * stringpool.h (class Stringpool_template): Add variant of add
4984         which takes a std::basic_string.
4985         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4986         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4987         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4988         (ver_test_12.o): New target.
4989         * testsuite/Makefile.in: Rebuild.
4990
4991 2011-06-27  Doug Kwan  <dougkwan@google.com>
4992
4993         * arm.cc (Arm_relocate_functions::thm_jump8,
4994         Arm_relocate_functions::thm_jump11): Use a wider signed
4995         type to compute offset.
4996         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4997         arm_thm_jump8.
4998         * testsuite/Makefile.in: Regenerate.
4999         * testsuite/arm_branch_in_range.sh: Check test results of
5000         arm_thm_jump11 and arm_thm_jump8.
5001         * testsuite/arm_thm_jump11.s: New test source file.
5002         * testsuite/arm_thm_jump11.t: New linker script.
5003         * testsuite/arm_thm_jump8.s: New test source file.
5004         * testsuite/arm_thm_jump8.t: New linker script.
5005
5006 2011-06-24  Ian Lance Taylor  <iant@google.com>
5007
5008         * layout.cc: Include "object.h".
5009         (ctors_sections_in_init_array): New static variable.
5010         (Layout::is_ctors_in_init_array): New function.
5011         (Layout::layout): Add entry to ctors_sections_in_init_array if
5012         appropriate.
5013         * layout.h (class Layout): Declare is_ctors_in_init_array.
5014         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
5015         is_ctors_reverse_view is set.
5016         (Sized_relobj_file::write_sections): Add layout parameter.  Change
5017         all callers.  Set is_ctors_reverse_view field of View_size.
5018         (Sized_relobj_file::reverse_words): New function.
5019         * object.h (Sized_relobj_file::View_size): Add
5020         is_ctors_reverse_view field.
5021         (class Sized_relobj_file): Update declarations.
5022         * testsuite/initpri3.c: New test.
5023         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
5024         initpri3b.
5025         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
5026         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
5027         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
5028         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
5029         * testsuite/Makefile.in: Rebuild.
5030
5031 2011-06-24  Cary Coutant  <ccoutant@google.com>
5032
5033         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5034         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5035         (debug_msg_cdebug.err): New targets.
5036         * testsuite/Makefile.in: Regenerate.
5037         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5038         Fix checks for link with shared library.
5039
5040 2011-06-24  Doug Kwan  <dougkwan@google.com>
5041
5042         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5043         skip empty text sections.
5044         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5045
5046 2011-06-22  Ian Lance Taylor  <iant@google.com>
5047
5048         PR gold/12910
5049         * options.h (class General_options): Add --ctors-in-init-array.
5050         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5051         friends as SHT_PROGBITS for merging sections.
5052         (Layout::layout): Remove special handling of .init_array and
5053         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5054         and .dtors if ctors_in_init_array.
5055         (Layout::make_output_section): Force correct section types for
5056         .init_array and friends.  Don't sort if doing relocatable link,
5057         Don't sort .ctors and .dtors if ctors_in_init_array.
5058         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5059         (Layout::output_section_name): Add relobj parameter.  Change all
5060         callers.  Handle .ctors. and .dtors. in code rather than table.
5061         Handle .ctors and .dtors if ctors_in_init_array.
5062         (Layout::match_file_name): New function, moved from output.cc.
5063         * layout.h (class Layout): Update declarations.
5064         * output.cc: Include "layout.h".
5065         (Input_section_sort_entry::get_priority): New function.
5066         (Input_section_sort_entry::match_file_name): Just call
5067         Layout::match_file_name.
5068         (Output_section::Input_section_sort_init_fini_compare::operator()):
5069         Handle .ctors and .dtors.  Sort by explicit priority rather than
5070         by name.
5071         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5072         * testsuite/initpri2.c: New test.
5073         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5074         (check_PROGRAMS): Add initpri2.
5075         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5076         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5077         * configure, testsuite/Makefile.in: Rebuild.
5078
5079 2011-06-19  Ian Lance Taylor  <iant@google.com>
5080
5081         PR gold/12880
5082         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5083         .interp section to a PT_INTERP segment even if we have seen a
5084         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5085         clause in a linker script.
5086         (Layout::finalize): Don't create a .interp section if we've
5087         already create a PT_INTERP segment.
5088         (Layout::create_interp): Always call choose_output_section (revert
5089         patch of 2011-06-17).  Don't create PT_INTERP segment.
5090         * script-sections.cc
5091         (Script_sections::create_note_and_tls_segments): Add a .interp
5092         section to a PT_INTERP segment even if we have seen a
5093         --dynamic-linker option.
5094
5095 2011-06-18  Ian Lance Taylor  <iant@google.com>
5096
5097         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5098         merely because a non-PT_LOAD segment has a dynamic reloc.
5099
5100 2011-06-18  Ian Lance Taylor  <iant@google.com>
5101
5102         * layout.cc (Layout::finish_dynamic_section): Don't create
5103         DT_FLAGS entry if not needed.
5104
5105 2011-06-18  Ian Lance Taylor  <iant@google.com>
5106
5107         PR gold/12745
5108         * layout.cc (Layout::layout_eh_frame): Correct handling of
5109         writable .eh_frame section.
5110
5111 2011-06-17  Ian Lance Taylor  <iant@google.com>
5112
5113         PR gold/12893
5114         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5115         symbol is redefined with the exact same object and value.
5116
5117 2011-06-17  Ian Lance Taylor  <iant@google.com>
5118
5119         PR gold/12880
5120         * layout.h (class Layout): Add interp_segment_ field.
5121         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5122         (Layout::attach_allocated_section_to_segment): If making shared
5123         library, put .interp section in PT_INTERP segment.
5124         (Layout::finalize): Also call create_interp if -dynamic-linker
5125         option was used.
5126         (Layout::create_interp): Assert that there is no PT_INTERP
5127         segment.  If not using a SECTIONS clause, use make_output_section.
5128         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5129         * script-sections.cc
5130         (Script_sections::create_note_and_tls_segments): If making shared
5131         library, put .interp section in PT_INTERP segment.
5132
5133 2011-06-17  Ian Lance Taylor  <iant@google.com>
5134
5135         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5136         when making a shared library.
5137
5138 2011-06-17  Ian Lance Taylor  <iant@google.com>
5139
5140         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5141         parameter.  Change all callers.  Don't issue warning about PC32
5142         against locally defined symbol.
5143
5144 2011-06-16  Ian Lance Taylor  <iant@google.com>
5145
5146         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5147         occurs in same object.
5148
5149 2011-06-14  Alan Modra  <amodra@gmail.com>
5150
5151         * po/POTFILES.in: Regenerate.
5152
5153 2011-06-09  Ian Lance Taylor  <iant@google.com>
5154
5155         * script-sections.cc
5156         (Orphan_output_section::set_section_addresses): For a relocatable
5157         link set address to 0.
5158
5159 2011-06-09  Cary Coutant  <ccoutant@google.com>
5160
5161         PR gold/12804
5162         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5163         used with --compress-debug-sections.
5164         * gold/object.cc (Sized_relobj_file::do_layout): Report
5165         uncompressed size of compressed input sections.
5166
5167 2011-06-08  Cary Coutant  <ccoutant@google.com>
5168
5169         PR gold/12804
5170         * testsuite/two_file_test_2_v1.cc: Change initialization of
5171         v2 to keep it in .data.
5172
5173 2011-06-07  Cary Coutant  <ccoutant@google.com>
5174
5175         * common.cc (Symbol_table::do_allocate_commons_list): Call
5176         gold_fallback.
5177         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5178         (Errors::fallback): New function.
5179         (gold_fallback): New function.
5180         * errors.h (Errors::fallback): New function.
5181         * gold.cc (gold_exit): Change status parameter to enum; adjust
5182         all callers.
5183         (queue_initial_tasks): Call gold_fallback.
5184         * gold.h: Include cstdlib.
5185         (Exit_status): New enum type.
5186         (gold_exit): Change status parameter to enum.
5187         (gold_fallback): New function.
5188         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5189         (Layout::create_symtab_sections): Likewise.
5190         (Layout::create_shdrs): Likewise.
5191         * main.cc (main): Adjust call to gold_exit.
5192         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5193         (Output_data_got::add_got_entry_pair): Likewise.
5194         (Output_section::add_input_section): Likewise.
5195         (Output_section::add_output_section_data): Likewise.
5196         (Output_segment::set_section_list_addresses): Likewise.
5197         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5198
5199 2011-06-07  Cary Coutant  <ccoutant@google.com>
5200
5201         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5202         for incremental links.
5203         * output.cc (Output_segment::set_section_list_addresses): Remove
5204         FIXME and test for TLS or BSS.
5205
5206 2011-06-07  Cary Coutant  <ccoutant@google.com>
5207
5208         * testsuite/Makefile.am: Add incremental_copy_test,
5209         incremental_common_test_1.
5210         * testsuite/Makefile.in: Regenerate.
5211         * testsuite/common_test_1_v1.c: New source file.
5212         * testsuite/common_test_1_v2.c: New source file.
5213         * testsuite/copy_test_v1.cc: New source file.
5214
5215 2011-06-07  Cary Coutant  <ccoutant@google.com>
5216
5217         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5218         update, allocate common from bss section's free list.
5219         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5220         linker-defined symbols.
5221         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5222         Skip GOT and PLT entries that are no longer referenced.
5223         (Output_section_incremental_inputs::write_info_blocks): Mark
5224         linker-defined symbols.
5225         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5226         * output.cc (Output_section::allocate): New function.
5227         * output.h (Output_section::allocate): New function.
5228         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5229         linker-defined symbols.
5230         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5231         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5232         (Symbol::init_base_output_data): Likewise.
5233         (Symbol::init_base_output_segment): Likewise.
5234         (Symbol::init_base_constant): Likewise.
5235         (Sized_symbol::init_output_data): Likewise.
5236         (Sized_symbol::init_output_segment): Likewise.
5237         (Sized_symbol::init_constant): Likewise.
5238         (Symbol_table::do_define_in_output_data): Likewise.
5239         (Symbol_table::do_define_in_output_segment): Likewise.
5240         (Symbol_table::do_define_as_constant): Likewise.
5241         * symtab.h (Symbol::is_predefined): New function.
5242         (Symbol::init_base_output_data): Add is_predefined parameter.
5243         (Symbol::init_base_output_segment): Likewise.
5244         (Symbol::init_base_constant): Likewise.
5245         (Symbol::is_predefined_): New data member.
5246         (Sized_symbol::init_output_data): Add is_predefined parameter.
5247         (Sized_symbol::init_output_segment): Likewise.
5248         (Sized_symbol::init_constant): Likewise.
5249         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5250
5251 2011-06-07  Cary Coutant  <ccoutant@google.com>
5252
5253         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5254         instead of emit_copy_reloc.
5255         (Copy_relocs::emit_copy_reloc): Refactor.
5256         (Copy_relocs::make_copy_reloc): New function.
5257         (Copy_relocs::add_copy_reloc): Remove.
5258         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5259         section.
5260         (Copy_relocs::make_copy_reloc): New function.
5261         (Copy_relocs::add_copy_reloc): Remove.
5262         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5263         unchanged input files.
5264         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5265         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5266         Reserve BSS space for COPY relocations.
5267         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5268         (Output_section_incremental_inputs::write_info_blocks): Record
5269         whether a symbol is copied from a shared object.
5270         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5271         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5272         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5273         (Incremental_input_entry_reader::get_output_symbol_index): Add
5274         is_copy parameter.
5275         (Incremental_binary::emit_copy_relocs): New function.
5276         (Incremental_binary::do_emit_copy_relocs): New function.
5277         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5278         new data member.
5279         (Sized_incremental_binary::add_copy_reloc): New function.
5280         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5281         (Sized_incremental_binary::Copy_reloc): New struct.
5282         (Sized_incremental_binary::Copy_relocs): New typedef.
5283         (Sized_incremental_binary::copy_relocs_): New data member.
5284         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5285         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5286         * target.h (Sized_target::emit_copy_reloc): New function.
5287         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5288
5289 2011-06-02  Cary Coutant  <ccoutant@google.com>
5290
5291         PR gold/12163
5292         * gold/archive.cc (Archive::Archive): Initialize new data member.
5293         (Archive::include_all_members): Return if archive has already been
5294         included.
5295         * gold/archive.h (Archive::include_all_members_): New data member.
5296
5297 2011-06-02  Nick Clifton  <nickc@redhat.com>
5298
5299         * dynobj.h: Fix spelling mistake in comment.
5300         * output.cc: Likewise.
5301
5302 2011-05-31  Doug Kwan  <dougkwan@google.com>
5303             Asier Llano
5304
5305         PR gold/12826
5306         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5307         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5308         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5309         redundant arm_exidx_test.so.
5310         * testsuite/Makefile.in: Regenerate.
5311         (check_SCRIPTS): Add pr12826.sh
5312         (check_DATA): Add pr12826.stdout
5313         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5314         * testsuite/pr12826.sh: New file.
5315         * testsuite/pr12826_1.s: Ditto.
5316         * testsuite/pr12826_1.s: Ditto.
5317
5318 2011-05-30  Ian Lance Taylor  <iant@google.com>
5319
5320         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5321         sections.
5322
5323 2011-05-29  Ian Lance Taylor  <iant@google.com>
5324
5325         PR gold/12804
5326         * testsuite/Makefile.am: Use different file name for two_file_test
5327         temporary file for each incremental test.
5328         * testsuite/Makefile.in: Rebuild.
5329
5330 2011-05-29  Ian Lance Taylor  <iant@google.com>
5331
5332         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5333         binary input file is empty.
5334
5335 2011-05-27  Ian Lance Taylor  <iant@google.com>
5336
5337         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5338         (ver_test_9.so): Likewise.
5339         * testsuite/Makefile.in: Rebuild.
5340
5341 2011-05-26 Cary Coutant  <ccoutant@google.com>
5342
5343         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5344         * incremental.cc (Incremental_inputs::report_input_section): Fix
5345         comment, indentation.
5346         (Incremental_inputs::report_comdat_group): New function.
5347         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5348         of data for incremental input file entry.
5349         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5350         group count, COMDAT group signatures.
5351         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5352         an unchanged input file.
5353         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5354         Initialize new data member.
5355         (Incremental_object_entry::add_comdat_group): New function.
5356         (Incremental_object_entry::get_comdat_group_count): New function.
5357         (Incremental_object_entry::get_comdat_signature_key): New function.
5358         (Incremental_object_entry::groups_): New data member.
5359         (Incremental_inputs::report_comdat_group): New function.
5360         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5361         data for incremental input file entry.
5362         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5363         (Incremental_input_entry_reader::get_input_section): Adjust size of
5364         data for incremental input file entry.
5365         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5366         (Incremental_input_entry_reader::get_comdat_group_signature): New
5367         function.
5368         * object.cc (Sized_relobj::include_section_group): Report kept
5369         COMDAT groups for incremental links.
5370
5371 2011-05-24  David Meyer  <pdox@google.com>
5372
5373         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5374         with name parameter.  Add found_name parameter.
5375         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5376         * dirsearch.h (class Dirsearch): Update declaration.
5377
5378 2011-05-24  Ian Lance Taylor  <iant@google.com>
5379
5380         * archive.cc (Library_base::should_include_member): Pull in object
5381         from archive if it defines the entry symbol.
5382         * parameters.cc (Parameters::entry): New function.
5383         * parameters.h (class Parameters): Declare entry.
5384         * output.h (class Output_file_header): Remove entry_ field.
5385         * output.cc (Output_file_header::Output_file_header): Remove entry
5386         parameter.  Change all callers.
5387         (Output_file_header::entry): Use parameters->entry.
5388         * gold.cc (queue_middle_tasks): Likewise.
5389         * plugin.cc (Plugin_hook::run): Likewise.
5390
5391 2011-05-24 Cary Coutant  <ccoutant@google.com>
5392
5393         * gold.cc (queue_initial_tasks): Pass incremental base filename
5394         to Output_file::open_base_file; don't print error message.
5395         * incremental-dump.cc (main): Adjust call to
5396         Output_file::open_for_modification.
5397         * incremental-dump.cc (main): Likewise.
5398         * incremental.cc (Incremental_inputs::report_command_line):
5399         Ignore --incremental-base option when comparing command lines.
5400         Ignore parameter when given as separate argument.
5401         * options.h (class General_options): Add --incremental-base.
5402         * output.cc (Output_file::Output_file):
5403         (Output_file::open_base_file): Add base_name and writable parameters;
5404         read base file into new file; print error message here.
5405         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5406         callers.
5407         * output.h (Output_file::open_for_modification): Rename to...
5408         (Output_file::open_base_file): ...this; add base_name and
5409         writable parameters; adjust all callers.
5410         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5411         callers.
5412         * testsuite/Makefile.am (incremental_test_4): Test
5413         --incremental-base.
5414         * testsuite/Makefile.in: Regenerate.
5415
5416 2011-05-24 Cary Coutant  <ccoutant@google.com>
5417
5418         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5419         incremental_test_4.
5420         * testsuite/Makefile.in: Regenerate.
5421         * testsuite/two_file_test_1_v1.cc: New test source file.
5422         * testsuite/two_file_test_1b_v1.cc: New test source file.
5423         * testsuite/two_file_test_2_v1.cc: New test source file.
5424
5425 2011-05-24 Cary Coutant  <ccoutant@google.com>
5426
5427         * dynobj.h (Dynobj::do_dynobj): New function.
5428         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5429         flag and soname for shared objects.
5430         * incremental.cc (Incremental_inputs::report_object): Make
5431         either Incremental_object_entry or Incremental_dynobj_entry; add
5432         soname to string table.
5433         (Incremental_inputs::report_input_section): Add assertion.
5434         (Output_section_incremental_inputs::set_final_data_size): Adjust
5435         type of input file entry for shared libraries; adjust size of
5436         shared library info entry.
5437         (Output_section_incremental_inputs::write_input_files): Write
5438         as_needed flag for shared libraries.
5439         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5440         of input file entry for shared libraries; write soname.
5441         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5442         soname from incremental info.
5443         * incremental.h (enum Incremental_input_flags): Add
5444         INCREMENTAL_INPUT_AS_NEEDED.
5445         (Incremental_input_entry::Incremental_input_entry): Initialize new
5446         data member.
5447         (Incremental_input_entry::set_as_needed): New function.
5448         (Incremental_input_entry::as_needed): New function.
5449         (Incremental_input_entry::do_dynobj_entry): New function.
5450         (Incremental_input_entry::as_needed_): New data member.
5451         (Incremental_object_entry::Incremental_object_entry): Don't check
5452         for shared library.
5453         (Incremental_object_entry::do_type): Likewise.
5454         (class Incremental_dynobj_entry): New class.
5455         (Incremental_input_entry_reader::as_needed): New function.
5456         (Incremental_input_entry_reader::get_soname): New function.
5457         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5458         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5459         size of shared library info entry.
5460         * layout.cc (Layout::finish_dynamic_section): Don't test for
5461         incremental link when adding DT_NEEDED entries.
5462         * object.h (Object::Object): Initialize new data member.
5463         (Object::dynobj): New function.
5464         (Object::set_as_needed): New function.
5465         (Object::as_needed): New function.
5466         (Object::do_dynobj): New function.
5467         (Object::as_needed_): New data member.
5468
5469 2011-05-24 Cary Coutant  <ccoutant@google.com>
5470
5471         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5472         info; adjust display of GOT entries.
5473         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5474         vector of input objects; remove file_status_.
5475         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5476         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5477         got_plt reader; call target hooks to reserve GOT entries.
5478         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5479         of input file info header and GOT info entry.
5480         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5481         relocation info.
5482         (Got_plt_view_info::got_descriptor): Remove.
5483         (Got_plt_view_info::sym_index): New data member.
5484         (Got_plt_view_info::input_index): New data member.
5485         (Local_got_offset_visitor::visit): Write input file index.
5486         (Global_got_offset_visitor::visit): Write 0 for input file index.
5487         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5488         with sym_index and input_index.
5489         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5490         incremental info GOT entry; replace got_descriptor with input_index.
5491         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5492         map from input file index to object.
5493         (Sized_relobj_incr::do_layout): Replace direct data member reference
5494         with accessor function.
5495         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5496         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5497         Adjust size of input file info header.
5498         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5499         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5500         (Incremental_input_entry_reader::get_input_section): Adjust size of
5501         input file info header.
5502         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5503         of incremental info GOT entry.
5504         (Incremental_got_plt_reader::get_got_desc): Remove.
5505         (Incremental_got_plt_reader::get_got_symndx): New function.
5506         (Incremental_got_plt_reader::get_got_input_index): New function.
5507         (Sized_incremental_binary::Sized_incremental_binary): Remove
5508         file_status_; add input_objects_.
5509         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5510         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5511         (Sized_incremental_binary::file_is_unchanged): Remove.
5512         (Sized_incremental_binary::set_input_object): New function.
5513         (Sized_incremental_binary::input_object): New function.
5514         (Sized_incremental_binary::file_status_): Remove.
5515         (Sized_incremental_binary::input_objects_): New data member.
5516         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5517         references.
5518         (Sized_relobj_incr::invalid_address): Move to base class.
5519         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5520         class.
5521         (Sized_relobj_incr::do_output_section_offset): Likewise.
5522         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5523         (Sized_relobj_incr::section_offsets_): Likewise.
5524         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5525         function.
5526         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5527         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5528         with accessor function.
5529         (Sized_relobj_file::do_layout): Likewise.
5530         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5531         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5532         (Sized_relobj_file::compute_final_local_value): Replace refs to
5533         section_offsets_ with accessor function.
5534         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5535         * object.h (Relobj::Relobj): Initialize new data members.
5536         (Relobj::add_dyn_reloc): New function.
5537         (Relobj::first_dyn_reloc): New function.
5538         (Relobj::dyn_reloc_count): New function.
5539         (Relobj::first_dyn_reloc_): New data member.
5540         (Relobj::dyn_reloc_count_): New data member.
5541         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5542         references.
5543         (Sized_relobj::Address): New typedef.
5544         (Sized_relobj::invalid_address): Move here from child class.
5545         (Sized_relobj::Sized_relobj): Initialize new data members.
5546         (Sized_relobj::sized_relobj): New function.
5547         (Sized_relobj::is_output_section_offset_invalid): Move here from
5548         child class.
5549         (Sized_relobj::get_output_section_offset): Likewise.
5550         (Sized_relobj::local_has_got_offset): Likewise.
5551         (Sized_relobj::local_got_offset): Likewise.
5552         (Sized_relobj::set_local_got_offset): Likewise.
5553         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5554         (Sized_relobj::clear_got_offsets): New function.
5555         (Sized_relobj::section_offsets): Move here from child class.
5556         (Sized_relobj::do_output_section_offset): Likewise.
5557         (Sized_relobj::do_set_section_offset): Likewise.
5558         (Sized_relobj::Local_got_offsets): Likewise.
5559         (Sized_relobj::local_got_offsets_): Likewise.
5560         (Sized_relobj::section_offsets_): Likewise.
5561         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5562         references.
5563         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5564         class.
5565         (Sized_relobj_file::sized_relobj): New function
5566         (Sized_relobj_file::local_has_got_offset): Move to base class.
5567         (Sized_relobj_file::local_got_offset): Likewise.
5568         (Sized_relobj_file::set_local_got_offset): Likewise.
5569         (Sized_relobj_file::get_output_section_offset): Likewise.
5570         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5571         (Sized_relobj_file::do_output_section_offset): Likewise.
5572         (Sized_relobj_file::do_set_section_offset): Likewise.
5573         (Sized_relobj_file::Local_got_offsets): Likewise.
5574         (Sized_relobj_file::local_got_offsets_): Likewise.
5575         (Sized_relobj_file::section_offsets_): Likewise.
5576         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5577         (all constructors).
5578         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5579         (Output_reloc::get_symbol_index): Likewise.
5580         (Output_reloc::local_section_offset): Likewise.
5581         (Output_reloc::get_address): Likewise.
5582         (Output_reloc::symbol_value): Likewise.
5583         (Output_data_got::reserve_slot): Move to class definition.
5584         (Output_data_got::reserve_local): New function.
5585         (Output_data_got::reserve_slot_for_global): Remove.
5586         (Output_data_got::reserve_global): New function.
5587         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5588         (all constructors, two instantiations).
5589         (Output_reloc::get_relobj): New function (two instantiations).
5590         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5591         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5592         (Output_data_reloc::add_global): Adjust type of relobj.
5593         (Output_data_reloc::add_global_relative): Likewise.
5594         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5595         (Output_data_reloc::add_local): Likewise.
5596         (Output_data_reloc::add_local_relative): Likewise.
5597         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5598         (Output_data_reloc::add_local_section): Likewise.
5599         (Output_data_reloc::add_output_section): Likewise.
5600         (Output_data_reloc::add_absolute): Likewise.
5601         (Output_data_reloc::add_target_specific): Likewise.
5602         (Output_data_got::reserve_slot): Move definition here.
5603         (Output_data_got::reserve_local): New function.
5604         (Output_data_got::reserve_global): New function.
5605         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5606         section_offsets_ with accessor function.
5607         (Sized_relobj_file::write_sections): Likewise.
5608         (Sized_relobj_file::do_relocate_sections): Likewise.
5609         * target.h (Sized_target::reserve_local_got_entry): New function.
5610         (Sized_target::reserve_global_got_entry): New function.
5611         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5612         (Target_x86_64::reserve_global_got_entry): New function.
5613         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5614
5615 2011-05-23 Cary Coutant  <ccoutant@google.com>
5616
5617         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5618         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5619         bit when checking got_type.
5620         * incremental.cc (Sized_incremental_binary::setup_readers):
5621         Store symbol table and string table locations; initialize bit vector
5622         of file status flags.
5623         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5624         unchanged files.
5625         (Sized_incremental_binary::do_process_got_plt): New function.
5626         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5627         (Output_section_incremental_inputs::set_final_data_size): Record
5628         file index for each input file.
5629         (Output_section_incremental_inputs::write_got_plt): Store file index
5630         instead of input entry offset for each GOT entry.
5631         * incremental.h
5632         (Incremental_input_entry::Incremental_input_entry): Initialize new
5633         data member.
5634         (Incremental_input_entry::set_offset): Store file index.
5635         (Incremental_input_entry::get_file_index): New function.
5636         (Incremental_input_entry::file_index_): New data member.
5637         (Incremental_binary::process_got_plt): New function.
5638         (Incremental_binary::do_process_got_plt): New function.
5639         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5640         data members.
5641         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5642         (Sized_incremental_binary::set_file_is_unchanged): New function.
5643         (Sized_incremental_binary::file_is_unchanged): New function.
5644         (Sized_incremental_binary::do_process_got_plt): New function.
5645         (Sized_incremental_binary::file_status_): New data member.
5646         (Sized_incremental_binary::main_symtab_loc_): New data member.
5647         (Sized_incremental_binary::main_strtab_loc_): New data member.
5648         * output.cc (Output_data_got::Got_entry::write): Add case
5649         RESERVED_CODE.
5650         (Output_data_got::add_global): Call add_got_entry.
5651         (Output_data_got::add_global_plt): Likewise.
5652         (Output_data_got::add_global_with_rel): Likewise.
5653         (Output_data_got::add_global_with_rela): Likewise.
5654         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5655         (Output_data_got::add_global_pair_with_rela): Likewise.
5656         (Output_data_got::add_local): Call add_got_entry.
5657         (Output_data_got::add_local_plt): Likewise.
5658         (Output_data_got::add_local_with_rel): Likewise.
5659         (Output_data_got::add_local_with_rela): Likewise.
5660         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5661         (Output_data_got::add_local_pair_with_rela): Likewise.
5662         (Output_data_got::reserve_slot): New function.
5663         (Output_data_got::reserve_slot_for_global): New function.
5664         (Output_data_got::add_got_entry): New function.
5665         (Output_data_got::add_got_entry_pair): New function.
5666         (Output_section::add_output_section_data): Edit FIXME.
5667         * output.h
5668         (Output_section_data_build::Output_section_data_build): New
5669         constructor with size parameter.
5670         (Output_data_space::Output_data_space): Likewise.
5671         (Output_data_got::Output_data_got): Initialize new data member; new
5672         constructor with size parameter.
5673         (Output_data_got::add_constant): Call add_got_entry.
5674         (Output_data_got::reserve_slot): New function.
5675         (Output_data_got::reserve_slot_for_global): New function.
5676         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5677         (Output_data_got::add_got_entry): New function.
5678         (Output_data_got::add_got_entry_pair): New function.
5679         (Output_data_got::free_list_): New data member.
5680         * target.h (Sized_target::init_got_plt_for_update): New function.
5681         (Sized_target::register_global_plt_entry): New function.
5682         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5683         Initialize new data member; call init; add constructor with PLT count.
5684         (Output_data_plt_x86_64::init): New function.
5685         (Output_data_plt_x86_64::add_relocation): New function.
5686         (Output_data_plt_x86_64::reserve_slot): New function.
5687         (Output_data_plt_x86_64::free_list_): New data member.
5688         (Target_x86_64::init_got_plt_for_update): New function.
5689         (Target_x86_64::register_global_plt_entry): New function.
5690         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5691         incremental updates.
5692         (Output_data_plt_x86_64::add_relocation): New function.
5693         * testsuite/object_unittest.cc (Object_test): Set default options.
5694
5695 2011-05-16  Ian Lance Taylor  <iant@google.com>
5696
5697         * options.h (class General_options): Make -i a synonym for -r.
5698
5699 2011-05-16  Ian Lance Taylor  <iant@google.com>
5700
5701         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5702
5703 2011-05-10 Cary Coutant  <ccoutant@google.com>
5704
5705         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5706         strip_all (-s).
5707
5708 2011-05-06  Ian Lance Taylor  <iant@google.com>
5709
5710         * layout.cc (Layout::layout): If the output section flags change,
5711         update the ordering.
5712
5713 2011-04-25 Cary Coutant  <ccoutant@google.com>
5714
5715         * incremental-dump.cc (dump_incremental_inputs): Print local
5716         symbol info for each input file.
5717         * incremental.cc
5718         (Output_section_incremental_inputs::set_final_data_size): Add local
5719         symbol info to input file entries in incremental info.
5720         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5721         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5722         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5723         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5724         implementation.
5725         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5726         (Sized_incr_relobj::do_relocate): Write the local symbols.
5727         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5728         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5729         Adjust size of input file header.
5730         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5731         (Incremental_inputs_reader::get_local_symbol_count): New function.
5732         (Incremental_inputs_reader::get_input_section): Adjust size of input
5733         file header.
5734         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5735         (Sized_incr_relobj::This): New typedef.
5736         (Sized_incr_relobj::sym_size): New const data member.
5737         (Sized_incr_relobj::Local_symbol): New struct.
5738         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5739         (Sized_incr_relobj::do_local_symbol_offset): New function.
5740         (Sized_incr_relobj::local_symbol_count_): New data member.
5741         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5742         (Sized_incr_relobj::local_symbol_index_): New data member.
5743         (Sized_incr_relobj::local_symbol_offset_): New data member.
5744         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5745         (Sized_incr_relobj::local_symbols_): New data member.
5746         * object.h (Relobj::output_local_symbol_count): New function.
5747         (Relobj::local_symbol_offset): New function.
5748         (Relobj::do_output_local_symbol_count): New function.
5749         (Relobj::do_local_symbol_offset): New function.
5750         (Sized_relobj::do_output_local_symbol_count): New function.
5751         (Sized_relobj::do_local_symbol_offset): New function.
5752
5753 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5754
5755         * descriptors.cc (set_close_on_exec): New function.
5756         (Descriptors::open): Use set_close_on_exec.
5757         * output.cc (S_ISLNK): Define if not defined.
5758
5759 2011-04-22 Cary Coutant  <ccoutant@google.com>
5760
5761         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5762         global symbol map.
5763         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5764         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5765         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5766         relocations.
5767         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5768         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5769         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5770         * incremental.h
5771         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5772         function.
5773         (Incremental_binary::apply_incremental_relocs): New function.
5774         (Incremental_binary::do_apply_incremental_relocs): New function.
5775         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5776         data member.
5777         (Sized_incremental_binary::add_global_symbol): New function.
5778         (Sized_incremental_binary::global_symbol): New function.
5779         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5780         (Sized_incremental_binary::symbol_map_): New data member.
5781         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5782         * target.h (Sized_target::apply_relocation): New function.
5783         * target-reloc.h (apply_relocation): New function.
5784         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5785
5786 2011-04-22  Doug Kwan  <dougkwan@google.com>
5787
5788         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5789         flag of a SHT_ARM_EXIDX section.
5790         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5791         * testsuite/Makefile.in: Regenerate.
5792         * testsuite/arm_exidx_test.s: New file.
5793         * testsuite/arm_exidx_test.sh: Same.
5794
5795 2011-04-20 Cary Coutant  <ccoutant@google.com>
5796
5797         PR gold/12689
5798         * archive.h (Incremental_archive_entry::Archive_member):
5799         Initialize arg_serial_ (second constructor).
5800
5801 2011-04-17  Ian Lance Taylor  <iant@google.com>
5802
5803         * object.cc (Relocate_info::location): Simplify location string.
5804         * errors.cc (Errors::error_at_location): Don't print program
5805         name.
5806         (Errors::warning_at_location): Likewise.
5807         (Errors::undefined_symbol): Likewise.
5808         * testsuite/debug_msg.sh: Update accordingly.
5809
5810 2011-04-14 Cary Coutant  <ccoutant@google.com>
5811
5812         * gold/layout.cc (Layout::symtab_section_offset): New function.
5813         * gold/layout.h (Layout::symtab_section_offset): New function.
5814         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5815
5816 2011-04-12  Ian Lance Taylor  <iant@google.com>
5817
5818         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5819         with MREMAP_MAYMOVE.
5820         * output.h (class Output_file): Add map_is_allocated_ field.
5821         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5822         not available, provide stubs.  If mremap is not available, #define
5823         it to gold_mremap.
5824         (MREMAP_MAYMOVE): Define if not defined.
5825         (Output_file::Output_file): Initialize map_is_allocated_.
5826         (Output_file::resize): Check map_is_allocated_.
5827         (Output_file::map_anonymous): If mmap fails, use malloc.
5828         (Output_file::unmap): Don't do anything for an anonymous map.
5829         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5830         is not available, provide stubs.
5831         (File_read::View::~View): Use free rather than delete[].
5832         (File_read::make_view): Use malloc rather than new[].  If mmap
5833         fails, use malloc.
5834         (File_read::find_or_make_view): Use malloc rather than new[].
5835         * gold.h: Remove HAVE_REMAP code.
5836         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5837         exists.  Rename mremap to gold_mremap.  If mmap is not available
5838         don't do anything.
5839         * configure, config.in: Rebuild.
5840
5841 2011-04-11  Ian Lance Taylor  <iant@google.com>
5842
5843         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5844         initialize local variable v.
5845
5846 2011-04-11  Cary Coutant  <ccoutant@google.com>
5847
5848         * archive.cc (Archive::include_member): Adjust call to
5849         report_object.
5850         (Add_archive_symbols::run): Track argument serial numbers.
5851         (Lib_group::include_member): Likewise.
5852         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5853         * archive.h (Incremental_archive_entry::Archive_member):
5854         Initialize arg_serial_.
5855         (Archive_member::arg_serial_): New data member.
5856         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5857         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5858         incremental link.
5859         (Sized_dynobj::do_for_all_local_got_entries): New function.
5860         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5861         function.
5862         * fileread.cc (get_mtime): New function.
5863         * fileread.h (get_mtime): New function.
5864         * gold.cc (queue_initial_tasks): Check for incremental update.
5865         (process_incremental_input): New function.
5866         (queue_middle_tasks): Don't force valid target for incremental
5867         update.
5868         * incremental-dump.cc (find_input_containing_global): Adjust
5869         size of symbol info entry.
5870         (dump_incremental_inputs): Dump argument serial number and
5871         in_system_directory flag; bias shndx by 1; print symbol names
5872         when dumping per-file symbol lists; use new symbol info readers.
5873         * incremental.cc
5874         (Output_section_incremental_inputs:update_data_size): New function.
5875         (Sized_incremental_binary::setup_readers): Setup input readers
5876         for each input file; build maps for files added from libraries
5877         and scripts.
5878         (Sized_incremental_binary::check_input_args): New function.
5879         (Sized_incremental_binary::do_check_inputs): Build map of argument
5880         serial numbers to input arguments.
5881         (Sized_incremental_binary::do_file_has_changed): Rename
5882         do_file_is_unchanged to this; compare file modification times.
5883         (Sized_incremental_binary::do_init_layout): New function.
5884         (Sized_incremental_binary::do_reserve_layout): New function.
5885         (Sized_incremental_binary::do_get_input_reader): Remove.
5886         (Sized_incremental_binary::get_symtab_view): New function.
5887         (Incremental_checker::can_incrementally_link_output_file): Remove.
5888         (Incremental_inputs::report_command_line): Exclude --debug options.
5889         (Incremental_inputs::report_archive_begin): Add parameter; track
5890         argument serial numbers; don't put input file entry for archive
5891         before archive members.
5892         (Incremental_inputs::report_archive_end): Put input file entry
5893         for archive after archive members.
5894         (Incremental_inputs::report_object): Add parameter; track argument
5895         serial numbers and in_system_directory flag.
5896         (Incremental_inputs::report_script): Add parameter; track argument
5897         serial numbers.
5898         (Output_section_incremental_inputs::set_final_data_size): Adjust
5899         size of symbol info entry; check for forwarding symbols.
5900         (Output_section_incremental_inputs::write_input_files): Write
5901         in_system_directory flag and argument serial number.
5902         (Output_section_incremental_inputs::write_info_blocks): Map section
5903         indices between incremental info and original input file; store
5904         input section index for each symbol.
5905         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5906         change operator() to visit().
5907         (class Global_got_offset_visitor): Likewise.
5908         (class Global_symbol_visitor_got_plt):
5909         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5910         classes.
5911         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5912         (Sized_incr_relobj::do_read_symbols): New function.
5913         (Sized_incr_relobj::do_layout): New function.
5914         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5915         (Sized_incr_relobj::do_add_symbols): New function.
5916         (Sized_incr_relobj::do_should_include_member): New function.
5917         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5918         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5919         (Sized_incr_relobj::do_section_size): New function.
5920         (Sized_incr_relobj::do_section_name): New function.
5921         (Sized_incr_relobj::do_section_contents): New function.
5922         (Sized_incr_relobj::do_section_flags): New function.
5923         (Sized_incr_relobj::do_section_entsize): New function.
5924         (Sized_incr_relobj::do_section_address): New function.
5925         (Sized_incr_relobj::do_section_type): New function.
5926         (Sized_incr_relobj::do_section_link): New function.
5927         (Sized_incr_relobj::do_section_info): New function.
5928         (Sized_incr_relobj::do_section_addralign): New function.
5929         (Sized_incr_relobj::do_initialize_xindex): New function.
5930         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5931         (Sized_incr_relobj::do_read_relocs): New function.
5932         (Sized_incr_relobj::do_gc_process_relocs): New function.
5933         (Sized_incr_relobj::do_scan_relocs): New function.
5934         (Sized_incr_relobj::do_count_local_symbols): New function.
5935         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5936         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5937         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5938         (Sized_incr_relobj::do_relocate): New function.
5939         (Sized_incr_relobj::do_set_section_offset): New function.
5940         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5941         (Sized_incr_dynobj::do_read_symbols): New function.
5942         (Sized_incr_dynobj::do_layout): New function.
5943         (Sized_incr_dynobj::do_add_symbols): New function.
5944         (Sized_incr_dynobj::do_should_include_member): New function.
5945         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5946         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5947         (Sized_incr_dynobj::do_section_size): New function.
5948         (Sized_incr_dynobj::do_section_name): New function.
5949         (Sized_incr_dynobj::do_section_contents): New function.
5950         (Sized_incr_dynobj::do_section_flags): New function.
5951         (Sized_incr_dynobj::do_section_entsize): New function.
5952         (Sized_incr_dynobj::do_section_address): New function.
5953         (Sized_incr_dynobj::do_section_type): New function.
5954         (Sized_incr_dynobj::do_section_link): New function.
5955         (Sized_incr_dynobj::do_section_info): New function.
5956         (Sized_incr_dynobj::do_section_addralign): New function.
5957         (Sized_incr_dynobj::do_initialize_xindex): New function.
5958         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5959         (make_sized_incremental_object): New function.
5960         (Incremental_library::copy_unused_symbols): New function.
5961         (Incremental_library::do_for_all_unused_symbols): New function.
5962         * incremental.h (enum Incremental_input_flags): New type.
5963         (class Incremental_checker): Remove.
5964         (Incremental_input_entry::Incremental_input_entry): Add argument
5965         serial number.
5966         (Incremental_input_entry::arg_serial): New function.
5967         (Incremental_input_entry::set_is_in_system_directory): New function.
5968         (Incremental_input_entry::is_in_system_directory): New function.
5969         (Incremental_input_entry::arg_serial_): New data member.
5970         (Incremental_input_entry::is_in_system_directory_): New data member.
5971         (class Script_info): Move here from script.h.
5972         (Script_info::Script_info): Add filename parameter.
5973         (Script_info::filename): New function.
5974         (Script_info::filename_): New data member.
5975         (Incremental_script_entry::Incremental_script_entry): Add argument
5976         serial number.
5977         (Incremental_object_entry::Incremental_object_entry): Likewise.
5978         (Incremental_object_entry::add_input_section): Build list of input
5979         sections with map to original shndx.
5980         (Incremental_object_entry::get_input_section_index): New function.
5981         (Incremental_object_entry::shndx_): New data member.
5982         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5983         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5984         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5985         serial number.
5986         (Incremental_inputs::report_archive_begin): Likewise.
5987         (Incremental_inputs::report_object): Likewise.
5988         (Incremental_inputs::report_script): Likewise.
5989         (class Incremental_global_symbol_reader): New class.
5990         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5991         and store flags and input file type.
5992         (Incremental_input_entry_reader::arg_serial): New function.
5993         (Incremental_input_entry_reader::type): Extract type from flags.
5994         (Incremental_input_entry_reader::is_in_system_directory): New function.
5995         (Incremental_input_entry_reader::get_input_section_count): Call
5996         accessor function for type.
5997         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5998         function for type; adjust size of global symbol entry.
5999         (Incremental_input_entry_reader::get_global_symbol_count): Call
6000         accessor function for type.
6001         (Incremental_input_entry_reader::get_object_count): Likewise.
6002         (Incremental_input_entry_reader::get_object_offset): Likewise.
6003         (Incremental_input_entry_reader::get_member_count): Likewise.
6004         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
6005         (Incremental_input_entry_reader::get_member_offset): Likewise.
6006         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
6007         (Incremental_input_entry_reader::Global_symbol_info): Remove.
6008         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
6009         (Incremental_input_entry_reader::get_global_symbol_reader): New
6010         function.
6011         (Incremental_input_entry_reader::get_output_symbol_index): New
6012         function.
6013         (Incremental_input_entry_reader::type_): Remove.
6014         (Incremental_input_entry_reader::flags_): New data member.
6015         (Incremental_inputs_reader::input_file_offset): New function.
6016         (Incremental_inputs_reader::input_file_index): New function.
6017         (Incremental_inputs_reader::input_file): Call input_file_offset.
6018         (Incremental_inputs_reader::input_file_at_offset): New function.
6019         (Incremental_relocs_reader::get_r_type): Reformat.
6020         (Incremental_relocs_reader::get_r_shndx): Reformat.
6021         (Incremental_relocs_reader::get_r_offset): Reformat.
6022         (Incremental_relocs_reader::data): New function.
6023         (Incremental_binary::Incremental_binary): Initialize new data members.
6024         (Incremental_binary::check_inputs): Add cmdline parameter.
6025         (Incremental_binary::file_is_unchanged): Remove.
6026         (Input_reader::arg_serial): New function.
6027         (Input_reader::get_unused_symbol_count): New function.
6028         (Input_reader::get_unused_symbol): New function.
6029         (Input_reader::do_arg_serial): New function.
6030         (Input_reader::do_get_unused_symbol_count): New function.
6031         (Input_reader::do_get_unused_symbol): New function.
6032         (Incremental_binary::input_file_count): New function.
6033         (Incremental_binary::get_input_reader): Change signature to use
6034         index instead of filename.
6035         (Incremental_binary::file_has_changed): New function.
6036         (Incremental_binary::get_input_argument): New function.
6037         (Incremental_binary::get_library): New function.
6038         (Incremental_binary::get_script_info): New function.
6039         (Incremental_binary::init_layout): New function.
6040         (Incremental_binary::reserve_layout): New function.
6041         (Incremental_binary::output_file): New function.
6042         (Incremental_binary::do_check_inputs): New function.
6043         (Incremental_binary::do_file_is_unchanged): Remove.
6044         (Incremental_binary::do_file_has_changed): New function.
6045         (Incremental_binary::do_init_layout): New function.
6046         (Incremental_binary::do_reserve_layout): New function.
6047         (Incremental_binary::do_input_file_count): New function.
6048         (Incremental_binary::do_get_input_reader): Change signature.
6049         (Incremental_binary::input_args_map_): New data member.
6050         (Incremental_binary::library_map_): New data member.
6051         (Incremental_binary::script_map_): New data member.
6052         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6053         new data members.
6054         (Sized_incremental_binary::output_section): New function.
6055         (Sized_incremental_binary::inputs_reader): Add const.
6056         (Sized_incremental_binary::symtab_reader): Add const.
6057         (Sized_incremental_binary::relocs_reader): Add const.
6058         (Sized_incremental_binary::got_plt_reader): Add const.
6059         (Sized_incremental_binary::get_symtab_view): New function.
6060         (Sized_incremental_binary::Inputs_reader): New typedef.
6061         (Sized_incremental_binary::Input_entry_reader): New typedef.
6062         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6063         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6064         (Sized_incremental_binary::do_file_has_changed): New function.
6065         (Sized_incremental_binary::do_init_layout): New function.
6066         (Sized_incremental_binary::do_reserve_layout): New function.
6067         (Sized_input_reader::Inputs_reader): Remove.
6068         (Sized_input_reader::Input_entry_reader): Remove.
6069         (Sized_input_reader::do_arg_serial): New function.
6070         (Sized_input_reader::do_get_unused_symbol_count): New function.
6071         (Sized_input_reader::do_get_unused_symbol): New function.
6072         (Sized_incremental_binary::do_input_file_count): New function.
6073         (Sized_incremental_binary::do_get_input_reader): Change signature;
6074         use index instead of filename.
6075         (Sized_incremental_binary::section_map_): New data member.
6076         (Sized_incremental_binary::input_entry_readers_): New data member.
6077         (class Sized_incr_relobj): New class.
6078         (class Sized_incr_dynobj): New class.
6079         (make_sized_incremental_object): New function.
6080         (class Incremental_library): New class.
6081         * layout.cc (Free_list::num_lists): New static data member.
6082         (Free_list::num_nodes): New static data member.
6083         (Free_list::num_removes): New static data member.
6084         (Free_list::num_remove_visits): New static data member.
6085         (Free_list::num_allocates): New static data member.
6086         (Free_list::num_allocate_visits): New static data member.
6087         (Free_list::init): New function.
6088         (Free_list::remove): New function.
6089         (Free_list::allocate): New function.
6090         (Free_list::dump): New function.
6091         (Free_list::print_stats): New function.
6092         (Layout_task_runner::run): Resize output file for incremental updates.
6093         (Layout::Layout): Initialize new data members.
6094         (Layout::set_incremental_base): New function.
6095         (Layout::init_fixed_output_section): New function.
6096         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6097         incremental updates.
6098         (Layout::create_gold_note): Do not create gold note section for
6099         incremental updates.
6100         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6101         for incremental updates.
6102         (Layout::set_section_offsets): For incremental updates, allocate space
6103         from free list.
6104         (Layout::create_symtab_sections): Layout with offsets relative to
6105         start of section; for incremental updates, allocate space from free
6106         list.
6107         (Layout::create_shdrs): For incremental updates, allocate space from
6108         free list.
6109         (Layout::finish_dynamic_section): For incremental updates, do not
6110         check --as-needed (fixed in subsequent patch).
6111         * layout.h (class Free_list): New class.
6112         (Layout::set_incremental_base): New function.
6113         (Layout::incremental_base): New function.
6114         (Layout::init_fixed_output_section): New function.
6115         (Layout::allocate): New function.
6116         (Layout::incremental_base_): New data member.
6117         (Layout::free_list_): New data member.
6118         * main.cc (main): Print Free_list statistics.
6119         * object.cc (Relobj::finalize_incremental_relocs): Add
6120         clear_counts parameter; clear counts only when clear_counts is set.
6121         (Sized_relobj::Sized_relobj): Initialize new base class.
6122         (Sized_relobj::do_layout): Don't report special sections.
6123         (Sized_relobj::do_for_all_local_got_entries): New function.
6124         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6125         symtab_off to all symbol table offsets.
6126         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6127         * object.h (class Got_offset_list): Move to top of file.
6128         (Object::Object): Allow case where input_file == NULL.
6129         (Object::~Object): Likewise.
6130         (Object::input_file): Assert that input_file != NULL.
6131         (Object::lock): Allow case where input_file == NULL.
6132         (Object::unlock): Likewise.
6133         (Object::is_locked): Likewise.
6134         (Object::token): Likewise.
6135         (Object::release): Likewise.
6136         (Object::is_incremental): New function.
6137         (Object::get_mtime): New function.
6138         (Object::for_all_local_got_entries): New function.
6139         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6140         (Object::set_is_in_system_directory): New function.
6141         (Object::is_in_system_directory): New function.
6142         (Object::do_is_incremental): New function.
6143         (Object::do_get_mtime): New function.
6144         (Object::do_for_all_local_got_entries): New function.
6145         (Object::is_in_system_directory_): New data member.
6146         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6147         (class Sized_relobj_base): New class.
6148         (class Sized_relobj): Derive from Sized_relobj_base.
6149         (class Sized_relobj::Symbols): Redeclare from base class.
6150         (class Sized_relobj::local_got_offset_list): Remove.
6151         (class Sized_relobj::Output_sections): Redeclare from base class.
6152         (class Sized_relobj::do_for_all_local_got_entries): New function.
6153         (class Sized_relobj::write_local_symbols): Add offset parameter.
6154         (class Sized_relobj::local_symbol_offset_): Update comment.
6155         (class Sized_relobj::local_dynsym_offset_): Update comment.
6156         * options.cc (Input_arguments::add_file): Remove const.
6157         * options.h (Input_file_argument::Input_file_argument):
6158         Initialize arg_serial_ (all constructors).
6159         (Input_file_argument::set_arg_serial): New function.
6160         (Input_file_argument::arg_serial): New function.
6161         (Input_file_argument::arg_serial_): New data member.
6162         (Input_arguments::Input_arguments): Initialize file_count_.
6163         (Input_arguments::add_file): Remove const.
6164         (Input_arguments::number_of_input_files): New function.
6165         (Input_arguments::file_count_): New data member.
6166         (Command_line::number_of_input_files): Call
6167         Input_arguments::number_of_input_files.
6168         * output.cc (Output_segment_headers::Output_segment_headers):
6169         Set current size.
6170         (Output_section::Input_section::current_data_size): New function.
6171         (Output_section::Output_section): Initialize new data members.
6172         (Output_section::add_input_section): Don't do merge sections for
6173         an incremental link; allocate space from free list for an
6174         incremental update.
6175         (Output_section::add_output_section_data): Allocate space from
6176         free list for an incremental update.
6177         (Output_section::update_data_size): New function.
6178         (Output_section::set_fixed_layout): New function.
6179         (Output_section::reserve): New function.
6180         (Output_segment::set_section_addresses): Remove const.
6181         (Output_segment::set_section_list_addresses): Remove const; allocate
6182         space from free list for an incremental update.
6183         (Output_segment::set_offset): Adjust size of RELRO segment for an
6184         incremental update.
6185         * output.h (Output_data::current_data_size): Move here from
6186         child classes.
6187         (Output_data::pre_finalize_data_size): New function.
6188         (Output_data::update_data_size): New function.
6189         (Output_section_headers::update_data_size): new function.
6190         (Output_section_data_build::current_data_size): Move to Output_data.
6191         (Output_data_strtab::update_data_size): New function.
6192         (Output_section::current_data_size): Move to Output_data.
6193         (Output_section::set_fixed_layout): New function.
6194         (Output_section::has_fixed_layout): New function.
6195         (Output_section::reserve): New function.
6196         (Output_section::update_data_size): New function.
6197         (Output_section::has_fixed_layout_): New data member.
6198         (Output_section::free_list_): New data member.
6199         (Output_segment::set_section_addresses): Remove const.
6200         (Output_segment::set_section_list_addresses): Remove const.
6201         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6202         New function.
6203         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6204         New function.
6205         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6206         parameter when calling Add_symbols constructor; store argument
6207         serial number for members of a lib group.
6208         (Add_symbols::locks): Allow case where token == NULL.
6209         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6210         (Read_member::~Read_member): New function.
6211         (Read_member::is_runnable): New function.
6212         (Read_member::locks): New function.
6213         (Read_member::run): New function.
6214         (Check_script::~Check_script): New function.
6215         (Check_script::is_runnable): New function.
6216         (Check_script::locks): New function.
6217         (Check_script::run): New function.
6218         (Check_library::~Check_library): New function.
6219         (Check_library::is_runnable): New function.
6220         (Check_library::locks): New function.
6221         (Check_library::run): New function.
6222         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6223         (Add_symbols::library_): New data member.
6224         (class Read_member): New class.
6225         (class Check_script): New class.
6226         (class Check_library): New class.
6227         * reloc.cc (Read_relocs::is_runnable): Allow case where
6228         token == NULL.
6229         (Read_relocs::locks): Likewise.
6230         (Scan_relocs::locks): Likewise.
6231         (Relocate_task::locks): Likewise.
6232         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6233         to clear counters.
6234         (Sized_relobj::incremental_relocs_scan): Fix comment.
6235         (Sized_relobj::do_relocate): Pass output file offset to
6236         write_local_symbols.
6237         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6238         from class declaration.
6239         * script.cc (read_input_script): Allocate Script_info; pass
6240         argument serial number to report_script.
6241         * script.h (class Script_info): Move to incremental.h.
6242         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6243         * symtab.h (Symbol_table::add_from_incrobj): New function.
6244         (Symbol_table::set_file_offset): New function.
6245
6246 2011-04-05  Cary Coutant  <ccoutant@google.com>
6247
6248         * incremental-dump.cc (dump_incremental_inputs): Change signature
6249         to take a Sized_incremental_binary; change caller.  Use readers
6250         in Sized_incremental_binary.
6251         * incremental.cc
6252         (Sized_incremental_binary::find_incremental_inputs_sections):
6253         Rename do_find_incremental_inputs_sections to this.
6254         (Sized_incremental_binary::setup_readers): New function.
6255         (Sized_incremental_binary::do_check_inputs): Check
6256         has_incremental_info_ flag; move setup code to setup_readers;
6257         use input readers.
6258         (Sized_incremental_binary::do_file_is_unchanged): New function.
6259         (Sized_incremental_binary::do_get_input_reader): New function.
6260         * incremental.h (class Incremental_binary): Move to end of file.
6261         (Incremental_binary::file_is_unchanged): New function.
6262         (Incremental_binary::do_file_is_unchanged): New function.
6263         (Incremental_binary::Input_reader): New class.
6264         (Incremental_binary::get_input_reader): New function.
6265         (class Sized_incremental_binary): Move to end of file.
6266         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6267         input section reader classes.
6268         (Sized_incremental_binary::has_incremental_info): New function.
6269         (Sized_incremental_binary::inputs_reader): New function.
6270         (Sized_incremental_binary::symtab_reader): New function.
6271         (Sized_incremental_binary::relocs_reader): New function.
6272         (Sized_incremental_binary::got_plt_reader): New function.
6273         (Sized_incremental_binary::do_file_is_unchanged): New function.
6274         (Sized_incremental_binary::Sized_input_reader): New class.
6275         (Sized_incremental_binary::get_input_reader): New function.
6276         (Sized_incremental_binary::find_incremental_inputs_sections):
6277         Rename do_find_incremental_inputs_sections to this.
6278         (Sized_incremental_binary::setup_readers): New function.
6279         (Sized_incremental_binary::has_incremental_info_): New data member.
6280         (Sized_incremental_binary::inputs_reader_): New data member.
6281         (Sized_incremental_binary::symtab_reader_): New data member.
6282         (Sized_incremental_binary::relocs_reader_): New data member.
6283         (Sized_incremental_binary::got_plt_reader_): New data member.
6284         (Sized_incremental_binary::current_input_file_): New data member.
6285
6286 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6287
6288         PR gold/12640
6289         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6290         violation.
6291
6292 2011-03-30  Cary Coutant  <ccoutant@google.com>
6293
6294         * archive.cc (Archive::include_member): Adjust call to report_object.
6295         (Add_archive_symbols::run): Add script_info to call to
6296         report_archive_begin.
6297         (Lib_group::include_member): Adjust call to report_object.
6298         (Add_lib_group_symbols::run): Adjust call to report_object.
6299         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6300         blocks.  Add object count for script input files.
6301         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6302         script_info parameter; change all callers.
6303         (Incremental_inputs::report_object): Add script_info parameter;
6304         change all callers.
6305         (Incremental_inputs::report_script): Store backpointer to
6306         incremental info entry.
6307         (Output_section_incremental_inputs::set_final_data_size): Record
6308         additional information for scripts.
6309         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6310         * incremental.h (Incremental_script_entry::add_object): New function.
6311         (Incremental_script_entry::get_object_count): New function.
6312         (Incremental_script_entry::get_object): New function.
6313         (Incremental_script_entry::objects_): New data member; adjust
6314         constructor.
6315         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6316         (Incremental_inputs::report_object): Add script_info parameter.
6317         (Incremental_inputs_reader::get_object_count): New function.
6318         (Incremental_inputs_reader::get_object_offset): New function.
6319         * options.cc (Input_arguments::add_file): Return reference to
6320         new input argument.
6321         * options.h (Input_argument::set_script_info): New function.
6322         (Input_argument::script_info): New function.
6323         (Input_argument::script_info_): New data member; adjust all
6324         constructors.
6325         (Input_file_group::add_file): Return reference to new input argument.
6326         (Input_file_lib::add_file): Likewise.
6327         (Input_arguments::add_file): Likewise.
6328         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6329         * script.cc (Parser_closure::Parser_closure): Add script_info
6330         parameter; adjust all callers.
6331         (Parser_closure::script_info): New function.
6332         (Parser_closure::script_info_): New data member.
6333         (read_input_script): Report scripts earlier to incremental info.
6334         (script_add_file): Set script_info in Input_argument.
6335         (script_add_library): Likewise.
6336         * script.h (Script_options::Script_info): Rewrite class.
6337
6338 2011-03-29  Cary Coutant  <ccoutant@google.com>
6339
6340         * archive.cc (Library_base::should_include_member): Move
6341         method here from class Archive.
6342         (Archive::Archive): Initialize base class.
6343         (Archive::should_include_member): Move to base class.
6344         (Archive::do_for_all_unused_symbols): New function.
6345         (Add_archive_symbols::run): Remove redundant access to
6346         incremental_inputs.
6347         (Lib_group::Lib_group): Initialize base class.
6348         (Lib_group::do_filename): New function.
6349         (Lib_group::include_member): Pass pointer to Lib_group to
6350         report_object.
6351         (Lib_group::do_for_all_unused_symbols): New function.
6352         (Add_lib_group_symbols::run): Report archive information for
6353         incremental links.
6354         * archive.h (class Library_base): New base class.
6355         (class Archive): Derive from Library_base.
6356         (Archive::filename): Move to base class.
6357         (Archive::set_incremental_info): Likewise.
6358         (Archive::incremental_info): Likewise.
6359         (Archive::Should_include): Likewise.
6360         (Archive::should_include_member): Likewise.
6361         (Archive::Armap_entry): Remove.
6362         (Archive::Unused_symbol_iterator): Remove.
6363         (Archive::unused_symbols_begin): Remove.
6364         (Archive::unused_symbols_end): Remove.
6365         (Archive::do_filename): New function.
6366         (Archive::do_get_mtime): New function.
6367         (Archive::do_for_all_unused_symbols): New function.
6368         (Archive::task_): Move to base class.
6369         (Archive::incremental_info_): Likewise.
6370         (class Lib_group): Derive from Library_base.
6371         (Lib_group::do_filename): New function.
6372         (Lib_group::do_get_mtime): New function.
6373         (Lib_group::do_for_all_unused_symbols): New function.
6374         (Lib_group::task_): Move to base class.
6375         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6376         function.
6377         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6378         function.
6379         * incremental.cc (Incremental_inputs::report_archive_begin):
6380         Use Library_base; call library's get_mtime; add incremental inputs
6381         entry before members.
6382         (class Unused_symbol_visitor): New class.
6383         (Incremental_inputs::report_archive_end): Use Library_base; use
6384         visitor class to record unused symbols; don't add incremental inputs
6385         entry after members.
6386         (Incremental_inputs::report_object): Use Library_base.
6387         * incremental.h
6388         (Incremental_archive_entry::Incremental_archive_entry): Remove
6389         unused Archive parameter.
6390         (Incremental_inputs::report_archive_begin): Use Library_base.
6391         (Incremental_inputs::report_archive_end): Likewise.
6392         (Incremental_inputs::report_object): Likewise.
6393         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6394         function.
6395         * object.h (Object::for_all_global_symbols): New function.
6396         (Object::do_for_all_global_symbols): New function.
6397         (Sized_relobj::do_for_all_global_symbols): New function.
6398         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6399         function.
6400         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6401         function.
6402
6403 2011-03-27  Ian Lance Taylor  <iant@google.com>
6404
6405         * archive.cc (Archive::interpret_header): Return -1 if something
6406         goes wrong.  Change callers accordingly.
6407
6408 2011-03-25  Cary Coutant  <ccoutant@google.com>
6409
6410         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6411         * testsuite/Makefile.in: Regenerate.
6412
6413 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6414
6415         * plugin.cc (get_view): New.
6416         (Plugin::load): Pass get_view to the plugin.
6417         (Plugin_manager::get_view): New.
6418
6419 2011-03-21  Ian Lance Taylor  <iant@google.com>
6420
6421         * testsuite/final_layout.sh: Rewrite to not use dc.
6422         * testsuite/relro_test.sh: Fail if dc is not present.
6423
6424 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6425
6426         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6427         Change == to -eq.
6428         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6429         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6430         Change == to -eq.
6431         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6432         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6433
6434 2011-03-14  Ian Lance Taylor  <iant@google.com>
6435
6436         * script-sections.cc (Sort_output_sections::script_compare):
6437         Rename from is_before, change return type.
6438         (Sort_output_sections::operator()): Adjust accordingly.
6439
6440 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6441
6442         PR gold/12572
6443         * testsuite/odr_violation2.cc: Add comment to make all error line
6444         numbers double digits.
6445         * testsuite/debug_msg.sh: Adjust expected errors.
6446
6447 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6448
6449         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6450         but mark earlier ones as non-canonical
6451         (offset_to_iterator): Update search target and example
6452         (do_addr2line): Return extra lines in a vector*
6453         (format_file_lineno): Extract from do_addr2line
6454         (one_addr2line): Add vector* out-param
6455         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6456         when a lineno entry appeared last for its instruction
6457         (Dwarf_line_info): Add vector* out-param
6458         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6459         * symtab.cc (Odr_violation_compare): Include the lineno in the
6460         comparison again.
6461         (linenos_from_loc): New. Combine the canonical line for an
6462         address with its other lines.
6463         (True_if_intersect): New. Helper functor to make
6464         std::set_intersection a query.
6465         (detect_odr_violations): Compare sets of lines instead of just
6466         one line for each function. This became less deterministic, but
6467         has fewer false positives.
6468         * symtab.h: Declarations.
6469         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6470         mix an optimized and non-optimized object in the same binary
6471         (odr_violation2.so): Same.
6472         * testsuite/Makefile.in: Regenerate from Makefile.am.
6473         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6474         * testsuite/debug_msg.sh: Update line numbers and add
6475         assertions.
6476         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6477         non-optimized context.
6478         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6479         isn't inlined, and use OdrDerived in an optimized context.
6480         * testsuite/odr_header1.h: Defines OdrDerived, where
6481         optimization will change the
6482         first-instruction-in-the-destructor's file and line number.
6483         * testsuite/odr_header2.h: Defines OdrBase.
6484
6485 2011-03-09  Ian Lance Taylor  <iant@google.com>
6486
6487         * fileread.cc (File_read::clear_views): Don't delete the whole
6488         file view.
6489
6490 2011-03-08  Ian Lance Taylor  <iant@google.com>
6491
6492         PR gold/12525
6493         * fileread.cc: #include <climits>.
6494         (GOLD_IOV_MAX): Define.
6495         (File_read::read_multiple): Limit number of entries by iov_max.
6496         * fileread.h (class File_read): Always set max_readv_entries to
6497         128.
6498
6499 2011-03-07  Ian Lance Taylor  <iant@google.com>
6500
6501         PR gold/12525
6502         * options.h (class General_options): Add -dy and -dn.
6503
6504 2011-03-02  Cary Coutant  <ccoutant@google.com>
6505
6506         * testsuite/script_test_9.t: Add TLS segment.
6507
6508 2011-03-02  Simon Baldwin  <simonb@google.com>
6509
6510         * configure.ac: Add check for gnu_indirect_function support in
6511         the toolchain building binutils.
6512         * configure: Rebuild.
6513
6514 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6515
6516         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6517         plugin only symbols.
6518         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6519         in plugin files as not needed in the symbol table.
6520
6521 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6522
6523         * output.cc (Output_section::add_input_section): Delay fill
6524         generation for section ordering.
6525
6526 2011-02-09  Ian Lance Taylor  <iant@google.com>
6527
6528         PR gold/12316
6529         * object.h (class Sized_relobj): Remove clear_local_symbols.
6530         * reloc.cc (Sized_relobj::do_relocate): Don't call
6531         clear_local_symbols.
6532
6533 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6534
6535         * plugin.cc (is_visible_from_outside): Return true for symbols
6536         in the -u option.
6537
6538 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6539
6540         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6541         filename.
6542
6543 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6544
6545         * icf.h (is_section_foldable_candidate): Change type of parameter
6546         to std::string.
6547         * icf.cc (Icf::find_identical_sections): Change type of local variable
6548         section_name to be std::string.
6549         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6550
6551 2011-01-25  Ian Lance Taylor  <iant@google.com>
6552
6553         * script.cc (script_add_extern): Rewrite to use
6554         add_symbol_reference.
6555
6556 2011-01-25  Doug Kwan  <dougkwan@google.com>
6557
6558         * icf.cc (get_section_contents): Always lock section's object.
6559
6560 2011-01-24  Ian Lance Taylor  <iant@google.com>
6561
6562         * options.h (class General_options): Accept
6563         --no-detect-odr-violations.
6564
6565 2011-01-24  Ian Lance Taylor  <iant@google.com>
6566
6567         * version.cc (version_string): Bump to 1.11.
6568
6569 2011-01-24  Ian Lance Taylor  <iant@google.com>
6570
6571         * plugin.cc (class Plugin_rescan): Define new class.
6572         (Plugin_manager::claim_file): Set any_claimed_.
6573         (Plugin_manager::save_archive): New function.
6574         (Plugin_manager::save_input_group): New function.
6575         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6576         necessary.
6577         (Plugin_manager::new_undefined_symbol): New function.
6578         (Plugin_manager::rescan): New function.
6579         (Plugin_manager::rescannable_defines): New function.
6580         (Plugin_manager::add_input_file): Set any_added_.
6581         * plugin.h (class Plugin_manager): define new fields rescannable_,
6582         undefined_symbols_, any_claimed_, and any_added_.  Declare
6583         Plugin_rescan as friend.  Declare new functions.
6584         (Plugin_manager::Rescannable): Define type.
6585         (Plugin_manager::Rescannable_list): Define type.
6586         (Plugin_manager::Undefined_symbol_list): Define type.
6587         (Plugin_manager::Plugin_manager): Initialize new fields.
6588         * archive.cc (Archive::defines_symbol): New function.
6589         (Add_archive_symbols::run): Pass archive to plugins if any.
6590         * archive.h (class Archive): Declare defines_symbol.
6591         * readsyms.cc (Input_group::~Input_group): New function.
6592         (Finish_group::run): Pass input_group to plugins if any.
6593         * readsyms.h (class Input_group): Declare destructor.
6594         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6595         any.
6596
6597 2011-01-10  Ian Lance Taylor  <iant@google.com>
6598
6599         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6600         section as relro.
6601         (Layout::set_segment_offsets): Reset increase_relro before calling
6602         set_section_addresses a second time.
6603
6604 2011-01-04  Cary Coutant  <ccoutant@google.com>
6605
6606         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6607         sections before NOBITS sections.
6608
6609 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6610
6611         * version.cc (print_version): Update copyright to 2011.
6612
6613 2010-12-23  Cary Coutant  <ccoutant@google.com>
6614
6615         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6616         of OS to this->add.  Add OD parameter to second form of the function.
6617
6618 2010-12-20  Ian Lance Taylor  <iant@google.com>
6619
6620         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6621         second of two consecutive entries with same offset.
6622
6623 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6624
6625         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6626         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6627         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6628         to avoid unneeded links against $(LDADD).
6629         * testsuite/Makefile.in: Regenerate.
6630
6631 2010-12-15  Ian Lance Taylor  <iant@google.com>
6632
6633         PR gold/12324
6634         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6635         for R_X86_64_32 and R_X86_64_PC32.
6636         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6637         ver_matching_def_pic.o.
6638         (ver_matching_def_pic.o): New target.
6639
6640 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6641
6642         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6643         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6644         Move definition before File_read::View member definitions.
6645         (File_read::View::~View): Initialize and hold lock before
6646         updating current_mapped_bytes.
6647
6648 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6649
6650         * dwarf_reader.cc: Remove outdated comment.
6651         * gold-threads.cc: Fix typo in error message.
6652         * archive.cc: Fix typos in comments.
6653         * archive.h: Likewise.
6654         * arm-reloc-property.cc: Likewise.
6655         * arm-reloc-property.h: Likewise.
6656         * arm-reloc.def: Likewise.
6657         * arm.cc: Likewise.
6658         * attributes.h: Likewise.
6659         * cref.cc: Likewise.
6660         * ehframe.cc: Likewise.
6661         * fileread.h: Likewise.
6662         * gold.h: Likewise.
6663         * i386.cc: Likewise.
6664         * icf.cc: Likewise.
6665         * incremental.h: Likewise.
6666         * int_encoding.cc: Likewise.
6667         * layout.h: Likewise.
6668         * main.cc: Likewise.
6669         * merge.h: Likewise.
6670         * object.cc: Likewise.
6671         * object.h: Likewise.
6672         * options.cc: Likewise.
6673         * readsyms.cc: Likewise.
6674         * reduced_debug_output.cc: Likewise.
6675         * reloc.cc: Likewise.
6676         * script-sections.cc: Likewise.
6677         * sparc.cc: Likewise.
6678         * symtab.h: Likewise.
6679         * target-reloc.h: Likewise.
6680         * target.cc: Likewise.
6681         * target.h: Likewise.
6682         * timer.cc: Likewise.
6683         * timer.h: Likewise.
6684         * x86_64.cc: Likewise.
6685
6686 2010-12-09  Cary Coutant  <ccoutant@google.com>
6687
6688         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6689         stack.
6690         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6691         parameter; change all callers.
6692         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6693         * options.h (warn_execstack): New option.
6694
6695 2010-12-07  Doug Kwan  <dougkwan@google.com>
6696
6697         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6698         like function call relocations.
6699
6700 2010-12-07  Ian Lance Taylor  <iant@google.com>
6701
6702         * archive.cc (Archive::get_elf_object_for_member): Permit
6703         punconfigured to be NULL.
6704         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6705         (Archive::include_member): Pass NULL to get_elf_object_for_member
6706         if we searched for the archive and this is the first included
6707         object.
6708
6709 2010-12-01  Ian Lance Taylor  <iant@google.com>
6710
6711         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6712         track_relocs_type_ field.
6713         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6714         Set track_relocs_type_.
6715         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6716         contents when using RELA relocs.
6717         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6718         reloc_map_.
6719         * reloc.cc (Track_relocs::next_addend): New function.
6720         * reloc.h (class Track_relocs): Declare next_addend.
6721
6722 2010-12-01  Ian Lance Taylor  <iant@google.com>
6723
6724         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6725         virtual destructor.
6726
6727 2010-12-01  Ian Lance Taylor  <iant@google.com>
6728
6729         * README: Update compilers known to work and fail.
6730
6731 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6732
6733         * configure.in: For --enable-gold, handle value `default' instead of
6734         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6735         not the default.
6736         * configure: Regenerate.
6737
6738 2010-11-18  Doug Kwan  <dougkwan@google.com>
6739
6740         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6741         and right_alignment to be zero.  Store result alignment only if it is
6742         greater than existing alignment.
6743
6744 2010-11-16  Cary Coutant  <ccoutant@google.com>
6745
6746         PR gold/12220
6747         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6748         Check for ".zdebug_line".
6749
6750 2010-11-16  Doug Kwan  <dougkwan@google.com>
6751             Cary Coutant  <ccoutant@google.com>
6752
6753         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6754         by reference; adjust all callers.
6755         * output.cc (Output_segment::set_section_addresses): Adjust references
6756         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6757         list is empty.
6758         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6759         end at page boundary.
6760
6761 2010-11-16  Cary Coutant  <ccoutant@google.com>
6762
6763         PR gold/12220
6764         * layout.cc (Layout::choose_output_section): Transform names of
6765         compressed sections even when using a script with a SECTIONS clause.
6766         (Layout::output_section_name): Remove code to transform
6767         compressed debug section names.
6768         * output.cc (Output_section::add_input_section): Use uncompressed
6769         section size when tracking input sections.
6770
6771 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6772
6773         * symtab.h (Symbol::NON_PIC_REF): Remove.
6774         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6775         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6776         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6777         (Symbol::use_plt_offset): Take a flags argument and pass it
6778         directly to needs_dynamic_reloc.  Restrict check for undefined
6779         weak symbols to function calls.
6780         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6781         (Target_arm::Scan::global): Use it.
6782         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6783         (Target_arm::Relocate::relocate): Likewise.
6784         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6785         parameter with an r_type parameter.  Use get_reference_flags
6786         to get the flags.
6787         (Target_arm::Relocate::relocate): Update accordingly.
6788         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6789         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6790         (Target_i386::Scan::global): Likewise.
6791         (Target_i386::Relocate::relocate): Likewise.
6792         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6793         parameter with an r_type parameter.  Use get_reference_flags
6794         to get the flags.
6795         (Target_i386::Relocate::relocate): Update accordingly.
6796         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6797         (Target_powerpc::Scan::global): Use it.
6798         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6799         (Target_powerpc::Relocate::relocate): Likewise.
6800         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6801         (Target_sparc::Scan::global): Use it.
6802         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6803         (Target_sparc::Relocate::relocate): Likewise.
6804         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6805         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6806         (Target_x86_64::Scan::global): Likewise.
6807         (Target_x86_64::Relocate::relocate): Likewise.
6808
6809 2010-11-08  Doug Kwan  <dougkwan@google.com>
6810             Cary Coutant  <ccoutant@google.com>
6811
6812         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6813         (Arm_exidx_merge_section::section_contents_): New data member.
6814         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6815         (Arm_input_section::~Arm_input_section): De-allocate memory.
6816         (Arm_input_section::original_contents_): New data member.
6817         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6818         in parameters instead of calling Object::section_contents without
6819         locking.
6820         (Arm_output_section::group_section): New parameter TASK.  Pass it
6821         to callees that need locking objects.
6822         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6823         to lock EXIDX input sections.  Fix a formatting issue.  Call
6824         Arm_exidx_merged_section::build_contents to create merged section
6825         contents.
6826         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6827         to lock object of stub table owner.
6828         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6829         TEXT_SIZE to initialize data member TEXT_SIZE_.
6830         (Arm_exidx_input_section::addralign): Fix typo in comment.
6831         (Arm_exidx_input_section::text_size): New method.
6832         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6833         that require locking objects.  Lock objects before scanning for stubs
6834         and updating local symbols.
6835         (Arm_input_section<big_endian>::init): Copy contents of original
6836         input section.
6837         (Arm_input_section<big_endian>::do_write): Use saved contents of
6838         original input section instead of calling Object::section_contents
6839         without locking.
6840         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6841         size without calling Object::section_size().
6842         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6843         for size.  Allocate a buffer for merged EXIDX entries.
6844         (Arm_exidx_merged_section::build_contents): New method.
6845         (Arm_exidx_merged_section::do_write): Move merge section contents
6846         building code to Arm_exidx_merged_section::build_contetns.  Write
6847         out contetns in buffer instead of building it on the fly.
6848         (Arm_relobj::make_exidx_input_section): Also pass text section size
6849         to Arm_exidx_input_section constructor.
6850         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6851         (Arm_dynobj::do_read_symbols): Fix memory leak.
6852         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6853         * target.h: (class Task): Add forward declaration.
6854         (Target::relax): Add new parameter TASK and pass it to
6855         Target::do_relax().
6856         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6857
6858 2010-11-05  Cary Coutant  <ccoutant@google.com>
6859
6860         PR gold/10708
6861         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6862         object when reading from the file.
6863         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6864         second layout pass.
6865         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6866         when reading section contents.
6867         (get_section_contents): Likewise.
6868         (icf::find_identical_sections): Likewise.
6869         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6870         object when reading from the file.
6871         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6872         the object when doing deferred section layout.
6873
6874 2010-11-03  Nick Clifton  <nickc@redhat.com>
6875
6876         PR gold/12001
6877         * script.h (class Symbol_assignment: name): New member.  Returns
6878         the name of the symbol.
6879         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6880         Returns true if the given symbol name is on the list of
6881         assignments wating to be processed.
6882         * archive.cc (should_incldue_member): If the symbol is undefined,
6883         check to see if it is on the list of symbols pending assignment.
6884
6885 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6886
6887         * script-sections.cc (Script_sections::find_memory_region): Check
6888         for a NULL output section pointer.
6889
6890 2010-10-29  Doug Kwan  <dougkwan@google.com>
6891
6892         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6893         Output_section::add_relaxed_input_section.
6894         * output.cc (Output_section::add_relaxed_input_section): Add new
6895         arguments LAYOUT and NAME.  Set section order index.
6896         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6897         Copy section order index.
6898         * output.h (Output_section::add_relaxed_input_section): Add new
6899         arguments LAYOUT and NAME.
6900
6901 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6902
6903         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6904         NATIVE_OR_CROSS_LINKER.
6905         * testsuite/Makefile.in: Regenerate.
6906
6907 2010-10-20  Doug Kwan  <dougkwan@google.com>
6908
6909         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6910         without SHF_LINK_ORDER flags.
6911         * layout.cc (Layout::choose_output_section): Do not filter
6912         SHF_LINK_ORDER flag in a relocatable link.
6913
6914 2010-10-17  Cary Coutant  <ccoutant@google.com>
6915
6916         * output.h (Output_segment::set_section_addresses): Change function
6917         signature.  Update all callers.
6918         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6919         sections.
6920         (Output_segment::set_section_addresses): Align after last TLS
6921         section.  Add padding before last relro section instead of after.
6922
6923 2010-10-17  Doug Kwan  <dougkwan@google.com>
6924
6925         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6926         GOT output section to be writable.
6927
6928 2010-10-14  Cary Coutant  <ccoutant@google.com>
6929
6930         * debug.h (DEBUG_INCREMENTAL): New flag.
6931         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6932         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6933         mode.
6934         * incremental.cc (report_command_line): Ignore all forms of
6935         --incremental.
6936         * layout.cc (Layout::Layout): Check parameters for incremental link
6937         mode.
6938         * options.cc (General_options::parse_incremental): New function.
6939         (General_options::parse_no_incremental): New function.
6940         (General_options::parse_incremental_full): New function.
6941         (General_options::parse_incremental_update): New function.
6942         (General_options::incremental_mode_): New data member.
6943         (General_options::finalize): Check incremental_mode_.
6944         * options.h (General_options): Update help text for --incremental.
6945         Add --no-incremental, --incremental-full, --incremental-update.
6946         (General_options::Incremental_mode): New enum type.
6947         (General_options::incremental_mode): New function.
6948         (General_options::incremental_mode_): New data member.
6949         * parameters.cc (Parameters::incremental_mode_): New data member.
6950         (Parameters::set_options): Set incremental_mode_.
6951         (Parameters::set_incremental_full): New function.
6952         (Parameters::incremental): New function.
6953         (Parameters::incremental_update): New function.
6954         (set_parameters_incremental_full): New function.
6955         * parameters.h (Parameters::set_incremental_full): New function.
6956         (Parameters::incremental): New function.
6957         (Parameters::incremental_update): New function.
6958         (Parameters::incremental_mode_): New data member.
6959         (set_parameters_incremental_full): New function.
6960         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6961         incremental link mode.
6962         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6963         (Sized_relobj::do_relocate_sections): Likewise.
6964         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6965         option.
6966         * testsuite/Makefile.in: Regenerate.
6967         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6968
6969 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6970
6971         * script-sections.h (class Script_sections): Make
6972         Sections_elements typedef public.
6973         * script-sections.cc (class Sort_output_sections): Add elements_
6974         field.  Add constructor which sets it; change all callers.
6975         (Sort_output_sections::is_before): New function.
6976         (Sort_output_sections::operator()): Call is_before.
6977         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6978         conditional.
6979         * testsuite/script_test_10.sh: New test. Test script section
6980         order.
6981         * testsuite/script_test_10.t: Likewise.
6982         * testsuite/script_test_10.s: Likewise.
6983         * testsuite/Makefile.am: Wrap the cross linker tests and the
6984         common tests into NATIVE_OR_CROSS_LINKER.
6985         (check_SCRIPTS): Add script_test_10.sh.
6986         (check_DATA): Add script_test_10.stdout.
6987         (script_test_10.o, script_test_10): New targets.
6988         (script_test_10.stdout): New target.
6989         * configure, testsuite/Makefile.in: Regenerate.
6990
6991 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6992
6993         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6994         error for the deprecated relocations.
6995         (Target_arm::Scan::global): Likewise.
6996         (Target_arm::Relocate::relocate): Likewise.
6997
6998 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6999
7000         * fileread.cc (Input_file::find_file): Initialize *found_name
7001         and *namep when using the fallback search for case 4.
7002
7003 2010-10-11  Cary Coutant  <ccoutant@google.com>
7004
7005         * options.h (class General_options): Redefine -z lazy as an alias for
7006         the negation of -z now.
7007
7008 2010-10-11  Ian Lance Taylor  <iant@google.com>
7009
7010         * resolve.cc (symbol_to_bits): Report the value of the unsupported
7011         binding.
7012
7013 2010-10-06  Nick Clifton  <nickc@redhat.com>
7014
7015         * script-sections.cc(class Memory_region): Remove
7016         current_lma_offset_ field.  Rename current_vma_offset_ to
7017         current_offset_.  Add last_section_ field.
7018         (Memory_region::get_current_vma_address): Rename to
7019         get_current_address.
7020         (Memory_region::get_current_lma_address): Delete.
7021         (Memory_region::increment_vma_offset): Rename to
7022         increment_offset.
7023         (Memory_region::increment_lma_offset): Delete.
7024         (Memory_region::attributes_compatible): New method.  Returns
7025         true if the provided section is compatible with the region.
7026         (Memory_region::get_last_section): New method.  Returns the last
7027         section to use the region.
7028         (Memory_region::set_last_section): New method.  Stores the last
7029         section to use the region.
7030         (Script_sections::block_in_region): New method.  Returns true if
7031         a block of memory is contained within a region.
7032         (Script_sections::find_memory_region): New method.  Locates a
7033         memory region to be used to set a VMA or LMA address.
7034         (Output_section_definition::set_section_addresses): Add code to
7035         check for addresses set by memory regions.
7036         (Output_segment::set_section_addresses): Remove memory region
7037         walking code.
7038         (Script_sections::create_segment): Add a warning if a header
7039         segment is created outside of any region.
7040         * script-sections.h (class Script_sections): Add prototypes for
7041         find_memory_region and block_in_region methods.
7042         * testsuite/memory_test.s: Use .long instead of .word.
7043         * testsuite/memory_test.t: Add some more output sections.
7044         * testsuite/memory_test.sh: Update expected output.
7045
7046 2010-10-02  Doug Kwan  <dougkwan@google.com>
7047
7048         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7049         defintion to symtab.h
7050         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7051         declaration to defintion.
7052
7053 2010-10-01  Nick Clifton  <nickc@redhat.com>
7054
7055         * expression.cc (eval): Replace dummy argument with NULL.
7056         (eval_maybe_dot): Check for a NULL result section pointer.
7057         (Symbol_expression::value): Likewise.
7058         (Dot_expression::value): Likewise.
7059         (BINARY_EXPRESSION): Likewise.
7060         (Max_expression::value): Likewise.
7061         (Min_expression::value): Likewise.
7062         (Absolute_expression::value): Likewise.
7063         (Addr_expression::value_from_output_section): Likewise.
7064         (Loaddddr_expression::value_from_output_section): Likewise.
7065         (Segment_start_expression::value): Likewise.
7066         * script-sections.cc
7067         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7068         argument with NULL.
7069         (Sections_elememt_dot_assignment::set_section_addresses):
7070         Likewise.
7071         (Output_data_expression::do_write_to_buffer): Likewise.
7072         (Output_section_definition::finalize_symbols): Likewise.
7073         (Output_section_definition::set_section_addresses): Likewise.
7074
7075 2010-09-30  Doug Kwan  <dougkwan@google.com>
7076
7077         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7078
7079 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7080
7081         * target.h (Target::can_icf_inline_merge_sections): New virtual
7082         function.
7083         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7084         virtual function.
7085         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7086         virtual function.
7087         * icf.cc (get_section_contents): Inline merge sections only when
7088         target allows it.
7089
7090 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7091
7092         * configure: Regenerate.
7093
7094 2010-09-17  Ian Lance Taylor  <iant@google.com>
7095
7096         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7097         * testsuite/Makefile.am (memory_test.o): New target.
7098         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7099         memory_test.t.
7100         * testsuite/Makefile.in: Rebuild.
7101
7102 2010-09-17  Doug Kwan  <dougkwan@google.com>
7103
7104         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7105         defintion if relocation uses GOT entries of the symbol.
7106         * testsuite/icf_safe_test.sh: Fix test.
7107         * testsuite/icf_safe_so_test.sh: Fix test.
7108
7109 2010-09-16  Cary Coutant  <ccoutant@google.com>
7110
7111         * script_sections.cc (class Memory_region): Remove "NULL" from
7112         vector initializations.
7113
7114 2010-09-15  Cary Coutant  <ccoutant@google.com>
7115
7116         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7117         Resolve forwarding symbols.
7118
7119 2010-09-15  Doug Kwan  <dougkwan@google.com>
7120
7121         * gold/testsuite/script_test_3.t: Add ARM special sections.
7122         * gold/testsuite/script_test_4.t: Same.
7123         * gold/testsuite/script_test_5.t: Same.
7124         * gold/testsuite/script_test_6.t: Same.
7125         * gold/testsuite/script_test_7.t: Same.
7126         * gold/testsuite/script_test_7.t: Same.
7127         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7128
7129 2010-09-14  Cary Coutant  <ccoutant@google.com>
7130
7131         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7132         (Target_x86_64::Relocate::relocate_tls): Replace check for
7133         saw_tls_block_reloc_ with test for executable section.
7134
7135 2010-09-12  Cary Coutant  <ccoutant@google.com>
7136
7137         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7138         position-independent executables to shared libraries need dynamic
7139         relocations.
7140         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7141         position-independent executables.
7142         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7143         * testsuite/Makefile.in: Regenerate.
7144
7145 2010-09-10  Nick Clifton  <nickc@redhat.com>
7146
7147         PR gold/11997
7148         * testsuite/memory_test.t: Discard any sections that are not
7149         needed.
7150
7151 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7152
7153         PR gold/11996
7154         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7155         "This::" to work around a bug in gcc 4.2.
7156
7157         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7158
7159 2010-09-09  Rafael Espindola  <espindola@google.com>
7160
7161         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7162         sections with different PF_X flags in the same segment.
7163         (Layout::find_first_load_seg): Search all segments to find the first
7164         one.
7165         * options.h (rosegment): New.
7166
7167 2010-09-08  Rafael Espindola  <espindola@google.com>
7168
7169         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7170
7171 2010-09-08  Doug Kwan  <dougkwan@google.com>
7172
7173         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7174         (Arm_relobj::do_relocate_sections): Add new parameter for output
7175         file to match the parent.
7176         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7177         of local symbols instead of input values.  Update code to track
7178         changes in gold::relocate_section.
7179         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7180         (Sized_relobj::compute_final_local_value_internal): New methods.
7181         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7182         body into private version of Sized_relobj::compute_final_local_value.
7183         Call the inline method.
7184         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7185         merged symbol value if there is one.
7186         (Symbol_value::has_output_value): New method defintiion.
7187         (Sized_relobj::Compute_final_local_value_status): New enum type.
7188         (Sized_relobj::compute_final_local_value): New methods.
7189         (Sized_relobj::compute_final_local_value_internal): New methods.
7190         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7191         and arm_cortex_a8.sh.
7192         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7193         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7194         New tests.
7195         * Makefile.in: Regenerate.
7196         * testsuite/arm_bl_out_of_range.s: Update test.
7197         * testsuite/thumb_bl_out_of_range.s: Ditto.
7198         * testsuite/thumb_blx_out_of_range.s: Ditto.
7199         * testsuite/arm_branch_out_of_range.sh: New file.
7200         * testsuite/arm_cortex_a8.sh: Ditto.
7201         * testsuite/arm_cortex_a8_b.s: Ditto.
7202         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7203         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7204         * testsuite/arm_cortex_a8_bl.s: Ditto.
7205         * testsuite/arm_cortex_a8_blx.s: Ditto.
7206         * testsuite/arm_cortex_a8_local.s: Ditto.
7207         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7208         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7209
7210 2010-09-08  Rafael Espindola  <espindola@google.com>
7211
7212         * Makefile.am (memory_test.stdout): Run readelf with -W.
7213         * Makefile.in: Regenerate.
7214         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7215         64 bit output.
7216
7217 2010-09-08  Rafael Espindola  <espindola@google.com>
7218
7219         * script-sections.cc (Script_sections::add_memory_region): Convert
7220         field precision to int.
7221         * script.cc (script_set_section_region, script_set_section_region):
7222         Convert field precision to int.
7223
7224 2010-09-08  Rafael Espindola  <espindola@google.com>
7225
7226         * arm.cc (do_finalize_sections): Create the __exidx_start and
7227         __exdix_end symbols even when the section is missing.
7228
7229 2010-09-08  Nick Clifton  <nickc@redhat.com>
7230
7231         * README: Remove claim that MEMORY is not supported.
7232         * expression.cc (script_exp_function_origin)
7233         (script_exp_function_length): Move from here to ...
7234         * script.cc: ... here.
7235         (script_set_section_region, script_add_memory)
7236         (script_parse_memory_attr, script_include_directive): New
7237         functions.
7238         * script-sections.cc
7239         (class Memory_region): New class.
7240         (class Output_section_definition): Add set_memory_region,
7241         set_section_vma, set_section_lma and get_section_name methods.
7242         (class Script_Sections): Add add_memory_region,
7243         find_memory_region, find_memory_region_origin,
7244         find_memory_region_length and set_memory_region methods.
7245         Have set_section_addresses method walk the list of set memory
7246         regions.
7247         Extend the print methos to display memory regions.
7248         * script-sections.h: Add prototypes for new methods.
7249         Add enum for MEMORY region attributes.
7250         * yyscript.y: Add support for parsing MEMORY regions.
7251         * script-c.h: Add prototypes for new functions.
7252         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7253         * testsuite/Makefile.in: Regenerate.
7254         * testsuite/memory_test.sh: New script.
7255         * testsuite/memory_test.s: New assembler source file.
7256         * testsuite/memory_test.t: New linker script.
7257
7258 2010-08-27  Doug Kwan  <dougkwan@google.com>
7259
7260         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7261         reference override an existing dynamic weak reference.
7262         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7263         * testsuite/Makefile.in: Regenerate.
7264         * testsuite/dyn_weak_ref.sh: New file.
7265         * testsuite/dyn_weak_ref_1.c: Ditto.
7266         * testsuite/dyn_weak_ref_2.c: Ditto.
7267
7268 2010-08-27  Ian Lance Taylor  <iant@google.com>
7269
7270         * incremental.h (class Incremental_input_entry): Add virtual
7271         destructor.
7272
7273 2010-08-27  Ian Lance Taylor  <iant@google.com>
7274
7275         * testsuite/start_lib_test_3.c: Mark t3 as used.
7276
7277 2010-08-27  Nick Clifton  <nickc@redhat.com>
7278
7279         * options.cc (version_script): Fix small typo in previous
7280         whitespace tidyup.
7281
7282 2010-08-25  Nick Clifton  <nickc@redhat.com>
7283
7284         * archive.cc: Formatting fixes: Remove whitespace between
7285         typename and following asterisk.  Remove whitespace between
7286         function name and opening parenthesis.
7287         * archive.h: Likewise.
7288         * arm.cc: Likewise.
7289         * attributes.cc: Likewise.
7290         * attributes.h: Likewise.
7291         * common.cc: Likewise.
7292         * copy-relocs.cc: Likewise.
7293         * dirsearch.h: Likewise.
7294         * dynobj.cc: Likewise.
7295         * ehframe.cc: Likewise.
7296         * ehframe.h: Likewise.
7297         * expression.cc: Likewise.
7298         * fileread.cc: Likewise.
7299         * fileread.h: Likewise.
7300         * gc.h: Likewise.
7301         * gold-threads.cc: Likewise.
7302         * gold.cc: Likewise.
7303         * i386.cc: Likewise.
7304         * icf.h: Likewise.
7305         * incremental-dump.cc: Likewise.
7306         * incremental.cc: Likewise.
7307         * layout.cc: Likewise.
7308         * layout.h: Likewise.
7309         * main.cc: Likewise.
7310         * merge.cc: Likewise.
7311         * merge.h: Likewise.
7312         * object.cc: Likewise.
7313         * object.h: Likewise.
7314         * options.cc: Likewise.
7315         * options.h: Likewise.
7316         * output.cc: Likewise.
7317         * output.h: Likewise.
7318         * plugin.cc: Likewise.
7319         * plugin.h: Likewise.
7320         * powerpc.cc: Likewise.
7321         * reloc.cc: Likewise.
7322         * script-c.h: Likewise.
7323         * script-sections.cc: Likewise.
7324         * script.cc: Likewise.
7325         * stringpool.cc: Likewise.
7326         * symtab.cc: Likewise.
7327         * symtab.h: Likewise.
7328         * target.cc: Likewise.
7329         * timer.cc: Likewise.
7330         * timer.h: Likewise.
7331         * version.cc: Likewise.
7332         * x86_64.cc: Likewise.
7333
7334 2010-08-24  Nick Clifton  <nickc@redhat.com>
7335
7336         PR 11899
7337         * layout.cc (segment_precedes): Sort segments by their physical
7338         addresses, if they have been set.
7339
7340 2010-08-23  Cary Coutant  <ccoutant@google.com>
7341
7342         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7343         symbols data.
7344         (Lib_group::include_member): Unlock object after deleting its
7345         symbols data.
7346         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7347         the bug fixed here.
7348
7349 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7350             Cary Coutant  <ccoutant@google.com>
7351
7352         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7353         constructor, and set_blocker.
7354         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7355         readsyms_blocker_.
7356         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7357         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7358         * testsuite/Makefile.am (start_lib_test): New test case.
7359         * testsuite/Makefile.in: Regenerate.
7360         * testsuite/start_lib_test_main.c: New file.
7361         * testsuite/start_lib_test_1.c: New file.
7362         * testsuite/start_lib_test_2.c: New file.
7363         * testsuite/start_lib_test_3.c: New file.
7364
7365 2010-08-19  Ian Lance Taylor  <iant@google.com>
7366
7367         * Makefile.in: Rebuild with automake 1.11.1.
7368         * aclocal.m4: Likewise.
7369         * testsuite/Makefile.in: Likewise.
7370
7371 2010-08-19  Ian Lance Taylor  <iant@google.com>
7372
7373         PR 10893
7374         * i386.cc (class Output_data_plt_i386): Update declarations.
7375         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7376         local_ifuncs_ fields.
7377         (Target_i386::do_plt_section_for_global): New function.
7378         (Target_i386::do_plt_section_for_local): New function.
7379         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7380         parameter; change all callers.  Initialize global_ifuncs_ and
7381         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7382         __rel_iplt_end.
7383         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7384         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7385         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7386         symbols.
7387         (Target_i386::make_plt_section): New function, broken out of
7388         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7389         (Target_i386::make_plt_entry): Call make_plt_section.
7390         (Target_i386::make_local_ifunc_plt_entry): New function.
7391         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7392         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7393         R_386_IRELATIVE to switch.
7394         (Target_i386::Scan::global): Likewise.
7395         (Target_i386::Relocate::relocate): Likewise.
7396         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7397         switch.
7398         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7399         (Target_x86_64::do_plt_section_for_global): New function.
7400         (Target_x86_64::do_plt_section_for_local): New function.
7401         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7402         parameter; change all callers.  If doing a static link define
7403         __rela_iplt_start and __rela_iplt_end.
7404         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7405         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7406         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7407         to point to .plt.
7408         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7409         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7410         switch.
7411         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7412         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7413         R_X86_64_IRELATIVE to switch.
7414         (Target_x86_64::Scan::global): Likewise.
7415         (Target_x86_64::Relocate::relocate): Likewise.
7416         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7417         switch.
7418         * target.h (class Target): Add plt_section_for_global and
7419         plt_section_for_local functions.  Add do_plt_section_for_global
7420         and do_plt_section_for_local virtual functions.
7421         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7422         clarifying comments.
7423         (Symbol::use_plt_offset): Handle IFUNC symbol.
7424         * object.cc (Sized_relobj::Sized_relobj): Initialize
7425         local_plt_offsets_.
7426         (Sized_relobj::local_has_plt_offset): New function.
7427         (Sized_relobj::local_plt_offset): New function.
7428         (Sized_relobj::set_local_plt_offset): New function.
7429         (Sized_relobj::do_count): Handle IFUNC symbol.
7430         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7431         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7432         is_ifunc_symbol functions.
7433         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7434         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7435         local_plt_offsets_ field.
7436         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7437         * output.h (class Output_section_data): Add non-const
7438         output_section function.
7439         (class Output_data_got): Update declarations.
7440         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7441         Add use_plt_offset parameter to global and local constructors.
7442         Change all callers.  Change local_sym_index_ field to 31 bits.
7443         Change GSYM_CODE and CONSTANT_CODE accordingly.
7444         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7445         doing a static link don't set sh_link field.
7446         (Output_data_got::Got_entry::write): Use PLT offset if
7447         appropriate.
7448         (Output_data_got::add_global_plt): New function.
7449         (Output_data_got::add_local_plt): New function.
7450         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7451         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7452         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7453         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7454         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7455         IFUNC conditional.
7456         * testsuite/ifunc-sel.h: New file.
7457         * testsuite/ifuncmain1.c: New file.
7458         * testsuite/ifuncmain1vis.c: New file.
7459         * testsuite/ifuncmod1.c: New file.
7460         * testsuite/ifuncdep2.c: New file.
7461         * testsuite/ifuncmain2.c: New file.
7462         * testsuite/ifuncmain3.c: New file.
7463         * testsuite/ifuncmod3.c: New file.
7464         * testsuite/ifuncmain4.c: New file.
7465         * testsuite/ifuncmain5.c: New file.
7466         * testsuite/ifuncmod5.c: New file.
7467         * testsuite/ifuncmain6pie.c: New file.
7468         * testsuite/ifuncmod6.c: New file.
7469         * testsuite/ifuncmain7.c: New file.
7470         * configure, testsuite/Makefile.in: Rebuild.
7471
7472 2010-08-18  Ian Lance Taylor  <iant@google.com>
7473
7474         * incremental.cc
7475         (Output_section_incremental_inputs::write_input_files): Add cast
7476         to avoid signed/unsigned comparison warning.
7477         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7478
7479 2010-08-12  Cary Coutant  <ccoutant@google.com>
7480
7481         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7482
7483 2010-08-13  Ian Lance Taylor  <iant@google.com>
7484
7485         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7486
7487 2010-08-12  Cary Coutant  <ccoutant@google.com>
7488             Doug Kwan  <dougkwan@google.com>
7489
7490         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7491         defintion overrides non-weak undef, remember that the original undef
7492         is not weak.
7493         * symtab.cc (Symbol_table::sized_write_global): For undef without
7494         an original weak binding, set binding to global in output.
7495         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7496         * testsuite/Makefile.in: Regenerate.
7497         * testsuite/strong_ref_weak_def.sh: New file.
7498         * testsuite/strong_ref_weak_def_1.c: Ditto.
7499         * testsuite/strong_ref_weak_def_2.c: Ditto.
7500
7501 2010-08-12  Cary Coutant  <ccoutant@google.com>
7502
7503         * testsuite/incremental_test.sh: Rewrite.
7504         * testsuite/incremental_test_1.c: Rewrite.
7505         * testsuite/incremental_test_2.c: Rewrite.
7506
7507 2010-08-12  Cary Coutant  <ccoutant@google.com>
7508
7509         * arm.cc (Target_arm::got_size): Add const.
7510         (Target_arm::got_entry_count): New function.
7511         (Target_arm::plt_entry_count): New function.
7512         (Target_arm::first_plt_entry_offset): New function.
7513         (Target_arm::plt_entry_size): New function.
7514         (Output_data_plt_arm::entry_count): New function.
7515         (Output_data_plt_arm::first_plt_entry_offset): New function.
7516         (Output_data_plt_arm::get_plt_entry_size): New function.
7517         * i386.cc (Target_i386::got_size): Add const.
7518         (Target_i386::got_entry_count): New function.
7519         (Target_i386::plt_entry_count): New function.
7520         (Target_i386::first_plt_entry_offset): New function.
7521         (Target_i386::plt_entry_size): New function.
7522         (Output_data_plt_i386::entry_count): New function.
7523         (Output_data_plt_i386::first_plt_entry_offset): New function.
7524         (Output_data_plt_i386::get_plt_entry_size): New function.
7525         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7526         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7527         * incremental.cc: Include target.h.
7528         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7529         parameter.  Adjust all callers.  Find incremental_got_plt section.
7530         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7531         section.
7532         (Output_section_incremental_inputs::set_final_data_size): Calculate
7533         size of incremental_got_plt section.
7534         (Output_section_incremental_inputs::do_write): Write the
7535         incremental_got_plt section.
7536         (Got_plt_view_info): New struct.
7537         (Local_got_offset_visitor): New class.
7538         (Global_got_offset_visitor): New class.
7539         (Global_symbol_visitor_got_plt): New class.
7540         (Output_section_incremental_inputs::write_got_plt): New function.
7541         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7542         Add parameter.  Adjust all callers.
7543         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7544         (Incremental_inputs::got_plt_section): New function.
7545         (Incremental_inputs::got_plt_section_): New data member.
7546         (Incremental_got_plt_reader): New class.
7547         * layout.cc (Layout::create_incremental_info_sections): Add the
7548         incremental_got_plt section.
7549         * object.h (Got_offset_list::get_list): New function.
7550         (Got offset_list::for_all_got_offsets): New function.
7551         (Sized_relobj::local_got_offset_list): New function.
7552         * powerpc.cc (Target_powerpc::got_size): Add const.
7553         (Target_powerpc::got_entry_count): New function.
7554         (Target_powerpc::plt_entry_count): New function.
7555         (Target_powerpc::first_plt_entry_offset): New function.
7556         (Target_powerpc::plt_entry_size): New function.
7557         (Output_data_plt_powerpc::entry_count): New function.
7558         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7559         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7560         * sparc.cc (Target_sparc::got_size): Add const.
7561         (Target_sparc::got_entry_count): New function.
7562         (Target_sparc::plt_entry_count): New function.
7563         (Target_sparc::first_plt_entry_offset): New function.
7564         (Target_sparc::plt_entry_size): New function.
7565         (Output_data_plt_sparc::entry_count): New function.
7566         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7567         (Output_data_plt_sparc::get_plt_entry_size): New function.
7568         * symtab.h (Symbol::got_offset_list): New function.
7569         (Symbol_table::for_all_symbols): New function.
7570         * target.h (Sized_target::got_entry_count): New function.
7571         (Sized_target::plt_entry_count): New function.
7572         (Sized_target::plt_entry_size): New function.
7573         * x86_64.cc (Target_x86_64::got_size): Add const.
7574         (Target_x86_64::got_entry_count): New function.
7575         (Target_x86_64::plt_entry_count): New function.
7576         (Target_x86_64::first_plt_entry_offset): New function.
7577         (Target_x86_64::plt_entry_size): New function.
7578         (Output_data_plt_x86_64::entry_count): New function.
7579         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7580         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7581
7582 2010-08-12  Cary Coutant  <ccoutant@google.com>
7583
7584         * archive.cc: Include incremental.h.
7585         (Archive::Archive): Initialize incremental_info_.
7586         (Archive::include_member): Record archive members in incremental info.
7587         (Add_archive_symbols::run): Record begin and end of an archive in
7588         incremental info.
7589         (Lib_group::include_member): Record objects in incremental info.
7590         * archive.h (Incremental_archive_entry): Forward declaration.
7591         (Archive::set_incremental_info): New member function.
7592         (Archive::incremental_info): New member function.
7593         (Archive::Unused_symbol_iterator): New class.
7594         (Archive::unused_symbols_begin): New member function.
7595         (Archive::unused_symbols_end): New member function.
7596         (Archive::incremental_info_): New data member.
7597         * incremental-dump.cc (find_input_containing_global): New function.
7598         (dump_incremental_inputs): Dump new incremental info sections.
7599         * incremental.cc: Include symtab.h.
7600         (Output_section_incremental_inputs): New class.
7601         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7602         new incremental info sections.
7603         (Sized_incremental_binary::do_check_inputs): Likewise.
7604         (Incremental_inputs::report_archive): Remove.
7605         (Incremental_inputs::report_archive_begin): New function.
7606         (Incremental_inputs::report_archive_end): New function.
7607         (Incremental_inputs::report_object): New function.
7608         (Incremental_inputs::finalize_inputs): Remove.
7609         (Incremental_inputs::report_input_section): New function.
7610         (Incremental_inputs::report_script): Rewrite.
7611         (Incremental_inputs::finalize): Do nothing but finalize string table.
7612         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7613         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7614         (Incremental_inputs::create_data_sections): New function.
7615         (Incremental_inputs::relocs_entsize): New function.
7616         (Output_section_incremental_inputs::set_final_data_size): New function.
7617         (Output_section_incremental_inputs::do_write): New function.
7618         (Output_section_incremental_inputs::write_header): New function.
7619         (Output_section_incremental_inputs::write_input_files): New function.
7620         (Output_section_incremental_inputs::write_info_blocks): New function.
7621         (Output_section_incremental_inputs::write_symtab): New function.
7622         * incremental.h (Incremental_script_entry): Forward declaration.
7623         (Incremental_object_entry): Forward declaration.
7624         (Incremental_archive_entry): Forward declaration.
7625         (Incremental_inputs): Forward declaration.
7626         (Incremental_inputs_header_data): Remove.
7627         (Incremental_inputs_header): Remove.
7628         (Incremental_inputs_header_write): Remove.
7629         (Incremental_inputs_entry_data): Remove.
7630         (Incremental_inputs_entry): Remove.
7631         (Incremental_inputs_entry_write): Remove.
7632         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7633         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7634         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7635         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7636         Likewise.
7637         (Incremental_input_entry): New class.
7638         (Incremental_script_entry): New class.
7639         (Incremental_object_entry): New class.
7640         (Incremental_archive_entry): New class.
7641         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7642         (Incremental_inputs::report_inputs): Remove.
7643         (Incremental_inputs::report_archive): Remove.
7644         (Incremental_inputs::report_archive_begin): New function.
7645         (Incremental_inputs::report_archive_end): New function.
7646         (Incremental_inputs::report_object): Change prototype.
7647         (Incremental_inputs::report_input_section): New function.
7648         (Incremental_inputs::report_script): Change prototype.
7649         (Incremental_inputs::get_reloc_count): New function.
7650         (Incremental_inputs::set_reloc_count): New function.
7651         (Incremental_inputs::create_data_sections): New function.
7652         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7653         (Incremental_inputs::inputs_section): New function.
7654         (Incremental_inputs::symtab_section): New function.
7655         (Incremental_inputs::relocs_section): New function.
7656         (Incremental_inputs::get_stringpool): Add const.
7657         (Incremental_inputs::command_line): Add const.
7658         (Incremental_inputs::inputs): Remove.
7659         (Incremental_inputs::command_line_key): New function.
7660         (Incremental_inputs::input_file_count): New function.
7661         (Incremental_inputs::input_files): New function.
7662         (Incremental_inputs::relocs_entsize): New function.
7663         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7664         (Incremental_inputs::finalize_inputs): Remove.
7665         (Incremental_inputs::Input_info): Remove.
7666         (Incremental_inputs::lock_): Remove.
7667         (Incremental_inputs::inputs_): Change type.
7668         (Incremental_inputs::inputs_map_): Remove.
7669         (Incremental_inputs::current_object_entry_): New data member.
7670         (Incremental_inputs::inputs_section_): New data member.
7671         (Incremental_inputs::symtab_section_): New data member.
7672         (Incremental_inputs::relocs_section_): New data member.
7673         (Incremental_inputs::reloc_count_): New data member.
7674         (Incremental_inputs_reader): New class.
7675         (Incremental_symtab_reader): New class.
7676         (Incremental_relocs_reader): New class.
7677         * layout.cc (Layout::finalize): Move finalization of incremental info
7678         and creation of incremental info sections to follow finalization of
7679         symbol table.  Set offsets for postprocessing sections.
7680         (Layout::create_incremental_info_sections): Call
7681         Incremental_inputs::create_data_sections.  Add incremental symtab
7682         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7683         sections to layout after input sections.
7684         * layout.h (struct Timespec): Forward declaration.
7685         (Layout::incremental_inputs): Add const.
7686         (Layout::create_incremental_info_sections): Add parameter.
7687         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7688         * object.cc: Include incremental.h.
7689         (Relobj::finalize_incremental_relocs): New function.
7690         (Sized_relobj::do_layout): Record input sections in incremental info.
7691         * object.h (Object::output_section): New function.
7692         (Object::output_section_offset): Moved from Relobj.
7693         (Object::get_incremental_reloc_base): New function.
7694         (Object::get_incremental_reloc_count): New function.
7695         (Object::do_output_section): New function.
7696         (Object::do_output_section_offset): Moved from Relobj.
7697         (Object::do_get_incremental_reloc_base): New function.
7698         (Object::do_get_incremental_reloc_count): New function.
7699         (Object::Object): Initialize new data members.
7700         (Relobj::output_section): Renamed do_output_section and moved to
7701         protected.
7702         (Relobj::output_section_offset): Moved to Object.
7703         (Relobj::do_get_incremental_reloc_base): New function.
7704         (Relobj::do_get_incremental_reloc_count): New function.
7705         (Relobj::allocate_incremental_reloc_counts): New function.
7706         (Relobj::count_incremental_reloc): New function.
7707         (Relobj::finalize_incremental_relocs): New function.
7708         (Relobj::next_incremental_reloc_index): New function.
7709         (Relobj::reloc_counts_): New data member.
7710         (Relobj::reloc_bases_): New data member.
7711         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7712         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7713         (Sized_relobj::incremental_relocs_scan): New function.
7714         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7715         (Sized_relobj::incremental_relocs_write): New function.
7716         (Sized_relobj::incremental_relocs_write_reltype): New function.
7717         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7718         incremental link.
7719         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7720         archives and object files elsewhere.
7721         (Add_symbols::run): Report object files here.
7722         (Finish_group::run): Report end of archive at end of group.
7723         * reloc.cc: Include layout.h, incremental.h.
7724         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7725         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7726         (Sized_relobj::incremental_relocs_scan): New function.
7727         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7728         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7729         (Sized_relobj::incremental_relocs_write): New function.
7730         (Sized_relobj::incremental_relocs_write_reltype): New function.
7731         * script.cc (read_input_script): Rewrite test for incremental link.
7732         Change call to Incremental_inputs::report_script.
7733         * symtab.h (Symbol_table::first_global_index): New function.
7734         (Symbol_table::output_count): New function.
7735
7736 2010-08-12  Doug Kwan  <dougkwan@google.com>
7737
7738         * arm.cc (Target_arm::merge_object_attributes): Check command line
7739         options --no-wchar-size-warning and --no-enum-size-warning.
7740         * options.h (General_options): Add ld-compatible options
7741         --no-enum-size-warning and --no-wchar-size-warning.
7742
7743 2010-08-04  Ian Lance Taylor  <iant@google.com>
7744
7745         * x86_64.cc (Target_x86_64::Scan::local): Use
7746         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7747         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7748         (Target_x86_64::Scan::global): Likewise.
7749         (Target_x86_64::Relocate::relocate): Likewise.
7750         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7751         Likewise.
7752
7753 2010-08-03  Cary Coutant  <ccoutant@google.com>
7754
7755         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7756         to reserve space in merged_strings vector. Keep total input size
7757         for stats.
7758         (Output_merge_string::do_print_merge_stats): Print total input size.
7759         * merge.h (Output_merge_string): Add input_size_ field.
7760         * stringpool.cc (Stringpool_template::string_length): Move
7761         implementations out of Stringpool_template class and place in
7762         stringpool.h.
7763         * stringpool.h (string_length): Move out of Stringpool_template.
7764
7765 2010-08-03  Ian Lance Taylor  <iant@google.com>
7766
7767         PR 11712
7768         * layout.cc (relaxation_loop_body): If address of load segment is
7769         set, adjust address to include headers if possible.
7770
7771 2010-08-03  Ian Lance Taylor  <iant@google.com>
7772
7773         * version.cc (version_string): Bump to 1.10.
7774
7775 2010-08-03  Ian Lance Taylor  <iant@google.com>
7776
7777         PR 11805
7778         * layout.h (enum Output_section_order): Define.
7779         (class Layout): Update declarations.
7780         * layout.cc (Layout::get_output_section): Add order parameter.
7781         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7782         is_first_non_relro parameters.  Change all callers.
7783         (Layout::choose_output_section): Likewise.
7784         (Layout::add_output_section_data): Likewise.
7785         (Layout::make_output_section): Likewise.  Set order.
7786         (Layout::default_section_order): New function.
7787         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7788         * output.cc (Output_section::Output_section): Initialize order_.
7789         Don't initialize deleted fields.
7790         (Output_segment::Output_segment): Don't initialize deleted
7791         fields.
7792         (Output_segment::add_output_section_to_load): New function
7793         replacing add_output_section.  Change all callers to call this or
7794         add_output_section_to_nonload.
7795         (Output_segment::add_output_section_to_nonload): New function.
7796         (Output_segment::remove_output_section): Rewrite.
7797         (Output_segment::add_initial_output_data): Likewise.
7798         (Output_segment::has_any_data_sections): Likewise.
7799         (Output_segment::is_first_section_relro): Likewise.
7800         (Output_segment::maximum_alignment): Likewise.
7801         (Output_segment::has_dynamic_reloc): New function replacing
7802         dynamic_reloc_count.  Change all callers.
7803         (Output_segment::has_dynamic_reloc_list): New function replacing
7804         dynamic_reloc_count_list.  Change all callers.
7805         (Output_segment::set_section_addresses): Rewrite.
7806         (Output_segment::set_offset): Rewrite.
7807         (Output_segment::find_first_and_last_list): Remove.
7808         (Output_segment::set_tls_offsets): Rewrite.
7809         (Output_segment::first_section_load_address): Likewise.
7810         (Output_segment::output_section_count): Likewise.
7811         (Output_segment::section_with_lowest_load_address): Likewise.
7812         (Output_segment::write_section_headers): Likewise.
7813         (Output_segment::print_sections_to_map): Likewise.
7814         * output.h (class Output_data): Remove dynamic_reloc_count_
7815         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7816         (Output_data::add_dynamic_reloc): Rewrite.
7817         (Output_data::has_dynamic_reloc): New function.
7818         (Output_data::dynamic_reloc_count): Remove.
7819         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7820         is_last_relro_, is_first_non_relro_, is_interp_,
7821         is_dynamic_linker_section_ fields.  Add order and set_order
7822         functions.  Remove is_relro_local, set_is_relro_local,
7823         is_last_relro, set_is_last_relro, is_first_non_relro,
7824         set_is_first_non_relro functions, is_interp, set_is_interp,
7825         is_dynamic_linker_section, and set_is_dynamic_linker_section
7826         functions.
7827         (class Output_segment): Change Output_data_list from std::list to
7828         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7829         output_bss_ fields.  Update declarations.
7830
7831 2010-08-02  Ian Lance Taylor  <iant@google.com>
7832
7833         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7834         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7835         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7836
7837 2010-08-02  Ian Lance Taylor  <iant@google.com>
7838
7839         PR 11855
7840         * script.cc (Script_options::Script_options): Initialize
7841         symbol_definitions_ and symbol_references_.
7842         (Script_options::add_symbol_assignment): Update
7843         symbol_definitions_ and symbol_references_.
7844         (Script_options::add_symbol_reference): New function.
7845         (script_symbol): New function.
7846         * script.h (class Script_options): Add symbol_definitions_ and
7847         symbol_references_ fields.
7848         (Script_options::referenced_const_iterator): New type.
7849         (Script_options::referenced_begin): New function.
7850         (Script_options::referenced_end): New function.
7851         (Script_options::is_referenced): New function.
7852         (Script_options::any_unreferenced): New function.
7853         * script-c.h (script_symbol): Declare.
7854         * yyscript.y (exp): Call script_symbol.
7855         * symtab.cc: Include "script.h".
7856         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7857         Change all callers.  Check symbols referenced by scripts.
7858         (Symbol_table::add_undefined_symbols_from_command_line): Add
7859         layout parameter.  Change all callers.
7860         (Symbol_table::do_add_undefined_symbols_from_command_line):
7861         Likewise.  Break out loop body.  Check symbols referenced by
7862         scripts.
7863         (Symbol_table::add_undefined_symbol_from_command_line): New
7864         function broken out of
7865         do_add_undefined_symbols_from_command_line.
7866         * symtab.h (class Symbol_table): Update declarations.
7867         * archive.cc: Include "layout.h".
7868         (Archive::should_include_member): Add layout parameter.  Change
7869         all callers.  Check for symbol mentioned in expression.
7870         * archive.h (class Archive): Update declaration.
7871         * object.cc (Sized_relobj::do_should_include_member): Add layout
7872         parameter.
7873         * object.h (Object::should_include_member): Add layout parameter.
7874         Change all callers.
7875         (Object::do_should_include_member): Add layout parameter.
7876         (class Sized_relobj): Update declaration.
7877         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7878         parameter.
7879         * dynobj.h (class Sized_dynobj): Update declaration.
7880         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7881         layout parameter.
7882         * plugin.h (class Sized_pluginobj): Update declaration.
7883
7884 2010-08-02  Ian Lance Taylor  <iant@google.com>
7885
7886         PR 11866
7887         * output.cc (Output_segment::set_offset): Search for the first and
7888         last sections rather than assuming that the list is in order.
7889         (Output_segment::find_first_and_last_list): New function.
7890         * output.h (class Output_segment): Update declarations.
7891         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7892         (relro_strip_test_SOURCES): New variable.
7893         (relro_strip_test_DEPENDENCIES): New variable.
7894         (relro_strip_test_LDFLAGS): New variable.
7895         (relro_strip_test_LDADD): New variable.
7896         (relro_strip_test.so): New target.
7897
7898 2010-08-02  Ian Lance Taylor  <iant@google.com>
7899
7900         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7901         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7902         (Target_i386::got_tlsdesc_section): New function.
7903         (Target_i386::got_section): Create space for GOT entries for
7904         TLSDESC relocations.
7905         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7906         R_386_TLS_GOTDESC.
7907         (Target_i386::Scan::global): Likewise.
7908         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7909         using TLSDESC GOT.
7910         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7911         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7912         (Target_x86_64::got_tlsdesc_section): New function.
7913         (Target_x86_64::got_section): Create space for GOT entries for
7914         TLSDESC relocations.
7915         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7916         R_386_TLS_GOTDESC.
7917         (Target_x86_64::Scan::global): Likewise.
7918         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7919         using TLSDESC GOT.
7920
7921 2010-08-02  Ian Lance Taylor  <iant@google.com>
7922
7923         * testsuite/final_layout.sh: Use dc to convert from hex to
7924         decimal.
7925
7926 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7927
7928         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7929         paramter to the call to gold::gc_process_relocs.
7930         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7931         paramter to the call to gold::gc_process_relocs.
7932         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7933         parameter to the call to gold::gc_process_relocs.
7934         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7935         template parameter to the call to gold::gc_process_relocs.
7936         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7937         paramter to the call to gold::gc_process_relocs.
7938         * gc.h (get_embedded_addend_size): New function.
7939         (gc_process_relocs): Save the size of the reloc for use by ICF.
7940         * icf.cc (get_section_contents): Get the addend from the text section
7941         for SHT_REL relocation sections.
7942         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7943         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7944         * int_encoding.h (read_from_pointer): New overloaded function.
7945         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7946         * testsuite/icf_sht_rel_addend_test.sh: New file.
7947         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7948         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7949
7950 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7951
7952         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7953         * Makefile.in: Regenerate.
7954         * testsuite/Makefile.in: Regenerate.
7955
7956 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7957
7958         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7959         * gold/testsuite/debug_msg.cc: Likewise.
7960         * gold/testsuite/odr_violation1.cc
7961         * gold/testsuite/odr_violation2.cc
7962
7963 2010-07-21  Cary Coutant  <ccoutant@google.com>
7964
7965         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7966         string, and length fields.
7967         (Output_merge_string::Merged_strings_list): New type.
7968         (Output_merge_string::Merged_strings_lists): New typedef.
7969         (Output_merge_string): Replace merged_strings_ with
7970         merged_strings_lists_.
7971         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7972         Merged_strings_list per input object and section.  Don't store pointer
7973         to the string.  Don't store length with each merged string entry.
7974         (Output_merge_string::finalize_merged_data): Loop over list of merged
7975         strings lists.  Recompute length of each merged string.
7976
7977 2010-07-15  Cary Coutant  <ccoutant@google.com>
7978
7979         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7980         here.
7981
7982 2010-07-14  Ian Lance Taylor  <iant@google.com>
7983
7984         * descriptors.cc (Descriptors::open): Report correct name in error
7985         message.
7986
7987 2010-07-13  Doug Kwan  <dougkwan@google.com>
7988
7989         * arm.cc (Arm_input_section::Arm_input_section): For a
7990         SHT_ARM_EXIDX section, always keeps the input sections.
7991         (Arm_input_section::set_exidx_section_link): New method.
7992         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7993         has_errors_ to false.
7994         (Arm_exidx_input_section::has_errors,
7995         Arm_exidx_input_section::set_has_errors): New methods.
7996         (Arm_exidx_input_section::has_errors_): New data member.
7997         (Arm_relobj::get_exidx_shndx_list): New method.
7998         (Arm_output_section::append_text_sections_to_list): Do not skip
7999         section without SHF_EXECINSTR.
8000         (Arm_output_section::fix_exidx_coverage): Skip input sections with
8001         errors.
8002         (Arm_relobj::make_exidx_input_section): Add new parameter for text
8003         section header.  Make error messages more verbose.  Check for
8004         a non-executable section linked to an EXIDX section.
8005         (Arm_relobj::do_read_symbols): Remove error checking, which has been
8006         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
8007         check that there is no deferred EXIDX section if we exit early.
8008         Instead of not making an EXIDX section in case of an error, make one
8009         and set the has_errors flag of it.
8010         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
8011         in a relocatable link.
8012         (Target_arm::do_relax): Look for the EXIDX output section instead of
8013         assuming that it is called .ARM.exidx.
8014         (Target_arm::fix_exidx_coverage): Add a new parameter for input
8015         section list.  Do not check for SHF_EXECINSTR section flags but
8016         skip any input section with errors.
8017         * output.cc (Output_section::Output_section): Initialize
8018         always_keeps_input_sections_ to false.
8019         (Output_section::add_input_section): Check for
8020         always_keeps_input_sections_.
8021         *  output.h (Output_section::always_keeps_input_sections,
8022         Output_section::set_always_keeps_input_sections): New methods.
8023         (Output_section::always_keeps_input_sections): New data member.
8024
8025 2010-07-13  Rafael Espindola  <espindola@google.com>
8026
8027         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
8028         * fileread.h (Input_file): Add try_extra_search_path and find_file.
8029
8030 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
8031             Ian Lance Taylor  <iant@google.com>
8032
8033         * output.h (Output_section_lookup_maps::add_merge_section):
8034         Correct check of whether value was inserted.
8035         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8036         (Output_section_lookup_maps::add_relaxed_input_section):
8037         Likewise.
8038         * arm.cc (Target_arm::got_section): Remove used local os.
8039         * i386.cc (Target_i386::got_section): Likewise.
8040         * x86_64.cc (Target_x86_64::got_section): Likewise.
8041         * sparc.cc (Target_sparc::got_section): Likewise.
8042         (Target_sparc::relocate): Remove unused local have_got_offset.
8043         * powerpc.cc (Target_powerpc::relocate): Likewise.
8044
8045 2010-07-13  Ian Lance Taylor  <iant@google.com>
8046
8047         * compressed_output.cc (zlib_decompress): Fix signature in
8048         !HAVE_ZLIB_H case.
8049
8050         * archive.cc (Archive::include_member): Unlock an external member
8051         of a thin archive.  Don't bother to delete an object we know is
8052         NULL.
8053
8054 2010-07-12  Cary Coutant  <ccoutant@google.com>
8055
8056         * compressed_output.cc (zlib_decompress): New function.
8057         (get_uncompressed_size): New function.
8058         (decompress_input_section): New function.
8059         * compressed_output.h (get_uncompressed_size): New function.
8060         (decompress_input_section): New function.
8061         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8062         Handle compressed debug sections.
8063         * layout.cc (is_compressed_debug_section): New function.
8064         (Layout::output_section_name): Map compressed section names to
8065         canonical names.
8066         * layout.h (is_compressed_debug_section): New function.
8067         (is_debug_info_section): Recognize compressed debug sections.
8068         * merge.cc: Include compressed_output.h.
8069         (Output_merge_data::do_add_input_section): Handle compressed
8070         debug sections.
8071         (Output_merge_string::do_add_input_section): Handle compressed
8072         debug sections.
8073         * object.cc: Include compressed_output.h.
8074         (Sized_relobj::Sized_relobj): Initialize new data members.
8075         (build_compressed_section_map): New function.
8076         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8077         * object.h (Object::section_is_compressed): New method.
8078         (Object::do_section_is_compressed): New method.
8079         (Sized_relobj::Compressed_section_map): New type.
8080         (Sized_relobj::do_section_is_compressed): New method.
8081         (Sized_relobj::compressed_sections_): New data member.
8082         * output.cc (Output_section::add_input_section): Handle compressed
8083         debug sections.
8084         * reloc.cc: Include compressed_output.h.
8085         (Sized_relobj::write_sections): Handle compressed debug sections.
8086
8087 2010-07-08  Cary Coutant  <ccoutant@google.com>
8088
8089         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8090         weak when resolving to a dynamic def.
8091         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8092         for weak undef/dynamic def cases. Adjust callers.
8093         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8094         undef_binding_weak_.
8095         (Symbol_table::sized_write_globals): Adjust symbol binding.
8096         (Symbol_table::sized_write_symbol): Add binding parameter.
8097         * symtab.h (Symbol::set_undef_binding): New method.
8098         (Symbol::is_undef_binding_weak): New method.
8099         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8100         (Symbol_table::should_override): Add new parameter.
8101         (Symbol_table::sized_write_symbol): Add new parameter.
8102
8103         * testsuite/weak_undef_file1.cc: Add new test case.
8104         * testsuite/weak_undef_file2.cc: Fix header comment.
8105         * testsuite/weak_undef_test.cc: Add new test case.
8106
8107 2010-06-29  Doug Kwan  <dougkwan@google.com>
8108
8109         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8110         Initialize USE_SYMBOL_.
8111         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8112         definition.
8113         (Arm_reloc_property::uses_symbol_): New data member declaration.
8114         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8115         uses symbol value and symbol is undefined but not weakly undefined.
8116
8117 2010-06-28  Rafael Espindola  <espindola@google.com>
8118
8119         * plugin.cc (Plugin::load): Use dlerror.
8120
8121 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8122
8123         * symtab.cc (detect_odr_violations): When reporting an ODR
8124         violation, report an object where the symbol is defined.
8125
8126 2010-06-25  Doug Kwan  <dougkwan@google.com>
8127
8128         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8129         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8130         definition.
8131         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8132         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8133         target hook to detect function points.
8134         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8135         * icf.h (Icf::check_section_for_function_pointers): Change type of
8136         parameter SECTION_NAME to const reference to std::string.  Use
8137         target hook to determine if section may have unsafe pointers.
8138         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8139         method definition.
8140
8141 2010-06-21  Rafael Espindola  <espindola@google.com>
8142
8143         * fileread.cc (Input_file::find_fie): New
8144         (Input_file::open): Use Input_file::find_fie.
8145         * fileread.h (Input_file::find_fie): New
8146         * plugin.cc (set_extra_library_path): New.
8147         (Plugin::load): Add set_extra_library_path to the transfer vector.
8148         (Plugin_manager::set_extra_library_path): New.
8149         (Plugin_manager::add_input_file): Use the extra search path if set.
8150         (set_extra_library_path(): New.
8151         * plugin.h (Plugin_manager): Add set_extra_library_path and
8152         extra_search_path_.
8153
8154 2010-06-19  Cary Coutant  <ccoutant@google.com>
8155
8156         * layout.cc (gdb_sections): Add .debug_types.
8157         (lines_only_debug_sections): Likewise.
8158
8159 2010-06-18  Rafael Espindola  <espindola@google.com>
8160
8161         * plugin.cc (add_input_file,add_input_library)
8162         (Plugin_manager::add_input_file): Make filename arguments const.
8163         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8164         const.
8165
8166 2010-06-16  Doug Kwan  <dougkwan@google.com>
8167
8168         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8169         .ARM.attributes section if we have not merged any input
8170         attributes sections.
8171
8172 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8173
8174         * arm.cc: Allow combining objects with no EABI version
8175         information.
8176
8177 2010-06-15  Rafael Espindola  <espindola@google.com>
8178
8179         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8180
8181 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8182
8183         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8184         (struct iovec): Correct !HAVE_READV definition.
8185
8186 2010-06-10  Cary Coutant  <ccoutant@google.com>
8187
8188         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8189         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8190         reloc sections.
8191         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8192
8193         PR 11683
8194         * symtab.h (Symbol::is_placeholder): New member function.
8195         * target-reloc.h (relocate_section): Check for placeholder symbols.
8196
8197         * testsuite/Makefile.am (plugin_test_8): New test.
8198         (plugin_test_9): New test.
8199         * testsuite/Makefile.in: Regenerate.
8200
8201 2010-06-09  Nick Clifton  <nickc@redhat.com>
8202
8203         * yyscript.y (input_list_element): Allow strings prefixed with
8204         the '-' character.  Treat these as libraries.
8205         * script.cc (script_add_library): New function.  Adds a library
8206         specified by "-l<name>" found in an input script.
8207         * script-c.h: Add prototype for script_add_library.
8208
8209 2010-06-07  Doug Kwan  <dougkwan@google.com>
8210
8211         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8212         Restrict stub-group size to be within long conditional branch
8213         range when working around cortex-A8 erratum.
8214
8215 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8216
8217         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8218         #ifdef typo.
8219
8220 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8221
8222         PR gold/11658
8223         * output.cc
8224         (Output_section::Input_section_sort_entry::compare_section_ordering):
8225         Change to return non-zero correctly.
8226         (Output_section::Input_section_sort_section_order_index_compare
8227         ::operator()): Change to fix ambiguity in comparisons.
8228
8229 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8230
8231         * gold.h (is_wildcard_string): New function.
8232         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8233         (Layout::layout_eh_frame): Ditto.
8234         (Layout::find_section_order_index): New method.
8235         (Layout::read_layout_from_file): New method.
8236         * layout.h (Layout::find_section_order_index): New method.
8237         (Layout::read_layout_from_file): New method.
8238         (Layout::input_section_position_): New private member.
8239         (Layout::input_section_glob_): New private member.
8240         * main.cc (main): Call read_layout_from_file here.
8241         * options.h (--section-ordering-file): New option.
8242         * output.cc (Output_section::input_section_order_specified_): New
8243         member.
8244         (Output_section::Output_section): Initialize new member.
8245         (Output_section::add_input_section): Add new parameter.
8246         Keep input sections when --section-ordering-file is used.
8247         (Output_section::set_final_data_size): Sort input sections when
8248         section ordering file is specified.
8249         (Output_section::Input_section_sort_entry): Add new parameter.
8250         Check sorting type.
8251         (Output_section::Input_section_sort_entry::compare_section_ordering):
8252         New method.
8253         (Output_section::Input_section_sort_compare::operator()): Change to
8254         consider section_order_index.
8255         (Output_section::Input_section_sort_init_fini_compare::operator()):
8256         Change to consider section_order_index.
8257         (Output_section::Input_section_sort_section_order_index_compare
8258         ::operator()): New method.
8259         (Output_section::sort_attached_input_sections): Change to sort
8260         according to section order when specified.
8261         (Output_section::add_input_section<32, true>): Add new parameter.
8262         (Output_section::add_input_section<64, true>): Add new parameter.
8263         (Output_section::add_input_section<32, false>): Add new parameter.
8264         (Output_section::add_input_section<64, false>): Add new parameter.
8265         * output.h (Output_section::add_input_section): Add new parameter.
8266         (Output_section::input_section_order_specified): New
8267         method.
8268         (Output_section::set_input_section_order_specified): New method.
8269         (Input_section::Input_section): Initialize section_order_index_.
8270         (Input_section::section_order_index): New method.
8271         (Input_section::set_section_order_index): New method.
8272         (Input_section::section_order_index_): New member.
8273         (Input_section::Input_section_sort_section_order_index_compare): New
8274         struct.
8275         (Output_section::input_section_order_specified_): New member.
8276         * script-sections.cc (is_wildcard_string): Delete and move modified
8277         method to gold.h.
8278         (Output_section_element_input::Output_section_element_input): Modify
8279         call to is_wildcard_string.
8280         (Output_section_element_input::Input_section_pattern
8281         ::Input_section_pattern): Ditto.
8282         (Output_section_element_input::Output_section_element_input): Ditto.
8283         * testsuite/Makefile.am (final_layout): New test case.
8284         * testsuite/Makefile.in: Regenerate.
8285         * testsuite/final_layout.cc: New file.
8286         * testsuite/final_layout.sh: New file.
8287
8288 2010-06-01  Rafael Espindola  <espindola@google.com>
8289
8290         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8291
8292 2010-06-01  Rafael Espindola  <espindola@google.com>
8293
8294         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8295         visibility of symbols.
8296
8297 2010-05-27  Doug Kwan  <dougkwan@google.com>
8298
8299         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8300         from start of output section instead of address for a local symbol
8301         in a merged or relaxed section when doing a relocatable link.
8302
8303 2010-05-26  Rafael Espindola  <espindola@google.com>
8304
8305         PR 11604
8306         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8307         adding sections the garbage collector removed.
8308         * gold/testsuite/Makefile.am: Add test.
8309         * gold/testsuite/Makefile.in: Regenerate.
8310         * gold/testsuite/plugin_test_7.sh: New.
8311         * gold/testsuite/plugin_test_7_1.c: New.
8312         * gold/testsuite/plugin_test_7_2.c: New.
8313
8314 2010-05-26  Rafael Espindola  <espindola@google.com>
8315
8316         * script-sections.cc (Output_section_definition::set_section_addresses):
8317         Check for --section-start.
8318
8319 2010-05-26  Doug Kwan  <dougkwan@google.com>
8320
8321         * arm.cc (Arm_scan_relocatable_relocs): New class.
8322         (Target_arm::relocate_special_relocatable): New method.
8323         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8324         (Arm_relocate_functions::thumb_branch_common): Same.
8325         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8326         instead of Default_scan_relocatable_relocs.
8327         * target-reloc.h (relocate_for_relocatable): Let target handle
8328         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8329         * target.h (Sized_target::relocate_special_relocatable): New method.
8330
8331 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8332
8333         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8334
8335 2010-05-23  Doug Kwan  <dougkwan@google.com>
8336
8337         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8338         instead of a cast.
8339         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8340         with a direct branch, not a conditional branch, to a stub.
8341         * merge.cc (Output_merge_base::record_input_section): New method
8342         defintion.
8343         (Output_merge_data::do_add_input_section): Record input section if
8344         keeps-input-sections flag is set.
8345         (Output_merge_string::do_add_input_section): Ditto.
8346         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8347         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8348         INPUT_SECTIONS_.
8349         (Output_merge_base::keeps_input_sections,
8350         Output_merge_base::set_keeps_input_sections,
8351         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8352         method definitions.
8353         (Output_merge_base::Input_sections): New type declaration.
8354         (Output_merge_base::input_sections_begin,
8355         Output_merge_base::input_sections_end,
8356         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8357         (Output_merge_base::bool keeps_input_sections_,
8358         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8359         Output_merge_base::input_sections_): New data members.
8360         (Output_merge_data::do_set_keeps_input_sections): New method
8361         defintion.
8362         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8363         * output.cc (Output_section::Input_section::relobj): Move method
8364         defintion from class declaration to here and handle merge sections.
8365         (Output_section::Input_section::shndx): Ditto.
8366         (Output_section::Output_section): Remove initializations of removed
8367         data members and initialize new data member LOOKUP_MAPS_.
8368         (Output_section::add_input_section): Set keeps-input-sections flag
8369         for a newly created merge output section as appropriate.  Adjust code
8370         to use Output_section_lookup_maps class.
8371         (Output_section::add_relaxed_input_section): Adjst code for lookup
8372         maps code refactoring.
8373         (Output_section::add_merge_input_section): Add a new parameter
8374         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8375         class.  If adding input section to a newly created merge output
8376         section fails, remove the new merge section.
8377         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8378         Adjust code for use of the Output_section_lookup_maps class.
8379         (Output_section::find_merge_section): Ditto.
8380         (Output_section::build_lookup_maps): New method defintion.
8381         (Output_section::find_relaxed_input_section): Adjust code to use
8382         Output_section_lookup_maps class.
8383         (Output_section::get_input_sections): Export merge sections.  Adjust
8384         code to use Output_section_lookup_maps class.
8385         (Output_section:::add_script_input_section): Adjust code to use
8386         Output_section_lookup_maps class.  Update lookup maps for merge
8387         sections also.
8388         (Output_section::discard_states): Use Output_section_lookup_maps.
8389         (Output_section::restore_states): Same.
8390         * output.h (Merge_section_properties): Move class defintion out of
8391         Output_section.
8392         (Output_section_lookup_maps): New class.
8393         (Output_section::Input_section::is_merge_section): New method
8394         defintion.
8395         (Output_section::Input_section::relobj): Move defintion out of class
8396         defintion.  Declare method only.
8397         (Output_section::Input_section::shndx): Ditto.
8398         (Output_section::Input_section::output_merge_base): New method defintion.
8399         (Output_section::Input_section::u2_.pomb): New union field.
8400         (Output_section::Merge_section_by_properties_map,
8401         Output_section::Output_section_data_by_input_section_map,
8402         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8403         Remove types.
8404         (Output_section::add_merge_input_section): Add new parameter
8405         KEEPS_INPUT_SECTIONS.
8406         (Output_section::build_lookup_maps): New method declaration.
8407         (Output_section::merge_section_map_,
8408         Output_section::merge_section_by_properties_map_,
8409         Output_section::relaxed_input_section_map_,
8410         Output_section::is_relaxed_input_section_map_valid_): Remove data
8411         members.
8412         (Output_section::lookup_maps_): New data member.
8413
8414 2010-05-21  Doug Kwan  <dougkwan@google.com>
8415
8416         PR gold/11619
8417         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8418         avoid a compilation error.
8419
8420 2010-05-19  Rafael Espindola  <espindola@google.com>
8421
8422         * script-sections.cc (Output_section_definition::allocate_to_segment):
8423         Update the phdrs_list even when the output section is NULL.
8424         * testsuite/Makefile.am: Add test.
8425         * testsuite/Makefile.in: Regenerate.
8426         * testsuite/script_test_9.cc: New.
8427         * testsuite/script_test_9.sh: New.
8428         * testsuite/script_test_9.t: New.
8429
8430 2010-05-19  Doug Kwan  <dougkwan@google.com>
8431
8432         * arm.cc (Arm_input_section::original_size): New method.
8433         (Arm_input_section::do_addralign): Add a cast.
8434         (Arm_input_section::do_output_offset): Remove static cast.
8435         (Arm_input_section::original_addralign,
8436          Arm_input_section::original_size_): Change type to uint32_t.
8437         (Arm_input_section::init): Add safe casts for section alignment
8438         and size.
8439         (Arm_input_section::set_final_data_size): Do not set address and
8440         offset of stub table.
8441         (Arm_output_section::fix_exidx_coverage): Change use of of
8442         Output_section::Simple_input_section to that of
8443         Output_section::Input_section.
8444         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8445         except for the first pass.
8446         * output.cc (Output_section::get_input_sections): Change type of
8447         input_sections to std::list<Input_section>.
8448         (Output_section::add_script_input_section): Rename from
8449         Output_section::add_simple_input_section.  Change type of SIS
8450         parameter from Simple_input_section to Input_section.
8451         * output.h (Output_section::Simple_input_section): Remove class.
8452         (Output_section::Input_section): Change class visibility to public.
8453         (Output_section::Input_section::addralign): Use stored alignments
8454         for special input sections if set.
8455         (Output_section::Input_section::set_addralign): New method.
8456         (Output_section::get_input_sections): Change parameter type from
8457         list of Simple_input_section to list of Input_section.
8458         (Output_section::add_script_input_section): Rename from
8459         Output_section::add_simple_input_section. Change first parameter's
8460         type from Simple_input_section to Input_section and remove the
8461         second and third parameters.
8462         * script-sections.cc (Input_section::Input_section_list): Change
8463         type to list of Output_section::Input_section/
8464         (Input_section_info::Input_section_info): Change parameter type of
8465         INPUT_SECTION to Output_section::Input_section.
8466         (Input_section_info::input_section): Change return type.
8467         (Input_section_info::input_section_): Change type to
8468         Output_section::Input_section.
8469         (Output_section_element_input::set_section_addresses): Adjust code
8470         to use Output_section::Input_section instead of
8471         Output_section::Simple_input_section.  Adjust code for renaming
8472         of Output_section::add_simple_input_section.
8473         (Orphan_output_section::set_section_addresses): Ditto.
8474
8475 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8476
8477         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8478         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8479
8480 2010-05-18  Rafael Espindola  <espindola@google.com>
8481
8482         * options.cc (General_options::finalize): Handle -nostdlib.
8483         * options.h (nostdlib): New option.
8484         * script.cc (script_add_search_dir): Handle -nostdlib.
8485
8486 2010-05-12  Doug Kwan  <dougkwan@google.com>
8487
8488         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8489         attributes section only if there no attributes section after merging.
8490         (Target_arm::merge_object_attributes): Move value of
8491         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8492         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8493         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8494         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8495         and arm_attr_merge_7.stdout.
8496         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8497         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8498         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8499         arm_attr_merge_7b.o): New rules.
8500         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8501         arm_attr_merge_7
8502         * testsuite/Makefile.in: Regenerate.
8503         * testsuite/arm_attr_merge.sh: New file.
8504         * testsuite/arm_attr_merge_[67][ab].s: Same.
8505
8506 2010-05-05  Nick Clifton  <nickc@redhat.com>
8507
8508         * po/es.po: Updated Spanish translation.
8509
8510 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8511
8512         * Makefile.am (install-exec-local): Properly install gold as
8513         default cross linker.
8514         * Makefile.in: Regenerated.
8515
8516 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8517             Nick Clifton  <nickc@redhat.com>
8518
8519         * configure.ac (install_as_default): Define and set to false
8520         unless --enable-gold or --enable-gold=both/gold has been
8521         specified.
8522         * configure: Regenerate.
8523
8524         * Makefile.am (install-exec-local): Install the executable as
8525         'ld.gold'.  If install_as_default is true then also install it as
8526         'ld'.
8527         * Makefile.in: Regenerated.
8528
8529 2010-04-24  Ian Lance Taylor  <iant@google.com>
8530
8531         * layout.cc (Layout::layout_reloc): In relocatable link don't
8532         combine reloc sections for grouped sections.
8533
8534 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8535
8536         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8537         sections that are not ordinary to icf.
8538         * icf.cc (get_section_contents): Handle relocation pointing to section
8539         with no object or shndx information.
8540         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8541         * testsuite/Makefile.in: Regenerate.
8542         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8543         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8544
8545 2010-04-22  Ian Lance Taylor  <iant@google.com>
8546
8547         * expression.cc (Expression::Expression_eval_info): Add
8548         result_alignment_pointer field.
8549         (Expression::eval_with_dot): Add result_alignment_pointer
8550         parameter.  Change all callers.
8551         (Expression::eval_maybe_dot): Likewise.
8552         (class Binary_expression): Add alignment_pointer parameter to
8553         left_value and right_value.  Change all callers.
8554         (BINARY_EXPRESSION): Set result alignment.
8555         (class Trinary_expression): Add alignment_pointer parameter to
8556         arg2_value and arg3_value.  Change all callers.
8557         (Trinary_cond::value): Set result alignment.
8558         (Max_expression::value, Min_expression::value): Likewise.
8559         (Align_expression::value): Likewise.
8560         * script-sections.cc (class Sections_element): Add dot_alignment
8561         parameter to set_section_addresses virtual function.  Update
8562         instantiations.
8563         (class Output_section_element): Likewise.
8564         (Script_sections::create_segments): Add dot_alignment parameter.
8565         Change all callers.
8566         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8567         (Script_sections::set_phdrs_clause_addresses): Likewise.
8568         * script-sections.h: Update declarations.
8569         * script.h: Update declarations.
8570         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8571         min_p_align.
8572         * testsuite/script_test_3.t: Set large alignment.
8573         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8574         segment has expected alignment.
8575
8576 2010-04-22  Nick Clifton  <nickc@redhat.com>
8577
8578         * po/gold.pot: Updated by the Translation project.
8579         * po/vi.po: Updated Vietnamese translation.
8580
8581 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8582
8583         * testsuite/Makefile.am (check_PROGRAMS): Add
8584         icf_virtual_function_folding_test.
8585         * testsuite/Makefile.in: Regenerated.
8586
8587 2010-04-15  Andrew Haley  <aph@redhat.com>
8588
8589         * options.h (merge_exidx_entries): New option.
8590         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8591         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8592         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8593         (Target_arm::merge_exidx_entries): New function.
8594         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8595         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8596         to Arm_exidx_fixup constructor.
8597         Add new arg, merge_exidx_entries.
8598         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8599         Arm_output_section::fix_exidx_coverage.
8600
8601 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8602
8603         * icf.cc (get_section_contents): Check for preemptible functions.
8604         Ignore addend when appropriate.
8605         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8606         section folded.
8607         (add_from_relobj): Check for section folded.
8608         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8609         * symtab.h (should_add_dynsym_entry): Add new parameter.
8610         * target-reloc.h (scan_relocs): Check for section folded.
8611         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8612         Check reloc types for function pointers in shared objects.
8613         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8614         case.
8615         (icf_preemptible_functions_test): New test case.
8616         (icf_string_merge_test): New test case.
8617         * testsuite.Makefile.in: Regenerate.
8618         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8619         bar_glob.  Refactor code.
8620         * testsuite/icf_preemptible_functions_test.cc: New file.
8621         * testsuite/icf_preemptible_functions_test.sh: New file.
8622         * testsuite/icf_string_merge_test.cc: New file.
8623         * testsuite/icf_string_merge_test.sh: New file.
8624         * testsuite/icf_virtual_function_folding_test.cc: New file.
8625         * testsuite/icf_virtual_function_folding_test.sh: New file.
8626
8627 2010-04-14  Doug Kwan  <dougkwan@google.com>
8628
8629         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8630         for local symbol recounting if we remove a section due to ICF.
8631         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8632         there are no regular objects in input.
8633
8634 2010-04-13  Doug Kwan  <dougkwan@google.com>
8635
8636         * arm.cc (Arm_input_section::set_final_data_size): Compute
8637         accurate final data size instead of using current data size.
8638
8639 2010-04-09  Doug Kwan  <dougkwan@google.com>
8640
8641         * layout.cc (Layout::choose_output_section): Handle script section
8642         types.
8643         (Layout::make_output_section_for_script): Add section type parameter.
8644         Handle script section types.
8645         * layout.h (Layout::make_output_section_for_script): Add section
8646         type parameter.
8647         * output.cc (Output_section::Output_section): Initialize data member
8648         is_noload_.
8649         (Output_section::do_reset_address_and_file_offset): Do not set address
8650         to 0 if section is a NOLOAD section.
8651         * output.h (Output_section::is_noload): New method.
8652         (Output_section::set_is_noload): Ditto.
8653         (Output_section::is_noload_): New data member.
8654         * script-c.h (Script_section_type): New enum type.
8655         (struct Parser_output_section_header): Add new file section_type.
8656         * script-sections.cc (Sections_element::output_section_name): Add
8657         parameter for returning script section type.
8658         (Output_section_definition::output_section_name): Ditto.
8659         (Output_section_definition::section_type)P; New method.
8660         (Output_section_definiton::script_section_type_name): Ditto.
8661         (Output_section_definition::script_section_type_): New data member.
8662         (Output_section_definition::Output_section_definition): Initialize
8663         data member Output_section_definition::script_section_type_.
8664         (Output_section_definition::create_sections): Pass script section type
8665         to Layout::make_output_section_for_script.
8666         (Output_section_definition::output_section_name): Return script
8667         section type to caller.
8668         (Output_section_definition::set_section_address): Do not advance
8669         dot value and load address if section type is NOLOAD.  Set address
8670         of NOLOAD sections regardless of section flags.
8671         (Output_section_definition::print): Print section type if it is
8672         not SCRIPT_SECTION_TYPE_NONE.
8673         (Output_section_definition::section_type): New method.
8674         (Output_section_definition::script_section_type_name): Ditto.
8675         (Script_sections::output_section_name): Add new parameter
8676         PSECTION_TYPE for returning script section type.  Pass it to
8677         section elements.  Handle discard sections.
8678         (Sort_output_sections::operator()): Handle NOLOAD sections.
8679         * script-sections.h (Script_sections::Section_type): New enum type.
8680         (Script_sections::output_section_name): Add a new parameter for
8681         returning script section type.
8682         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8683         INFO and NOLOAD.
8684         * yyscript.y (union): Add new field SECTION_TYPE.
8685         (COPY, DSECT, INFO, NOLOAD): New tokens.
8686         (opt_address_and_section_type): Change type to output_section_header.
8687         (section_type): New non-terminal
8688         (section_header): Handle section type.
8689         (opt_address_and_section_type): Return section type value.
8690
8691 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8692
8693         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8694         * testsuite/plugin_common_test_2.c (foo): Likewise.
8695
8696 2010-04-08  Doug Kwan  <dougkwan@google.com>
8697
8698         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8699         Output_merge_data.
8700         * output.cc (Output_section::add_merge_input_section): Simplify
8701         code and return status of Output_merge_base::add_input_section.
8702         Update merge section map only if Output_merge_base::add_input_section
8703         returns true.
8704
8705 2010-04-07  Doug Kwan  <dougkwan@google.com>
8706
8707         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8708         if section is marked as containing instructions but has no mapping
8709         symbols.
8710         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8711         correct section index.
8712         (Arm_relobj::find_linked_text_section): Ditto.
8713
8714 2010-04-07  Cary Coutant  <ccoutant@google.com>
8715
8716         * archive.cc (include_member): Destroy Read_symbols_data object before
8717         releasing file.
8718         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8719         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8720         (Read_symbols_data::~Read_symbols_data) New destructor.
8721         (Section_relocs::Section_relocs) New constructor.
8722         (Section_relocs::~Section_relocs) New destructor.
8723         (Read_relocs_data::Read_relocs_data) New constructor.
8724         (Read_relocs_data::~Read_relocs_data) New destructor.
8725         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8726         pointers to NULL after deleting.
8727
8728 2010-04-07  Doug Kwan  <dougkwan@google.com>
8729
8730         * arm.cc: Replace "endianity" with "endianness" in comments.
8731         (Arm_exidx_cantunwind): Ditto.
8732         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8733         (Arm_relobj::merge_flags_and_attributes): New method.
8734         (Arm_relobj::merge_flags_and_attributes_): New data member.
8735         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8736         (Arm_relobj::scan_sections_for_stubs): Ditto.
8737         (Arm_relobj::do_read_symbols): Check to see if we really want to
8738         merge processor-specific flags and attributes.  Exit early if
8739         an object is empty except for section names and the undefined symbol.
8740         (Target_arm::do_finalize_sections): Move check for ELF format to
8741         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8742         attributes from a regular object only when we have determined that
8743         it is aapropriate.  Do not create an .ARM.attributes section in
8744         output if there is no regular input object.
8745         (Target_arm::merge_processor_specific_flags): Check
8746         --warn-mismatch before printing any error.
8747         (Target_arm::merge_object_attributes): Ditto.
8748         * gold.cc (queue_middle_tasks): Handle the case in which there is
8749         no regular object in input.
8750         * options.cc (General_options::parse_EB): New method.
8751         (General_options::parse_EL): Same.
8752         (General_options::General_options): Initialize endianness_.
8753         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8754         New options.
8755         (General_options::Endianness): New enum.
8756         (General_options::endianness): New method.
8757         (General_options::endianness_): New data member.
8758         * parameters.cc (Parameters::set_options): Check target endianness.
8759         (Parameters::set_target_once): Ditto.
8760         (Parameters::check_target_endianness): New method.
8761         (parameters_force_valid_target): If either -EL or -EB is specified,
8762         use it to define endianness of default target.
8763         * parameters.h (Parameters::check_target_endianness): New method
8764         declaration.
8765         * target.h (class Target): Change "endianity" to "endianness"
8766         in comments.
8767
8768 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8769
8770         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8771         * configure: Regenerate.
8772         * Makefile.in: Regenerate.
8773         * testsuite/Makefile.in: Regenerate.
8774
8775 2010-04-06  Cary Coutant  <ccoutant@google.com>
8776
8777         gcc PR lto/42757
8778         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8779         prevailing definitions of common symbols.
8780         * testsuite/plugin_test_6.sh: New test case.
8781         * testsuite/plugin_common_test_1.c: New test case.
8782         * testsuite/plugin_common_test_2.c: New test case.
8783         * testsuite/Makefile.am (plugin_test_6): New test case.
8784         * testsuite/Makefile.in: Regenerate.
8785
8786 2010-04-06  Nick Clifton  <nickc@redhat.com>
8787
8788         * po/vi.po: New Vietnamese translation.
8789
8790 2010-03-30  Doug Kwan  <dougkwan@google.com>
8791
8792         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8793
8794 2010-03-25  Doug Kwan  <dougkwan@google.com>
8795
8796         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8797         to avoid a conversion warning on a 32-bit host.
8798
8799 2010-03-24  Ian Lance Taylor  <iant@google.com>
8800
8801         * testsuite/script_test_3.t: Add a TLS segment.
8802         * testsuite/Makefile.am (check_PROGRAMS): Add
8803         tls_phdrs_script_test.
8804         (tls_phdrs_script_test_SOURCES): Define.
8805         (tls_phdrs_script_test_DEPENDENCIES): Define.
8806         (tls_phdrs_script_test_LDFLAGS): Define.
8807         (tls_phdrs_script_test_LDADD): Define.
8808         * testsuite/Makefile.in: Rebuild.
8809
8810 2010-03-23  Cary Coutant  <ccoutant@google.com>
8811
8812         * fileread.cc (find_or_make_view): Fix comment.
8813
8814 2010-03-23  Ian Lance Taylor  <iant@google.com>
8815
8816         * script-sections.cc (class Orphan_section_placement): Define
8817         PLACE_TLS and PLACE_TLS_BSS.
8818         (Orphan_section_placement::Orphan_section_placement): Initialize
8819         new places.
8820         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8821         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8822         (tls_script_test_SOURCES): Define.
8823         (tls_script_test_DEPENDENCIES): Define.
8824         (tls_script_test_LDFLAGS): Define.
8825         (tls_script_test_LDADD): Define.
8826         * testsuite/Makefile.in: Rebuild.
8827
8828 2010-03-22  Doug Kwan  <dougkwan@google.com>
8829
8830         * arm.cc (Arm_relocate_functions::abs8,
8831         Arm_relocate_functions::abs16): Use correct check for overflow
8832         specified in the ARM ELF specs.
8833         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8834         target of a BLX instruction specially.
8835         (Reloc_stub::stub_type_for_reloc): Ditto.
8836         (Relocate::relocate): Use symbolic names instead of numeric relocation
8837         codes to report error.
8838         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8839         workaround.
8840         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8841         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8842         thumb2_blx_out_of_range.stdout
8843         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8844         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8845         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8846         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8847         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8848         thumb2_blx_in_range, thumb2_blx_in_range.o,
8849         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8850         thumb2_blx_out_of_range.o): New rules.
8851         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8852         thumb2_blx_in_range and thumb2_blx_out_of_range.
8853         * testsuite/Makefile.in: Regenerate.
8854         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8855         * testsuite/thumb_blx_in_range.s: New file.
8856         * testsuite/thumb_blx_out_of_range.s: New file.
8857
8858 2010-03-22  Rafael Espindola  <espindola@google.com>
8859
8860         * archive.cc (Should_include): Move to archive.h.
8861         (should_include_member): Make it a member of Archive.
8862         (Lib_group): New.
8863         (Add_lib_group_symbols): New.
8864         * archive.h: Include options.h.
8865         (Archive_member): Moved from Archive.
8866         (Should_include): Moved from archive.cc.
8867         (Lib_group): New.
8868         (Add_lib_group_symbols): New.
8869         * dynobj.cc (do_should_include_member): New.
8870         * dynobj.h (do_should_include_member): New.
8871         * gold.cc (queue_initial_tasks): Update call to queue.
8872         * main.cc (main): Print lib group stats.
8873         * object.cc (do_should_include_member): New.
8874         * object.h: Include archive.h.
8875         (Object::should_include_member): New.
8876         (Object::do_should_include_member): New.
8877         (Sized_relobj::do_should_include_member): New.
8878         * options.cc (General_options::parse_start_lib): New.
8879         (General_options::parse_end_lib): New.
8880         (Input_arguments::add_file): Handle lib groups.
8881         (Input_arguments::start_group): Check we are not in a lib.
8882         (Input_arguments::start_lib): New.
8883         (Input_arguments::end_lib): New.
8884         * options.h (General_options): Add start_lib and end_lib.
8885         (Input_argument::lib_): New.
8886         (Input_argument::lib): New.
8887         (Input_argument::is_lib): New.
8888         (Input_file_lib): New.
8889         (Input_arguments::in_lib_): New.
8890         (Input_arguments::in_lib): New.
8891         (Input_arguments::start_lib): New.
8892         (Input_arguments::end_lib_): New.
8893         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8894         in unused members as preempted.
8895         (Sized_pluginobj::do_should_include_member): New.
8896         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8897         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8898         return the blocker.
8899         (Read_symbols::do_whole_lib_group): New.
8900         (Read_symbols::do_lib_group): New.
8901         (Read_symbols::do_read_symbols): Handle lib groups.
8902         (Read_symbols::get_name): Handle lib groups.
8903         * readsyms.h (Read_symbols): Add an archive member pointer.
8904         (Read_symbols::do_whole_lib_group): New.
8905         (Read_symbols::do_lib_group): New.
8906         (Read_symbols::member_): New.
8907         * script.cc (read_input_script): Update call to queue_soon.
8908
8909 2010-03-19  Doug Kwan  <dougkwan@google.com>
8910
8911         * arm.cc (Stub_table::Stub_table): Initialize new data members
8912         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8913         (Stub_table::add_reloc_stub): Assign stub offset and update
8914         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8915         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8916         New data members.
8917         (Stub_table::update_data_size_and_addralign): Use
8918         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8919         instead of going over all reloc stubs.
8920         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8921         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8922         Stringpool_template::offset_ to size of Stringpool_char.
8923         (Stringpool_template::new_key_offset): Remove code to initialize
8924         Stringpool_template::offset_.
8925         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8926         Stringpool_template::offset_ to zero.
8927
8928 2010-03-15  Doug Kwan  <dougkwan@google.com>
8929
8930         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8931         offset_.
8932         (Stringpool_template::new_key_offset): New method.
8933         (Stringpool_template::add_string): Assign offsets when adding new
8934         strings.
8935         (Stringpool_template::set_string_offsets): Do not set string offsets
8936         when not optimizing.
8937         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8938         member size_.
8939         (Chunked_vector::clear): Clear size_.
8940         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8941         (Chunked_vector::size): Return size_.
8942         (Chunked_vector::push_back): Use size_ to find insert position.
8943         (Chunked_vector::size_): New data member.
8944         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8945         (Stringpool_template::new_key_offset): New method declaration.
8946         (Stringpool_template::offset_): New data member.
8947
8948 2010-03-15   Rafael Espindola  <espindola@google.com>
8949
8950         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8951         Add_symbols' constructor.
8952         * readsyms.h (Add_symbols): Remove the input_group member.
8953
8954 2010-03-10  Ian Lance Taylor  <iant@google.com>
8955
8956         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8957         target to ask whether a reference to a symbol requires a stack
8958         split.
8959         * target.h (Target::is_call_to_non_split): New function.
8960         (Target::do_is_call_to_non_split): Declare virtual function.
8961         * target.cc: Include "symtab.h".
8962         (Target::do_is_call_to_non_split): New function.
8963         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8964
8965 2010-03-10  Cary Coutant  <ccoutant@google.com>
8966
8967         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8968         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8969         (File_read::open[2]): Add whole_file_view_ to list of views.
8970         (File_read::make_view): Remove test of whole_file_view_.
8971         (File_read::find_or_make_view): Create whole_file_view_ if
8972         necessary.
8973         (File_read::clear_views): Replace bool parameter with enum;
8974         adjust all callers.  Don't delete views with permanent data;
8975         do delete cached views and views from archives if
8976         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8977         if clearing the corresponding view.
8978         * fileread.h (File_read::Clear_views_mode): New enum.
8979         (File_read::View::is_permanent_view): New method.
8980         (File_read::clear_views): Replace bool parameter
8981         with enum; adjust all callers.
8982         * options.h (General_options): Change keep_files_mapped option;
8983         add map_whole_files.
8984         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8985         releasing the file.
8986         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8987         the file.
8988
8989 2010-03-10  David S. Miller  <davem@davemloft.net>
8990
8991         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8992
8993 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8994
8995         * icf.cc (get_section_contents): Add '@' marker after processing the
8996         merge reloc.
8997
8998 2010-03-08  Doug Kwan  <dougkwan@google.com>
8999
9000         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
9001         due to a conversion warning.
9002         (Arm_relobj::update_output_local_symbol_count): Check for local
9003         symbol with unset output index.
9004
9005 2010-03-05  Ian Lance Taylor  <iant@google.com>
9006
9007         * options.h (class General_options): Add --spare-dynamic-tags.
9008         * output.cc (Output_data_dynamic::set_final_data_size): Implement
9009         --spare-dynamic-tags.
9010
9011 2010-03-05  Ian Lance Taylor  <iant@google.com>
9012
9013         * incremental.cc: Include "libiberty.h".
9014
9015 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
9016
9017         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
9018         function, is_info_ member.
9019         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
9020         (Versions::Versions): Update caller.
9021         (Versions::define_base_version): Likewise.
9022         (Versions::add_def): Likewise.
9023
9024 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
9025
9026         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
9027         (Scan::possible_function_pointer_reloc): New function.
9028         (Scan::local_reloc_may_be_function_pointer): Change to call
9029         possible_function_pointer_reloc.
9030         (Scan::global_reloc_may_be_function_pointer): Ditto.
9031         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9032         relocations in ".data.rel.ro._ZTV" section.
9033         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9034         * testsuite/icf_safe_so_test.cc: Ditto.
9035         * testsuite/icf_safe_test.cc: Ditto.
9036         * testsuite/icf_safe_test.sh: Ditto.
9037
9038 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9039             Ian Lance Taylor  <iant@google.com>
9040
9041         * target-reloc.h (relocate_section): Check the symbol table index
9042         for -1U before setting the local symbol index.
9043         (scan_relocatable_relocs): If copying the relocation, record that
9044         the local symbol is required.
9045         * object.h (Symbol_value::is_output_symtab_index_set): New
9046         function.
9047         (Symbol_value::may_be_discarded_from_output_symtab): New
9048         function.
9049         (Symbol_value::has_output_symtab_entry): New function.
9050         (Symbol_value::needs_output_symtab_entry): Remove.
9051         (Symbol_value::output_symtab_index): Make sure the symbol index is
9052         set.
9053         (Symbol_value::set_output_symtab_index): Make sure the symbol
9054         index is not set.  Make sure the new index is valid.
9055         (Symbol_value::set_must_have_output_symtab_entry): New function.
9056         (Symbol_value::has_output_dynsym_entry): New function.
9057         (Symbol_value::set_output_dynsym_index): Make sure the new index
9058         is valid.
9059         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9060         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9061         local symbol if permitted.
9062         (Sized_relobj::do_finalize_local_symbols): Call
9063         is_output_symtab_index_set rather than needs_output_symtab_entry.
9064         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9065         rather than needs_output_symtab_entry.  Call
9066         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9067         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9068         is_output_symtab_index_set rather than needs_output_symtab_entry.
9069         * testsuite/discard_locals_relocatable_test.c: New file.
9070         * testsuite/discard_locals_test.sh: Test -r.
9071         * testsuite/Makefile.am (check_DATA): Add
9072         discard_locals_relocatable_test1.syms,
9073         discard_local_relocatable_test2.syms.
9074         (MOSTLYCLEANFILES): Likewise.  Also add
9075         discard_locals_relocatable_test1.lout and
9076         discard_locals_relocatable_test2.out.
9077         (discard_locals_relocatable_test1.syms): New target.
9078         (discard_locals_relocatable_test.o): New target.
9079         (discard_locals_relocatable_test1.out): New target.
9080         (discard_locals_relocatable_test2.syms): New target.
9081         (discard_locals_relocatable_test2.out): New target.
9082         (various): Add missing ../ld-new dependencies.
9083         * testsuite/Makefile.in: Rebuild.
9084
9085 2010-03-03  Nick Clifton  <nickc@redhat.com>
9086
9087         * po/fi.po: New Finnish translation.
9088
9089 2010-03-01  Doug Kwan  <dougkwan@google.com>
9090
9091         * layout.cc (Layout::Layout): Force section types of .init_array*,
9092         .preinit_array* and .fini_array* sections.
9093         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9094         Fix check of return value of std::string::find.().
9095         (Output_section::Input_section_sort_compare::operator()): Remove
9096         comment about .init_array.
9097         (Output_section::Input_section_sort_init_fini_compare::operator()):
9098         New method.
9099         (Output_section::sort_attached_input_sections): Handle .init_array
9100         and .fini_array specially.
9101         * output.h (Output_section::Inut_section_sort_compare): Update
9102         comment.
9103         (Output_section::Input_section_sort_init_fini_compare): New struct.
9104
9105 2010-02-26  Doug Kwan  <dougkwan@google.com>
9106
9107         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9108         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9109         * testsuite/debug_msg.sh: Avoid matching source line number for
9110         use of global variable undef_int.
9111
9112 2010-02-26  Doug Kwan  <dougkwan@google.com>
9113
9114         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9115         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9116         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9117         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9118         * options.cc (General_options::General_options): Initialize member
9119         fix_v4bx_.
9120         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9121         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9122         and rm_no_fix_v4bx.stdout
9123         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9124         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9125         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9126         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9127         and arm_no_fix_v4bx.
9128         * Makefile.in: Regenerate.
9129         * testsuite/arm_fix_v4bx.s: New file.
9130         * testsuite/arm_fix_v4bx.sh: Ditto.
9131
9132 2010-02-24  Doug Kwan  <dougkwan@google.com>
9133
9134         * arm.cc (Target_arm::got_section): Make the .got section the first
9135         non RELRO section in the data segment.
9136         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9137         suffixes of section names.
9138
9139 2010-02-24  Doug Kwan  <dougkwan@google.com>
9140
9141         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9142         flags and attributes merging if an input file is a binary file.
9143         * fileread.cc (Input_file::open): Record format of original file.
9144         * fileread.h (Input_file::Format): New enum type.
9145         (Input_file::Input_file): Initialize data member format_.
9146         (Input_file::format): New method definition.
9147         (Input_file::format_):: New data member.
9148
9149 2010-02-24  Doug Kwan  <dougkwan@google.com>
9150
9151         * arm.cc (Arm_output_data_got): New class.
9152         (ARM_TCB_SIZE): New constant
9153         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9154         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9155         If user uses a script with a SECTIONS clause, issue only a warning
9156         for a misplaced EXIDX input section.  Otherwise, issue an error.
9157         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9158         garbage collection.
9159         (Target_arm::got_mode_index_entry): Handle static linking.
9160         (Target_arm::Scan::local): Ditto.
9161         (Target_arm::Scan::global): Ditto.
9162         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9163         all incorrectly implemented relocations.
9164         (Target_arm::fix_exidx_coverage): Pass layout to
9165         Arm_output_section::fix_exidx_coverage.
9166         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9167         from ".ARM.exidx." and ".ARM.extab.".
9168
9169 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9170
9171         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9172         section if it does not already exist.
9173         * attributes.cc (Attributes_section_data::Attributes_section_data):
9174         Don't crash if size is zero.
9175
9176 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9177             Ian Lance Taylor  <iant@google.com>
9178
9179         * gold.cc (queue_middle_tasks): If no input files were opened,
9180         exit.
9181         * workqueue.h (Task_function::Task_function): Assert that there is
9182         a blocker.
9183
9184 2010-02-22  Doug Kwan  <dougkwan@google.com>
9185
9186         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9187         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9188         types to avoid warnings due to different uint64_t implementations
9189         on different hosts.
9190
9191 2010-02-21  Doug Kwan  <dougkwan@google.com>
9192
9193         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9194         handling of the maximum backward branch offset.
9195         (Arm_relocate_functions::thumb_branch_common): Ditto.
9196         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9197         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9198         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9199         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9200         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9201         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9202         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9203         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9204         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9205         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9206         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9207         thumb2_bl_out_of_range.o): New rules.
9208         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9209         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9210         thumb2_bl_out_of_range
9211         * testsuite/Makefile.in: Regenerate.
9212         * testsuite/arm_bl_in_range.s: New file.
9213         * testsuite/arm_bl_out_of_range.s: Ditto.
9214         * testsuite/arm_branch_in_range.sh: Ditto.
9215         * testsuite/arm_branch_range.t: Ditto.
9216         * testsuite/thumb2_branch_range.t: Ditto.
9217         * testsuite/thumb_bl_in_range.s: Ditto.
9218         * testsuite/thumb_bl_out_of_range.s: Ditto.
9219         * testsuite/thumb_branch_range.t: Ditto.
9220
9221 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9222
9223         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9224         Add reloc offset information.
9225         * icf.cc (get_section_contents): Change iterators to point to the new
9226         vectors. Add reloc offset information to the contents.
9227         * icf.h (Icf::Sections_reachable_info): New typedef.
9228         (Icf::Sections_reachable_list): New typedef.
9229         (Icf::Offset_info): New typedef.
9230         (Icf::Reloc_info): New struct typedef.
9231         (Icf::Reloc_info_list): New typedef.
9232         (Icf::symbol_reloc_list): Delete method.
9233         (Icf::addend_reloc_list): Delete method.
9234         (Icf::section_reloc_list): Delete method.
9235         (Icf::reloc_info_list): New method.
9236         (Icf::reloc_info_list_): New member.
9237
9238 2010-02-19  Doug Kwan  <dougkwan@google.com>
9239
9240         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9241         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9242         * arm.cc (Arm_relocation_functions): New forward declaration.
9243         (Target_arm::Target_arm): Initialize new data members
9244         got_mod_index_offset_ and tls_base_symbol_defined_.
9245         (Target_arm::Relocate::relocate_tls): New method.
9246         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9247          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9248         New methods.
9249         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9250         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9251         (Target_arm::got_mod_index_offset_,
9252         Target_arm::tls_base_symbol_defined_): New data members.
9253         (Target_arm::Scan::local, Target::Scan::global,
9254         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9255         relocations.
9256
9257 2010-02-18  Doug Kwan  <dougkwan@google.com>
9258
9259         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9260         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9261         text section as a parameter becuase some broken tools may not set
9262         the link in section header.
9263         (Target_arm::has_got_section): New method.
9264         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9265         without any mapping symbol as data only.  Remove warning.
9266         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9267         link in its section header, try to discover the link by inspecting the
9268         REL31 relocation at the beginning of the section.
9269         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9270         in error message.
9271         (Target_arm::Scan::global): Treat any reference to the symbol
9272         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9273
9274 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9275
9276         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9277         (Scan::global_reloc_may_be_function_pointer): New function.
9278         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9279         (Scan::global_reloc_may_be_function_pointer): New function.
9280         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9281         (Scan::global_reloc_may_be_function_pointer): New function.
9282         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9283         (Scan::global_reloc_may_be_function_pointer): New function.
9284         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9285         (Scan::global_reloc_may_be_function_pointer): New function.
9286         (Scan::possible_function_pointer_reloc): New function.
9287         (Target_x86_64::can_check_for_function_pointers): New function.
9288         * gc.h (gc_process_relocs): Scan relocation types to determine if
9289         function pointers were taken for targets that support it.
9290         * icf.cc (Icf::find_identical_sections): Include functions for
9291         folding in safe ICF whose pointer is not taken.
9292         * icf.h (Secn_fptr_taken_set): New typedef.
9293         (fptr_section_id_): New member.
9294         (section_has_function_pointers): New function.
9295         (set_section_has_function_pointers): New function.
9296         (check_section_for_function_pointers): New function.
9297         * options.h: Fix comment for safe ICF option.
9298         * target.h (can_check_for_function_pointers): New function.
9299         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9300         Modify icf_safe_test for X86-64.
9301         * testsuite/Makefile.in: Regenerate.
9302         * testsuite/icf_safe_so_test.cc: New file.
9303         * testsuite/icf_safe_so_test.sh: New file.
9304         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9305         (main): Change to take pointer to function kept_func_3.
9306         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9307         folding is done correctly for X86-64.
9308
9309 2010-02-12  David S. Miller  <davem@davemloft.net>
9310
9311         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9312         is_symbolless parameter.
9313         (Output_reloc<SHT_REL>::is_symbolless): New.
9314         (Output_reloc<SHT_REL>::is_symbolless_): New.
9315         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9316         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9317         (Output_reloc<SHT_RELA>::is_symbolless): New.
9318         (Output_data_reloc::add_global): Handle is_symbolless.
9319         (Output_data_reloc::add_global_relative): Likewise.
9320         (Output_data_reloc::add_local): Likewise.
9321         (Output_data_reloc::add_local_relative): Likewise.
9322         (Output_data_reloc::add_symbolless_global_addend): New.
9323         (Output_data_reloc::add_symbolless_local_addend): New.
9324         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9325         is_symbolless.
9326         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9327         instead of ->is_relative_
9328         (Output_reloc::write): Likewise.
9329         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9330         (Output_reloc::write_rel): Simplify.
9331
9332         * sparc.cc (Target_sparc::Scan::local): Use
9333         ->add_symbolless_local_addend as needed.
9334         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9335         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9336         based upon relocation offset.
9337
9338 2010-02-11  Doug Kwan  <dougkwan@google.com>
9339
9340         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9341         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9342         beginning of function.
9343         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9344         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9345         parameter is_32bit in calls to should_apply_static_reloc.
9346         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9347         (check_DATA): Add arm_abs_global.stdout.
9348         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9349         arm_abs_global.stdout): New rules.
9350         (MOSTLLYCLEANFILES): Add arm_abs_global
9351         * Makefile.in: Regenerate.
9352         * testsuite/arm_abs_global.s: New file.
9353         * testsuite/arm_abs_global.sh: Ditto.
9354         * testsuite/arm_abs_lib.s: Ditto.
9355
9356 2010-02-11  Ian Lance Taylor  <iant@google.com>
9357
9358         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9359         Read_relocs task.
9360         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9361         Allocate_commons_task first.
9362         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9363         task, rather than symtab_lock_.
9364         (Gc_process_relocs::~Gc_process_relocs): New function.
9365         (Gc_process_relocs::is_runnable): Check this_blocker_.
9366         (Gc_process_relocs::locks): Use next_blocker_ rather than
9367         blocker_.
9368         (Scan_relocs::~Scan_relocs): New function.
9369         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9370         symtab_lock_.
9371         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9372         next_blocker_.
9373         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9374         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9375         constructor accordingly.
9376         (class Gc_process_relocs): Likewise.
9377         (class Scan_relocs): Likewise.
9378         * common.h (class Allocate_commons_task): Remove symtab_lock_
9379         field, and corresponding constructor parameter.
9380         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9381         symtab_lock_.
9382         (Allocate_commons_task::locks): Likewise.
9383
9384 2010-02-11  Ian Lance Taylor  <iant@google.com>
9385
9386         * gold-threads.h (class Once): Define.
9387         (class Initialize_lock): Rewrite as child of Once.
9388         * gold-threads.cc (class Once_initialize): Define.
9389         (once_pointer_control): New static variable.
9390         (once_pointer, once_arg): New static variables.
9391         (c_run_once): New static function.
9392         (Once::Once, Once::run_once, Once::internal_run): New functions.
9393         (class Initialize_lock_once): Remove.
9394         (initialize_lock_control): Remove.
9395         (initialize_lock_pointer): Remove.
9396         (initialize_lock_once): Remove.
9397         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9398         (Initialize_lock::initialize): Rewrite.
9399         (Initialize_lock::do_run_once): New function.
9400         * archive.cc (Archive::interpret_header): Only clear name if it is
9401         not already empty.
9402         * fileread.cc: Include "gold-threads.h"
9403         (file_counts_lock): New static variable.
9404         (file_counts_initialize_lock): Likewise.
9405         (File_read::release): Only increment counts when using --stats.
9406         Use a lock around the increment.
9407         * parameters.cc (class Set_parameters_target_once): Define.
9408         (set_parameters_target_once): New static variable.
9409         (Parameters::Parameters): Move here from parameters.h.
9410         (Parameters::set_target): Rewrite.
9411         (Parameters::set_target_once): New function.
9412         (Parameters::clear_target): Move here and rewrite.
9413         * parameters.h (class Parameters): Update declarations.  Add
9414         set_parameters_target_once_ field.
9415         (Parameters::Parameters): Move to parameters.cc.
9416         (Parameters::clear_target): Likewise.
9417         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9418         task.
9419         (Start_group::~Start_group): New function.
9420         (Start_group::is_runnable): New function.
9421         (Start_group::locks, Start_group::run): New functions.
9422         (Finish_group::run): Change saw_undefined to size_t.
9423         * readsyms.h (class Start_group): Define.
9424         (class Finish_group): Change saw_undefined_ field to size_t.
9425         (Finish_group::Finish_group): Remove saw_undefined and
9426         this_blocker parameters.  Change all callers.
9427         (Finish_group::set_saw_undefined): New function.
9428         (Finish_group::set_blocker): New function.
9429         * symtab.h (class Symbol_table): Change saw_undefined to return
9430         size_t.  Change saw_undefined_ field to size_t.
9431         * target-select.cc (Set_target_once::do_run_once): New function.
9432         (Target_selector::Target_selector): Initialize set_target_once_
9433         field.  Don't initialize lock_ and initialize_lock_ fields.
9434         (Target_selector::instantiate_target): Rewrite.
9435         (Target_selector::set_target): New function.
9436         * target-select.h (class Set_target_once): Define.
9437         (class Target_selector): Update declarations.  Make
9438         Set_target_once a friend.  Remove lock_ and initialize_lock_
9439         fields.  Add set_target_once_ field.
9440
9441 2010-02-10  Ian Lance Taylor  <iant@google.com>
9442
9443         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9444         queueing any tasks.
9445         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9446         (queue_middle_tasks): Add all blockers before queueing any tasks.
9447         (queue_final_tasks): Likewise.
9448         * token.h (Task_token::add_blockers): New function.
9449         * object.h (Input_objects::number_of_relobjs): New function.
9450
9451 2010-02-10  Ian Lance Taylor  <iant@google.com>
9452
9453         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9454         shared, not if not position independent.
9455         * x86_64.cc (Relocate::relocate_tls): Likewise.
9456         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9457         (tls_pie_pic_test): New target.
9458         * testsuite/Makefile.in: Rebuild.
9459
9460         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9461         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9462         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9463         * testsuite/Makefile.in: Rebuild.
9464
9465 2010-02-09  David S. Miller  <davem@davemloft.net>
9466
9467         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9468         R_SPARC_RELATIVE using ->add_local_relative().
9469         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9470
9471         * output.h (Output_data_dynamic::add_section_size): New method
9472         that takes two Output_data objects.
9473         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9474         entry param.  Handle it in initializers.
9475         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9476         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9477         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9478         arg.
9479         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9480         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9481         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9482         for dynrel_includes_plt.
9483         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9484         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9485         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9486         before .rela.plt
9487         (Target_sparc::do_finalize_sections): Update to pass true for
9488         dynrel_includes_plt.
9489         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9490         output before .rela.plt
9491         (Target_powerpc::do_finalize_sections): Update to pass true for
9492         dynrel_includes_plt when 32-bit.
9493
9494 2010-02-08  Doug Kwan  <dougkwan@google.com>
9495
9496         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9497         method.
9498         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9499         Arm_relobj::scan_section_for_cortex_a8_stubs,
9500         Arm_relobj::do_relocation_section): Instead of calling
9501         Output_section::output_address, use faster
9502         Arm_relobj::simple_input_section_output_address.
9503
9504 2010-02-08  David S. Miller  <davem@davemloft.net>
9505
9506         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9507         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9508         relocation helper function.
9509
9510         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9511         just like R_SPARC_GOT{10,13,22}.
9512         (Target_sparc::Scan::local): Likewise.
9513         (Target_sparc::Relocate:relocate): Likewise.
9514
9515 2010-02-06  Ian Lance Taylor  <iant@google.com>
9516
9517         * configure.ac: Rewrite targetobjs duplicate removal code to use
9518         only shell constructs.
9519         * configure: Rebuild.
9520
9521 2010-02-05  Doug Kwan  <dougkwan@google.com>
9522
9523         PR 11247
9524         * arm.cc (Arm_relobj::section_is_scannable): New method.
9525         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9526         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9527
9528 2010-02-04  Doug Kwan  <dougkwan@google.com>
9529
9530         PR 11247
9531         * arm-reloc-property.cc (cstdio): Include.
9532         * configure.ac (targetobjs): Remove duplicates.
9533         * configure: Regenerate.
9534         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9535         big and little endian version for a given address size.
9536
9537 2010-02-03  Doug Kwan  <dougkwan@google.com>
9538
9539         * arm-reloc-property.cc
9540         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9541         definition.
9542         * arm-reloc-property.h
9543         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9544         New method definition.
9545         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9546         declaration.
9547         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9548         overflow to N.
9549         (GOT_PREL): Change implemented to Y.
9550         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9551         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9552         (Arm_relocate_functions::movw_abs_nc): Remove method.
9553         (Arm_relocate_functions::movt_abs): Ditto.
9554         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9555         (Arm_relocate_functions::thm_movt_abs): Ditto.
9556         (Arm_relocate_functions::movw_rel_nc): Ditto.
9557         (Arm_relocate_functions::movw_rel): Ditto.
9558         (Arm_relocate_functions::movt_rel): Ditto.
9559         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9560         (Arm_relocate_functions:thm_movw_rel): Ditto.
9561         (Arm_relocate_functions:thm_movt_rel): Ditto.
9562         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9563         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9564         New method definitions.
9565         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9566         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9567         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9568         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9569         (Target_arm::Relocate::relocate): Check for non-static or
9570         unimplemented relocation code and exit early.  Change calls to
9571         Target_arm::reloc_uses_thumb_bit and
9572         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9573         instead.  Refactor code to handle similar relocations to increase
9574         code sharing.  Remove check for unsupported relocation code in switch
9575         statement.
9576         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9577         relocation property table to find out size.  Change error message to
9578         print out the name of a relocation code instead of the numeric value.
9579         (Target_arm::scan_reloc_for_stub): Use relocation property table
9580         instead of calling Target_arm::reloc_uses_thumb_bit().
9581
9582 2010-02-02  Doug Kwan  <dougkwan@google.com>
9583
9584         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9585         types of relaxed input section.
9586
9587 2010-02-02  Doug Kwan  <dougkwan@google.com>
9588
9589         * Makefile.am (HFILES): Add arm-reloc-property.h.
9590         (DEFFILES): New.
9591         (TARGETSOURCES): Add arm-reloc-property.cc
9592         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9593         (libgold_a_SOURCES): $(DEFFILES)
9594         * Makefile.in: Regenerate.
9595         * arm-reloc-property.cc: New file.
9596         * arm-reloc-property.h: New file.
9597         * arm-reloc.def: New file.
9598         * arm.cc: Update comments.
9599         (arm-reloc-property.h): New included header.
9600         (arm_reloc_property_table): New global variable.
9601         (Target_arm::do_select_as_default_target): New method definition.
9602         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9603         arm-reloc-property to targ_extra_obj.
9604         * parameters.cc (set_parameters_target): Call
9605         Target::select_as_default_target().
9606         * target.h (Target::select_as_default_target): New method definition.
9607         (Target::do_select_as_default_target): Same.
9608
9609 2010-02-01  Doug Kwan  <dougkwan@google.com>
9610
9611         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9612         first_output_text_section_.
9613         (Arm_exidx_fixup::first_output_text_section): New method definition.
9614         (Arm_exidx_fixup::first_output_text_section_): New data member.
9615         (Arm_exidx_fixup::process_exidx_section): Record the first text
9616         output section seen.
9617         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9618         and entsize in output section header.
9619
9620 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9621
9622         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9623         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9624         (Arm_relocate_functions::thm_alu11): New Method.
9625         (Arm_relocate_functions::thm_pc8): New Method.
9626         (Arm_relocate_functions::thm_pc12): New Method.
9627         (Target_arm::Scan::local): Handle the relocations.
9628         (Target_arm::Scan::global): Likewise.
9629         (Target_arm::Relocate::relocate): Likewise.
9630         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9631
9632 2010-01-29  Doug Kwan  <dougkwan@google.com>
9633
9634         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9635         of relocation types as ld.
9636
9637 2010-01-29  Doug Kwan  <dougkwan@google.com>
9638
9639         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9640         to public.
9641         (Arm_relocate_functions::thumb_branch_common): Ditto.
9642         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9643         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9644         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9645         Arm_relocate_functions::jump24): Remove.
9646         (Target_arm::Relocate::relocate): Adjust code to call
9647         Arm_relocation_functions::arm_branch_common and
9648         Arm_relocation_functions::thumb_branch_common instead of their removed
9649         wrappers.  Merge switch-cases together to reduce source code size.
9650
9651 2010-01-29  Doug Kwan  <dougkwan@google.com>
9652
9653         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9654         output_local_symbol_count_needs_update_.
9655         (Arm_relobj::output_local_symbol_count_needs_update,
9656          Arm_relobj::set_output_local_symbol_count_needs_update,
9657          Arm_relobj::update_output_local_symbol_count): New methods.
9658         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9659         member.
9660         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9661         of pointed function as in a R_ARM_PREL31 relocation.
9662         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9663         for output local symbol count updating.
9664         (Target_arm::do_relax): Update output local symbol counts in objects
9665         if necessary.
9666         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9667
9668 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9669
9670         * arm.cc: Added support for the ARM relocations:
9671         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9672         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9673         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9674         movw_prel_nc).
9675         (Arm_relocate_functions::movw_rel): New method.
9676         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9677         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9678         thm_movw_prel_nc).
9679         (Arm_relocate_functions::thm_movw_rel): New method.
9680         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9681         thm_movt_prel).
9682         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9683         relocations.
9684         (Target_arm::Scan::global): Likewise.
9685         (Target_arm::Relocate::relocate): Likewise.
9686         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9687         Likewise.
9688
9689 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9690
9691         * arm.cc: Added support for ARM group relocations.
9692         (Target_arm::reloc_needs_sym_origin): New method.
9693         (Arm_relocate_functions::calc_grp_kn): New method.
9694         (Arm_relocate_functions::calc_grp_residual): New method.
9695         (Arm_relocate_functions::calc_grp_gn): New method.
9696         (Arm_relocate_functions::arm_grp_alu): New Method.
9697         (Arm_relocate_functions::arm_grp_ldr): New Method.
9698         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9699         (Arm_relocate_functions::arm_grp_ldc): New Method.
9700         (Target_arm::Scan::local): Handle the ARM group relocations.
9701         (Target_arm::Scan::global): Likewise.
9702         (Target_arm::Relocate::relocate): Likewise.
9703         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9704         Likewise.
9705
9706 2010-01-26  Doug Kwan  <dougkwan@google.com>
9707
9708         * arm.cc (set): Include.
9709         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9710         pointer type.
9711         (Arm_output_section::Text_section_list): New type.
9712         (Arm_output_section::append_text_sections_to_list): New method.
9713         (Arm_output_section::fix_exidx_coverage): Ditto.
9714         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9715         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9716         Relobj::set_section_offset() instead of
9717         Sized_relobj::invalidate_section_offset().
9718         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9719         parameter for section headers. Ignore relocation sections for
9720         unallocated sections and EXIDX sections.
9721         (Target_arm::fix_exidx_coverage): New method.
9722         (Target_arm::output_section_address_less_than): New type.
9723         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9724         linked text section instead of the EXIDX section.
9725         (Arm_output_section::create_stub_group): Add an assertion to check
9726         that this is not an EXIDX output section.
9727         (Arm_output_section::append_text_sections_to_list): New method.
9728         (Arm_output_section::fix_exidx_coverage): Ditto.
9729         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9730         Arm_relobj::section_needs_reloc_stub_scanning.
9731         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9732         first pass.
9733         (Target_arm::fix_exidx_coverage): New method.
9734         * object.h (Relobj::set_output_section): New method.
9735         (Sized_relobj::invalidate_section_offset): Remove method.
9736         (Sized_relobj::do_invalidate_section_offset): Remove method.
9737         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9738
9739 2010-01-25  Doug Kwan  <dougkwan@google.com>
9740
9741         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9742         Fix warning due to signed and unsigned comparison on a 32-bit host.
9743
9744 2010-01-22  Doug Kwan  <dougkwan@google.com>
9745
9746         * arm.cc (Target_arm::do_relax): Record an output section for section
9747         offset adjustment it contains any stub table that has changed.
9748         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9749         offsets in an output section if necessary.
9750         * output.cc (Output_section::Output_section): Initialize
9751         section_offsets_need_adjustments_.
9752         (Output_section::add_input_section_for_script): Renamed to
9753         Output_section::add_simple_input_section.
9754         (Output_section::save_states): Add a comment.
9755         (Output_section::discard_states): New method defintion.
9756         (Output_section::adjust_section_offsets): Same.
9757         * output.h (Output_section::add_input_section_for_script): Renamed to
9758         Output_section::add_simple_input_section.
9759         (Output_section::discard_states): New method declaration.
9760         (Output_section::adjust_section_offsets): Same.
9761         (Output_section::section_offsets_need_adjustment,
9762         Output_section::set_section_offsets_need_adjustment): New method
9763         definitions.
9764         (Output_section::section_offsets_need_adjustment_): New data member.
9765         * script-sections.cc
9766         (Output_section_element_input::set_section_address): Adjust code for
9767         renaming of Output_section::add_input_section_for_script.
9768         (Orphan_output_section::set_section_address): Same.
9769
9770 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9771
9772         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9773         Fix_v4bx enum values .
9774         * gold/options.h (General_options): New option definitions.
9775         (General_options::fix_v4bx): New method.
9776         (General_options::Fix_v4bx): New enum.
9777         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9778         (General_options::parse_fix_v4bx_interworking): New method.
9779
9780 2010-01-22  Doug Kwan  <dougkwan@google.com>
9781
9782         * arm.cc (Arm_exidx_fixup): New class.
9783
9784 2010-01-21  Doug Kwan  <dougkwan@google.com>
9785
9786         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9787         classes.
9788         (Arm_exidx_section_offset_map): New type.
9789
9790 2010-01-21  Doug Kwan  <dougkwan@google.com>
9791
9792         * arm.cc (Arm_exidx_input_section): New class.
9793         (Arm_relobj::exidx_input_section_by_link,
9794         Arm_relobj::exidx_input_section_by_shndx,
9795         Arm_relobj::make_exidx_input_section): New methods.
9796         (read_arm_attributes_section): Remove.
9797         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9798         information about them.
9799         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9800         to here.
9801
9802 2010-01-20  Doug Kwan  <dougkwan@google.com>
9803
9804         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9805         Input_section_specifier to Section_id.
9806         (Target_arm::new_arm_input_section: Adjust code for change of key
9807         type.
9808         (Target_arm::find_arm_input_section): Ditto.
9809         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9810         (Section_id): Remove.
9811         (Garbage_collection::Section_id_hash): Remove.
9812         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9813         (Section_id): Remove.
9814         (Icf::Section_id_hash): Remove.
9815         * object.h (Section_id, Const_section_id, Section_id_hash,
9816         Const_section_id_hash): New type definitions.
9817         * output.cc (Output_section::add_relaxed_input_section): Change to
9818         use Const_section_id instead of Input_section_specifier as key type.
9819         (Output_section::add_merge_input_section): Ditto.
9820         (Output_section::build_relaxation_map): Change to use Section_id
9821         instead of Input_section_specifier as key type.
9822         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9823         Ditto.
9824         (Output_section::convert_input_sections_to_relaxed_sections): Change
9825         to use Const_section_id instead of Input_section_specifier as key type.
9826         (Output_section::find_merge_section): Ditto.
9827         (Output_section::find_relaxed_input_section): Ditto.
9828         * output.h (Input_section_specifier): Remove class.
9829         (Output_section::Output_section_data_by_input_section_map): Change
9830         key type to Const_section_id.
9831         (Output_section::Output_relaxed_input_section_by_input_section_map):
9832         Ditto.
9833         (Output_section::Relaxation_map): Change key type to Section_id.
9834
9835 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9836
9837         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9838         (class Arm_v4bx_stub): New class.
9839         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9840         (Stub_factory::make_arm_v4bx_stub): New method.
9841         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9842         (Stub_table::empty): Handle v4bx stubs.
9843         (Stub_table::add_arm_v4bx_stub): New method.
9844         (Stub_table::find_arm_v4bx_stub): New method.
9845         (Arm_relocate_functions::v4bx): New method.
9846         (Target_arm::fix_v4bx): New method.
9847         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9848         (Stub_table::relocate_stubs): Likewise.
9849         (Stub_table::do_write): Likewise.
9850         (Stub_table::update_data_size_and_addralign): Likewise.
9851         (Stub_table::finalize_stubs):  Likewise.
9852         (Target_arm::Scan::local): Likewise.
9853         (Target_arm::Scan::global): Likewise.
9854         (Target_arm::do_finalize_sections): Likewise.
9855         (Target_arm::Relocate::relocate): Likewise.
9856         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9857         Likewise.
9858         (Target_arm::scan_reloc_for_stub): Likewise.
9859         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9860
9861 2010-01-19  Ian Lance Taylor  <iant@google.com>
9862
9863         * output.cc (Output_section_headers::do_sized_write): Write large
9864         segment count to sh_info field.
9865         (Output_file_header::do_sized_write): For large segment count,
9866         write PN_XNUM to e_phnum field.
9867
9868 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9869
9870         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9871         (Arm_relocate_functions::thm_jump8): New function.
9872         (Arm_relocate_functions::thm_jump11): New function.
9873         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9874         R_ARM_THM_JUMP11.
9875         (Target_arm::Scan::global): Likewise.
9876         (Target_arm::Relocate::relocate): Likewise.
9877         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9878         Likewise.
9879
9880 2010-01-14  Doug Kwan  <dougkwan@google.com>
9881
9882         * arm.cc (map, utility): Include headers.
9883         (Target_arm::apply_cortex_a8_workaround): New method.
9884         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9885         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9886         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9887         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9888         the --[no-]fix-cortex-a8 command line options.
9889         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9890         (Target_arm::relocate_stub): Use addend in instruction template.
9891         * options.h (DEFINE_bool): Set the user-set flag.
9892         (General_options): Add --[no-]-fix-cortex options.
9893         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9894         : Update fast look-up map after conversion.
9895
9896 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9897
9898         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9899         in the first pass of do_layout.
9900
9901 2010-01-13  Doug Kwan  <dougkwan@google.com>
9902
9903         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9904         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9905         apparent compiler problem of not folding static constant integral
9906         data members of elfcpp::Elf_sizes<32>.
9907
9908 2010-01-13  Doug Kwan  <dougkwan@google.com>
9909
9910         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9911         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9912         Arm_relobj::scan_section_for_cortex_a8_erratum,
9913         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9914         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9915         sections to scan for relocation stubs into a new method
9916         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9917         relocation and Cortex-A8 stub scanning.
9918         (Target_arm::do_relax): Force stubs to be after stubbed sections
9919         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9920         the beginning of a new relaxation pass.  Update a comment.
9921         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9922
9923 2010-01-12  Ian Lance Taylor  <iant@google.com>
9924
9925         * target-reloc.h (visibility_error): New inline function.
9926         (relocate_section): Call visibility_error.
9927         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9928         (MOSTLYCLEANFILES): Likewise.
9929         (protected_4_pic.o, protected_3.err): New targets.
9930         * testsuite/protected_4.cc: New file.
9931
9932 2010-01-12  Doug Kwan  <dougkwan@google.com>
9933
9934         * arm.cc (Cortex_a8_reloc): New class.
9935         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9936         and cortex_a8_relocs_info_.
9937         (Target_arm::fix_cortex_a8): New method definition.
9938         (Target_arm::Cortex_a8_relocs_info): New type.
9939         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9940         New data member declarations.
9941         (Target_arm::scan_reloc_for_stub): Record information about
9942         relocations for THUMB branches that might be exempted from the
9943         Cortex-A8 workaround.
9944         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9945         at the beginning of a relaxation pass.
9946
9947 2010-01-12  Doug Kwan  <dougkwan@google.com>
9948
9949         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9950         (Arm_relobj::Mapping_symbol_position,
9951          Arm_reloj::Mapping_symbol_position_less,
9952          Arm_relobj::Mapping_symbols_info): New types.
9953         (Target_arm::is_mapping_symbol_name): New method definition.
9954         (Arm_relobj::do_count_local_symbols): Save information about mapping
9955         symbols.
9956
9957 2010-01-11  Doug Kwan  <dougkwan@google.com>
9958
9959         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9960         Arm_relocate_functions::thumb32_branch_upper,
9961         Arm_relocate_functions::thumb32_branch_lower,
9962         Arm_relocate_functions::thumb32_cond_branch_offset,
9963         Arm_relocate_functions::thumb32_cond_branch_upper,
9964         Arm_relocate_functions::thumb32_cond_branch_lower,
9965         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9966         branch offset encoding.
9967         (Arm_relocate_functions::thumb_branch_common): Use new branch
9968         offset encoding methods to avoid code duplication.
9969         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9970         (Stub_addend_reader::operator()): Use new branch encoding method
9971         to avoid code duplication.
9972
9973 2010-01-11  Doug Kwan  <dougkwan@google.com>
9974
9975         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9976         (Target_arm::do_finalize_sections): Define special EXIDX section
9977         symbols only if referenced.
9978         * gc.h (Garbage_collection::add_reference): New method.
9979         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9980         code duplication.
9981
9982 2010-01-11  Ian Lance Taylor  <iant@google.com>
9983
9984         * script.cc (Version_script_info::build_expression_list_lookup):
9985         Change complaing about duplicate wildcard match from error to
9986         warning.
9987
9988         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9989         of 2009-12-30.
9990         (Version_script_info::Version_script_info): Initialize globs_,
9991         default_version_, default_is_global_, and exact_.  Don't
9992         initialize globals_ or locals_.
9993         (Version_script_info::build_lookup_tables): Build local symbols
9994         first.
9995         (Version_script_info::unquote): New function.
9996         (Version_script_info::add_exact_match): New function.
9997         (Version_script_info::build_expression_list_lookup): Remove lookup
9998         parameter.  Add is_global parameter.  Change all callers.  Handle
9999         wildcard pattern specially.  Unquote pattern.  Call
10000         add_exact_match.
10001         (Version_script_info::get_name_to_match): New function.
10002         (Version_script_info::get_symbol_version): New function.
10003         (Version_script_info::get_symbol_version_helper): Remove.
10004         (Version_script_info::check_unmatched_names): Call unquote.
10005         * script.h (class Version_script_info): Change get_symbol_version
10006         to be non-inline and add is_global parameter; change all callers.
10007         Rewrite symbol_is_local.  Update declarations.  Define struct
10008         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
10009         Remove globals_ and locals_ members.  Add exact_, globs_,
10010         default_version_, is_global_.
10011         (Version_script_info::Glob): Remove pattern, add expression and
10012         is_global.  Update constructor.  Change all callers.
10013         * dynobj.cc (Versions::finalize): Mark the version symbol as the
10014         default version.
10015         (Versions::symbol_section_contents): If a symbol is undefined, or
10016         defined in a dynamic object, set the version index to
10017         VER_NDX_LOCAL.
10018         * symtab.cc (Symbol_table::add_from_relobj): Don't call
10019         symbol_is_local.
10020         (Symbol_table::add_from_pluginobj): Likewise.
10021         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
10022
10023 2010-01-11  Doug Kwan  <dougkwan@google.com>
10024
10025         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
10026         (incremental_dump_LDADD): Add linking option for libintl.
10027         * Makefile.in: Regenerate.
10028
10029 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
10030
10031         PR gold/11144
10032         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10033         instead of -Ds.
10034         * testsuite/Makefile.in: Regenerated.
10035
10036 2010-01-10  Doug Kwan  <dougkwan@google.com>
10037
10038         * options.h (DEFINE_var): Use parentheses around argument varname__
10039         in macro body to avoid any unintended subsequent substitutions.
10040
10041 2010-01-10  Ian Lance Taylor  <iant@google.com>
10042
10043         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10044         candidates before doing symbol resolution.
10045
10046         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10047         ODR candidates if only one is weak.
10048
10049 2010-01-08  Ian Lance Taylor  <iant@google.com>
10050
10051         * script.cc (Version_script_info::build_expression_list_lookup):
10052         Don't warn about ambiguous version, just record the ambiguity.
10053         (Version_script_info::get_symbol_version_helper): Give error if
10054         version is ambiguous.
10055
10056 2010-01-08  Doug Kwan  <dougkwan@google.com>
10057
10058         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10059         prev_data_size_ and prev_addralign_.  Remove initializer for
10060         deleted data member has_been_changed_.
10061         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10062         to determine if the table is empty.
10063         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10064         Remove.
10065         (Stub_table::add_reloc_stub): Define method in class definition
10066         instead of just declaring it there.
10067         (Stub_table::add_cortex_a8_stub): New method definition.
10068         (Stub_table::update_data_size_and_addralign): Ditto.
10069         (Stub_table::finalize_stubs): Ditto.
10070         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10071         (Stub_table::do_addralign_): Return address alignment in the
10072         (Stub_table::do_reset_address_and_file_offset): Define method in
10073         class definition instead of declaring it there.  Set current data
10074         size to be the data size of the previous pass.
10075         (Stub_table::set_final_data_size): Use current data size as the
10076         final data size.
10077         (Stub_table::relocate_stub): Change parameter type of stub from
10078         Reloc_stub pointer to Stub pointer.
10079         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10080         (Stub_table::Cortex_a8_stub_list): New typedef.
10081         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10082          Stub_table::prev_addralign_): New data member.
10083         (Arm_relobj::Arm_relobj): Initialize data member
10084         section_has_cortex_a8_workaround_.
10085         (Arm_relobj::section_has_cortex_a8_workaround,
10086          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10087          definitions.
10088         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10089         declarations.
10090         (Target_arm::relocate_stub): Change parameter type of stub from
10091         Reloc_stub pointer to Stub pointer.
10092         (Insn_template::size, Insn_template::alignment): Handle
10093         THUMB16_SPECIAL_TYPE.
10094         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10095          Stub_table::update_data_size_and_addralign,
10096          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10097         definitions.
10098         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10099         (Stub_table::do_write): Ditto.
10100         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10101
10102 2010-01-08  Ian Lance Taylor  <iant@google.com>
10103
10104         PR 11108
10105         * symtab.h (class Symbol): Remove fields is_target_special_ and
10106         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10107         (Symbol::is_defined_in_discarded_section): New function.
10108         (Symbol::set_is_defined_in_discarded_section): New function.
10109         (Symbol::has_plt_offset): Rewrite.
10110         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10111         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10112         Don't initialize is_target_special_ or has_plt_offset_.
10113         Initialize is_defined_in_discarded_section_.
10114         (Symbol_table::add_from_relobj): If appropriate, set
10115         is_defined_in_discarded_section.
10116         * resolve.cc (Symbol::override_base_with_special): Don't test
10117         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10118         * target-reloc.h (relocate_section): Do special handling for
10119         symbols defined in discarded sections for global symbols as well
10120         as local symbols.
10121
10122 2010-01-08  Ian Lance Taylor  <iant@google.com>
10123
10124         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10125         the SHT_SYMTAB case.
10126
10127 2010-01-08  Ian Lance Taylor  <iant@google.com>
10128
10129         * object.cc (Sized_relobj::do_layout): Don't get confused if
10130         layout_eh_frame returns NULL.
10131
10132 2010-01-08  Ian Lance Taylor  <iant@google.com>
10133
10134         PR 11084
10135         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10136         dynamic symbol table, use the normal symbol table.
10137         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10138         symbol table.
10139
10140 2010-01-08  Ian Lance Taylor  <iant@google.com>
10141
10142         PR 11072
10143         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10144         sections.
10145
10146 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10147
10148         * version.cc (print_version): Change to "Copyright 2010".
10149
10150 2010-01-08  Ian Lance Taylor  <iant@google.com>
10151
10152         PR 10287
10153         PR 11063
10154         * i386.cc (class Target_i386): Change return type of plt_section
10155         to be non-const.
10156         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10157         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10158         tls_desc_rel_ field.
10159         (Output_data_plt_i386::rel_tls_desc): New function.
10160         (Target_i386::rel_tls_desc_section): New function.
10161         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10162         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10163         R_386_TLS_DESC reloc in rel_tls_desc_section.
10164         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10165         Define struct Tlsdesc_info.
10166         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10167         (Target_x86_64::do_reloc_symbol_index): New function.
10168         (Target_x86_64::add_tlsdesc_info): New function.
10169         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10170         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10171         tlsdesc_rel_ field.
10172         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10173         all callers.
10174         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10175         (Target_x86_64::rela_tlsdesc_section): New function.
10176         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10177         handling.
10178         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10179         (Target_x86_64::do_reloc_addend): New function.
10180         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10181         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10182         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10183         (Output_reloc::type): New function.
10184         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10185         (Output_reloc::is_target_specific): New function.
10186         (Output_reloc::target_arg): New function.
10187         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10188         absolute relocs and target specific relocs.
10189         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10190         add_target_specific.
10191         (class Output_data_reloc) [SHT_RELA]: Likewise.
10192         * output.cc (Output_reloc::Output_reloc): Add four new versions
10193         for absolute relocs and target specific relocs.
10194         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10195         (Output_reloc::get_symbol_index): Likewise.
10196         (Output_reloc::local_section_offset): Check that local_sym_index_
10197         is not TARGET_CODE or 0.
10198         (Output_reloc::symbol_value): Likewise.
10199         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10200         reloc.
10201         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10202         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10203         functions.
10204         * layout.cc (add_target_dynamic_tags): Use output section for
10205         DT_PLTRELSZ and DT_JMPREL.
10206
10207 2010-01-07  Ian Lance Taylor  <iant@google.com>
10208
10209         PR 11061
10210         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10211         function.
10212         (class Output_data_reloc_generic): Define.
10213         (class Output_data_reloc_base): Change base class to
10214         Output_data_reloc_generic.  Change add() method to call
10215         bump_relative_reloc_count for a relative reloc.  Remove
10216         sort_relocs_ field.
10217         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10218         to sort_relocs().
10219         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10220         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10221         appropriate.
10222         * layout.h (class Layout): Update declaration.
10223
10224 2010-01-07  Ian Lance Taylor  <iant@google.com>
10225
10226         * output.h (class Output_data): Add const version of
10227         output_section and do_output_section.
10228         (class Output_section_data): Add const version of
10229         do_output_section.
10230         (class Output_section): Likewise.
10231         * layout.cc (Layout::add_target_dynamic_tags): New function.
10232         * layout.h (class Layout): Update declarations.
10233         * arm.cc (Target_arm::do_finalize_sections): Use
10234         add_target_dynamic_tags.
10235         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10236         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10237         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10238         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10239
10240 2010-01-07  Ian Lance Taylor  <iant@google.com>
10241
10242         PR 11042
10243         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10244         object as needed.
10245
10246 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10247             Ian Lance Taylor  <iant@google.com>
10248
10249         PR 11019
10250         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10251         Xindex::read_symtab_xindex.
10252
10253 2010-01-07  Doug Kwan  <dougkwan@google.com>
10254
10255         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10256         (Insn_template::thumb16_bcond_insn): New method declaration.
10257         (Insn_template): Fix spelling.
10258         (Stub::thumb16_special): New method declaration.
10259         (Stub::do_write): Define virtual method which was previously pure
10260         virtual.
10261         (Stub::do_thumb16_special): New method declaration.
10262         (Stub::do_fixed_endian_write): New template member.
10263         (Reloc_stub::do_write): Remove.
10264         (Reloc_stub::do_fixed_endian_write): Remove.
10265         (Cortex_a8_stub): New class definition.
10266         (Stub_factory::make_cortex_a8_stub): New method definition.
10267         (Stub_factory::Stub_factory): Add missing static storage class
10268         qualifier for elf32_arm_stub_a8_veneer_blx.
10269
10270 2010-01-07  Ian Lance Taylor  <iant@google.com>
10271
10272         PR 10980
10273         * options.h (class General_options): Add --warn-unresolved-symbols
10274         and --error-unresolved-symbols.
10275         * errors.cc (Errors::undefined_symbol): Implement
10276         --warn-unresolved-symbols.
10277
10278         * options.h (class General_options): Add -z text and -z textoff.
10279         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10280
10281 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10282
10283         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10284         (Garbage_collection::cident_sections): New function.
10285         (Garbage_collection::add_cident_section): New function.
10286         (Garbage_collection::cident_sections_): New member.
10287         (gc_process_relocs): Add references to sections whose names are C
10288         identifiers.
10289         * gold.h (cident_section_start_prefix): New constant.
10290         (cident_section_stop_prefix): New constant.
10291         (is_cident): New function.
10292         * layout.cc (Layout::define_section_symbols): Replace string constants
10293         with the newly defined constants.
10294         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10295         C identifiers.
10296         * testsuite/Makefile.am: Add gc_orphan_section_test.
10297         * testsuite/Makefile.in: Regenerate.
10298         * testsuite/gc_orphan_section_test.cc: New file.
10299         * testsuite/gc_orphan_section_test.sh: New file.
10300
10301 2010-01-06  Ian Lance Taylor  <iant@google.com>
10302
10303         PR 10980
10304         * options.h (class General_options): Add --warn-shared-textrel.
10305         * layout.cc (Layout::finish_dynamic_section): Implement
10306         --warn-shared-textrel.
10307
10308         PR 10980
10309         * options.h (class General_options): Add --warn-multiple-gp.
10310
10311 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10312
10313         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10314         $(THREADSLIB) and $(LIBDL).
10315         * Makefile.in: Rebuild.
10316
10317 2010-01-06  Ian Lance Taylor  <iant@google.com>
10318
10319         PR 10980
10320         * options.cc (General_options::parse_section_start): New function.
10321         (General_options::section_start): New function.
10322         (General_options::General_options): Initialize all members.
10323         * options.h: Include <map>
10324         (class General_options): Add --section-start.  Add section_starts_
10325         member.
10326         * layout.cc (Layout::attach_allocated_section_to_segment): If
10327         --section-start was used, set the address of the segment.  Remove
10328         local sort_sections.
10329         (Layout::relaxation_loop_body): If the address of the load segment
10330         has been set by --section-start, don't use it.
10331         * output.h (Output_segment::update_flags_for_output_section): New
10332         function.
10333         * output.cc (Output_segment::add_output_section): Call
10334         update_flags_for_output_section.
10335
10336 2010-01-05  Ian Lance Taylor  <iant@google.com>
10337
10338         PR 10980
10339         * options.h (class General_options): Add --undefined-version.
10340         * script.cc (struct Version_expression): Add was_matched_by_symbol
10341         field.
10342         (Version_script_info::matched_symbol): New function.
10343         (Version_script_info::get_symbol_version_helper): Call
10344         matched_symbol.
10345         (Version_script_info::check_unmatched_names): New function.
10346         * script.h (class Version_script_info): Update declarations.
10347         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10348
10349         * options.h (class General_options): Use DEFINE_bool_alias for
10350         allow_multiple_definition.
10351         * resolve.cc (Symbol_table::should_override): Don't test
10352         allow_multiple_definition.
10353
10354         PR 10980
10355         * options.h (class General_options): Add --cref.
10356         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10357         until after printing cref table.
10358         * cref.cc: Include "symtab.h".
10359         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10360         (Cref_table_compare::operator()): New function.
10361         (Cref_inputs::gather_cref): New function.
10362         (filecol): New static const.
10363         (Cref_inputs::print_cref): New function.
10364         (Cref::print_cref): New function.
10365         * cref.h: Include <cstdio>.
10366         (class Cref): Update declarations.
10367         * mapfile.h (Mapfile::file): New function.
10368         * object.h (class Object): Define Symbols.  Declare virtual
10369         do_get_global_symbols.
10370         (Object::get_global_symbols): New function.
10371         * object.cc (Input_objects::add_object): Pass object to cref_ if
10372         --cref.
10373         (Input_objects::archive_start): Likewise.
10374         (Input_objects::archive_stop): Likewise.
10375         (Input_objects::print_cref): New function.
10376         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10377         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10378         --cref.
10379         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10380         function.
10381         * plugin.h (class Sized_pluginobj): Update declarations.
10382
10383 2010-01-05  Ian Lance Taylor  <iant@google.com>
10384
10385         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10386         to is_default_version.  Rename insdef to insdefault.
10387         (Symbol_table::add_from_relobj): Rename def to is_default_version
10388         and local to is_forced_local.
10389         (Symbol_table::add_from_pluginobj): Likewise.
10390         (Symbol_table::add_from_dynobj): Likewise.
10391         (Symbol_table::define_special_symbol): Rename insdef to
10392         insdefault.
10393
10394 2010-01-04  Ian Lance Taylor  <iant@google.com>
10395
10396         PR 10980
10397         * options.h (class General_options): Add
10398         --allow-multiple-definition and -z muldefs.
10399         * resolve.cc (Symbol_table::should_override): Don't warn about a
10400         multiple symbol definition if --allow-multiple-definition or -z
10401         muldefs.
10402
10403         PR 10980
10404         * options.h (class General_options): Add --add-needed and
10405         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10406         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10407         error if --copy-dt-needed-entries aka --add-needed is used and
10408         would cause a change in behaviour.
10409
10410         PR 10980
10411         * options.h (class General_options): Add -G as a short version of
10412         --shared.  Add no-op options -assert, -g, and -i.
10413
10414 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10415
10416         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10417         check for .text or .gnu.linkonce.t sections.
10418         * icf.cc (Icf::find_identical_sections): Ditto.
10419         Change the detection for mangled function name within the section
10420         name.
10421         * icf.h (is_section_foldable_candidate): New function.
10422
10423 2009-12-30  Ian Lance Taylor  <iant@google.com>
10424
10425         PR 10980
10426         * options.h (class General_options): Permit two dashes with
10427         --retain-symbols-file.
10428
10429 2009-12-30  Ian Lance Taylor  <iant@google.com>
10430
10431         PR 10979
10432         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10433         don't put the file header and segment headers in the text
10434         segment.
10435
10436         PR 10979
10437         * common.cc (Sort_commons::operator()): Stabilize sort when both
10438         entries are NULL.
10439         (Symbol_table::do_allocate_commons_list): When allocating common
10440         symbols, skip a symbol which is no longer common.
10441         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10442         an object before checking its type.
10443         * testsuite/common_test_2.c: New file.
10444         * testsuite/common_test_3.c: New file.
10445         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10446         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10447         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10448         (common_test_2_pic.o, common_test_2.so): New targets.
10449         (common_test_3_pic.o, common_test_3.so): New targets.
10450         * testsuite/Makefile.in: Rebuild.
10451
10452         PR 10979
10453         * script.cc (read_input_script): If we see a new SECTIONS clause,
10454         and we have added an input section, give an error.
10455         * layout.h (class Layout): Add have_added_input_section function.
10456         Add have_added_input_section_ field.
10457         * layout.cc (Layout::Layout): Initialize
10458         have_added_input_section_.
10459         (Layout::layout): Set have_added_input_section_.
10460         (Layout::layout_eh_frame): Likewise.
10461
10462 2009-12-30  Ian Lance Taylor  <iant@google.com>
10463
10464         PR 10931
10465         * options.h (class General_options): Add --sort-common option.
10466         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10467         * common.cc (Sort_common): Add sort_order parameter to
10468         constructor.  Add sort_order_ field.
10469         (Sort_commons::operator): Check sort_order_.
10470         (Symbol_table::allocate_commons): Determine the sort order.
10471         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10472         Change all callers.
10473         (Symbol_table::do_allocate_commons_list): Likewise.
10474
10475 2009-12-30  Ian Lance Taylor  <iant@google.com>
10476
10477         PR 10916
10478         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10479         symbols from this object, don't change the visibility of an
10480         undefined symbol.
10481         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10482
10483 2009-12-30  Ian Lance Taylor  <iant@google.com>
10484
10485         PR 10861
10486         * script.h (class Version_script_info): Define Language enum.
10487         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10488         new fields globals_, locals_, and is_finalized_.
10489         * script.cc: Various formatting fixes.
10490         (class Parser_closure): Change language_stack_ from a vector of
10491         std::string to one of Version_script_info::Language.  Adjust all
10492         uses accordingly.
10493         (class Lazy_demangler): Remove.
10494         (struct Version_expression): Change language from std::string to
10495         Version_script_info::Language.
10496         (Version_script_info::Version_script_info): New function.
10497         (Version_script_info::~Version_script_info): Don't call clear.
10498         (Version_script_info::finalize): New function.
10499         (Version_script_info::build_lookup_tables): New function.
10500         (Version_script_info::build_expression_list_lookup): New
10501         function.
10502         (Version_script_info::get_symbol_version_helper): Rewrite to use
10503         lookup tables.
10504         (Version_script_info::print_expression_list): Adjust to use
10505         Version_script_info::Language.
10506         (script_push_lex_into_version_mode): Check that the version script
10507         has not been finalized.
10508         (version_script_push_lang): Change language string to
10509         Version_script_info::Language.
10510         * options.cc (Command_line::version_script): New function.
10511         * options.h (class General_options): Add finalize_dynamic_list
10512         function.  Change version_script from declaration to definition.
10513         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10514         * testsuite/version_script.map: Remove duplicate def of foo.
10515         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10516         version_script.map.
10517         * testsuite/Makefile.in: Rebuild.
10518
10519 2009-12-30  Ian Lance Taylor  <iant@google.com>
10520
10521         PR 10843
10522         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10523         if the input symbol index is 0, make the output symbol index 0.
10524
10525 2009-12-30  Ian Lance Taylor  <iant@google.com>
10526
10527         PR 10670
10528         * options.h (class General_options): Add -x/--discard-all.
10529         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10530         --discard-all.  If the local symbol needs a dynamic entry, check
10531         that before handling --discard-locals.
10532
10533 2009-12-30  Ian Lance Taylor  <iant@google.com>
10534
10535         PR 10450
10536         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10537         flags to PF_R.
10538         (Output_segment::add_output_section): Don't change the flags if
10539         the type is PT_TLS.
10540
10541         PR 10450
10542         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10543         GNU hash table if they need a dynamic value.  Otherwise, don't add
10544         them if they are defined in a dynamic object or are forced local.
10545
10546 2009-12-29  Ian Lance Taylor  <iant@google.com>
10547
10548         PR 10450
10549         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10550         .gnu.hash table for a 32-bit target.
10551
10552         PR 10450
10553         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10554         regular and a dynamic object only needs a dynamic symbol table
10555         entry if it is externally visible.
10556
10557         PR 10450
10558         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10559         constructor.  Add global_offset_table_ field.
10560         (Target_i386::got_section): Set global_offset_table_.
10561         (Target_i386::do_finalize_sections): Set global_offset_table_
10562         size.
10563         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10564         in constructor.  Add global_offset_table_ field.
10565         (Target_x86_64::got_section): Set global_offset_table_.
10566         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10567         size.
10568
10569         * layout.cc (Layout::Layout): Initialize increase_relro_.
10570         (Layout::get_output_section): Add is_relro, is_last_relro, and
10571         is_first_non_relro parameters.  Change all callers.
10572         (Layout::choose_output_section): Likewise.
10573         (Layout::add_output_section_data): Likewise.
10574         (Layout::make_output_section): Likewise.
10575         (Layout::set_segment_offsets): Clear increase_relro when using a
10576         linker script.
10577         * layout.h (class Layout): Add increase_relro method.  Add
10578         increase_relro_ field.  Update declarations.
10579         * output.cc (Output_section::Output_section): Initialize
10580         is_last_relro_ and is_first_non_relro_.
10581         (Output_segment::add_output_section): Group relro sections is
10582         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10583         (Output_segment::maximum_alignment): Remove relro handling.
10584         (Output_segment::set_section_addresses): Add increase_relro
10585         parameter.  Change all callers.  Add initial alignment to align
10586         relro sections on separate page.  Remove old relro handling.
10587         (Output_segment::set_section_list_addresses): Remove in_relro
10588         parameter.  Change all callers.
10589         (Output_segment::set_offset): Add increase parameter.  Change all
10590         callers.  Remove old relro handling.
10591         * output.h (class Output_section): Add new methods: is_last_relro,
10592         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10593         Add is_last_relro_ and is_first_non_relro_ fields.
10594         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10595         Create separate .got.plt section.  Call increase_relro.
10596         * x86_64.cc (Target_x86_64::got_section): Likewise.
10597         * testsuite/relro_script_test.t: Add .got.plt.
10598
10599         PR 10450
10600         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10601         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10602         (Layout::finalize): Call set_dynamic_symbol_size.
10603         (Layout::set_dynamic_symbol_size): New function.
10604         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10605         set_dynamic_symbol_size.
10606
10607         PR 10450
10608         * output.h (class Output_section): Add is_entsize_zero_ field.
10609         * output.cc (Output_section::Output_section): Initialize
10610         is_entsize_zero_.
10611         (Output_section::set_entsize): If two different entsizes are
10612         requested, force it to zero.
10613         (Output_section::add_input_section): Set flags for .debug_str
10614         before updating section flags.  Set entsize.
10615         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10616         and SHF_STRING if all input sections have those flags.
10617
10618 2009-12-29   Rafael Espindola  <espindola@google.com>
10619
10620         * main.cc (main): Fix the sys time reporting.
10621         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10622         reporting.
10623
10624 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10625
10626         * options.cc (General_options::parse_version): Allow -v to exit
10627         without an error if there is nothing to link.
10628
10629 2009-12-29  Ian Lance Taylor  <iant@google.com>
10630
10631         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10632         using a version of gcc before 4.1.
10633         * configure: Rebuild.
10634
10635 2009-12-28  Chris Demetriou  <cgd@google.com>
10636
10637         * attributes.cc (Output_attributes_section_data::do_write): Use
10638         std::vector::front rather than std::vector::data.
10639
10640 2009-12-28  Ian Lance Taylor  <iant@google.com>
10641
10642         * symtab.h (class Symbol_table): Add enum Defined.
10643         * resolve.cc (Symbol_table::should_override): Add defined
10644         parameter.  Change all callers.  Test whether object is NULL
10645         before calling a method on it.
10646         (Symbol_table::report_resolve_problem): Add defined parameter.
10647         Change all callers.
10648         (Symbol_table::should_override_with_special): Likewise.
10649         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10650         parameter.  Change all callers.
10651         (Symbol_table::do_define_in_output_data): Likewise.
10652         (Symbol_table::define_in_output_segment): Likewise.
10653         (Symbol_table::do_define_in_output_segment): Likewise.
10654         (Symbol_table::define_as_constant): Likewise.
10655         (Symbol_table::do_define_as_constant): Likewise.
10656         * script.h (class Symbol_assignment): Add is_defsym parameter to
10657         constructor; change all callers.
10658         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10659         parameter.  Change all callers.  Add is_defsym_ field.
10660         (class Parser_closure): Add parsing_defsym parameter to
10661         constructor; change all callers.  Add parsing_defsym accessor
10662         function.  Add parsing_defsym_ field.
10663
10664 2009-12-28  Ian Lance Taylor  <iant@google.com>
10665
10666         * gold.cc (queue_middle_tasks): Fix formatting.
10667         * object.cc (Relobj::is_section_name_included): Likewise.
10668
10669 2009-12-23  Ian Lance Taylor  <iant@google.com>
10670
10671         * i386.cc (Target_i386::do_calls_non_split): Recognize
10672         -fsplit-stack prologue for a function with a static chain.
10673         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10674         -fsplit-stack prologue when using %r11.
10675
10676 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10677
10678         * options.cc (General_options::parse_version): Make -v continue and do
10679         the link like GNU ld does.
10680
10681 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10682
10683         * Makefile.am (CCFILES): Add timer.cc.
10684         (HFILES): Add timer.h.
10685         * configure.ac: Check for sysconf and times.
10686         * main.cc: include timer.h.
10687         (main): Use Timer instead of get_run_time.
10688         * timer.cc: New.
10689         * timer.h: New.
10690         * workqueue.cc: include timer.h.
10691         (Workqueue::find_and_run_task):
10692         Report user, sys and wall time.
10693         * Makefile.in: Regenerate.
10694         * config.in: Regenerate.
10695         * configure: Regenerate.
10696
10697 2009-12-16  Doug Kwan  <dougkwan@google.com>
10698
10699         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10700         sections.
10701         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10702         relaxed input sections.
10703         * output.cc (Output_section::find_relaxed_input_section): Change
10704         return type to Output_relaxed_input_section pointer.  Adjust code
10705         for new type of relaxed_input_section_map_.
10706         * output.h (Output_section::find_relaxed_input_section): Change
10707         return type to Output_relaxed_input_section pointer.
10708         (Output_section::Output_relaxed_input_section_by_input_section_map):
10709         New type.
10710         (Output_section::relaxed_input_section_map_): Change type to
10711         Output_section::Output_relaxed_input_section_by_input_section_map.
10712         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10713         input section.
10714
10715 2009-12-15  Ian Lance Taylor  <iant@google.com>
10716
10717         * layout.cc (Layout::create_shstrtab): Only write out after input
10718         sections if we are compressing debug sections.
10719
10720 2009-12-15  Ian Lance Taylor  <iant@google.com>
10721
10722         * archive.cc (Archive::add_symbols): Only look up a symbol without
10723         a version if there is, in fact, a version.
10724
10725 2009-12-14  Ian Lance Taylor  <iant@google.com>
10726
10727         Revert -Wshadow changes, all changes from:
10728         2009-12-11  Doug Kwan  <dougkwan@google.com>
10729         2009-12-11  Nick Clifton  <nickc@redhat.com>
10730         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10731
10732 2009-12-11  Doug Kwan  <dougkwan@google.com>
10733
10734         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10735         due to -Wshadow.
10736         * attributes.cc (Object_attribute::size): Ditto.
10737         (Attributes_section_data::size): Ditto.
10738         (Attributes_section_data::Attributes_section_data): Ditto.
10739         (Output_attributes_section_data::do_write): Ditto.
10740         * attributes.h (Object_attribute::set_type): Ditto.
10741         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10742
10743 2009-12-11  Nick Clifton  <nickc@redhat.com>
10744
10745         * archive.cc: Fix shadowed variable warnings.
10746         * arm.cc: Likewise.
10747         * compressed_output.cc: Likewise.
10748         * compressed_output.h: Likewise.
10749         * configure: Likewise.
10750         * dwarf_reader.cc: Likewise.
10751         * dynobj.cc: Likewise.
10752         * dynobj.h: Likewise.
10753         * ehframe.cc: Likewise.
10754         * ehframe.h: Likewise.
10755         * errors.cc: Likewise.
10756         * expression.cc: Likewise.
10757         * fileread.cc: Likewise.
10758         * fileread.h: Likewise.
10759         * freebsd.h: Likewise.
10760         * i386.cc: Likewise.
10761         * icf.cc: Likewise.
10762         * incremental.h: Likewise.
10763         * layout.cc: Likewise.
10764         * layout.h: Likewise.
10765         * mapfile.cc: Likewise.
10766         * merge.cc: Likewise.
10767         * merge.h: Likewise.
10768         * object.cc: Likewise.
10769         * object.h: Likewise.
10770         * options.h: Likewise.
10771         * output.cc: Likewise.
10772         * output.h: Likewise.
10773         * parameters.cc: Likewise.
10774         * plugin.cc: Likewise.
10775         * powerpc.cc: Likewise.
10776         * reduced_debug_output.cc: Likewise.
10777         * reduced_debug_output.h: Likewise.
10778         * reloc.cc: Likewise.
10779         * reloc.h: Likewise.
10780         * resolve.cc: Likewise.
10781         * script-sections.cc: Likewise.
10782         * script.cc: Likewise.
10783         * script.h: Likewise.
10784         * sparc.cc: Likewise.
10785         * symtab.cc: Likewise.
10786         * symtab.h: Likewise.
10787         * target-select.cc: Likewise.
10788         * target-select.h: Likewise.
10789         * token.h: Likewise.
10790         * workqueue.cc: Likewise.
10791         * workqueue.h: Likewise.
10792         * x86_64.cc: Likewise.
10793
10794 2009-12-10  Doug Kwan  <dougkwan@google.com>
10795
10796         * arm.cc (attributes.h): New include.
10797         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10798         (Arm_relobj::~Arm_relobj): Delete object pointed by
10799         attributes_section_data_.
10800         (Arm_relobj::attributes_section_data): New method definition.
10801         (Arm_relobj::attributes_section_data_): New data member declaration.
10802         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10803         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10804         attributes_section_data_.
10805         (Arm_dynobj::attributes_section_data): New method definition.
10806         (Arm_dynobj::attributes_section_data_): New data member declaration.
10807         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10808         initialization value of may_use_blx_ to false.
10809         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10810         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10811         object attributes to compute results instead of hard-coding.
10812         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10813         Target_arm::get_secondary_compatible_arch,
10814         Target_arm::set_secondary_compatible_arch
10815         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10816         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10817         New method declarations.
10818         (Target_arm::get_aeabi_object_attribute): New method definition.
10819         (Target_arm::attributes_section_data_): New data member declaration.
10820         (read_arm_attributes_section): New template definition.
10821         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10822         (Arm_dynobj::do_read_symbols): Ditto.
10823         (Target_arm::do_finalize_sections): Merge attributes sections from
10824         input.  Check for BLX use after attributes section merging.
10825         Fix __exidx_start and __exidx_end visibility.  Create an
10826         .ARM.attributes section if necessary.
10827         (Target_arm::get_secondary_compatible_arch,
10828         Target_arm::set_secondary_compatible_arch,
10829         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10830         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10831         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10832         New method definitions.
10833
10834 2009-12-09  Ian Lance Taylor  <iant@google.com>
10835
10836         * plugin.cc (Plugin::load): Don't cast from void* to a function
10837         pointer.
10838
10839 2009-12-09  Ian Lance Taylor  <iant@google.com>
10840
10841         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10842         information fields.
10843
10844 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10845
10846         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10847         Replace two_file_shared_1.so with two_file_shared_2.so.
10848         * testsuite/Makefile.in: Regenerated.
10849
10850 2009-12-08  Doug Kwan  <dougkwan@google.com>
10851
10852         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10853         (HFILES): Add attributes.h and int_encoding.h.
10854         * Makefile.in: Regenerate.
10855         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10856         function definitions to int_encoding.cc
10857         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10858         prototypes to int_encoding.h
10859         * reduced_debug_output.cc (int_encoding.h): New include.
10860         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10861         function definitions to int_encoding.cc
10862         (insert_into_vector, read_from_pointer): Move template definitions to
10863         int_encoding.h
10864         * attributes.cc: New file.
10865         * attributes.h: New file.
10866         * int_encoding.cc: New file.
10867         * int_encoding.h: New file.
10868
10869 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10870
10871         PR gold/11055
10872         * incremental-dump.cc (dump_incremental_inputs): New.
10873         (main): Use dump_incremental_inputs.
10874
10875 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10876
10877         PR gold/10893
10878         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10879         checking elfcpp::STT_FUNC.
10880         (Target_i386::Relocate::relocate): Likewise.
10881         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10882
10883         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10884         symbols from shared libraries into normal FUNC symbols.
10885
10886         * symtab.h (Symbol): Add is_func and use it.
10887
10888 2009-12-05  Doug Kwan  <dougkwan@google.com>
10889
10890         * arm.cc (Target_arm::arm_info): Initialize new fields
10891         attributes_section and attributes_vendor.
10892         * i386.cc (Target_i386::i386_info): Same.
10893         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10894         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10895         fields attributes_section and attributes_vendor.
10896         * sparc.cc (Target_sparc::sparc_info): Same.
10897         * target.h (Target::attributes_section, Target::attributes_vendor,
10898         Target::is_attributes_section, Target::attribute_arg_type,
10899         Target::attributes_order): New method definitions.
10900         (Target::Target_info::attributes_section,
10901         Target::Target_info::attributes_vendor): New fields.
10902         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10903         virtual method definitions.
10904         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10905         attributes_section and attributes_vendor.
10906         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10907
10908 2009-12-05  Doug Kwan  <dougkwan@google.com>
10909
10910         * arm.cc: Update comments about interworking and stub generation.
10911         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10912         considered as non-PIC.
10913         (Arm_relocate_functions::base_abs): Fix formatting.
10914         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10915         of function to use GOT entry address instead of offset.
10916         (Target_arm::Scan::global): Issue an error if a symbol would need a
10917         PLT does not get one because it is untyped.  Remove code to create
10918         dynamic symbols for relative branches.
10919         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10920         takes unsigned integer instead of boolean.
10921
10922 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10923
10924         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10925         (two_file_test_LDADD): Likewise.
10926         (common_test_1_LDADD): Likewise.
10927         (exception_test_LDADD) Likewise.
10928         (weak_test_LDADD): Likewise.
10929         (many_sections_test_LDADD): Likewise.
10930         (initpri1_LDADD): Likewise.
10931         (script_test_1_LDADD): Likewise.
10932         (script_test_2_LDADD): Likewise.
10933         (justsyms_LDADD): Likewise.
10934         (binary_test_LDADD): Likewise.
10935         (large_LDADD): Likewise.
10936         * testsuite/Makefile.in: Regenerated.
10937
10938 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10939
10940         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10941         (Symbol_table::override_with_special): Likewise.
10942         (Symbol_table::add_from_object): Likewise.
10943
10944 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10945
10946         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10947         Don't set the data_offset twice.
10948
10949 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10950
10951         * testsuite/Makefile.in: Regenerate.
10952
10953 2009-12-03  Doug Kwan  <dougkwan@google.com>
10954
10955         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10956         (Target_arm::do_finalize_sections): Add parameter for symbol table
10957         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10958         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10959         parameter for symbol table pointer.
10960         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10961         an additional parameter for a pointer to symbol table.
10962         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10963         parameter for a symbol table pointer.
10964         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10965         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10966         Ditto.
10967         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10968         parameter for a symbol table pointer.
10969
10970 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10971
10972         * incremental.cc (Incremental_inputs_header)
10973         (Incremental_inputs_header_write, Incremental_inputs_entry)
10974         (Incremental_inputs_entry_write): Move ...
10975         * incremental.h (Incremental_inputs_header)
10976         (Incremental_inputs_header_write, Incremental_inputs_entry)
10977         (Incremental_inputs_entry_write): here.
10978
10979 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10980
10981         * incremental.cc (make_sized_incremental_binary): Set the target.
10982         Error if it is incompatible.
10983         * output.h (Output_file): Add filename method.
10984
10985 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10986
10987         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10988         from the get_* methods.
10989
10990 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10991
10992         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10993         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10994         Write 0 for the data_offset of scripts.
10995
10996 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10997
10998         * testsuite/Makefile.am: Add the incremental_test.sh test.
10999         * testsuite/incremental_test.sh: New.
11000         * testsuite/incremental_test_1.c: New.
11001         * testsuite/incremental_test_2.c: New.
11002
11003 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
11004
11005         * incremental-dump.cc (main): Fix typos.
11006
11007 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
11008
11009         PR gold/11025
11010         * incremental-dump.cc (main): Use llu to print 64 bit values.
11011
11012 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
11013             H.J. Lu  <hongjiu.lu@intel.com>
11014
11015         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
11016         $(LIBDL).
11017         (incremental_dump_LDADD): Likewise.
11018         * Makefile.in: Regenerated.
11019
11020 2009-11-25  Doug Kwan  <dougkwan@google.com>
11021
11022         Revert:
11023
11024         2009-11-25  Doug Kwan  <dougkwan@google.com>
11025
11026                 * arm.cc (Target_arm::Target_arm): Move method definition
11027                 outside of class definition.  Add code to handle
11028                 --target1-rel, --target1-abs and --target2= options.
11029                 (Target_arm::get_reloc_reloc_type): Change method to be
11030                 non-static and const.
11031                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11032                 New data member declaration.
11033                 (Target_arm::Scan::local, Target_arm::Scan::global,
11034                 Target_arm::Relocate::relocate,
11035                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11036                 Adjust call to Target_arm::get_real_reloc_type.
11037                 (Target_arm::get_real_reloc_type): Use command line options
11038                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11039                 * options.h (--target1-rel, --target1-abs, --target2): New
11040                 ARM-only options.
11041
11042 2009-11-25  Doug Kwan  <dougkwan@google.com>
11043
11044         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11045         class definition.  Add code to handle --target1-rel, --target1-abs
11046         and --target2= options.
11047         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11048         and const.
11049         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11050         member declaration.
11051         (Target_arm::Scan::local, Target_arm::Scan::global,
11052         Target_arm::Relocate::relocate,
11053         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11054         call to Target_arm::get_real_reloc_type.
11055         (Target_arm::get_real_reloc_type): Use command line options to
11056         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11057         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11058         options.
11059
11060 2009-11-25  Doug Kwan  <dougkwan@google.com>
11061
11062         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11063         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11064         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11065         formatting.
11066         (Arm_relocate_functions::thm_call): Replace body with a call to
11067         Arm_relocate_functions::thumb_branch_common.
11068         (Arm_relocate_functions::thm_jump24,
11069         Arm_relocate_functions::thm_xpc22): New method definitions.
11070         (Arm_relocate_functions::thumb_branch_common): New method definition.
11071         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11072         operator.
11073         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11074         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11075
11076 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11077
11078         * Makefile.am: Build incremental-dump
11079         * Makefile.in: Regenerate.
11080         * incremental-dump.cc: New.
11081         * incremental.cc (Incremental_inputs_header_data,
11082         Incremental_inputs_entry_data): Move to incremental.h
11083         * incremental.h: (Incremental_inputs_header_data,
11084         Incremental_inputs_entry_data): Move from incremental.cc
11085
11086 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11087
11088         * incremental.cc (Incremental_inputs_header,
11089         Incremental_inputs_header_write, Incremental_inputs_entry,
11090         Incremental_inputs_entry_write): Add a typedef with the data type.
11091
11092 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11093
11094         * incremental.cc (Incremental_inputs_header,
11095         Incremental_inputs_header_write, Incremental_inputs_entry,
11096         Incremental_inputs_entry_write): Update comment about which
11097         type has the filed descriptions.
11098
11099 2009-11-15  Doug Kwan  <dougkwan@google.com>
11100
11101         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11102         (Arm_relocate_functions::arm_branch_common): Change method defintion
11103         in class definition to a method declaration and update list of formal
11104         parameters.
11105         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11106         Arm_relocation_functions::jump24): Adjust call to
11107         Arm_relocate_functions::arm_branch_common.  Update list of formal
11108         parameters.
11109         (Arm_relocate_functions::xpc25): New method definition.
11110         (Arm_relocate_functions::arm_branch_common): Move method defintion
11111         out from class definition.  Use stubs for mode-switching and extending
11112         branch ranges.
11113         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11114         specially.  Change code to enable use of stubs in ARM branches.
11115
11116 2009-11-10  Doug Kwan  <dougkwan@google.com>
11117
11118         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11119         in method declaration.
11120         (Target_arm::relocate_stub): New method declaration.
11121         (Target_arm::default_target): Change to return a pointer instead of
11122         a const reference.
11123         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11124         Target_arm::default_target.
11125         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11126         method definition.
11127         (Target_arm::relocate_section): Adjust view.
11128         (Target_arm::relocate_stub): New method definition.
11129
11130 2009-11-10  Doug Kwan  <dougkwan@google.com>
11131
11132         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11133         a format warning.
11134         * incremental.cc (open_incremental_binary): Initialized local
11135         variables to avoid warnings.
11136         * object.cc (make_elf_object): Ditto.
11137         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11138         a format warning.
11139
11140 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11141
11142         PR gold/10930
11143         * testsuite/plugin_test.c: Include "config.h".
11144
11145 2009-11-09  Doug Kwan  <dougkwan@google.com>
11146
11147         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11148         (arm_symbol_value): Remove.
11149         (Arm_relocate_functions::arm_branch_common,
11150         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11151         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11152         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11153         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11154         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11155         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11156         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11157         Arm_relocate_functions::thm_mobw_abs_nc,
11158         Arm_relocate_functions::thm_mov_abs,
11159         Arm_relocate_functions::movw_prel_nc,
11160         Arm_relocate_functions::thm_movt_abs,
11161         Arm_relocate_functions::movt_prel,
11162         Arm_relocate_functions::thm_movw_prel_nc,
11163         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11164         (Target_arm::Relocate::relocate): Only decompose address into two
11165         parts if relocation type uses the thumb-bit and pass the actual
11166         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11167         calls to methods in Arm_relocate_functions for this change.
11168
11169 2009-11-08  Ian Lance Taylor  <iant@google.com>
11170
11171         PR 10925
11172         * reloc.cc: Instantiate
11173         Sized_relobj::initialize_input_to_output_maps and
11174         Sized_relobj:free_input_to_output_maps.
11175
11176 2009-11-06  Ian Lance Taylor  <iant@google.com>
11177
11178         PR 10876
11179         * defstd.cc (in_segment): Set only_if_ref true for "end".
11180
11181 2009-11-06  Doug Kwan  <dougkwan@google.com>
11182
11183         * arm.cc (class Reloc_stub): Correct a comment.
11184         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11185         (Target_arm::scan_section_for_stubs): New method declaration.
11186         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11187         Change methods from private to protected.
11188         (Target_arm::do_may_relax): New method definition.
11189         (Target_arm::do_relax, Target_arm::group_sections,
11190         Target_arm::scan_reloc_for_stub,
11191         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11192         (Target_arm::arm_input_section_map_): New data member declaration.
11193         (Target_arm::scan_reloc_for_stub,
11194         Target_arm::scan_reloc_section_for_stubs,
11195         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11196         Target_arm::do_relax): New method definitions.
11197
11198 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11199
11200         * configure.ac: Check for (struct stat)::st_mtim
11201         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11202         * config.in: Regenerate.
11203         * configure: Regenerate.
11204
11205 2009-11-05  Ian Lance Taylor  <iant@google.com>
11206
11207         PR 10910
11208         * output.cc (Output_segment::add_output_section): Add missing
11209         return statement.
11210
11211 2009-11-04  Ian Lance Taylor  <iant@google.com>
11212
11213         PR 10880
11214         * object.h (class Object): Add is_needed and set_is_needed
11215         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11216         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11217         defined in a dynamic object and referenced by a regular object,
11218         set is_needed for the dynamic object.
11219         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11220         if the file is marked with as_needed and it is not needed.
11221
11222 2009-11-04  Ian Lance Taylor  <iant@google.com>
11223
11224         PR 10887
11225         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11226         tags if data is discarded by linker script.
11227         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11228         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11229         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11230         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11231
11232 2009-11-04  Ian Lance Taylor  <iant@google.com>
11233
11234         * layout.cc (Layout::get_output_section): Add is_interp and
11235         is_dynamic_linker_section parameters.  Change all callers.
11236         (Layout::choose_output_section): Likewise.
11237         (Layout::make_output_section): Likewise.
11238         (Layout::add_output_section_data): Add is_dynamic_linker_section
11239         parameter.  Change all callers.
11240         * layout.h (class Layout): Update declarations.
11241         * output.h (class Output_section): Add is_interp, set_is_interp,
11242         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11243         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11244         generate_code_fills_at_write_ to a bitfield.
11245         * output.cc (Output_section::Output_sections): Initialize new
11246         fields.
11247         (Output_segment::add_output_section): Add do_sort parameter.
11248         Change all callers.
11249
11250 2009-11-03  Ian Lance Taylor  <iant@google.com>
11251
11252         PR 10860
11253         * options.h (class General_options): Add --warn-common.
11254         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11255         merging two common symbols.
11256         (Symbol_table::should_override): Handle --warn-common when merging
11257         a common symbol with a defined symbol.  Use report_resolve_problem
11258         for multiple definitions.
11259         (Symbol_table::report_resolve_problem): New function.
11260         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11261
11262 2009-11-03  Doug Kwan  <dougkwan@google.com>
11263
11264         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11265         stub_factory_.
11266         (Target_arm::stub_factory): New method definition.
11267         (Target_arm::new_arm_input_section,
11268         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11269         Target_arm::reloc_uses_thumb_bit): New method declarations.
11270         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11271         New type definitions.
11272         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11273         member declarations.
11274         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11275         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11276         New method definitions.
11277
11278 2009-11-03  Ian Lance Taylor  <iant@google.com>
11279
11280         * options.h (class General_options): Add --warn_constructors.
11281
11282 2009-11-03  Ian Lance Taylor  <iant@google.com>
11283
11284         PR 10893
11285         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11286         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11287
11288 2009-11-03  Ian Lance Taylor  <iant@google.com>
11289
11290         PR 10895
11291         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11292         --msgid-bugs-address.
11293         (install-pdf): New target.
11294         (install-data_yes): Look up one directory to find mkinstalldirs.
11295
11296 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11297
11298         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11299         tree.
11300
11301 2009-10-30  Doug Kwan  <dougkwan@google.com>
11302
11303         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11304
11305 2009-10-30  Doug Kwan  <dougkwan@google.com>
11306
11307         * arm.cc (Stub_addend_reader): New struct template definition
11308         and partial specializations.
11309         (Stub_addend_reader::operator()): New method definition for a
11310         partially specialized template.
11311
11312 2009-10-30  Doug Kwan  <dougkwan@google.com>
11313
11314         * arm.cc (Arm_relobj::processor_specific_flags): New method
11315         definition.
11316         (Arm_relobj::do_read_symbols): New method declaration.
11317         (Arm_relobj::processor_specific_flags_): New data member declaration.
11318         (Arm_dynobj): New class definition.
11319         (Target_arm::do_finalize_sections): Add input_objects parameter.
11320         (Target_arm::do_adjust_elf_header): New method declaration.
11321         (Target_arm::are_eabi_versions_compatible,
11322         (Target_arm::merge_processor_specific_flags): New method declaration.
11323         (Target_arm::do_make_elf_object): New overloaded method definitions
11324         and declaration.
11325         (Arm_relobj::do_read_symbols): New method definition.
11326         (Arm_dynobj::do_read_symbols): Ditto.
11327         (Target_arm::do_finalize_sections): Add input_objects parameters.
11328         Merge processor-specific flags from all input objects.
11329         (Target_arm::are_eabi_versions_compatible,
11330         Target_arm::merge_processor_specific_flags,
11331         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11332         New method definitions.
11333         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11334         Input_objects pointer type parameter.
11335         * layout.cc (Layout::finalize): Pass input objects to target's.
11336         finalize_sections function.
11337         * output.cc (Output_file_header::do_sized_write): Set ELF file
11338         header's processor-specific flags.
11339         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11340         Input_objects pointer type parameter.
11341         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11342         * target.h (Input_objects): New forward class declaration.
11343         (Target::processor_specific_flags,
11344         Target::are_processor_specific_flags_sect): New method definitions.
11345         (Target::finalize_sections): Add input_objects parameter.
11346         (Target::Target): Initialize processor_specific_flags_ and
11347         are_processor_specific_flags_set_.
11348         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11349         parameter.
11350         (Target::set_processor_specific_flags): New method definition.
11351         (Target::processor_specific_flags_,
11352         Target::are_processor_specific_flags_set_): New data member
11353         declarations.
11354         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11355         Input_objects pointer type parameter.
11356
11357 2009-10-30  Doug Kwan  <dougkwan@google.com>
11358
11359         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11360
11361 2009-10-28  Ian Lance Taylor  <iant@google.com>
11362
11363         * object.h (class Relobj): Drop options parameter from
11364         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11365         do_scan_relocs, do_relocate.  Change all callers.
11366         (class Sized_relobj): Drop options parameters from
11367         do_gc_process_relocs, do_scan_relocs, do_relocate,
11368         do_relocate_sections, relocate_sections, emit_relocs_scan,
11369         emit_relocs_scan_reltype.  Change all callers.
11370         (struct Relocate_info): Remove options field and all references to
11371         it.
11372         * reloc.h (class Read_relocs): Remove options constructor
11373         parameter and options_ field.  Change all callers.
11374         (class Gc_process_relocs, class Scan_relocs): Likewise.
11375         (class Relocate_task): Likewise.
11376         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11377         all callers.
11378         (scan_relocatable_relocs): Likewise.
11379         * target.h (class Sized_target): Remove options parameter from
11380         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11381         all callers.
11382         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11383         callers.
11384         * arm.cc: Update functions to remove options parameters.
11385         * i386.cc: Likewise.
11386         * powerpc.cc: Likewise.
11387         * sparc.cc: Likewise.
11388         * x86_64.cc: Likewise.
11389         * testsuite/testfile.cc: Likewise.
11390
11391 2009-10-28  Doug Kwan  <dougkwan@google.com>
11392
11393         * arm.cc (Arm_relobj): New class definition.
11394         (Arm_relobj::scan_sections_for_stubs,
11395         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11396         New method definitions.
11397
11398 2009-10-28  Cary Coutant  <ccoutant@google.com>
11399
11400         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11401         (Plugin::cleanup_done_): New member.
11402         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11403         (Plugin_manager::cleanup_done_): Remove.
11404         (Plugin_manager::add_input_file): Edit error message.
11405         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11406         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11407
11408 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11409
11410         * fileread.cc: (File_read::View::~View): Use the new
11411         data_ownership_ filed.
11412         (File_read::~File_read): Dispose the new whole_file_view_.
11413         (File_read::open): Mmap the whole file if needed.
11414         (File_read::open): Use whole_file_view_ instead of contents_.
11415         (File_read::find_view): Use whole_file_view_ if applicable.
11416         (File_read::do_read): Use whole_file_view_ instead of contents_.
11417         (File_read::make_view): Use whole_file_view_ instead of contents_,
11418         update File_read::View::View call.
11419         (File_read::find_or_make_view): Update File_read::View::View
11420         call.
11421         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11422         remove contents_
11423         (File_read::View::Data_ownership): New enum.
11424         (File_read::View::View): Replace bool mapped_ with Data_ownership
11425         argument.
11426         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11427         (File_read::View::data_ownership_): New field.
11428         (File_read::contents_): Remove (replaced by whole_file_view_).
11429         (File_read::whole_file_view_): New field.
11430         * options.h (class General_options): Add --keep-files-mapped.
11431
11432 2009-10-27  Cary Coutant  <ccoutant@google.com>
11433
11434         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11435         * testsuite/Makefile.am (plugin_test_5): New test case.
11436         * testsuite/Makefile.in: Regenerate.
11437
11438 2009-10-25  Doug Kwan  <dougkwan@google.com>
11439
11440         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11441         from private to protected to allow access by child class.
11442         (Sized_relobj::do_relocate_sections): New method declaration.
11443         (Sized_relobj::relocate_sections): Virtualize.
11444         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11445         Sized_relobj::relocate_sections.  Instantiate template explicitly
11446         for different target sizes and endianity.
11447
11448 2009-10-24  Doug Kwan  <dougkwan@google.com>
11449
11450         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11451         (Arm_input_section::as_arm_input_section): New method.
11452         (Arm_output_section): New class definition.
11453         (Arm_output_section::create_stub_group,
11454         Arm_output_section::group_sections): New method definitions.
11455
11456 2009-10-22  Doug Kwan  <dougkwan@google.com>
11457
11458         * arm.cc (Arm_input_section): New class definition.
11459         (Arm_input_section::init, Arm_input_section:do_write,
11460         Arm_input_section::set_final_data_size,
11461         Arm_input_section::do_reset_address_and_file_offset): New method
11462         definitions.
11463
11464 2009-10-21  Doug Kwan  <dougkwan@google.com>
11465
11466         * arm.cc (Stub_table, Arm_input_section): New forward class
11467         declarations.
11468         (Stub_table): New class defintion.
11469         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11470         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11471         New method definition.
11472
11473 2009-10-21  Doug Kwan  <dougkwan@google.com>
11474
11475         * arm.cc: Update copyright comments.
11476         (Target_arm): New forward class template declaration.
11477         (Arm_address): New type.
11478         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11479         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11480         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11481         constants.
11482         (Insn_template): Same.
11483         (DEF_STUBS): New macro.
11484         (Stub_type): New enum type.
11485         (Stub_template): New class definition.
11486         (Stub): Same.
11487         (Reloc_stub): Same.
11488         (Stub_factory): Same.
11489         (Target_arm::Target_arm): Initialize may_use_blx_ and
11490         should_force_pic_veneer_.
11491         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11492         Target_arm::should_force_pic_veneer,
11493         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11494         Target_arm::using_thumb_only, Target_arm:;default_target): New
11495         method defintions.
11496         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11497         New data member declarations.
11498         (Insn_template::size, Insn_template::alignment): New method defintions.
11499         (Stub_template::Stub_template): New method definition.
11500         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11501         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11502         (Stub_factory::Stub_factory): New method definition.
11503         * gold.h (string_hash): New template.
11504         * output.h (Input_section_specifier::hash_value): Use
11505         gold::string_hash.
11506         (Input_section_specifier::string_hash): Remove.
11507         * stringpool.cc (Stringpool_template::string_hash): Use
11508         gold::string_hash.
11509
11510 2009-10-20  Doug Kwan  <dougkwan@google.com>
11511
11512         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11513         symbols of relaxed input sections.
11514         * output.h (Output_section::find_relaxed_input_section): Make
11515         method public.
11516
11517 2009-10-16  Doug Kwan  <dougkwan@google.com>
11518
11519         * dynobj.cc (Versions::Versions): Initialize version_script_.
11520         Only insert base version symbol definition for a shared object
11521         if version script defines any version versions.
11522         (Versions::define_base_version): New method definition.
11523         (Versions::add_def): Check that base version is not needed.
11524         (Versions::add_need): Define base version lazily.
11525         * dynobj.h (Versions::define_base_version): New method declaration.
11526         (Versions::needs_base_version_): New data member declaration.
11527         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11528         (check_DATA): Add no_version_test.stdout.
11529         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11530         New make rules.
11531         * testsuite/Makefile.in: Regenerate.
11532         * testsuite/no_version_test.c: New file.
11533         * testsuite/no_version_test.sh: Ditto.
11534
11535 2009-10-16  Doug Kwan  <dougkwan@google.com>
11536
11537         * expression.cc (class Segment_start_expression): New class definition.
11538         (Segment_start_expression::value): New method definition.
11539         (script_exp_function_segment_start): Return a new
11540         Segment_start_expression.
11541         * gold/script-c.h (script_saw_segment_start_expression): New function
11542         prototype.
11543         * script-sections.cc (Script_sections::Script_sections): Initialize
11544         SAW_SEGMENT_START_EXPRESSION_ to false.
11545         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11546         and -Tbbs options to specify section addresses if given in
11547         command line and no SEGMENT_START expression is seen in a script.
11548         * script-sections.h (Script_sections::saw_segment_start_expression,
11549         Script_sections::set_saw_segment_start_expression): New method
11550         definition.
11551         (Script_sections::saw_segment_start_expression_): New data member
11552         declaration.
11553         * script.cc (script_saw_segment_start_expression): New function.
11554         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11555         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11556         script_test_7.sh and script_test_8.sh.
11557         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11558         script_test_8.stdout.
11559         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11560         (script_test_6, script_test_6.stdout, script_test_7,
11561         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11562         * Makefile.in: Regenerate.
11563         * testsuite/script_test_6.sh: New file.
11564         * testsuite/script_test_6.t: Same.
11565         * testsuite/script_test_7.sh: Same.
11566         * testsuite/script_test_7.t: Same.
11567         * testsuite/script_test_8.sh: Same.
11568
11569 2009-10-16  Doug Kwan  <dougkwan@google.com>
11570
11571         * output.cc (Output_segment::set_section_list_address): Cast
11572         expressions to unsigned long long type to avoid format warnings.
11573
11574 2009-10-15  Ian Lance Taylor  <iant@google.com>
11575
11576         * script.cc (Script_options::add_symbol_assignment): Always add a
11577         dot assignment to script_sections_.
11578         * script-sections.cc (Script_sections::add_dot_assignment):
11579         Initialize if necessary.
11580
11581         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11582         program headers with no load segment if there is a linker script.
11583
11584         * layout.cc (Layout::set_segment_offsets): Align the file offset
11585         to the segment aligment for -N or -n with no load segment.
11586         * output.cc (Output_segment::add_output_section): Don't crash if
11587         the first section is a TLS section.
11588         (Output_segment::set_section_list_addresses): Print an error
11589         message if the address moves backward in a linker script.
11590         * script-sections.cc
11591         (Output_section_element_input::set_section_addresses): Don't
11592         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11593         (Orphan_output_section::set_section_addresses): Likewise.
11594
11595 2009-10-15  Doug Kwan  <dougkwan@google.com>
11596
11597         * layout.cc (Layout::finish_dynamic_section): Generate tags
11598         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11599         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11600         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11601
11602 2009-10-14  Ian Lance Taylor  <iant@google.com>
11603
11604         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11605         fields.
11606         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11607         data_shdr fields of relinfo.
11608         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11609         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11610         R_386_TLS_LDO_32, adjust based on section flags.
11611         (Target_i386::Relocate::fix_up_ldo): Remove.
11612
11613 2009-10-13  Ian Lance Taylor  <iant@google.com>
11614
11615         Add support for -pie.
11616         * options.h (class General_options): Add -pie and
11617         --pic-executable.
11618         (General_options::output_is_position_independent): Test -pie.
11619         (General_options::output_is_executable): Return true if not shared
11620         and not relocatable.
11621         (General_options::output_is_pie): Remove.
11622         * options.cc (General_options::finalize): Reject incompatible uses
11623         of -pie.
11624         * gold.cc (queue_middle_tasks): A -pie link is not static.
11625         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11626         * symtab.cc (Symbol::final_value_is_known): Return false if
11627         output_is_position_independent.
11628         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11629         output_is_position_independent.
11630         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11631         output_is_position_independent.
11632         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11633         output_is_position_independent.
11634         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11635         two_file_pie_test.
11636         (basic_pie_test.o, basic_pie_test): New targets.
11637         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11638         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11639         (two_file_pie_test): New target.
11640         * testsuite/Makefile.in: Rebuild.
11641         * README: Remove note saying that -pie is not supported.
11642
11643 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11644
11645         * options.h (class General_options): Add -init and -fini.
11646         * layout.cc (Layout::finish_dynamic_section): Emit
11647         given init and fini functions.
11648
11649 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11650
11651         * gc.h (gc_process_relocs): Check if icf is enabled using new
11652         function.
11653         * gold.cc (queue_initial_tasks): Likewise.
11654         (queue_middle_tasks): Likewise.
11655         * object.cc (do_layout): Likewise.
11656         * symtab.cc (is_section_folded): Likewise.
11657         * main.cc (main): Likewise.
11658         * reloc.cc (Read_relocs::run): Likewise.
11659         (Sized_relobj::do_scan_relocs): Likewise.
11660         * icf.cc (is_function_ctor_or_dtor): New function.
11661         (Icf::find_identical_sections): Check if function is ctor or dtor when
11662         safe icf is chosen.
11663         * options.h (General_options::icf): Change option to be an enum.
11664         (Icf_status): New enum.
11665         (icf_enabled): New method.
11666         (icf_safe_folding): New method.
11667         (set_icf_status): New method.
11668         (icf_status_): New variable.
11669         * (options.cc) (General_options::finalize): Set icf_status_.
11670         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11671         icf_test and icf_keep_unique_test to use the --icf enum flag.
11672         * testsuite/icf_safe_test.sh: New file.
11673         * testsuite/icf_safe_test.cc: New file.
11674
11675 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11676
11677         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11678         includes to gc.h and icf.h.
11679         * arm.cc: Include gc.h.
11680         * gold.cc: Likewise.
11681         * i386.cc: Likewise.
11682         * powerpc.cc: Likewise.
11683         * sparc.cc: Likewise.
11684         * x86_64.cc: Likewise.
11685         * gc.h: Include icf.h.
11686
11687 2009-10-11  Ian Lance Taylor  <iant@google.com>
11688
11689         * plugin.cc: Include "gold.h" before other header files.
11690
11691 2009-10-10  Chris Demetriou  <cgd@google.com>
11692
11693         * options.h (Input_file_argument::Input_file_type): New enum.
11694         (Input_file_argument::is_lib_): Replace with...
11695         (Input_file_argument::type_): New member.
11696         (Input_file_argument::Input_file_argument): Take Input_file_type
11697         'type' rather than boolean 'is_lib' as second argument.
11698         (Input_file_argument::is_lib): Use type_.
11699         (Input_file_argument::is_searched_file): New function.
11700         (Input_file_argument::may_need_search): Handle is_searched_file.
11701         * options.cc (General_options::parse_library): Support -l:filename.
11702         (General_options::parse_just_symbols): Update for Input_file_argument
11703         changes.
11704         (Command_line::process): Likewise.
11705         * archive.cc (Archive::get_file_and_offset): Likewise.
11706         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11707         * script.cc (read_script_file, script_add_file): Likewise.
11708         * fileread.cc (Input_file::Input_file): Likewise.
11709         (Input_file::will_search_for): Handle is_searched_file.
11710         (Input_file::open): Likewise.
11711         * readsyms.cc (Read_symbols::get_name): Likewise.
11712         * testsuite/Makefile.am (searched_file_test): New test.
11713         * testsuite/Makefile.in: Regenerate.
11714         * testsuite/searched_file_test.cc: New file.
11715         * testsuite/searched_file_test_lib.cc: New file.
11716
11717 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11718             Ian Lance Taylor  <iant@google.com>
11719
11720         * descriptor.cc: Include <cstdio> and "binary-io.h".
11721         (Descriptors::open): Open the files in binary mode always.
11722         * script.cc (Lex::get_token): Treat \r as whitespace.
11723
11724 2009-10-09  Ian Lance Taylor  <iant@google.com>
11725
11726         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11727
11728 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11729             Ian Lance Taylor  <iant@google.com>
11730
11731         * configure.ac: Check for readv function also.
11732         * fileread.cc (readv): Define if not HAVE_READV.
11733         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11734         does not exist.
11735         * config.in: Regenerate.
11736         * configure: Regenerate.
11737
11738 2009-10-09  Doug Kwan  <dougkwan@google.com>
11739
11740         * layout.cc (Layout::make_output_section): Call target hook to make
11741         ordinary output section.
11742         (Layout::finalize): Adjust parameter list of call the
11743         Target::may_relax().
11744         * layout.h (class Layout::section_list): New method.
11745         * merge.h (Output_merge_base::entsize): Change visibility to public.
11746         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11747         New methods.
11748         (Output_merge_string::do_is_string): New method.
11749         * object.cc (Sized_relobj::do_setup): renamed from
11750         Sized_relobj::set_up.
11751         * object.h (Sized_relobj::adjust_shndx,
11752         Sized_relobj::initializ_input_to_output_maps,
11753         Sized_relobj::free_input_to_output_maps): Change visibilities to
11754         protected.
11755         (Sized_relobj::setup): Virtualize.
11756         (Sized_relobj::do_setup): New method declaration.
11757         (Sized_relobj::invalidate_section_offset,
11758         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11759         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11760         * options.cc (parse_int): New function.
11761         * options.h (parse_int): New declaration.
11762         (DEFINE_int): New macro.
11763         (stub_group_size): New option.
11764         * output.cc (Output_section::Output_section): Initialize memebers
11765         merge_section_map_, merge_section_by_properties_map_,
11766         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11767         (Output_section::add_input_section): Handled deferred code-fill
11768         generation and remove an old comment.
11769         (Output_section::add_relaxed_input_section): New method definition.
11770         (Output_section::add_merge_input_section): Use merge section by
11771         properties map to speed to search.  Update merge section maps
11772         as appropriate.
11773         (Output_section::build_relaxation_map): New method definition.
11774         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11775         Same.
11776         (Output_section::relax_input_section): Renamed to
11777         Output_section::convert_input_sections_to_relaxed_sections and change
11778         interface to take a vector of pointers to relaxed sections.
11779         (Output_section::find_merge_section,
11780         Output_section::find_relaxed_input_section): New method definitions.
11781         (Output_section::is_input_address_mapped,
11782         Output_section::output_offset, Output_section::output_address):
11783         Use output section data maps to speed up searching.
11784         (Output_section::find_starting_output_address): Add comments.
11785         (Output_section::do_write,
11786         Output_section::write_to_postprocessing_buffer): Do code-fill
11787         generation as appropriate.
11788         (Output_section::get_input_sections): Invalidate relaxed input section
11789         map.
11790         (Output_section::restore_states): Adjust type of checkpoint .
11791         Invalidate relaxed input section map.
11792         * output.h (Output_merge_base): New class declaration.
11793         (Input_section_specifier): New class defintion.
11794         (class Output_relaxed_input_section) Change base class to
11795         Output_section_data_build.
11796         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11797         base class initializer.
11798         (Output_section::add_relaxed_input_section): New method declaration.
11799         (Output_section::Input_section): Change visibility to protected.
11800         (Output_section::Input_section::relobj,
11801         Output_section::Input_section::shndx): Handle relaxed input sections.
11802         Output_section::input_sections) Change visibility to protected.  Also
11803         define overload to return a non-const pointer.
11804         (Output_section::Merge_section_properties): New class defintion.
11805         (Output_section::Merge_section_by_properties_map,
11806         Output_section::Output_section_data_by_input_section_map,
11807         Output_section::Relaxation_map): New types.
11808         (Output_section::relax_input_section): Rename method to
11809         Output_section::convert_input_sections_to_relaxed_sections and change
11810         interface to take a vector of relaxed section pointers.
11811         (Output_section::find_merge_section,
11812         Output_section::find_relaxed_input_section,
11813         Output_section::build_relaxation_map,
11814         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11815         New method declarations.
11816         (Output_section::merge_section_map_
11817         Output_section::merge_section_by_properties_map_,
11818         Output_section::relaxed_input_section_map_,
11819         Output_section::is_relaxed_input_section_map_valid_,
11820         Output_section::generate_code_fills_at_write_): New data members.
11821         * script-sections.cc
11822         (Output_section_element_input::set_section_addresses): Call
11823         current_data_size and addralign methods of relaxed input sections.
11824         (Orphan_output_section::set_section_addresses): Call current_data_size
11825         and addralign methods of relaxed input sections.
11826         * symtab.cc (Symbol_table::compute_final_value): Extract template
11827         from the body of Symbol_table::sized_finalize_symbol.
11828         (Symbol_table::sized_finalized_symbol): Call
11829         Symbol_table::compute_final_value.
11830         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11831         (Symbol_table::compute_final_value): New templated method declaration.
11832         * target.cc (Target::do_make_output_section): New method defintion.
11833         * target.h (Target::make_output_section): New method declaration.
11834         (Target::relax): Add more parameters for input objects, symbol table
11835         and layout.  Adjust call to do_relax.
11836         (Target::do_make_output_section): New method declaration.
11837         (Target::do_relax): Add parameters for input objects, symbol table
11838         and layout.
11839
11840 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11841
11842         * pread.c: Include stdio.h.
11843
11844 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11845
11846         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11847         defined.
11848
11849 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11850
11851         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11852         Change read_shndx type to unsigned int.
11853         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11854         int.
11855         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11856         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11857         Change read_shndx type to unsigned int.
11858         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11859         int.
11860         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11861         * layout.cc (Layout::create_symtab_sections): Cast the result of
11862         local_symcount * symsize to off_t in the gold_assert.
11863
11864 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11865
11866         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11867         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11868         R_ARM_BASE_ABS.
11869         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11870         (Arm_relocate_functions::thm_abs5): New function.
11871         (Arm_relocate_functions::abs12): New function.
11872         (Arm_relocate_functions::abs16): New function.
11873         (Arm_relocate_functions::base_abs): New function.
11874         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11875         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11876         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11877         R_ARM_BASE_ABS.
11878         (Scan::global): Likewise.
11879         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11880         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11881         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11882         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11883         R_ARM_BASE_ABS.
11884
11885 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11886
11887         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11888         (Arm_relocate_functions::movt_prel): New function.
11889         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11890         (Arm_relocate_functions::thm_movt_prel): New function.
11891         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11892         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11893         (Scan::global, Relocate::relocate): Likewise.
11894         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11895
11896 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11897
11898         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11899         Incremental_checker.
11900         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11901         unsigned int.
11902         (class Incremental_inputs_header): New class.
11903         (Incremental_inputs_header_writer): Edit comment.
11904         (Incremental_inputs_entry): New class.
11905         (Incremental_inputs_entry_writer): Edit comment.
11906         (Sized_incremental_binary::do_find_incremental_inputs_section):
11907         Add *strtab_shndx parameter, fill it.
11908         (Sized_incremental_binary::do_check_inputs): New method.
11909         (Incremental_checker::can_incrementally_link_output_file): Use
11910         Sized_incremental_binary::check_inputs.
11911         (Incremental_inputs::report_command_line): Save command line in
11912         command_line_.
11913         * incremental.h:
11914         (Incremental_binary::find_incremental_inputs_section): New
11915         method.
11916         (Incremental_binary::do_find_incremental_inputs_section): Add
11917         strtab_shndx parameter.
11918         (Incremental_binary::do_check_inputs): New pure virtual method.
11919         (Sized_incremental_binary::do_check_inputs): Declare.
11920         (Incremental_checker::Incremental_checker): Add incremental_inputs
11921         parameter, use it to initialize incremental_inputs_.
11922         (Incremental_checker::incremental_inputs_): New field.
11923         (Incremental_checker::command_line): New method.
11924         (Incremental_checker::inputs): New method.
11925         (Incremental_checker::command_line_): New field.
11926
11927 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11928
11929         * incremental.cc: Include <cstdarg> and "target-select.h".
11930         (vexplain_no_incremental): New function.
11931         (explain_no_incremental): New function.
11932         (Incremental_binary::error): New method.
11933         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11934         method.
11935         (make_sized_incremental_binary): New function.
11936         (open_incremental_binary): New function.
11937         (can_incrementally_link_file): Add checks if output is ELF and has
11938         inputs section.
11939         * incremental.h: Include "elfcpp_file.h" and "output.h".
11940         (Incremental_binary): New class.
11941         (Sized_incremental_binary): New class.
11942         (open_incremental_binary): Declare.
11943         * object.cc (is_elf_object): Use
11944         elfcpp::Elf_recognizer::is_elf_file.
11945         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11946         * output.h (Output_file::filesize): New method.
11947
11948 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11949
11950         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11951         New function.
11952         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11953         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11954         function.
11955         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11956         function.
11957         (Arm_relocate_functions::movw_abs_nc): New function.
11958         (Arm_relocate_functions::movt_abs): New function.
11959         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11960         (Arm_relocate_functions::thm_movt_abs): New function.
11961         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11962         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11963         (Scan::global): Likewise.
11964         (Relocate::relocate): Likewise.
11965         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11966
11967 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11968
11969         * arm.cc (Arm_relocate_functions::got_prel) New function.
11970         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11971         (Relocate::relocate): Likewise.
11972         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11973
11974 2009-10-06  Ian Lance Taylor  <iant@google.com>
11975
11976         * options.h (class General_options): Define
11977         split_stack_adjust_size parameter.
11978         * object.h (class Object): Add uses_split_stack_ and
11979         has_no_split_stack_ fields.  Add uses_split_stack and
11980         has_no_split_stack accessor functions.  Declare
11981         handle_split_stack_section.
11982         (class Reloc_symbol_changes): Define.
11983         (class Sized_relobj): Define Function_offsets.  Declare
11984         split_stack_adjust, split_stack_adjust_reltype, and
11985         find_functions.
11986         * object.cc (Object::handle_split_stack_section): New function.
11987         (Sized_relobj::do_layout): Call handle_split_stack_section.
11988         * dynobj.cc (Sized_dynobj::do_layout): Call
11989         handle_split_stack_section.
11990         * reloc.cc (Sized_relobj::relocate_sections): Call
11991         split_stack_adjust for executable sections in split_stack
11992         objects.  Pass reloc_map to relocate_section.
11993         (Sized_relobj::split_stack_adjust): New function.
11994         (Sized_relobj::split_stack_adjust_reltype): New function.
11995         (Sized_relobj::find_functions): New function.
11996         * target-reloc.h: Include "object.h".
11997         (relocate_section): Add reloc_symbol_changes parameter.  Change
11998         all callers.
11999         * target.h (class Target): Add calls_non_split method.  Declare
12000         do_calls_non_split virtual method.  Declare match_view and
12001         set_view_to_nop.
12002         * target.cc: Include "elfcpp.h".
12003         (Target::do_calls_non_split): New function.
12004         (Target::match_view): New function.
12005         (Target::set_view_to_nop): New function.
12006         * gold.cc (queue_middle_tasks): Give an error if mixing
12007         split-stack and non-split-stack objects with -r.
12008         * i386.cc (Target_i386::relocate_section): Add
12009         reloc_symbol_changes parameter.
12010         (Target_i386::do_calls_non_split): New function.
12011         * x86_64.cc (Target_x86_64::relocate_section): Add
12012         reloc_symbol_changes parameter.
12013         (Target_x86_64::do_calls_non_split): New function.
12014         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
12015         parameter.
12016         * powerpc.cc (Target_powerpc::relocate_section): Add
12017         reloc_symbol_changes parameter.
12018         * sparc.cc (Target_sparc::relocate_section): Add
12019         reloc_symbol_changes parameter.
12020         * configure.ac: Call AM_CONDITIONAL for the default target.
12021         * configure: Rebuild.
12022         * testsuite/Makefile.am (TEST_AS): New variable.
12023         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
12024         (check_DATA): Add split_i386 and split_x86_64 files.
12025         (SPLIT_DEFSYMS): Define.
12026         (split_i386_[1234n].o): New targets.
12027         (split_i386_[124]): New targets.
12028         (split_i386_[1234r].stdout): New targets.
12029         (split_x86_64_[1234n].o): New targets.
12030         (split_x86_64_[124]): New targets.
12031         (split_x86_64_[1234r].stdout): New targets.
12032         (MOSTLYCLEANFILES): Add new executables.
12033         * testsuite/split_i386.sh: New file.
12034         * testsuite/split_x86_64.sh: New file.
12035         * testsuite/split_i386_1.s: New file.
12036         * testsuite/split_i386_2.s: New file.
12037         * testsuite/split_i386_3.s: New file.
12038         * testsuite/split_i386_4.s: New file.
12039         * testsuite/split_i386_n.s: New file.
12040         * testsuite/split_x86_64_1.s: New file.
12041         * testsuite/split_x86_64_2.s: New file.
12042         * testsuite/split_x86_64_3.s: New file.
12043         * testsuite/split_x86_64_4.s: New file.
12044         * testsuite/split_x86_64_n.s: New file.
12045         * testsuite/testfile.cc (Target_test): Update relocation_section
12046         function.
12047         * testsuite/Makefile.in: Rebuild.
12048
12049 2009-10-06  Ian Lance Taylor  <iant@google.com>
12050
12051         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12052         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12053         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12054         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12055         the address on ldo_addrs_.
12056         (Target_i386::Relocate::fix_up_ldo): New function.
12057
12058 2009-10-06   Rafael Espindola  <espindola@google.com>
12059
12060         * plugin.cc (add_input_library): New.
12061         (Plugin::load): Add add_input_library to tv.
12062         (Plugin_manager::add_input_file): Add the is_lib argument.
12063         (add_input_file): Update call to Plugin_manager::add_input_file.
12064         (add_input_library): New.
12065         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12066
12067 2009-09-30  Doug Kwan  <dougkwan@google.com>
12068
12069         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12070         symbol and call Symbol::may_need_copy_reloc to determine if
12071         a copy reloc is needed.
12072         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12073         nocopyreloc is given in command line.
12074         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12075         given in command line.
12076         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12077         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12078         of the removed Target_i386::may_need_copy_reloc.
12079         * options.h (copyreloc): New option with default value false.
12080         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12081         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12082         instead of the removed Target_powerpc::may_need_copy_reloc.
12083         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12084         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12085         instead of the removed Target_sparc::may_need_copy_reloc.
12086         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12087         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12088         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12089         instead of the removed Target_x86_64::may_need_copy_reloc.
12090
12091 2009-09-30  Ian Lance Taylor  <iant@google.com>
12092
12093         * object.h (class Object): Remove target_ field, and target,
12094         sized_target, and set_target methods.
12095         (Object::sized_target): Remove.
12096         (class Sized_relobj): Update declarations.  Remove sized_target.
12097         * object.cc (Sized_relobj::setup): Remove target parameter.
12098         Change all callers.
12099         (Input_objects::add_object): Don't do anything with the target.
12100         (make_elf_sized_object): Add punconfigured parameter.  Change all
12101         callers.  Set or test parameter target.
12102         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12103         Change all callers.
12104         * parameters.cc (Parameters::set_target): Change parameter type to
12105         be non-const.
12106         (Parameters::default_target): Remove.
12107         (set_parameters_target): Change parameter type to be non-const.
12108         (parameters_force_valid_target): New function.
12109         (parameters_clear_target): New function.
12110         * parameters.h (class Parameters): Update declarations.  Remove
12111         default_target method.  Add sized_target and clear_target
12112         methods.  Change target_ to be non-const.
12113         (set_parameters_target): Update declaration.
12114         (parameters_force_valid_target): Declare.
12115         (parameters_clear_target): Declare.
12116         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12117         as NULL if we aren't searching.
12118         (Add_symbols::run): Don't check for compatible target.
12119         * fileread.cc (Input_file::open_binary): Call
12120         parameters_force_valid_target.
12121         * gold.cc (queue_middle_tasks): Likewise.
12122         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12123         set_target on object.
12124         * dynobj.h (class Sized_dynobj): Update declarations.
12125         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12126         make_elf_object returns NULL.
12127         (Archive::include_member): Don't check whether object target is
12128         compatible.
12129         * output.cc (Output_section::add_input_section): Get target from
12130         parameters.
12131         (Output_section::relax_input_section): Likewise.
12132         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12133         parameters.
12134         (Sized_relobj::do_scan_relocs): Likewise.
12135         (Sized_relobj::relocate_sections): Likewise.
12136         * resolve.cc (Symbol_table::resolve): Likewise.
12137         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12138         parameter.  Change all callers.
12139         (Symbol_table::add_from_object): Get target from parameters.
12140         (Symbol_table::add_from_relobj): Don't check object target.
12141         (Symbol_table::add_from_dynobj): Likewise.
12142         (Symbol_table::define_special_symbol): Get target from
12143         parameters.
12144         * symtab.h (class Symbol_table): Update declaration.
12145         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12146         parameter.  Change all callers.  Clear parameter target.
12147         (Binary_test): Test target here.
12148         * testsuite/object_unittest.cc (gold_testsuite): Remove
12149         target_test_pointer parameter.  Change all callers.
12150         (Object_test): Test target here.
12151
12152 2009-09-26  Ian Lance Taylor  <iant@google.com>
12153
12154         * testsuite/initpri1.c: Don't try to use constructor priorities if
12155         compiling with gcc before 4.3.
12156
12157 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12158
12159         * testsuite/retain_symbols_file_test.sh (check_present): Change
12160         output file name to retain_symbols_file_test.stdout.
12161         (check_absent): Likewise.
12162
12163 2009-09-18  Craig Silverstein  <csilvers@google.com>
12164
12165         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12166         * options.cc: Include <cerrno> and <fstream>.
12167         (General_options::finalize): Parse -retain-symbols-file tag.
12168         * options.h: New flag.
12169         (General_options): New method should_retain_symbol, new
12170         variable symbols_to_retain.
12171         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12172         should_retain_symbol map.
12173         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12174         * testsuite/Makefile.in: Regenerate.
12175         * testsuite/retain_symbols_file_test.sh: New file.
12176
12177 2009-09-18  Nick Clifton  <nickc@redhat.com>
12178
12179         * po/es.po: Updated Spanish translation.
12180
12181 2009-09-17  Doug Kwan  <dougkwan@google.com>
12182
12183         * debug.h (DEBUG_RELAXATION): New constant.
12184         (DEBUG_ALL): Add DEBUG_RELAXATION.
12185         (debug_string_to_enum): Add relaxation debug option.
12186         * layout.cc
12187         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12188         Layout::Relaxation_debug_check::read_sections,
12189         Layout::Relaxation_debug_check::read_sections): New method definitions.
12190         (Layout::Layout): Initialize data members
12191         record_output_section_data_from_scrips_,
12192         script_output_section_data_list_ and relaxation_debug_check_.
12193         (Layout::save_segments, Layout::restore_segments,
12194         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12195         Layout::relaxation_loop_body): New method definitions.
12196         (Layout::finalize): Support relaxation.  Move section layout code to
12197         Layout::relaxation_loop_body.
12198         (Layout::set_asection_address_from_script): Move code for orphan
12199         section placement out.
12200         (Layout::place_orphan_sections_in_script): New method definition.
12201         * layout.h (Output_segment_headers, Output_file_header):
12202         New forward class declarations.
12203         (Layout::~Layout): Define.
12204         (Layout::new_output_section_data_from_script): New method definition.
12205         (Layout::place_orphan_sections_in_script): New method declaration.
12206         (Layout::Segment_states): New type declaration.
12207         (Layout::save_segments, Layout::restore_segments,
12208         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12209         Layout::relaxation_loop_body): New method declarations.
12210         (Layout::Output_section_data_list): New type declaration.
12211         (Layout::Relaxation_debug_check): New class definition.
12212         (Layout::record_output_section_data_from_script_,
12213         Layout::script_output_section_data_list_, Layout::segment_states_,
12214         Layout::relaxation_debug_check_): New data members.
12215         * output.cc: (Output_section_headers::do_size): New method definition.
12216         (Output_section_headers::Output_section_headers): Move size
12217         computation to Output_section_headers::do_size.
12218         (Output_segment_headers::do_size): New method definition.
12219         (Output_file_header::Output_file_header): Move size computation to
12220         Output_file_header::do_size and call it.
12221         (Output_file_header::do_size): New method definition.
12222         (Output_data_group::Output_data_group): Adjust call to
12223         Output_section_data.
12224         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12225         (Output_symtab_xindex::do_write): Add array bound check.
12226         (Output_section::Input_section::print_to_mapfile): Handle
12227         RELAXED_INPUT_SECTION_CODE.
12228         (Output_section::Output_section): Initialize data member checkpoint_.
12229         (Output_section::~Output_section): Delete checkpoint object pointed
12230         by checkpoint_.
12231         (Output_section::add_input_section): Always add an Input_section if
12232         relaxing.
12233         (Output_section::add_merge_input_section): Add assert.
12234         (Output_section::relax_input_section): New method definition.
12235         (Output_section::set_final_data_size): Set load address to zero for
12236         an unallocated section.
12237         (Output_section::do_address_and_file_offset_have_reset_values):
12238         New method definition.
12239         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12240         Handle relaxed input section.
12241         (Output_section::sort_attached_input_sections): Checkpoint input
12242         section list lazily.
12243         (Output_section::get_input_sections): Change type of input_sections to
12244         list of Simple_input_section pointers.  Checkpoint input section list
12245         lazily.  Also handle relaxed input sections.
12246         (Output_section::add_input_section_for_script): Take a reference to
12247         a Simple_input_section object instead of Relobj pointer and section
12248         index as parameter.  Handle relaxed input sections.
12249         (Output_section::save_states, Output_section::restore_states): New
12250         method definitions.
12251         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12252         (Output_data::is_data_size_fixed): New method definition.
12253         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12254         if it is fixed.
12255         (Output_data::address_and_file_offset_have_reset_values): New method
12256         definition.
12257         (Output_data::do_address_and_file_offset_have_reset_values): New method
12258         definition.
12259         (Output_data::set_data_size): Check that data size is not fixed.
12260         (Output_data::fix_data_size): New method definition.
12261         (Output_data::is_data_size_fixed_): New data member.
12262         (Output_section_headers::set_final_data_size): New method definition.
12263         (Output_section_headers::do_size): New method declaration.
12264         (Output_segment_headers::set_final_data_size): New method definition.
12265         (Output_segment_headers::do_size): New method declaration.
12266         (Output_file_header::set_final_data_size)::New method definition.
12267         (Output_file_header::do_size)::New method declaration.
12268         (Output_section_data::Output_section_data): Add new parameter
12269         is_data_size_fixed and use it to fix data size.
12270         (Output_data_const::Output_data_const): Adjust call to base class
12271         constructor and fix data size.
12272         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12273         base class constructor and fix data size.
12274         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12275         base class constructor and fix data size.
12276         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12277         class constructor and fix data size.
12278         (Output_data_group::set_final_data_size): New method definition.
12279         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12280         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12281         class constructor and fix data size.
12282         (Output_relaxed_input_section): New class definition.
12283         (Output_section::Simple_input_section): New class definition.
12284         (Output_section::get_input_sections): Adjust parameter list.
12285         (Output_section::add_input_section_for_script): Same.
12286         (Output_section::save_states, Output_section::restore_states,
12287         Output_section::do_address_and_file_offset_have_reset_values,
12288         (Output_section::Input_section::Input_section): Handle
12289         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12290         Output_relaxed_input_section.
12291         (Output_section::Input_section::is_input_section,
12292         Output_section::Input_section::set_output_section): Handle relaxed
12293         input section.
12294         (Output_section::Input_section::is_relaxed_input_section,
12295         Output_section::Input_section::output_section_data,
12296         Output_section::Input_section::relaxed_input_section): New method
12297         definitions.
12298         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12299         value.
12300         (Output_section::Input_section::u1_): Update comments.
12301         (Output_section::Input_section::u2_): Add new union member poris.
12302         (Output_section::Checkpoint_output_section): New classs definition.
12303         (Output_section::relax_input_section): New method declaration.
12304         (Output_section::checkpoint_): New data member.
12305         (Output_segment): Update comments.
12306         (Output_segment::Output_segment): Un-privatize copy constructor.
12307         (Output_segment::operator=): Un-privatize.
12308         * script-sections.cc (Output_section_element::Input_section_list):
12309         Change element type to Output_section::Simple_input_section.
12310         (Output_section_element_dot_assignment::set_section_addresses):
12311         Register output section data for relaxation clean up.
12312         (Output_data_exression::Output_data_expression): Adjust call to base
12313         constructor to fix data size.
12314         (Output_section_element_data::set_section_addresses): Register
12315         Output_data_expression object for relaxation clean up.
12316         (struct Input_section_info): Replace Relobj pointer and section index
12317         pair with Output_section::Simple_input_section and Convert struct to a
12318         class.
12319         (Input_section_sorter::operator()): Adjust access to
12320         Input_section_info data member to use accessors.
12321         (Output_section_element_input::set_section_addresses): Use layout
12322         parameter.  Adjust code to use Output_section::Simple_input_section
12323         and Input_secction_info classes.  Register filler for relaxation
12324         clean up.
12325         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12326         and section index pair with Output_section::Simple_input_section
12327         class.  Adjust code accordingly.
12328         (Phdrs_element::release_segment): New method definition.
12329         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12330         segment list.
12331         (Script_sections::release_segments): New method definition.
12332         * gold/script-sections.h (Script_sections::release_segments): New
12333         method declaration.
12334         * gold/target.h (Target::may_relax, Target::relax,
12335         Target::do_may_relax, Target::do_relax): New method definitions.
12336
12337 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12338
12339         * arm.cc (has_signed_unsigned_overflow): New function.
12340         (Arm_relocate_functions::abs8): New function.
12341         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12342         (Target_arm::Scan::global): Likewise.
12343         (Target_arm::relocate::relocate): Likewise.
12344         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12345         Likewise.
12346
12347 2009-09-16  Cary Coutant  <ccoutant@google.com>
12348
12349         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12350         * testsuite/Makefile.in: Regenerate.
12351
12352 2009-09-11  Nick Clifton  <nickc@redhat.com>
12353
12354         * po/gold.pot: Updated by the Translation project.
12355
12356 2009-09-08  Cary Coutant  <ccoutant@google.com>
12357
12358         * output.cc (Output_file::open): Add execute permission to empty file.
12359         * testsuite/Makefile.am (permission_test): New test.
12360         * testsuite/Makefile.in: Regenerate.
12361
12362 2009-09-02  Ian Lance Taylor  <iant@google.com>
12363
12364         * output.cc (Output_file::resize): Call map_no_anonymous rather
12365         than map.
12366
12367 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12368
12369         * gold.cc: Include "incremental.h".
12370         (queue_initial_tasks): Call Incremental_checker methods.
12371         * incremental.cc: Include "output.h".
12372         (Incremental_checker::can_incrementally_link_output_file): New
12373         method.
12374         * incremental.h (Incremental_checker): New class.
12375
12376         * output.cc (Output_file::open_for_modification): New method.
12377         (Output_file::map_anonymous): Changed return type to bool.  Record
12378         map in base_ field.
12379         (Output_file::map_no_anonymous): New method, broken out of map.
12380         (Output_file::map): Use map_no_anonymous and map_anonymous.
12381         * output.h (class Output_file): Update declarations.
12382
12383 2009-08-24  Cary Coutant  <ccoutant@google.com>
12384
12385         * options.h (Command_line::Pre_options): New class.
12386         (Command_line::pre_options): New member.
12387         * options.cc (gold::options::ready_to_register): New variable.
12388         (One_option::register_option): Do nothing if not registering options.
12389         Assert if same short option registered twice.
12390         (General_options::General_options): Turn off option registration when
12391         done constructing.
12392         (Command_line::Pre_options::Pre_options): New constructor.
12393
12394 2009-08-24  Cary Coutant  <ccoutant@google.com>
12395
12396         * options.h (General_options::no_keep_memory): Remove incorrect
12397         short option.
12398
12399 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12400
12401         * Makefile.am (am__skiplex, am__skipyacc): New.
12402         * Makefile.in: Regenerate.
12403
12404 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12405
12406         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12407         (INCLUDES): ... this.
12408         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12409         (AM_CPPFLAGS): Renamed from ...
12410         (INCLUDE): ... this.
12411         * Makefile.in, testsuite/Makefile.in: Regenerate.
12412
12413         * Makefile.in: Regenerate.
12414         * aclocal.m4: Likewise.
12415         * config.in: Likewise.
12416         * configure: Likewise.
12417         * testsuite/Makefile.in: Likewise.
12418
12419         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12420         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12421         * Makefile.in: Regenerate.
12422         * testsuite/Makefile.in: Regenerate.
12423
12424 2009-08-19  Cary Coutant  <ccoutant@google.com>
12425
12426         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12427         symbols in shared libraries overridden by hidden or internal symbols
12428         in the main program.
12429
12430 2009-08-19  Chris Demetriou  <cgd@google.com>
12431
12432         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12433         checking source file names in error messages.
12434
12435 2009-08-18  Doug Kwan  <dougkwan@google.com>
12436
12437         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12438         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12439         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12440         an elfcpp::Ehdr as parameter.
12441         * object.cc (Object::set_target): Remove the version that looks up
12442         a target and sets it.
12443         (Sized_relobj::setup): Take a Target object instead of
12444         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12445         (make_elf_sized_object): Find target and ask target to
12446         make an ELF object.
12447         * object.h: (Object::set_target): Remove the version that looks up
12448         a target and sets it.
12449         (Sized_relobj::setup): Take a Target object instead of
12450         an elfcpp:Ehdr as parameter.
12451         * target.cc: Include dynobj.h.
12452         (Target::do_make_elf_object_implementation): New.
12453         (Target::do_make_elf_object): New.
12454         * target.h (Target::make_elf_object): New template declaration.
12455         (Target::do_make_elf_object): New method declarations.
12456         (Target::do_make_elf_object_implementation): New template declaration.
12457
12458 2009-08-14  Ian Lance Taylor  <iant@google.com>
12459
12460         * gold.h (FUNCTION_NAME): Define.
12461         (gold_unreachable): Use FUNCTION_NAME.
12462
12463 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12464
12465         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12466         symbol in the --keep-unique list is not found.
12467
12468 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12469
12470         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12471         been maked as --keep-unique.
12472         (Icf::unfold_section): New function.
12473         * icf.h (Icf::unfold_section): New function.
12474         * options.h (General_options::keep_unique): New option.
12475         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12476         * testsuite/Makefile.in: Regenerate.
12477         * testsuite/icf_keep_unique_test.sh: New file.
12478         * testsuite/icf_keep_unique_test.cc: New file.
12479
12480 2009-08-12  Cary Coutant  <ccoutant@google.com>
12481
12482         PR 10471
12483         * resolve.cc (Symbol_table::resolve): Check for references from
12484         dynamic objects to hidden and internal symbols.
12485         * testsuite/Makefile.am (hidden_test.sh): New test.
12486         * testsuite/Makefile.in: Regenerate.
12487         * testsuite/hidden_test.sh: New script.
12488         * testsuite/hidden_test_1.c: New test source.
12489         * testsuite/hidden_test_main.c: New test source.
12490
12491 2009-08-11  Doug Kwan  <dougkwan@google.com>
12492
12493         * arm.cc: Update comments.
12494         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12495         segment to locate the .ARM.exidx section if present.
12496
12497 2009-08-09  Doug Kwan  <dougkwan@google.com>
12498
12499         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12500         patch.
12501
12502 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12503         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12504         compiler warnings.
12505
12506 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12507
12508         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12509         valid tls_segment only for non-debug-section relocations.
12510         * testsuite/Makefile.am: Add gc_tls_test.
12511         * testsuite/Makefile.in: Regenerate.
12512         * testsuite/gc_tls_test.cc: New file.
12513         * testsuite/gc_tls_test.sh: New file.
12514
12515 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12516
12517         * icf.cc: New file.
12518         * icf.h: New file.
12519         * Makefile.am (CCFILES): Add icf.cc.
12520         (HFILES): Add icf.h
12521         * Makefile.in: Regenerate.
12522         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12523         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12524         section, symbol and addend information for the relocs.
12525         * gold.cc (queue_middle_tasks): Call identical code folding.
12526         * gold.h: Add defines for multimap.
12527         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12528         to the call of finalize_local_symbols.
12529         * main.cc (main): Create object of class Icf.
12530         * object.cc (Sized_relobj::do_layout): Allow this function to be
12531         called twice during icf.
12532         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12533         to sections marked as identical by icf.
12534         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12535         when available.
12536         (Sized_relobj::do_section_entsize): New function.
12537         * object.h (Object::section_entsize): New function.
12538         (Object::do_section_entsize): New pure virtual function.
12539         (Relobj::finalize_local_symbols): Add new parameter.
12540         (Relobj::do_section_entsize): New function.
12541         * options.h (General_options::icf): New option.
12542         (General_options::icf_iterations): New option.
12543         (General_options::print_icf_sections): New option.
12544         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12545         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12546         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12547         icf.
12548         * symtab.cc (Symbol_table::is_section_folded): New function.
12549         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12550         to sections marked as identical by icf.
12551         * symtab.h (Symbol_table::set_icf): New function.
12552         (Symbol_table::icf): New function.
12553         (Symbol_table::is_section_folded): New function.
12554         (Symbol_table::icf_): New data member.
12555         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12556         * testsuite/Makefile.am: Add commands to build icf_test.
12557         * testsuite/Makefile.in: Regenerate.
12558         * testsuite/icf_test.sh: New file.
12559         * testsuite/icf_test.cc: New file.
12560
12561 2009-07-24  Chris Demetriou  <cgd@google.com>
12562
12563         * layout.cc (is_compressible_debug_section): Fix incorrect
12564         comment about compressed section names.
12565
12566 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12567
12568         PR 10419
12569         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12570
12571 2009-07-16  Ian Lance Taylor  <iant@google.com>
12572
12573         PR 10400
12574         * layout.h: #include <map>.
12575         (class Kept_section): Change from struct to class.  Add accessors
12576         and setters.  Add section size to Comdat_group mapping.  Change
12577         Comdat_group to std::map.  Add is_comdat_ field.  Add
12578         linkonce_size field in union.
12579         (class Layout): Update declaration of find_or_add_kept_section.
12580         Don't declare find_kept_object.
12581         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12582         parameter.  Add object, shndx, is_comdat, and is_group_name
12583         parameters.  Change all callers.  Adjust for new Kept_section.
12584         (Layout::find_kept_object): Remove.
12585         * object.cc (Sized_relobj::include_section_group): Update use of
12586         Kept_section.  Rename secnum to shndx.  Only record
12587         Kept_comdat_section if sections are the same size.
12588         (Sized_relobj::include_linkonce_section): Update use of
12589         Kept_section.  Only record Kept_comdat_section if sections are the
12590         same size.  Set size of linkonce section.
12591         (Sized_relobj::map_to_kept_section): Update call to
12592         get_kept_comdat_section.
12593         * object.h (class Sized_relobj): Rename fields in
12594         Kept_comdat_section to drop trailing underscores; change object
12595         field to Relobj*.  Change Kept_comdat_section_table to store
12596         struct rather than pointer.
12597         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12598         Add kept_object and kept_shndx parameters.  Change all callers.
12599         (Sized_relobj::get_kept_comdat_section): Change return type to
12600         bool.  Add kept_object and kept_shndx parameters.  Change all
12601         callers.
12602         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12603         Layout::find_or_add_kept_section.
12604
12605 2009-07-09  Ian Lance Taylor  <iant@google.com>
12606
12607         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12608         Reserve space in the hash table.
12609
12610 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12611
12612         * fileread.cc (File_read::get_mtime): New method.
12613         * fileread.h (Timespec): New structure.
12614         (File_read::get_mtime): New method.
12615         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12616         Renamed from timestamp_nsec.
12617         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12618         Elf_Xword.
12619         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12620         timestamp_nsec.
12621         (Incremental_inputs::report_archive): Save mtime; style fix.
12622         (Incremental_inputs::report_obejct): Save mtime; style fix.
12623         (Incremental_inputs::report_script): Save mtime; style fix.
12624         (Incremental_inputs::finalize_inputs): Style fix.
12625         (Incremental_inputs::finalize): Style fix.
12626         (Incremental_inputs::create_input_section_data): Store inputs
12627         mtime.
12628         * incremental.h (Incremental_inputs::report_script): Add mtime
12629         argument.
12630         (Incremental_inputs::Input_info::Input_info): Intialize only one
12631         union member.
12632         (Incremental_inputs::Input_info::archive): Move to nameless
12633         union.
12634         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12635         (Incremental_inputs::Input_info::script): Move to nameless union.
12636         (Incremental_inputs::mtime): New field.
12637         * script.cc (read_input_script): Pass file mtime to
12638         Incremental_input.
12639         * script.h (Script_info::inputs): Style fix.
12640
12641 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12642
12643         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12644         instead of 32.
12645
12646 2009-06-24  Ian Lance Taylor  <iant@google.com>
12647
12648         PR 10156
12649         * layout.cc (Layout::choose_output_section): If we find an
12650         existing section, update the flags.
12651         (Layout::create_notes): New function, broken out of
12652         Layout::finalize.
12653         (Layout::finalize): Don't create note sections.
12654         (Layout::create_note): Don't crash if linker script discards
12655         section.
12656         (Layout::create_gold_note): Likewise.
12657         (Layout::create_build_id): Likewise.  Don't set
12658         after_input_sections on the section.
12659         (Layout::create_executable_stack_info): Remove target parameter.
12660         Change caller.
12661         * layout.h (class Layout): Declare create_notes.  Update
12662         declaration of create_executable_stack_info.
12663         * gold.cc (queue_middle_tasks): Call create_notes.
12664         * output.cc (Output_section::update_flags_for_input_section): Move
12665         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12666         invalid.
12667         * output.h (Output_data::mark_address_invalid): New function.
12668         (class Output_section): Only declare, not define,
12669         update_flags_for_input_section.  Remove set_flags.
12670
12671 2009-06-24  Ian Lance Taylor  <iant@google.com>
12672
12673         * script-sections.cc (Output_section_definition::
12674         set_section_addresses): Rename shadowing local load_address to
12675         laddr.
12676
12677 2009-06-24  Ian Lance Taylor  <iant@google.com>
12678
12679         PR 10244
12680         * reloc.cc (relocate_sections): Skip empty relocation sections.
12681
12682 2009-06-23  Ian Lance Taylor  <iant@google.com>
12683
12684         PR 10156
12685         * layout.cc (Layout::create_note): Use choose_output_section
12686         rather than make_output_section.
12687
12688 2009-06-23  Ian Lance Taylor  <iant@google.com>
12689
12690         PR 10237
12691         * options.cc (General_options::parse_V): Set printed_version_.
12692         (General_options::General_options): Initialize printed_version_.
12693         * options.h (class General_options): Add printed_version_ field.
12694         * gold.cc (queue_initial_tasks): If there are no input files,
12695         don't give a fatal error if we printed the version information.
12696         (queue_middle_tasks): If using -r with a shared object, give a
12697         fatal error rather than an ordinary error.
12698
12699 2009-06-23  Ian Lance Taylor  <iant@google.com>
12700
12701         PR 10219
12702         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12703         (Layout::make_output_section): Set have_stabstr_section_ if we see
12704         a .stab*str section.
12705         (Layout::finalize): Call link_stabs_sections.
12706         (Layout::link_stabs_sections): New file.
12707         * layout.h (class Layout): Add have_stabstr_section_ field.
12708         Declare link_stabs_sections.
12709
12710 2009-06-23  Doug Kwan  <dougkwan@google.com>
12711
12712         * Makefile.am (libgold_a_LIBADD): New.
12713         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12714         * Makefile.in: Regenerate.
12715         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12716         * configure: Regenerate.
12717         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12718         * fileread.cc: Include sys/state.h
12719         * gold.h: Declare memmem and strndup if found missing.
12720         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12721
12722 2009-06-23  Ian Lance Taylor  <iant@google.com>
12723
12724         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12725         * configure: Rebuild.
12726
12727 2009-06-23  Ian Lance Taylor  <iant@google.com>
12728
12729         PR 10147
12730         * object.cc (Object::section_contents): Don't try to get a view if
12731         the section has length zero.
12732         (Object::handle_gnu_warning_section): If the section is empty, use
12733         the name of the section as the warning.
12734
12735 2009-06-23  Ian Lance Taylor  <iant@google.com>
12736
12737         PR 10133
12738         * stringpool.h (class Stringpool_template): Add optimize_ field.
12739         (Stringpool_template::set_optimize): New function.
12740         * stringpool.cc (Stringpool_template::Stringpool_template):
12741         Initialize optimize_ field.
12742         (Stringpool_template::set_string_offsets): Test local optimize
12743         fild rather than parameter.
12744         * layout.cc (Layout::Layout): Call set_optimize on the section
12745         name stringpool.
12746
12747 2009-06-22  Ian Lance Taylor  <iant@google.com>
12748
12749         PR 10030
12750         * yyscript.y: Parse TARGET.
12751         * script.cc (script_set_target): New function.
12752         * script-c.h (script_set_target): Declare.
12753         * options.cc (General_options::string_to_object_format): Rename
12754         from string_to_object_format in anonymous namespace.  Change
12755         callers.
12756         * options.h (class General_options): Declare
12757         string_to_object_format.
12758
12759 2009-06-22  Ian Lance Taylor  <iant@google.com>
12760
12761         * script-sections.cc (Script_sections::create_segments): Don't put
12762         program headers in a PT_LOAD segment if -n or -N.
12763
12764 2009-06-22  Ian Lance Taylor  <iant@google.com>
12765
12766         PR 10141
12767         * options.h (class General_options): Add -z lazy and -z now.  Sort
12768         -z options into alphabetical order.
12769         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12770
12771 2009-06-21  Ian Lance Taylor  <iant@google.com>
12772
12773         * layout.cc (Layout::make_output_section): Call
12774         Target::new_output_section.
12775         (Layout::attach_allocated_section_to_segment): Put large section
12776         sections in a separate load segment with the large segment flag
12777         set.
12778         (Layout::segment_precedes): Sort large data segments after other
12779         load segments.
12780         (align_file_offset): New static function.
12781         (Layout::set_segment_offsets): Use align_file_offset.
12782         * output.h (class Output_section): Add is_small_section_ and
12783         is_large_section_ fields.
12784         (Output_section::is_small_section): New function.
12785         (Output_section::set_is_small_section):  New function.
12786         (Output_section::is_large_section): New function.
12787         (Output_section::set_is_large_section): New function.
12788         (Output_section::is_large_data_section): New function.
12789         (class Output_segment): Add is_large_data_segment_ field.
12790         (Output_segment::is_large_data_segment): New function.
12791         (Output_segment::set_is_large_data_segment): New function.
12792         * output.cc (Output_section::Output_section): Initialize new
12793         fields.
12794         (Output_segment::Output_segment): Likewise.
12795         (Output_segment::add_output_section): Add assertion that large
12796         data sections always go in large data segments.  Force small data
12797         sections to the end of the list of data sections.  Force small BSS
12798         sections to the start of the list of BSS sections.  For large BSS
12799         sections to the end of the list of BSS sections.
12800         * symtab.h (class Symbol): Declare is_common_shndx.
12801         (Symbol::is_defined): Check Symbol::is_common_shndx.
12802         (Symbol::is_common): Likewise.
12803         (class Symbol_table): Define enum Commons_section_type.  Update
12804         declarations.  Add small_commons_ and large_commons_ fields.
12805         * symtab.cc (Symbol::is_common_shndx): New function.
12806         (Symbol_table::Symbol_table): Initialize new fields.
12807         (Symbol_table::add_from_object): Put small and large common
12808         symbols in the right list.
12809         (Symbol_table::sized_finalized_symbol): Check
12810         Symbol::is_common_shndx.
12811         (Symbol_table::sized_write_globals): Likewise.
12812         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12813         common symbol lists.  Don't call do_allocate_commons_list if the
12814         list is empty.
12815         (Symbol_table::do_allocate_commons_list): Remove is_tls
12816         parameter.  Add comons_section_type parameter.  Change all
12817         callers.  Handle small and large common symbols.
12818         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12819         Symbol::is_common_shndx.
12820         * resolve.cc (symbol_to_bits): Likewise.
12821         * target.h (Target::small_common_shndx): New function.
12822         (Target::small_common_section_flags): New function.
12823         (Target::large_common_shndx): New function.
12824         (Target::large_common_section_flags): New function.
12825         (Target::new_output_section): New function.
12826         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12827         small_common_section_flags, and large_common_section_flags
12828         fields.
12829         (Target::do_new_output_section): New virtual function.
12830         * arm.cc (Target_arm::arm_info): Initialize new fields.
12831         * i386.cc (Target_i386::i386_info): Likewise.
12832         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12833         Likewise.
12834         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12835         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12836         (Target_x86_64::do_new_output_section): New function.
12837         * configure.ac: Define conditional MCMODEL_MEDIUM.
12838         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12839         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12840         (large_LDFLAGS): Define.
12841         * testsuite/large.c: New file.
12842         * testsuite/testfile.cc (Target_test::test_target_info):
12843         Initialize new fields.
12844         * configure, testsuite/Makefile.in: Rebuild.
12845
12846 2009-06-05  Doug Kwan  <dougkwan@google.com>
12847
12848         * Makefile.am (CCFILES): Add target.cc.
12849         * Makefile.in: Regenerate.
12850         * i386.cc (class Target_i386): Define new virtual method to
12851         override do_is_local_label_name in parent.
12852         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12853         local symbols if --discard-locals or -X is given.
12854         * options.h (class General_options): Declare new options
12855         '--discard-locals' and '-X' for discarding locals.
12856         * target.h (class Target): Define new methods is_local_label_name.
12857         Declare new virtual method do_is_local_label_name.
12858         * target.cc: New file.
12859         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12860         (check_SCRIPTS): Add discard_locals_test.sh.
12861         (check_DATA): Add discard_local_tests.syms.
12862         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12863         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12864         * testsuite/Makefile.in: Regenerate.
12865         * testsuite/discard_locals_test.c: New file.
12866         * testsuite/discard_locals_test.sh: Same.
12867
12868 2009-06-05  Doug Kwan  <dougkwan@google.com>
12869
12870         * object.cc (Sized_relobj::Sized_relobj): Initialize
12871         discarded_eh_frame_shndx_ to -1U.
12872         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12873         section.
12874         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12875         a discarded .eh_frame section.
12876         (Sized_relobj::do_finalize_local_symbols): Ditto.
12877         * object.h (class Sized_relobj): Declare new member
12878         discarded_eh_frame_shndx_.
12879         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12880         (local_labels_test.o, local_labels_test): New rules.
12881         * testsuite/Makefile.in: Regenerate.
12882
12883 2009-06-04  Doug Kwan  <dougkwan@google.com>
12884
12885         * layout.cc (Layout::section_name_mapping): Add mapping for
12886         special ARM sections.
12887
12888 2009-06-03  Doug Kwan  <dougkwan@google.com>
12889
12890         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12891         (utils::has_overflow): Same.
12892
12893 2009-06-03  Ian Lance Taylor  <iant@google.com>
12894
12895         * layout.cc (Layout::section_name_mapping): New array, replacing
12896         Layout::linkonce_mapping.
12897         (Layout::section_name_mapping_count): New variable, replacing
12898         Layout::linkonce_mapping_count.
12899         (Layout::linkonce_output_name): Remove.
12900         (Layout::output_section_name): Rewrite.
12901         * layout.h (class Layout): Rename Linkonce_mapping to
12902         Section_name_mapping, linkonce_mapping to section_name_mapping,
12903         linkonce_mapping_count to section_name_mapping_count.  Don't
12904         declare linkonce_output_name.
12905
12906 2009-06-03  Doug Kwan  <dougkwan@google.com>
12907
12908         * gold/arm.cc (namespace utils): New.
12909         (Target_arm::reloc_is_non_pic): Define new method.
12910         (class Arm_relocate_functions): New.
12911         (Target_arm::Relocate::relocate): Handle relocation types used by
12912         Android.
12913
12914 2009-06-03  Ian Lance Taylor  <iant@google.com>
12915
12916         * arm.cc (Target_arm::scan::global): Use || instead of |.
12917
12918 2009-06-02  Doug Kwan  <dougkwan@google.com>
12919
12920         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12921         issued_non_pic_error_.
12922         (class Target_arm::Scan): Declare new method check_non_pic.
12923         Define new method symbol_needs_plt_entry.
12924         Declare new data member issued_non_pic_error_.
12925         (class Target_arm::Relocate): Declare new method
12926         should_apply_static_reloc.
12927         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12928         (Target_arm::Scan::check_non_pic): Define new method.
12929         (Target_arm::Scan::local): Handle a small subset of reloc types used
12930         by Android.
12931         (Target_arm::Scan::local): Same.
12932         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12933
12934 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12935
12936         * incremental.cc (Incremental_inputs::report_command_line): Filter
12937         out --incremental-* options.
12938
12939 2009-05-29  Doug Kwan  <dougkwan@google.com>
12940
12941         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12942         template class.
12943         (class Target_arm): Update comment.
12944         (Target_arm::Target_arm): Initialize new data members GOT_,
12945         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12946         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12947         and Target_arm::rel_dyn_section.
12948         Declare new_enum Target_arm::Got_type.
12949         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12950         and DYNBSS_.
12951         Update commments for member do_dynsym_value.
12952         (Target_arm::got_size, Target_arm::plt_section,
12953         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12954         new methods inside class defintion.
12955         (Target_arm::got_section): Define new method.
12956         (Target_arm::rel_dyn_section): Same.
12957         (Output_data_plt_arm): New template class.
12958         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12959         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12960         (Output_data_plt_arm::add_entry): Same.
12961         (Output_data_plt_arm::first_plt_entry): Define new
12962         static data member for PLT instruction template.
12963         (Output_data_plt_arm::plt_entry): Same.
12964         (Output_data_plt_arm::do_write): Define new method.
12965         (Target_arm::make_plt_entry): Same.
12966         (Target_arm::do_finalize_sections): Same.
12967         (Target_arm::do_dynsym_value): Same.
12968
12969 2009-05-28  Doug Kwan  <dougkwan@google.com>
12970
12971         * Makefile.am (TARGETSOURCES): Add arm.cc.
12972         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12973         * Makefile.in: Regenerate.
12974         * arm.cc: New file.
12975         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12976
12977 2009-05-26  Doug Kwan  <dougkwan@google.com>
12978
12979         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12980         (General_options::check_excluded_libs): Strip off directories in
12981         archive name before matching like GNU ld does.
12982         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12983         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12984         (exclude_libs_test_LDFLAGS): Add linker option
12985         -Wl,--exclude-libs,libexclude_libs_test_3
12986         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12987         an explicit archive without using -l.
12988         (alt/libexclude_libs_test_3.a): New make rule.
12989         * testsuite/Makefile.in: Regenerate.
12990         * testsuite/exclude_libs_test.c : Declare lib3_default().
12991         (main): Call it.
12992         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12993         * exclude_libs_test_3.c: New file.
12994
12995 2009-05-26  Nick Clifton  <nickc@redhat.com>
12996
12997         * po/id.po: New Indonesian translation.
12998         * po/gold.pot: Updated template file.
12999
13000 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
13001
13002         * testsuite/Makefile.am: Add -ffunction-sections to compile
13003         gc_comdat_test files.  Add -Wl,--gc-sections to build
13004         gc_comdat_test.
13005         * testsuite/Makefile.in: Regenerate.
13006         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
13007
13008 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
13009
13010         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
13011         kept comdat section was garbage collected.
13012         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
13013         * testsuite/Makefile.in: Regenerate.
13014         * testsuite/gc_comdat_test.sh: New file.
13015         * testsuite/gc_comdat_test_1.cc: New file.
13016         * testsuite/gc_comdat_test_2.cc: New file.
13017
13018 2009-05-19  Doug Kwan  <dougkwan@google.com>
13019
13020         * archive.cc (Archive::Archive): Move constructor from archive.h
13021         to here.  Initialize no_export_.
13022         (Archive::get_elf_object_for_member): Set no_export flag of object.
13023         * archive.h (Archive::Archive): Move constructor body to
13024         archive.cc.
13025         (Archive::no_export): New method.
13026         (Archive::no_export_): New field.
13027         * object.h (Object::Object): Initialize no_export_ to false.
13028         (Object::no_export, Object::set_no_export): New methods.
13029         (Object::no_export_): New field.
13030         * options.cc (General_options::parse_exclude_libs): New method.
13031         (General_options::check_excluded_libs) Same.
13032         * options.h (exclude_libs): New option.
13033         (General_options::check_excluded_libs): New method declaration.
13034         (General_options::excluded_libs_): New field.
13035         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13036         default or protected visibility if an object has no-export flag set.
13037         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13038         (check_SCRIPTS): Add exclude_libs_test.sh.
13039         (check_DATA): Add exclude_libs_test.syms.
13040         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13041         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13042         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13043         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13044         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13045         libexclude_libs_test_2.a): New rules.
13046         * testsuite/Makefile.in: Regenerate.
13047         * testsuite/exclude_libs_test.c: New file.
13048         * testsuite/exclude_libs_test.sh: Ditto.
13049         * testsuite/exclude_libs_test_1.c: Ditto.
13050         * testsuite/exclude_libs_test_2.c: Ditto.
13051
13052 2009-05-15  Ian Lance Taylor  <iant@google.com>
13053
13054         * configure.ac: Check for declarations for cases where libiberty.h
13055         checks HAVE_DECL_xxx.
13056         * configure, config.in: Rebuild.
13057
13058 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13059
13060         * gold.h (Incremental_argument_list): Remove (invalid) forward
13061         declaration.
13062         * incremental.cc (Incremental_inputs::report_achive): New method.
13063         (Incremental_inputs::report_object): New method.
13064         (Incremental_inputs::report_script): New method.
13065         (Incremental_inputs::finalize_inputs): New method.
13066         (Incremental_inputs::finalize): Call finalize_inputs().
13067         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13068         Create inputs entries.
13069         * incremental.h (Incremental_input_type): New enum.
13070         (Incremental_inputs::Incremental_input): Initialize new fields.
13071         (Incremental_inputs::report_inputs): New method.
13072         (Incremental_inputs::report_achive): New method.
13073         (Incremental_inputs::report_object): New method.
13074         (Incremental_inputs::report_script): New method.
13075         (Incremental_inputs::finalize_inputs): New method.
13076         (Incremental_inputs::Input_info): New struct.
13077         (Incremental_inputs::Input_info_map): New typedef.
13078         (Incremental_inputs::lock_): New field.
13079         (Incremental_inputs::Inputs_): New field.
13080         (Incremental_inputs::Inputs_map): New field.
13081         * main.cc (main): Call Incremental_input::report_inputs.
13082         * options.h (Input_argument_list): Typedef moved from
13083         Input_arguments.
13084         (Input_file_group::Files): Remove, use ::Input_argument_list.
13085         (Input_file_group::Input_argument_list): Remove, use
13086         ::Input_argument_list.
13087         * plugin.cc (Plugin_manager::add_input_file): Add error in
13088         incremental build.
13089         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13090         functions.
13091         * script.cc (read_input_script): Call
13092         Incremental_input::report_script.
13093         * script.h (Script_info): New class.
13094
13095 2009-04-27  Ian Lance Taylor  <iant@google.com>
13096
13097         * x86_64.cc (do_adjust_output_section): Set entsize to
13098         plt_entry_size.
13099
13100 2009-04-23  Elliott Hughes  <enh@google.com>
13101
13102         * output.cc (Output_file::close): After short writes, continue
13103         writing from the correct offset in the buffer being written.
13104
13105 2009-04-23  Chris Demetriou  <cgd@google.com>
13106
13107         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13108         * configure: Regenerate.
13109         * config.in: Regenerate.
13110         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13111         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13112
13113 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13114
13115         * incremental.cc (Incremental_inputs_header_data): Renamed from
13116         Incremental_input_header_data.
13117         (Incremental_inputs_header_data::data_size): New field.
13118         (Incremental_inputs_header_data::put_input_file_count): Renamed
13119         from input_file_count.
13120         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13121         from command_line_offset.
13122         (Incremental_inputs_header_data::put_reserved): Renamed from
13123         put_reserved.
13124         (Incremental_inputs_entry_data): Renamed from
13125         Incremental_input_entry_data.
13126         (Incremental_inputs_entry_data::data_size): New field.
13127         (Incremental_inputs::report_command_line): New method.
13128         (Incremental_inputs::finalize): New method.
13129         (Incremental_inputs::create_incremental_inputs_data): New method.
13130         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13131         * incremental.h: New file.
13132         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13133         (Layout::finalize): Create incremental inputs section in
13134         incremental builds.
13135         (Layout::create_incremental_info_sections): New method.
13136         * layout.h (Layout::incremental_inputs): New method.
13137         (Layout::create_incremental_info_sections): New method.
13138         (Layout::incremental_inputs_): New field.
13139         * main.cc (main): Notify Incremental_input of the command line.
13140
13141 2009-04-01  Ian Lance Taylor  <iant@google.com>
13142             Mikolaj Zalewski  <mikolajz@google.com>
13143
13144         * gold.h (reserve_unordered_map): Define, three versions, one for
13145         each version of Unordered_map.
13146         * layout.cc (Layout::Layout): Remove options parameter.  Add
13147         number_of_input_files parameter.  Don't initialize options_.
13148         Initialize number_of_input_files_ and resized_signatures_.  Move
13149         sections_are_attached_.
13150         (Layout::layout_group): Reserve space for group_signatures_.
13151         (Layout::find_or_add_kept_section): Change name parameter to be a
13152         reference.  Resize signatures_ map when it gets large enough.
13153         (Layout::layout_eh_frame): Use parameters->options() instead of
13154         this->options_.
13155         (Layout::make_output_section): Likewise.
13156         (Layout::attach_allocated_section_to_segment): Likewise.
13157         (Layout::finalize, Layout::create_executable_stack): Likewise.
13158         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13159         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13160         * layout.h (class Layout): Update declarations.  Remove options_
13161         field.  Add number_of_input_files_ and resized_signatures_
13162         fields.  Move sections_are_attached_ field.
13163         * main.cc (main): Pass number of input files to Layout
13164         constructor.  Don't pass options.
13165
13166 2009-03-30  Ian Lance Taylor  <iant@google.com>
13167
13168         * ffsll.c (ffsll): Correct implementation.
13169
13170 2009-03-27  Ian Lance Taylor  <iant@google.com>
13171
13172         * ffsll.c: New file.
13173         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13174         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13175         * ftruncate.c (ftruncate): Declare before definition.
13176         * mremap.c (mremap): Likewise.
13177         * pread.c (pread): Likewise.
13178         * configure, Makefile.in, config.in: Rebuild.
13179
13180         * mremap.c: New file.
13181         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13182         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13183         (mremap): Declare if HAVE_MREMAP is not defined.
13184         * configure, Makefile.in, config.in: Rebuild.
13185
13186 2009-03-27  Cary Coutant  <ccoutant@google.com>
13187
13188         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13189         position independent.
13190         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13191         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13192
13193 2009-03-24  Cary Coutant  <ccoutant@google.com>
13194
13195         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13196         an executable.
13197         (needs_dynamic_reloc): Likewise.
13198
13199 2009-03-24  Ian Lance Taylor  <iant@google.com>
13200
13201         * yyscript.y (file_cmd): Recognize EXTERN.
13202         (extern_name_list, extern_name_list_body): New nonterminals.
13203         * script.cc (script_add_extern): Define.
13204         * script-c.h (script_add_extern): Declare.
13205
13206 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13207
13208         * object.cc (is_elf_object): Define.
13209         * object.h (is_elf_object): Declare.
13210         * archive.cc (Archive::get_elf_object_for_member): Call
13211         is_elf_object.
13212         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13213
13214 2009-03-24  Elliott Hughes  <enh@google.com>
13215
13216         * output.cc (Output_file::map_anonymous): Define.
13217         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13218         try an anonymous one.  Report the size if the mmap fails.
13219         * output.h (class Output_file): Declare map_anonymous.
13220
13221 2009-03-24  Ian Lance Taylor  <iant@google.com>
13222
13223         * target-select.cc (instantiate_target): Don't acquire the lock if
13224         the instantiated_target_ field has already been set.
13225
13226 2009-03-23  Ian Lance Taylor  <iant@google.com>
13227
13228         * gold-threads.h (class Initialize_lock): Define.
13229         * gold-threads.cc (class Initialize_lock_once): Define.
13230         (initialize_lock_control): New static variable.
13231         (initialize_lock_pointer): New static variable.
13232         (initialize_lock_once): New static function.
13233         (Initialize_lock::Initialize_lock): Define.
13234         (Initialize_lock::initialize): Define.
13235         * target-select.h: Include "gold-threads.h".
13236         (class Target_selector): Add lock_ and initialize_lock_ fields.
13237         Don't define instantiate_target, just declare it.
13238         * target-select.cc (Target_selector::Target_selector): Initialize
13239         new fields.
13240         (Target_selector::instantiate_target): Define.
13241         * descriptors.h: Include "gold-threads.h".
13242         (class Descriptors): Add initialize_lock_ field.
13243         * descriptors.cc (Descriptors::Descriptors): Initialize new
13244         field.
13245         (Descriptors::open): Use initialize_lock_ field
13246         * errors.h (class Errors): Add initialize_lock_ field.
13247         * errors.cc (Errors::Errors): Initialize new field.
13248         (Errors::initialize_lock): Use initialize_lock_ field.
13249         * powerpc.cc (class Target_selector_powerpc): Remove
13250         instantiated_target_ field.  In do_recognize call
13251         instantiate_target rather than do_instantiate_target.  In
13252         do_instantiate_target just allocate a new target.
13253         * sparc.cc (class Target_selector_sparc): Likewise.
13254
13255         * freebsd.h: New file.
13256         * i386.cc: Include "freebsd.h".
13257         (Target_i386): Derive from Target_freebsd rather than
13258         Sized_target.
13259         (Target_selector_i386): Derive from Target_selector_freebsd rather
13260         than Target_selector.
13261         * x86_64.cc: Include "freebsd.h".
13262         (Target_x86_64): Derive from Target_freebsd rather than
13263         Sized_target.
13264         (Target_selector_x86_64): Derive from Target_selector_freebsd
13265         rather than Target_selector.
13266         * target.h (class Target): Add adjust_elf_header and
13267         do_adjust_elf_header.
13268         * output.cc (Output_file_header:: do_sized_write): Call target
13269         adjust_elf_header routine.
13270         * configure.tgt: Set targ_osabi.
13271         * configure.ac: Define GOLD_DEFAULT_OSABI.
13272         * parameters.cc (Parameters::default_target): Pass
13273         GOLD_DEFAULT_OSABI to select_target.
13274         * target-select.h (class Target_selector): Make instantiate_target
13275         protected rather than private.
13276         * Makefile.am (HFILES): Add freebsd.h.
13277         * configure, Makefile.in, config.in: Rebuild.
13278
13279         * merge.cc (do_add_input_section): Correct pend value.  Change
13280         message about last entry not being null terminated from error to
13281         warning.
13282
13283 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13284
13285         * incremental.cc: New file.
13286         * Makefile.am (CCFILES): Add incremental.cc.
13287         * Makefile.in: Rebuild.
13288
13289 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13290
13291         * layout.cc (Layout::output_section_name): Preserve names
13292         of '.note.' sections.
13293
13294 2009-03-19  Ian Lance Taylor  <iant@google.com>
13295
13296         * descriptors.cc (Descriptors::open): Check that the options are
13297         valid before using them.
13298
13299 2009-03-18  Ian Lance Taylor  <iant@google.com>
13300
13301         * script-sections.h: Include <list>.
13302         (class Script_sections): Change Sections_elements from std::vector
13303         to std::list.  Typedef public Elements_iterator.  Add
13304         orphan_section_placement_, data_segment_align_start_, and
13305         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13306         field.
13307         * script-sections.cc (class Orphan_section_placement): New class.
13308         (class Sections_element): Add virtual functions is_relro and
13309         orphan_section_init.  Remove virtual function place_orphan_here.
13310         (class Output_section_definition): Add is_relro and
13311         orphan_section_init.  Remove place_orphan_here.
13312         (class Orphan_output_section): Likewise.
13313         (Script_sections::Script_sections): Update for field changes.
13314         (Script_sections::data_segment_align): Set saw_data_segment_align_
13315         and data_segment_align_start_, not data_segment_align_index.
13316         (Script_sections::data_segment_relro_end): Check
13317         saw_data_segment_align_.  Use data_segment_align_start_ rather
13318         than data_segment_align_index_.
13319         (Script_sections::place_orphan): Rewrite to use
13320         Orphan_section_placement.
13321
13322 2009-03-17  Ian Lance Taylor  <iant@google.com>
13323
13324         * archive.cc (Archive::add_symbols): Check for a version attached
13325         to the symbol name in the archive map.
13326         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13327         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13328         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13329         (ver_test_11.a): New target.
13330         * testsuite/Makefile.in: Rebuild.
13331
13332         * configure.ac: Check for chsize and posix_fallocate.  Replace
13333         ftruncate.
13334         * ftruncate.c: New file, from gnulib.
13335         * output.cc (posix_fallocate): Define dummy version if not
13336         HAVE_POSIX_FALLOCATE.
13337         (Output_file::map): Call posix_fallocate rather than lseek and
13338         write.
13339         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13340         * configure, Makefile.in, config.in: Rebuild.
13341
13342 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13343
13344         * layout.h (Layout::create_note): Add section_name parameter.
13345         * layout.cc (Layout::create_note): Likewise.
13346         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13347
13348 2009-03-17  Ian Lance Taylor  <iant@google.com>
13349
13350         * descriptors.cc: Include "options.h".
13351         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13352         (Descriptors::open): Always use O_CLOEXEC when opening a new
13353         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13354         then set FD_CLOEXEC.
13355
13356         * sparc.cc (class Target_sparc): Add has_got_section.
13357         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13358         make sure we have a GOT section.
13359
13360         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13361         (Target_sparc::Scan::local): Likewise.
13362         (Target_sparc::Scan::global): Likewise.
13363         (Target_sparc::Relocate::relocate): Likewise.
13364         (Target_sparc::Relocate::relocate_tls): Likewise.
13365
13366         * symtab.cc (Symbol_table::define_default_version): New function,
13367         broken out of add_from_object.
13368         (Symbol_table::add_from_object): Call define_default_version.
13369         (Symbol_table::define_special_symbol): Add resolve_oldsym
13370         parameter.  Change all callers.  If the version for a symbol comes
13371         from a version script, resolve it with the symbol with the same
13372         name with no version.  Also add the symbol without a version if
13373         appropriate.
13374         (do_define_in_output_data): If resolving with oldsym, don't delete
13375         sym.
13376         (do_define_in_output_segment): Likewise.
13377         (do_define_as_constant): Likewise.
13378         * symtab.h (class Symbol_table): Update declarations.
13379
13380 2009-03-13  Ian Lance Taylor  <iant@google.com>
13381
13382         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13383         (Read_symbols::requeue): New function.
13384         (Read_symbols::do_read_symbols): If make_elf_object fails because
13385         the target type is not configured, and the file was searched for,
13386         issue a warning and retry with the next directory.
13387         (Add_symbols::run): If the file has an incompatible format, and
13388         it was searched for, requeue the Read_symbols task.  On error,
13389         release the object.
13390         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13391         dirindex parameter to constructor.  Change all callers.  Declare
13392         incompatible_warning and requeue.
13393         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13394         input_argument_ and input_group_ fields.  Add them to
13395         constructor.  Change all callers.
13396         (class Read_script): Add dirindex_ field.  Add it to constructor.
13397         Change all callers.
13398         * archive.cc (Archive::setup): Remove input_objects parameter.
13399         Change all callers.
13400         (Archive::get_file_and_offset): Likewise.
13401         (Archive::read_all_symbols): Likewise.
13402         (Archive::read_symbols): Likewise.
13403         (Archive::get_elf_object_for_member): Remove input_objects
13404         parameter.  Add punconfigured parameter.  Change all callers.
13405         (Archive::add_symbols): Change return type to bool.  Check return
13406         value of include_member.
13407         (Archive::include_all_members): Likewise.
13408         (Archive::include_member): Change return type to bool.  Return
13409         false if first included object has incompatible target.  Set
13410         included_member_ field.
13411         (Add_archive_symbols::run): If add_symbols returns false, requeue
13412         Read_symbols task.
13413         * archive.h (class Archive): Add included_member_ field.
13414         Initialize it in constructor.  Add input_file and searched_for
13415         methods.  Update declarations.
13416         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13417         input_argument_ fields.  Add them to constructor.  Change all
13418         callers.
13419         * script.cc: Include "target-select.h".
13420         (class Parser_closure): Add skip_on_incompatible_target_ and
13421         found_incompatible_target_ fields.  Add
13422         skip_on_incompatible_target parameter to constructor.  Change all
13423         callers.  Add methods skip_on_incompatible_target,
13424         clear_skip_on_incompatible_target, found_incompatible_target, and
13425         set_found_incompatible_target.
13426         (read_input_script): Add dirindex parameter.  Change all callers.
13427         If parser finds an incompatible target, requeue Read_symbols
13428         task.
13429         (script_set_symbol): Clear skip_on_incompatible_target in
13430         closure.
13431         (script_add_assertion, script_parse_option): Likewise.
13432         (script_start_sections, script_add_phdr): Likewise.
13433         (script_check_output_format): New function.
13434         * script.h (read_input_script): Update declaration.
13435         * script-c.h (script_check_output_format): Declare.
13436         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13437         (ignore_cmd): Remove OUTPUT_FORMAT.
13438         * fileread.cc (Input_file::Input_file): Add explicit this.
13439         (Input_file::will_search_for): New function.
13440         (Input_file::open): Add pindex parameter.  Change all callers.
13441         * fileread.h (class Input_file): Add input_file_argument method.
13442         Declare will_search_for.  Update declarations.
13443         * object.cc (make_elf_object): Add punconfigured parameter.
13444         Change all callers.
13445         * object.h (class Object): Make input_file public.  Add
13446         searched_for method.
13447         (make_elf_object): Update declaration.
13448         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13449         restart search.
13450         * dirsearch.h (class Dirsearch): Update declaration.
13451         * options.h (class General_options): Add --warn-search-mismatch.
13452         * parameters.cc (Parameters::is_compatible_target): New function.
13453         * parameters.h (class Parameters): Declare is_compatible_target.
13454         * workqueue.cc (Workqueue::add_blocker): New function.
13455         * workqueue.h (class Workqueue): Declare add_blocker.
13456
13457         * fileread.cc (Input_file::open): Remove options parameter.
13458         Change all callers.
13459         (Input_file::open_binary): Likewise.
13460         * script.cc (read_input_script): Likewise.
13461         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13462         options parameter from constructor.  Change all callers.
13463         (class Read_script): Likewise.
13464         * fileread.h (class Input_file): Update declarations.
13465         * script.h (read_input_script): Update declaration.
13466
13467 2009-03-10  Nick Clifton  <nickc@redhat.com>
13468
13469         * po/es.po: New Spanish translation.
13470
13471 2009-03-06  Cary Coutant  <ccoutant@google.com>
13472
13473         * options.cc (parse_short_option): Keep dash_z from registering itself.
13474
13475 2009-03-03  Ian Lance Taylor  <iant@google.com>
13476
13477         PR 9918
13478         * target-reloc.h (relocate_section): Pass output_section to
13479         relocate.
13480         * i386.cc (Target_i386::should_apply_static_reloc): Add
13481         output_section parameter.  Change all callers.
13482         (Target_i386::Relocate::relocate): Add output_section parameter.
13483         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13484         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13485         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13486         * testsuite/two_file_shared.sh: New script.
13487         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13488         (check_DATA): Add two_file_shared.dbg.
13489         (two_file_shared.dbg): New target.
13490         * testsuite/Makefile.in: Rebuild.
13491
13492 2009-03-01  Ian Lance Taylor  <iant@google.com>
13493
13494         * configure.ac: Check for byteswap.h.
13495         * configure: Rebuild.
13496         * config.in: Rebuild.
13497
13498 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13499
13500         * layout.cc (Layout::find_or_add_kept_section): New function.
13501         (Layout::add_comdat): Removed.
13502         * layout.h (struct Kept_section): Move out of class Layout.
13503         Remove trailing underscores from field names.  Add group_sections
13504         field.  Rename group_ field to is_group.  Change all uses.
13505         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13506         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13507         comdat_groups_ field.
13508         (Sized_relobj::include_section_group): Use
13509         find_or_add_kept_section and Kept_section::group_sections.
13510         (Sized_relobj::include_linkonce_section): Likewise.
13511         * object.cc (class Sized_relobj): Don't define Comdat_group or
13512         Comdat_group_table.  Remove find_comdat_group and
13513         add_comdat_group.  Remove comdat_groups_ field.
13514         * plugin.cc (include_comdat_group): Use
13515         Layout::find_or_add_kept_section.
13516
13517 2009-02-28  Ian Lance Taylor  <iant@google.com>
13518
13519         * README: --gc-sections and map files are now supported.  Document
13520         some build requirements.
13521
13522         PR 6992
13523         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13524         relocatable link set the value of the section symbol to zero.
13525         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13526         relocatable link don't include the section address in the local
13527         symbol value.
13528
13529 2009-02-27  Ian Lance Taylor  <iant@google.com>
13530
13531         PR 6811
13532         * options.h (class Search_directory): Add is_system_directory.
13533         (class General_options): Declare is_in_system_directory.
13534         * options.cc (get_relative_sysroot): Make static.
13535         (get_default_sysroot): Make static.
13536         (General_optoins::is_in_system_directory): New function.
13537         * fileread.cc (Input_file::is_in_system_directory): New function.
13538         * fileread.h (class Input_file): Declare is_in_system_directory.
13539         * object.h (class Object): Add is_in_system_directory.
13540         (class Input_objects): Remove system_library_directory_ field.
13541         * object.cc (Input_objects::add_object): Don't set
13542         system_library_directory_.
13543         (input_objects::found_in_system_library_directory): Remove.
13544         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13545         parameter.  Change all callers.
13546         (Symbol_table::sized_write_globals): Likewise.
13547         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13548         Call Object::is_in_system_directory.
13549         * symtab.h (class Symbol_table): Update declarations.
13550
13551         PR 5990
13552         * descriptors.h (Open_descriptor): Add is_on_stack field.
13553         * descriptors.cc (Descriptors::open): If the descriptor is on the
13554         top of the stack, remove it.  Initialize is_on_stack field.
13555         (Descriptors::release): Only add pod to stack if it is not on the
13556         stack already.
13557         (Descriptors::close_some_descriptor): Clear stack_next and
13558         is_on_stack fields.
13559
13560         PR 7091
13561         * output.cc (Output_section::find_starting_output_address): Rename
13562         from starting_output_address; add PADDR parameter; change return
13563         type.
13564         * output.h (class Output_section): Declare
13565         find_starting_output_address instead of starting_output_address.
13566         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13567         section symbol for which we can't find a merge section.
13568
13569         PR 9836
13570         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13571         hidden or internal, force the symbol to be local.
13572         * resolve.cc (Symbol::override_visibility): Define.
13573         (Symbol::override_base): Use override_visibility.
13574         (Symbol_table::resolve): Likewise.
13575         (Symbol::override_base_with_special): Likewise.
13576         (Symbol_table::override_with_special): If the visibility is hidden
13577         or internal, force the symbol to be local.
13578         * symtab.h (class Symbol): Add set_visibility and
13579         override_visibility.
13580         * testsuite/ver_test_1.sh: New file.
13581         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13582         (check_DATA): Add ver_test_1.syms.
13583         (ver_test_1.syms): New target.
13584         * testsuite/Makefile.in: Rebuild.
13585
13586 2009-02-25  Cary Coutant  <ccoutant@google.com>
13587
13588         * layout.cc (Layout::choose_output_section): Don't rename sections
13589         when using a linker script that has a SECTIONS clause.
13590         * Makefile.in: Regenerate.
13591
13592         * testsuite/Makefile.am (script_test_5.sh): New test case.
13593         * testsuite/Makefile.in: Regenerate.
13594         * testsuite/script_test_5.cc: New file.
13595         * testsuite/script_test_5.sh: New file.
13596         * testsuite/script_test_5.t: New file.
13597
13598 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13599
13600         * archive.cc (Archive::include_member): Update calls to add_symbols.
13601         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13602         the Layout argument.
13603         * dynobj.h (do_add_symbols): Add the Layout argument.
13604         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13605         Layout argument.
13606         * object.h (Object::add_symbols): Add the Layout argument.
13607         (Object::do_add_symbols): Add the Layout argument.
13608         (Sized_relobj::do_add_symbols): Add the Layout argument.
13609         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13610         Unify the two versions.
13611         (Add_plugin_symbols): Remove.
13612         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13613         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13614         (Add_plugin_symbols): Remove.
13615         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13616         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13617         (Add_symbols::run): Make it work with Pulginobj.
13618
13619 2009-02-06  Ian Lance Taylor  <iant@google.com>
13620
13621         * object.cc (Sized_relobj::do_layout): Make info message start
13622         with lower case letter.
13623
13624 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13625
13626         * binary.cc: Fix file comment.
13627
13628         * options.h (enum Incremental_disposition): Define.
13629         (class General_options): Add new options: --incremental,
13630         --incremental_changed, --incremental_unchanged,
13631         --incremental_unknown.  Add incremental_disposition_ and
13632         implicit_incremental_ fields.
13633         (General_options::incremental_disposition): New function.
13634         (class Position_dependent_options): Add incremental_disposition
13635         option.
13636         (Position_dependent_options::copy_from_options): Set incremental
13637         dispositions.
13638         * options.cc (General_options::parse_incremental_changed): New
13639         function.
13640         (General_options::parse_incremental_unchanged): New function.
13641         (General_options::parse_incremental_unknown): New function.
13642         (General_options::General_options): Initialize new fields
13643         incremental_disposition_ and implicit_incremental_.
13644         (General_options::finalize): Check for uasge of --incremental-*
13645         without --incremental.
13646
13647 2009-02-06  Chris Demetriou  <cgd@google.com>
13648
13649         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13650         pointer and to report location as the file name associated with
13651         the symbol.
13652         (gold_undefined_symbol_at_location): New function to replace the
13653         old gold_undefined_symbol functionality.
13654         * target-reloc.h (relocate_section): Update to use
13655         gold_undefined_symbol_at_location.
13656         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13657         Call gold_undefined_symbol function rather than gold_error.
13658         * errors.h (Errors::undefined_symbol): Take location as a
13659         string, rather than calculating it from a relocation.
13660         * errors.cc (Errors::fatal): Print "fatal error:" before the
13661         formatted message.
13662         (Errors::error, Errors::error_at_location): Print "error: "
13663         before the formatted message.
13664         (Errors::undefined_symbol): Take location as a string, rather
13665         than calculating it from a relocation.
13666         (gold_undefined_symbol_at_location): New function akin to
13667         old gold_undefined_symbol, calculates location from relocation.
13668         (gold_undefined_symbol): Change to take only a Symbol pointer
13669         and to report location as the file name associated with the symbol.
13670         * testsuite/debug_msg.sh: Update for changed error messages.
13671         * testsuite/undef_symbol.sh: Likewise.
13672
13673 2009-02-04  Duncan Sands  <baldrick@free.fr>
13674
13675         PR 9812
13676         * reduced_debug_output.h
13677         (Output_reduced_debug_abbrev_section::failed): Use format for
13678         gold_warning.
13679         (Output_reduced_debug_info_section::faild): Likewise.
13680
13681 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13682
13683         * script.cc (Lazy_demangler): New class.
13684         (Version_script_info::get_symbol_version_helper): Demangle a
13685         symbol only once.
13686
13687 2009-01-29  Cary Coutant  <ccoutant@google.com>
13688
13689         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13690         to __tls_get_addr.
13691         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13692
13693 2009-01-28  Ian Lance Taylor  <iant@google.com>
13694
13695         * version.cc (version_string): Bump to 1.9.
13696
13697         * gold.h: Include <cstring> and <stdint.h>.
13698         * version.cc: Include <cstdio>.
13699         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13700         warning.
13701         * reduced_debug_output.cc (insert_into_vector): Rename from
13702         Insert_into_vector; change all callers.  Use Swap_unaligned to
13703         avoid aliasing issue; remove union since it is unnecessary.
13704
13705 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13706
13707         * Makefile.am (CCFILES): Add gc.cc.
13708         (HFILES): Add gc.h.
13709         * Makefile.in: Regenerate.
13710         * gold.cc (Gc_runner): New class.
13711         (queue_initial_tasks): Call garbage collection related tasks
13712         when corresponding options are invoked.
13713         (queue_middle_gc_tasks): New function.
13714         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13715         processed early before laying out sections during garbage collection.
13716         * gold.h (queue_middle_gc_tasks): New function.
13717         (is_prefix_of): Move from "layout.cc".
13718         * i386.cc (Target_i386::gc_process_relocs): New function.
13719         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13720         * main.cc (main): Create object of class "Garbage_collection".
13721         * object.cc (Relobj::copy_symbols_data): New function.
13722         (Relobj::is_section_name_included): New function.
13723         (Sized_relobj::do_layout): Allow this function to be called twice
13724         during garbage collection and defer layout of section during the
13725         first call.
13726         * object.h (Relobj::get_symbols_data): New function.
13727         (Relobj::is_section_name_included): New function.
13728         (Relobj::copy_symbols_data): New function.
13729         (Relobj::set_symbols_data): New function.
13730         (Relobj::get_relocs_data): New function.
13731         (Relobj::set_relocs_data): New function.
13732         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13733         (Relobj::gc_process_relocs): New function.
13734         (Relobj::do_gc_process_relocs): New pure virtual function.
13735         (Relobj::sd_): New data member.
13736         (Sized_relobj::is_output_section_offset_invalid): New function.
13737         (Sized_relobj::do_gc_process_relocs): New function.
13738         * options.h (General_options::gc_sections): Modify to not be a no-op.
13739         (General_options::print_gc_sections): New option.
13740         * plugin.cc (Plugin_finish::run): Remove function call to
13741         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13742         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13743         * reloc.cc (Read_relocs::run): Add task to process relocs and
13744         determine unreferenced sections when doing garbage collection.
13745         (Gc_process_relocs): New class.
13746         (Sized_relobj::do_gc_process_relocs): New function.
13747         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13748         sections that are garbage collected.
13749         * reloc.h (Gc_process_relocs): New class.
13750         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13751         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13752         symbols whose corresponding sections are garbage collected.
13753         (Symbol_table::Symbol_table): Add new parameter for the garbage
13754         collection object.
13755         (Symbol_table::gc_mark_undef_symbols): New function.
13756         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13757         (Symbol_table::gc_mark_dyn_syms): New function.
13758         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13759         as garbage.
13760         (Symbol_table::add_from_object): Likewise.
13761         (Symbol_table::add_from_relobj): When building shared objects, do not
13762         treat externally visible symbols as garbage.
13763         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13764         table information for static and relocatable links.
13765         * symtab.h (Symbol_table::set_gc): New function.
13766         (Symbol_table::gc): New function.
13767         (Symbol_table::gc_mark_undef_symbols): New function.
13768         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13769         (Symbol_table::gc_mark_dyn_syms): New function.
13770         (Symbol_table::gc_): New data member.
13771         * target.h (Sized_target::gc_process_relocs): New pure virtual
13772         function.
13773         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13774         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13775
13776 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13777
13778         * options.h (General_options::gc_sections): Define as a no-op for now.
13779         (General_options::no_keep_memory): Ditto.
13780         (General_options::Bshareable): Define.
13781         * options.cc (General_options::finalize): Honor -Bshareable.
13782
13783 2009-01-20  Andreas Schwab  <schwab@suse.de>
13784
13785         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13786         read the value in the contents, since we don't use it.  Use the
13787         template endianness when writing.
13788         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13789
13790 2009-01-19  Andreas Schwab  <schwab@suse.de>
13791
13792         * configure.tgt (powerpc64-*): Fix targ_obj.
13793
13794 2009-01-15  Ian Lance Taylor  <iant@google.com>
13795
13796         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13797         local symbols when stripping all symbols.
13798
13799 2009-01-14  Cary Coutant  <ccoutant@google.com>
13800
13801         * output.cc (Output_reloc): Add explicit instantiations.
13802
13803 2009-01-14  Cary Coutant  <ccoutant@google.com>
13804
13805         * archive.cc (Archive::get_elf_object_for_member): Remove call
13806         to File_read::claim_for_plugin.
13807         * descriptors.cc (Descriptors::open): Remove reference to
13808         is_claimed.
13809         (Descriptors::claim_for_plugin): Remove.
13810         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13811         (Descriptors::is_claimed): Remove.
13812         (claim_descriptor_for_plugin): Remove.
13813         * fileread.cc (File_read::claim_for_plugin): Remove.
13814         * fileread.h (File_read::claim_for_plugin): Remove.
13815         (File_read::descriptor): Reopen descriptor if necessary.
13816         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13817         (Plugin_manager::all_symbols_read): Add task parameter. Change
13818         all callers.
13819         (Plugin_manager::get_input_file): New function.
13820         (Plugin_manager::release_input_file): New function.
13821         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13822         corresponding data member.
13823         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13824         and pass to base constructor. Change all callers.
13825         (get_input_file, release_input_file): New functions.
13826         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13827         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13828         (Plugin_manager::all_symbols_read): Add task parameter.
13829         (Plugin_manager::get_input_file): New function.
13830         (Plugin_manager::release_input_file): New function.
13831         (Plugin_manager::task_): New data member.
13832         (Pluginobj::Pluginobj): Add filesize parameter.
13833         (Pluginobj::filename): New function.
13834         (Pluginobj::descriptor): New function.
13835         (Pluginobj::filesize): New function.
13836         (Pluginobj::filesize_): New data member.
13837         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13838         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13839         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13840
13841         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13842         with archive libraries.
13843         * testsuite/Makefile.in: Regenerate.
13844         * testsuite/plugin_test.c (struct sym_info): New type.
13845         (get_input_file, release_input_file): New static variables.
13846         (onload): Capture new transfer vector entries.
13847         (claim_file_hook): Stop reading at end of file according to filesize.
13848         Factor out parsing of readelf output into separate function.
13849         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13850         APIs and get the source file name from the symbol table.  Convert
13851         source file name to corresponding object file name.  Print info
13852         message when adding new input files.
13853         (parse_readelf_line): New function.
13854         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13855         * testsuite/plugin_test_2.sh: Likewise.
13856         * testsuite/plugin_test_3.sh: Likewise.
13857         * testsuite/plugin_test_4.sh: New test case.
13858
13859 2009-01-07  Ian Lance Taylor  <iant@google.com>
13860
13861         * version.cc (version_string): Bump to 1.8.
13862
13863 2008-12-23  Cary Coutant  <ccoutant@google.com>
13864
13865         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13866         * plugin.cc (Plugin_manager::finish): Rename as
13867         layout_deferred_objects.  Move cleanup to separate function.
13868         (Plugin_manager::cleanup): New function.
13869         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13870         separately.
13871         * plugin.h (Plugin_manager::finish): Rename as
13872         layout_deferred_objects.
13873         (Plugin_manager::cleanup): New function.
13874         (Plugin_manager::cleanup_done): New field.
13875
13876 2008-12-23  Cary Coutant  <ccoutant@google.com>
13877
13878         * plugin.cc (is_visible_from_outside): New function.
13879         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13880         so we don't return "IR only" status for exported symbols or -r links.
13881
13882         * testsuite/Makefile.am (plugin_test_3): New test case.
13883         * testsuite/Makefile.in: Regenerate.
13884         * testsuite/plugin_test_3.sh: New file.
13885
13886 2008-12-22  Cary Coutant  <ccoutant@google.com>
13887
13888         * object.cc (Sized_relobj::layout_section): New function.
13889         (Sized_relobj::do_layout): Defer layout of input sections until after
13890         plugin has provided replacement files.
13891         (Sized_relobj::do_layout_deferred_sections): New function.
13892         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13893         (Relobj::layout_deferred_sections): New function.
13894         (Relobj::do_layout_deferred_sections): New function.
13895         (Sized_relobj::do_layout_deferred_sections): New function.
13896         (Sized_relobj::layout_section): New function.
13897         (Sized_relobj::Deferred_layout): New structure.
13898         (Sized_relobj::deferred_layout_): New field.
13899         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13900         Change all callers.  Layout deferred sections.
13901         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13902         references.
13903         (Plugin_hook::run): Move code from do_plugin_hook inline.
13904         (Plugin_hook::do_plugin_hook): Remove.
13905         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13906         (Plugin_manager::finish): Renamed, was cleanup.
13907         (Plugin_manager::should_defer_layout): New function.
13908         (Plugin_manager::add_deferred_layout_object): New function.
13909         (Plugin_manager::Deferred_layout_list): New type.
13910         (Plugin_manager::deferred_layout_objects_): New field.
13911         (Plugin_hook::do_plugin_hook): Remove.
13912
13913 2008-12-17  Ian Lance Taylor  <iant@google.com>
13914
13915         * options.h (class General_options): Add --no case for
13916         --export-dynamic.
13917
13918 2008-12-16  Cary Coutant  <ccoutant@google.com>
13919
13920         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13921         vector.
13922         (Plugin_manager::claim_file): Create plugin object even if
13923         plugin did not call the add_symbols callback.
13924         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13925         asking for more symbols than were added.
13926         * testsuite/Makefile.am (plugin_test_1): Add test case with
13927         no global symbols.
13928         (empty.syms): New target.
13929         * testsuite/Makefile.in: Regenerate.
13930         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13931         message. Don't call add_symbols if no globals.
13932         (all_symbols_read_hook): Don't provide replacement for empty
13933         claimed file.
13934
13935 2008-12-12  Ian Lance Taylor  <iant@google.com>
13936
13937         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13938         r_type == 0 for a local symbol with r_sym == 0.
13939         (scan_relocatable_relocs): Pass r_sym to
13940         local_non_section_strategy.
13941         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13942         r_sym parameter.
13943
13944         * configure.ac: Update test for TLS descriptors: they are
13945         supported as of glibc 2.9.
13946         * configure: Rebuild.
13947
13948 2008-12-11  Ian Lance Taylor  <iant@google.com>
13949
13950         PR 7091
13951         * target-reloc.h (Default_scan_relocatable_relocs): For each
13952         function, map r_type == 0 to RELOC_DISCARD.
13953
13954 2008-12-10  Cary Coutant  <ccoutant@google.com>
13955
13956         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13957         object to override a kept COMDAT group from a plugin object.
13958
13959 2008-12-09  Ian Lance Taylor  <iant@google.com>
13960
13961         PR 7088
13962         * yyscript.y (file_cmd): Handle INPUT.
13963
13964         * testsuite/initpri1.c: Change all declarations to be full
13965         prototypes by adding void, to avoid compiler warnings.
13966
13967 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13968
13969         * options.cc (General_options::parse_plugin_opt): New.
13970         (General_options::add_plugin): The argument now is just the filename.
13971         (General_options::add_plugin_option): New.
13972         * options.h (plugin_opt): New.
13973         (add_plugin): Change argument name.
13974         (add_plugin_option): New.
13975         * plugin.cc (Plugin::load): Don't parse the plugin option.
13976         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13977         (Plugin::add_option): New.
13978         (Plugin::args_): Change type.
13979         (Plugin::filename_): New.
13980         (Plugin_manager::add_plugin_option): New.
13981         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13982         * testsuite/Makefile.in: Regenerate.
13983
13984 2008-12-05  Cary Coutant  <ccoutant@google.com>
13985
13986         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13987         Handle --strip-lto-sections option.
13988         * options.h (strip_lto_sections): New option.
13989
13990 2008-12-01  Cary Coutant  <ccoutant@google.com>
13991
13992         * plugin.cc (ld_plugin_message): Change format parameter to const.
13993         Fix mismatch between new[] and delete.
13994
13995 2008-11-14  Cary Coutant  <ccoutant@google.com>
13996
13997         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13998         instead of -1U.
13999
14000 2008-11-05  Craig Silverstein  <csilvers@google.com>
14001
14002         * options.cc (General_options::parse_dynamic_list): New function.
14003         * options.h (General_options): New flags dynamic_list,
14004         dynamic_list_data, dynamic_list_cpp_new, and
14005         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
14006         (General_options::in_dynamic_list): New function.
14007         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
14008         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
14009         (Lex::can_continue_name): Likewise.
14010         (yylex): Likewise.
14011         (read_script_file): New parameter script_options.
14012         (read_dynamic_list): New function.
14013         (Script_options::define_dynamic_list): New function.
14014         (dynamic_list_keyword_parsecodes): New variable.
14015         (dynamic_list_keywords): New variable.
14016         * script.h (Script_options::define_dynamic_list): New function
14017         prototype.
14018         (read_dynamic_list): New function prototype.
14019         * symtab.cc (strprefix): New macro.
14020         (Symbol::should_add_dynsym_entry): Support dynamic_list,
14021         dynamic_list_data, dynamic_list_cpp_new, and
14022         dynamic_list_cpp_typeinfo.
14023         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
14024         (dynamic_list_expr): New rule.
14025         (dynamic_list_nodes): Likewise.
14026         (dynamic_list_node): Likewise.
14027         * testsuite/Makefile.am (dynamic_list): New test.
14028         * testsuite/Makefile.in: Regenerated.
14029         * testsuite/dynamic_list.t: New file.
14030         * testsuite/dynamic_list.sh: New file.
14031
14032 2008-11-05  Craig Silverstein  <csilvers@google.com>
14033
14034         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14035         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14036         (t11_last): Likewise.
14037         * testsuite/ver_test_6.c (main): Likewise.
14038
14039 2008-10-07  Cary Coutant  <ccoutant@google.com>
14040
14041         * options.c (General_options::finalize): Add check for -static and
14042         -shared.
14043         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14044         is not empty.
14045
14046 2008-10-02  Cary Coutant  <ccoutant@google.com>
14047
14048         * plugin.cc (make_sized_plugin_object): Fix conditional
14049         compilation to work when not all targets are enabled.
14050
14051 2008-09-29  Cary Coutant  <ccoutant@google.com>
14052
14053         * archive.cc (Archive::get_file_and_offset): Use filename instead
14054         of name to get library path.
14055         (Archive::include_member): Unlock external member of a thin archive.
14056
14057         * testsuite/Makefile.am (TEST_AR): New variable.
14058         (thin_archive_test_1): New test.
14059         (thin_archive_test_2): New test.
14060         * testsuite/Makefile.in: Regenerate.
14061         * testsuite/thin_archive_main.cc: New file.
14062         * testsuite/thin_archive_test_1.cc: New file.
14063         * testsuite/thin_archive_test_2.cc: New file.
14064         * testsuite/thin_archive_test_3.cc: New file.
14065         * testsuite/thin_archive_test_4.cc: New file.
14066
14067 2008-09-29  Cary Coutant  <ccoutant@google.com>
14068
14069         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14070         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14071         instead of -1U.
14072         (Sized_relobj::do_finalize_local_symbols): Likewise.
14073         (Sized_relobj::map_to_kept_section): Likewise.
14074         * object.h (Sized_relobj::invalid_address): New constant.
14075         (Sized_relobj::do_output_section_offset): Check for invalid_address
14076         and return -1ULL.
14077         * output.cc (Output_reloc::local_section_offset): Use constant
14078         invalid_address instead of -1U.
14079         (Output_reloc::get_address): Likewise.
14080         (Output_section::output_address): Change -1U to -1ULL.
14081         * output.h (Output_reloc::invalid_address): New constant.
14082         * reloc.cc (Sized_relobj::write_sections): Use constant
14083         invalid_address instead of -1U.
14084         (Sized_relobj::relocate_sections): Likewise.
14085         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14086         values for merge sections.
14087         * target-reloc.h (relocate_for_relocatable): Use constant
14088         invalid_address instead of -1U.
14089
14090 2008-09-19  Cary Coutant  <ccoutant@google.com>
14091
14092         Add plugin functionality for link-time optimization (LTO).
14093         * configure.ac (plugins): Add --enable-plugins option.
14094         * configure: Regenerate.
14095         * config.in: Regenerate.
14096         * Makefile.am (LIBDL): New variable.
14097         (CCFILES): Add plugin.cc.
14098         (HFILES): Add plugin.h.
14099         (ldadd_var): Add LIBDL.
14100         * Makefile.in: Regenerate.
14101
14102         * archive.cc: Include "plugin.h".
14103         (Archive::setup): Don't preread archive symbols when using a plugin.
14104         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14105         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14106         files.
14107         (Archive::include_member): Add symbols from plugin objects.
14108         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14109         * descriptors.cc (Descriptors::open): Check for file descriptors
14110         abandoned by plugins.
14111         (Descriptors::claim_for_plugin): New function.
14112         * descriptors.h (Descriptors::claim_for_plugin): New function.
14113         (Open_descriptor::is_claimed): New field.
14114         (claim_descriptor_for_plugin): New function.
14115         * fileread.cc (File_read::claim_for_plugin): New function.
14116         * fileread.h (File_read::claim_for_plugin): New function.
14117         (File_read::descriptor): New function.
14118         * gold.cc: Include "plugin.h".
14119         (queue_initial_tasks): Add task to call plugin hooks for generating
14120         new object files.
14121         * main.cc: Include "plugin.h".
14122         (main): Load plugin libraries.
14123         * object.h (Pluginobj): Declare.
14124         (Object::pluginobj): New function.
14125         (Object::do_pluginobj): New function.
14126         (Object::set_target): New function.
14127         * options.cc: Include "plugin.h".
14128         (General_options::parse_plugin): New function.
14129         (General_options::General_options): Initialize plugins_ field.
14130         (General_options::add_plugin): New function.
14131         * options.h (Plugin_manager): Declare.
14132         (General_options): Add --plugin option.
14133         (General_options::has_plugins): New function.
14134         (General_options::plugins): New function.
14135         (General_options::add_plugin): New function.
14136         (General_options::plugins_): New field.
14137         * plugin.cc: New file.
14138         * plugin.h: New file.
14139         * readsyms.cc: Include "plugin.h".
14140         (Read_symbols::do_read_symbols): Check for archive before checking
14141         for ELF file.  Call plugin hooks to claim files.
14142         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14143         from a real object file; force override when processing replacement
14144         files.
14145         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14146         (Symbol::init_base_object): Likewise.
14147         (Symbol::init_base_output_data): Likewise.
14148         (Symbol::init_base_output_segment): Likewise.
14149         (Symbol::init_base_constant): Likewise.
14150         (Symbol::init_base_undefined): Likewise.
14151         (Symbol::output_section): Assert that object is not a plugin.
14152         (Symbol_table::add_from_pluginobj): New function.
14153         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14154         undefined.
14155         (Symbol_table::sized_write_globals): Likewise.
14156         (Symbol_table::add_from_pluginobj): Instantiate template.
14157         * symtab.h (Sized_pluginobj): Declare.
14158         (Symbol::in_real_elf): New function.
14159         (Symbol::set_in_real_elf): New function.
14160         (Symbol::in_real_elf_): New field.
14161         (Symbol_table::add_from_pluginobj): New function.
14162
14163         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14164         (LIBDL): New variable.
14165         (LDADD): Add LIBDL.
14166         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14167         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14168         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14169         (MOSTLYCLEANFILES): Likewise.
14170         * testsuite/Makefile.in: Regenerate.
14171         * testsuite/plugin_test.c: New file.
14172         * testsuite/plugin_test_1.sh: New file.
14173         * testsuite/plugin_test_2.sh: New file.
14174
14175 2008-09-16  Ian Lance Taylor  <iant@google.com>
14176
14177         * target-reloc.h (relocate_section): Check whether a symbol is
14178         defined by the ABI before reporting an undefined symbol error.
14179         * target.h (Target::is_defined_by_abi): Make parameter const.
14180         (Target::do_is_defined_by_abi): Likewise.
14181         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14182         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14183         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14184         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14185         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14186         * testsuite/Makefile.in: Rebuild.
14187
14188         * fileread.cc (make_view): Add casts to avoid warning.
14189
14190 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14191
14192         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14193         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14194
14195 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14196
14197         * options.h (General_options::output_is_executable): New.
14198         (General_options::output_is_pie): New.
14199         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14200         for shared libraries.
14201         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14202
14203 2008-09-11  Chris Demetriou  <cgd@google.com>
14204
14205         * options.h (origin): New -z option.
14206         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14207         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14208         in DT_FLAGS_1.
14209
14210 2008-09-05  Cary Coutant  <ccoutant@google.com>
14211
14212         * fileread.cc (File_read::make_view): Add check for attempt to map
14213         beyond end of file.
14214
14215 2008-09-05  Cary Coutant  <ccoutant@google.com>
14216
14217         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14218         explicit instantiations.
14219
14220 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14221
14222         PR gold/6858
14223         * options.cc (General_options::finalize): Allow undefined symbols
14224         in shlibs if linking -shared.
14225
14226         PR gold/6859
14227         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14228         symbols as not needing a dynsym entry.
14229
14230 2008-08-20  Craig Silverstein  <csilvers@google.com>
14231
14232         * fileread.cc (File_read::open): Do not lock the file unless it
14233         was successfully opened.
14234
14235 2008-08-14  Cary Coutant  <ccoutant@google.com>
14236
14237         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14238         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14239         * testsuite/tls_test.cc (struct int128): 128-bit struct
14240         for testing TLS relocs with non-zero addend.
14241         (v12): New TLS variable.
14242         (t12): New test.
14243         (t_last): Add check for v12.
14244         * testsuite/tls_test.h (t12): New function.
14245         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14246
14247 2008-08-13  Ian Lance Taylor  <iant@google.com>
14248
14249         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14250         set tls_segment_ or relro_segment_.
14251         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14252         when appropriate.
14253         * output.h (Output_section::clear_is_relro): New function.
14254         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14255         sections specially even when output_data_ is empty.
14256         (Output_segment::maximum_alignment): When first section is relro,
14257         only force alignment for PT_LOAD segments.
14258         * script.cc (script_data_segment_align): New function.
14259         (script_data_segment_relro_end): New function.
14260         * script-c.h (script_data_segment_align): Declare.
14261         (script_data_segment_relro_end): Declare.
14262         * script-sections.h (class Script_sections): Declare
14263         data_segment_align and data_segment_relro_end.  Add fields
14264         segment_align_index_ and saw_relro_end_.
14265         * script-sections.cc (class Sections_element): Add set_is_relro
14266         virtual function.  Add new bool* parameter to place_orphan_here.
14267         Add get_output_section virtual function.
14268         (class Output_section_definition): Add set_is_relro.  Add new
14269         bool* parameter to place_orphan_here.  Add get_output_section.
14270         Add is_relro_ field.
14271         (Output_section_definition::Output_section_definition): Initialize
14272         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14273         and is_relro_ fields.
14274         (Output_section_definition::place_orphan_here): Add is_relro
14275         parameter.
14276         (Output_section_definition::set_section_addresses): Set relro for
14277         output section.
14278         (Output_section_definition::alternate_constraint): Likewise.
14279         (class Orphan_output_section): Add new bool* parameter to
14280         place_orphan_here.  Add get_output_section.
14281         (Orphan_output_section::place_orphan_here): Add is_relro
14282         parameter.
14283         (Script_sections::Script_sections): Initialize
14284         data_segment_align_index_ and saw_relro_end_.
14285         (Script_sections::data_segment_align): New function.
14286         (Script_sections::data_segment_relro_end): New function.
14287         (Script_sections::place_orphan): Set or clear is_relro.
14288         (Script_sections::set_section_addresses): Force alignment of first
14289         TLS section.
14290         * yyscript.y (exp): Call script_data_segment_align and
14291         script_data_segment_relro_end.
14292         * testsuite/relro_script_test.t: New file.
14293         * testsuite/relro_test.cc (using_script): Declare.
14294         (t1, t2): Test using_script.
14295         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14296         (relro_script_test_SOURCES): Define.
14297         (relro_script_test_DEPENDENCIES): Define.
14298         (relro_script_test_LDFLAGS): Define.
14299         (relro_script_test_LDADD): Define.
14300         (relro_script_test.so): New target.
14301         * testsuite/Makefile.in: Rebuild.
14302
14303 2008-08-06  Cary Coutant <ccoutant@google.com>
14304
14305         * archive.cc (Archive::total_archives, Archive::total_members)
14306         (Archive::total_members_loaded): New variables.
14307         (Archive::setup): Add parameter.  Add option to preread
14308         archive symbols.
14309         (Archive::read_armap): Add counter.
14310         (Archive::get_file_and_offset): New function.
14311         (Archive::get_elf_object_for_member): New function.
14312         (Archive::read_all_symbols): New function.
14313         (Archive::read_symbols): New function.
14314         (Archive::add_symbols): Add counters.
14315         (Archive::include_all_members): Use armap to find members if it's
14316         already built.
14317         (Archive::include_member): Skip reading symbols if already read.
14318         Factored code into Archive::get_file_and_offset and
14319         Archive::get_elf_object_for_member.  Changed call to
14320         Mapfile::report_include_archive_member.
14321         (Archive::print_stats): New function.
14322         * archive.h: Declare Object and Read_symbols_data classes.
14323         (Archive::Archive): Add initializers for new members.
14324         (Archive::setup): Add parameter.
14325         (Archive::print_stats): New function.
14326         (Archive::total_archives, Archive::total_members)
14327         (Archive::total_members_loaded): New variables.
14328         (Archive::get_file_and_offset): New function.
14329         (Archive::get_elf_object_for_member): New function.
14330         (Archive::read_all_symbols): New function.
14331         (Archive::read_symbols): New function.
14332         (Archive::Archive_member): New class.
14333         (Archive::members_): New member.
14334         (Archive::num_members_): New member.
14335         * main.cc: Include archive.h.
14336         (main): Call Archive::print_stats.
14337         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14338         archive parameter; member_name is now the fully-decorated name.
14339         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14340         * options.h: (General_options): Add --preread-archive-symbols option.
14341         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14342         Archive::setup.
14343
14344 2008-08-04  Ian Lance Taylor  <iant@google.com>
14345
14346         * symtab.h (Symbol::use_plt_offset): New function.
14347         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14348         * powerpc.cc (Relocate::relocate): Likewise.
14349         * sparc.cc (Relocate::relocate): Likewise.
14350         * x86_64.cc (Relocate::relocate): Likewise.
14351         * testsuite/weak_plt.sh: New test.
14352         * testsuite/weak_plt_main.cc: New test.
14353         * testsuite/weak_plt_shared.cc: New test.
14354         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14355         (check_PROGRAMS): Add weak_plt.
14356         (check_DATA): Add weak_plt_shared.so.
14357         (weak_plt_main_pic.o, weak_plt): New targets.
14358         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14359         * testsuite/Makefile.in: Rebuild.
14360
14361         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14362         gcctestdir/ld.
14363         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14364         * testsuite/Makefile.in: Rebuild.
14365
14366 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14367
14368         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14369         * Makefile.in: Regenerate.
14370         * po/POTFILES.in: Regenerate.
14371
14372 2008-07-29  Ian Lance Taylor  <iant@google.com>
14373
14374         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14375         symbols before other symbols.
14376         * testsuite/script_test_2.cc (test_addr): Declare.
14377         (test_addr_alias): Declare.
14378         (main): Check that test_addr and test_addr_alias have the right
14379         values.
14380         * testsuite/script_test_2.t: Define test_addr_alias and
14381         test_addr.
14382
14383 2008-07-24  Ian Lance Taylor  <iant@google.com>
14384
14385         PR 5990
14386         * descriptors.cc: New file.
14387         * descriptors.h: New file.
14388         * gold-threads.h (class Hold_optional_lock): New class.
14389         * fileread.cc: Include "descriptors.h".
14390         (File_read::~File_read): Release descriptor rather than closing
14391         it.
14392         (File_read::open) [file]: Call open_descriptor rather than open.
14393         Set is_descriptor_opened_.
14394         (File_read::open) [memory]: Assert that descriptor is not open.
14395         (File_read::reopen_descriptor): New function.
14396         (File_read::release): Release descriptor.
14397         (File_read::do_read): Make non-const.  Reopen descriptor.
14398         (File_read::read): Make non-const.
14399         (File_read::make_view): Reopen descriptor.
14400         (File_read::do_readv): Likewise.
14401         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14402         Update declarations.
14403         * layout.cc: Include "descriptors.h".
14404         (Layout::create_build_id): Use open_descriptor rather than open.
14405         * output.cc: Include "descriptors.h".
14406         (Output_file::open): Use open_descriptor rather than open.
14407         * archive.cc (Archive::const_iterator): Change Archive to be
14408         non-const.
14409         (Archive::begin, Archive::end): Make non-const.
14410         (Archive::count_members): Likewise.
14411         * archive.h (class Archive): Update declarations.
14412         * object.h (Object::read): Make non-const.
14413         * Makefile.am (CCFILES): Add descriptors.cc.
14414         (HFILES): Add descriptors.h.
14415         * Makefile.in: Rebuild.
14416
14417         PR 6716
14418         * gold.h: Always include <clocale>.  Add Solaris workarounds
14419         following code in binutils/sysdep.h.
14420
14421         PR 6048
14422         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14423         this->eh_frame_hdr_ is NULL before using it.
14424
14425         * dynobj.cc (Versions::Versions): Update comment.
14426
14427         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14428         the base version name.
14429
14430         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14431         array size plus one.
14432         (Stringpool_template::set_string_offsets): Subtract one from key
14433         before using it as an array index.
14434         (Stringpool_template::get_offset_with_length): Likewise.
14435         (Stringpool_template::write_to_buffer): Likewise.
14436         * stringpool.h (Stringpool_template::get_offset_from_key):
14437         Likewise.
14438
14439 2008-07-23  Ian Lance Taylor  <iant@google.com>
14440
14441         PR 6658
14442         * object.h (Merged_symbol_value::value): Do our best to handle a
14443         negative addend.
14444
14445         PR 6647
14446         * script.cc (Version_script_info::get_versions): Don't add empty
14447         version tag to return value.
14448         (Version_script_info::get_symbol_version_helper): Change return
14449         type to bool.  Add pversion parameter.  Change all callers.
14450         (script_register_vers_node): Don't require a non-NULL tag.
14451         * script.h (class Version_script_info): Update declarations.
14452         (Version_script_info::get_symbol_version): Change return type to
14453         bool.  Add version parameter.  Change all callers.
14454         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14455         handling.  Handle an empty version from a version script.
14456         (Symbol_table::define_special_symbol): Likewise.
14457         * testsuite/ver_test_10.script: New file.
14458         * testsuite/ver_test_10.sh: New file.
14459         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14460         (check_DATA): Add ver_test_10.syms.
14461         (ver_test_10.syms, ver_test_10.so): New target.
14462         * testsuite/Makefile.in: Rebuild.
14463
14464 2008-07-23  Simon Baldwin  <simonb@google.com>
14465
14466         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14467         to zero for undefined symbols from dynamic libraries.
14468
14469 2008-07-23  Ian Lance Taylor  <iant@google.com>
14470
14471         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14472         Change all callers.
14473         * symtab.h (class Symbol_table): Update declaration.
14474         * testsuite/ver_test_9.cc: New file.
14475         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14476         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14477         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14478         (ver_test_9.so, ver_test_9.o): New targets.
14479         * testsuite/Makefile.in: Rebuild.
14480
14481 2008-07-22  Ian Lance Taylor  <iant@google.com>
14482
14483         * options.h (class General_options): Define --check-sections.
14484         * layout.cc (Layout::set_segment_offsets): Handle
14485         --check-sections.
14486
14487         * options.h (class General_options): Define -n/--nmagic and
14488         -N/--omagic.
14489         * options.cc (General_options::finalize): For -n/--nmagic or
14490         -N/--omagic, set -static.
14491         * layout.cc (Layout::attach_allocated_section_to_segment): If
14492         -N/--omagic, don't put read-only and read-write sections in
14493         different segments.
14494         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14495         finding a read-only segment.
14496         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14497         don't set the minimum segment alignment to the common page size,
14498         and don't set the file offset to the address modulo the page size.
14499         * script-sections.cc (Script_sections::create_segments): If
14500         -n/--omagic, don't put read-only and read-write sections in
14501         different segments.
14502
14503         * cref.cc: New file.
14504         * cref.h: New file.
14505         * options.h (class General_options): Add --print-symbol-counts.
14506         * main.cc (main): Issue defined symbol report if requested.
14507         * archive.cc (Archive::interpret_header): Make into a const member
14508         function.
14509         (Archive::add_symbols): Call Input_objects::archive_start and
14510         archive_stop.
14511         (Archive::const_iterator): Define new class.
14512         (Archive::begin, Archive::end): New functions.
14513         (Archive::include_all_members): Rewrite to use iterator.
14514         (Archive::count_members): New function.
14515         * archive.h (class Archive): Update declarations.
14516         (Archive::filename): New function.
14517         * object.cc: Include "cref.h".
14518         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14519         (Sized_relobj::do_get_global_symbol_counts): New function.
14520         (Input_objects::add_object): Add object to cross-referencer.
14521         (Input_objects::archive_start): New function.
14522         (Input_objects::archive_stop): New function.
14523         (Input_objects::print_symbol_counts): New function.
14524         * object.h: Declare Cref and Archive.
14525         (Object::get_global_symbol_counts): New function.
14526         (Object::do_get_global_symbol_counts): New pure virtual function.
14527         (class Sized_relobj): Add defined_count_ field.  Update
14528         declarations.
14529         (class Input_objects): Add cref_ field.  Update constructor.
14530         Update declarations.
14531         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14532         defined_count_.
14533         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14534         symbol counts.
14535         (Sized_dynobj::do_get_global_symbol_counts): New function.
14536         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14537         defined_count_.  Update declarations.  Define Symbols typedef.
14538         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14539         parameter.  Change all callers.
14540         (Symbol_table::add_from_dynobj): Add sympointers and defined
14541         parameters.  Change all callers.
14542         * symtab.h (class Symbol_table): Update declarations.
14543         * Makefile.am (CCFILES): Add cref.cc.
14544         (HFILES): Add cref.h.
14545         * Makefile.in: Rebuild.
14546
14547 2008-07-22  Simon Baldwin  <simonb@google.com>
14548
14549         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14550         to zero when writing undefined symbols.
14551
14552 2008-07-22  Ian Lance Taylor  <iant@google.com>
14553
14554         * output.cc (Output_section::add_input_section): Don't try to
14555         merge empty merge sections.
14556
14557 2008-07-21  Craig Silverstein  <csilvers@google.com>
14558
14559         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14560         Include symbol version in error message.
14561
14562 2008-07-20  Chris Demetriou  <cgd@google.com>
14563
14564         * configure.ac (gold_cv_c_random_seed): New configured variable.
14565         (RANDOM_SEED_CFLAGS): New substituted variable.
14566         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14567         * configure: Rebuild.
14568         * Makefile.in: Likewise.
14569         * testsuite/Makefile.in: Likewise.
14570
14571 2008-07-18  Ian Lance Taylor  <iant@google.com>
14572
14573         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14574         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14575         * testsuite/ver_test_main.cc (main): Call t4.
14576         (t4, t4_2a): Define.
14577         * testsuite/ver_test_2.cc (t4_2): Define.
14578         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14579         * testsuite/ver_test_4.cc (t4_2a): Define.
14580         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14581         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14582
14583 2008-07-17  Ian Lance Taylor  <iant@google.com>
14584
14585         * dynobj.cc (Versions::add_def): If we give an error about a
14586         missing version, go ahead and create the version anyhow.
14587
14588 2008-07-10  Ian Lance Taylor  <iant@google.com>
14589
14590         Handle output sections with more than 0x7fffffff bytes.
14591         * object.h (class Relobj): Change map_to_output_ to
14592         output_sections_, and just keep a section pointer.  Change all
14593         uses.  Move comdat group support to Sized_relobj.
14594         (Relobj::is_section_specially_mapped): Remove.
14595         (Relobj::output_section): Remove poff parameter.  Change all
14596         callers.
14597         (Relobj::output_section_offset): New function.
14598         (Relobj::set_section_offset): Rewrite.
14599         (Relobj::map_to_output): Remove.
14600         (Relobj::output_sections): New function.
14601         (Relobj::do_output_section_offset): New pure virtual function.
14602         (Relobj::do_set_section_offset): Likewise.
14603         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14604         group support from Relobj.  Update declarations.
14605         (Sized_relobj::get_output_section_offset): New function.
14606         (Sized_relobj::do_output_section_offset): New function.
14607         (Sized_relobj::do_set_section_offset): New function.
14608         * object.cc (Relobj::output_section_address): Remove.
14609         (Sized_relobj::Sized_relobj): Initialize new fields.
14610         (Sized_relobj::include_section_group): Cast find_kept_object to
14611         Sized_relobj.
14612         (Sized_relobj::include_linkonce_section): Likewise.
14613         (Sized_relobj::do_layout): Use separate arrays for output section
14614         and output offset.
14615         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14616         output_sections.
14617         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14618         output_sections and section_offsets.
14619         (Sized_relobj::write_local_symbols): Likewise.
14620         (map_to_kept_section): Compute output address directly.
14621         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14622         output_sections and section_offsets.
14623         (Sized_relobj::write_sections): Likewise.
14624         (Sized_relobj::relocate_sections): Likewise.
14625         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14626         * output.h (class Output_reloc): Update declarations.  Change
14627         u2_.relobj to Sized_relobj*.
14628         (class Output_data_reloc): Change add functions to use
14629         Sized_relobj*.
14630         * output.cc (Output_reloc::Output_reloc): Change relobj to
14631         Sized_relobj*.
14632         (Output_reloc::local_section_offset): Change return type to
14633         Elf_Addr.  Use get_output_section_offset.
14634         (Output_reloc::get_address): Likewise.
14635         (Output_section::is_input_address_mapped): Don't call
14636         is_section_specially_mapped.
14637         (Output_section::output_offset): Likewise.
14638         (Output_section::output_address): Likewise.
14639         (Output_section::starting_output_address): Likewise.
14640         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14641         parameter to Sized_relobj*.
14642         (Copy_relocs::need_copy_reloc): Likewise.
14643         (Copy_relocs::save): Likewise.
14644         * copy-relocs.h (class Copy_relocs): Update declarations.
14645         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14646         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14647         * target-reloc.h (relocate_for_relocatable): Change
14648         offset_in_output_section type to Elf_Addr.  Change code that uses
14649         it as well.
14650         * layout.cc (Layout::layout): Always set *off.
14651         * mapfile.cc (Mapfile::print_input_section): Use
14652         output_section_offset.
14653         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14654         Sized_relobj*.
14655         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14656         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14657         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14658
14659 2008-07-03  Ian Lance Taylor  <iant@google.com>
14660
14661         * layout.cc (Layout::include_section): Do not discard unrecognized
14662         SHT_STRTAB sections.
14663
14664 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14665
14666         * script.cc (Lex::can_continue_name): Make '?' allowable in
14667         version-script names.
14668         * testsuite/version_script.map: Change glob pattern to use '?'
14669
14670 2008-06-30  Manish Singh  <yosh@gimp.org>
14671
14672         PR 6585
14673         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14674         Correct typo.
14675
14676 2008-06-30  Ian Lance Taylor  <iant@google.com>
14677
14678         PR 6660
14679         PR 6682
14680         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14681         versions]: Don't try to read the value in the contents, since we
14682         don't use it.  Use the template endianness when writing.
14683
14684 2008-06-25  Cary Coutant  <ccoutant@google.com>
14685
14686         * fileread.cc (File_read::make_view): Assert on zero-length view.
14687         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14688         symbol table when there are no symbols to read.
14689
14690 2008-06-23  Craig Silverstein  <csilvers@google.com>
14691
14692         * version.cc (version_string): Bump to 1.7
14693
14694 2008-06-18  Craig Silverstein  <csilvers@google.com>
14695
14696         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14697         constant 0xFFFF to type Valtype.
14698         (Powerpc_relocate_functions::rel16_ha): Likewise.
14699
14700 2008-06-17  Ian Lance Taylor  <iant@google.com>
14701
14702         * output.h (Output_section::Input_section): Initialize p2align_ to
14703         zero for Output_section_data constructors.
14704         (Output_section::Input_section::addralign): If not an input
14705         section, return the alignment of the Output_section_data.
14706         * testsuite/copy_test.cc: New file.
14707         * testsuite/copy_test_1.cc: New file.
14708         * testsuite/copy_test_2.cc: New file.
14709         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14710         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14711         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14712         (copy_test_1_pic.o, copy_test_1.so): New targets.
14713         (copy_test_2_pic.o, copy_test_2.so): New targets.
14714         * testsuite/Makefile.in: Rebuild.
14715
14716         * script-sections.cc (Script_sections::place_orphan): Initialize
14717         local variable exact.
14718
14719 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14720
14721         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14722
14723 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14724             David S. Miller  <davem@davemloft.net>
14725
14726         * powerpc.cc: New file.
14727         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14728         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14729         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14730         * Makefile.in: Rebuild.
14731
14732 2008-06-09  Ian Lance Taylor  <iant@google.com>
14733
14734         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14735         <exception>.
14736         (throwing, orig_terminate): New static variables.
14737         (terminate_handler): New static function.
14738         (t2): Set terminate handler.
14739
14740 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14741
14742         PR 6584
14743         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14744         alignment.
14745
14746 2008-05-30  Cary Coutant  <ccoutant@google.com>
14747
14748         * archive.cc (Archive::include_all_members) Correct to step
14749         over symbol table and extended name table in thin archives.
14750
14751 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14752
14753         PR 6407
14754         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14755         calculation.
14756
14757 2008-05-28  Caleb Howe  <cshowe@google.com>
14758
14759         * reduced_debug_output.cc: New file.
14760         * reduced_debug_output.h: New file.
14761         * options.h (class General_options): Add --strip-debug-non-line.
14762         * options.cc (General_options::finalize): Add strip_debug_non_line
14763         to the strip heirarchy.
14764         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14765         fields.
14766         * layout.cc: Include "reduced_debug_output.h".
14767         (Layout::Layout): Initialize new fields.
14768         (line_only_debug_sections): New static array.
14769         (is_lines_only_debug_sections): New static inline function.
14770         (Layout::include_section): Handle --strip-debug-non-line.
14771         (Layout::make_output_section): If --strip-debug-non-line, build
14772         new output sections for .debug_abbrev and .debug_info.
14773         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14774         gold.  Warn about possible overflow.
14775         (read_signed_LEB_128): Likewise.
14776         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14777         (read_signed_LEB_128): Declare.
14778         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14779         (HFILES): Add reduced_debug_output.h.
14780         * Makefile.in: Rebuild.
14781
14782 2008-05-21  Ian Lance Taylor  <iant@google.com>
14783
14784         * mapfile.cc: New file.
14785         * mapfile.h: New file.
14786         * options.h (class General_options): Add -M/--print-map and -Map.
14787         * options.cc (General_options::finalize): Make -M equivalent to
14788         -Map -.
14789         * main.cc: Include <cstdio> and "mapfile.h".
14790         (main): Open mapfile if requested.
14791         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14792         constructor.  Change caller.
14793         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14794         (queue_middle_tasks): Likewise.
14795         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14796         declarations.
14797         * archive.cc: Include "mapfile.h".
14798         (Archive::add_symbols): Add mapfile parameter.  Change all
14799         callers.  Pass mapfile, symbol, and reason to include_member.
14800         (Archive::include_all_members): Add mapfile parameter.  Change all
14801         callers.
14802         (Archive::include_member): Add mapfile, sym, and why parameters.
14803         Change all callers.  Report inclusion to map file.
14804         * archive.h: Include "fileread.h".
14805         (class Archive): Update declarations.
14806         (Archive::file): New const method.
14807         (class Add_archive_symbols): Add mapfile_ field.  Update
14808         constructor.  Change all callers.
14809         * readsyms.h (class Read_symbols): Likewise.
14810         (class Finish_group): Likewise.
14811         (class Read_script): Likewise.
14812         * common.cc: Include "mapfile.h".
14813         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14814         all callers.
14815         (Symbol_table::do_allocate_commons): Likewise.
14816         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14817         symbol allocation to mapfile.
14818         * common.h (class Allocate_commons_task): Add mapfile_ field.
14819         Update constructor.  Change all callers.
14820         * symtab.h (class Symbol_table): Update declarations.
14821         * layout.cc: Include "mapfile.h".
14822         (Layout_task_runner::run): Print information to mapfile.
14823         (Layout::create_gold_note): Change Output_data_fixed_space to
14824         Output_data_zero_fill.
14825         (Layout::create_build_id): Likewise.
14826         (Layout::print_to_mapfile): New function.
14827         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14828         constructor.  Change caller.
14829         (class Layout): Declare print_to_mapfile.
14830         * output.cc (Output_section::Input_section::print_to_mapfile): New
14831         function.
14832         (Output_section::add_input_section): If producing a map, always
14833         add to input_sections_ list.
14834         (Output_section::do_print_to_mapfile): New function.
14835         (Output_segment::print_sections_to_mapfile): New function.
14836         (Output_segment::print_section_list_to_mapfile): New function.
14837         * output.h: Include "mapfile.h".
14838         (Output_data::print_to_mapfile): New function.
14839         (Output_data::do_print_to_mapfile): New virtual function.
14840         (Output_segment_headers::do_print_to_mapfile): New function.
14841         (Output_file_header::do_print_to_mapfile): New function.
14842         (Output_data_const::do_print_to_mapfile): New function.
14843         (class Output_data_const_buffer): Add map_name_ field.  Update
14844         constructor.  Change all callers.  Add do_print_to_mapfile
14845         function.
14846         (class Output_data_fixed_space): Likewise.
14847         (class Output_data_space): Likewise.
14848         (class Output_data_zero_fill): New class.
14849         (Output_data_strtab::do_print_to_mapfile): New function.
14850         (Output_data_reloc_base::do_print_to_mapfile): New function.
14851         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14852         (Output_data_group::do_print_to_mapfile): New function.
14853         (Output_data_got::do_print_to_mapfile): New function.
14854         (Output_data_dynamic::do_print_to_mapfile): New function.
14855         (Output_symtab_xindex::do_print_to_mapfile): New function.
14856         (class Output_section): Declare do_print_to_mapflie.  Declare
14857         print_to_mapfile in Input_section.
14858         (class Output_segment): Declare new functions.
14859         * object.h (Sized_relobj::symbol_count): New function.
14860         * script-sections.cc
14861         (Output_section_element_dot_assignment::set_section_addresses):
14862         Change Output_data_fixed_space to Output_data_zero_fill.
14863         (Output_data_expression::do_print_to_mapfile): New function.
14864         * script.cc (read_input_script): Add mapfile parameter.  Change
14865         all callers.
14866         * script.h (read_input_script): Update declaration.
14867         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14868         (Eh_frame::do_print_to_mapfile): New function.
14869         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14870         (Output_merge_string::do_print_to_mapfile): New function.
14871         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14872         function.
14873         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14874         function.
14875         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14876         function.
14877         * Makefile.am (CCFILES): Add mapfile.cc.
14878         (HFILES): Add mapfile.h.
14879         * Makefile.in: Rebuild.
14880
14881 2008-05-19  Ian Lance Taylor  <iant@google.com>
14882
14883         * options.h (class General_options): Add -z relro.
14884         * layout.cc (Layout::Layout): Initialize relro_segment_.
14885         (Layout::add_output_section_data): Return the output section.
14886         (Layout::make_output_section): Rcognize relro sections and mark
14887         them appropriately.
14888         (Layout::attach_allocated_section_to_segment): Put relro sections
14889         in a PT_GNU_RELRO segment.
14890         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14891         section as relro.
14892         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14893         PT_TLS segments.
14894         (Layout::linkonce_mapping): Map d.rel.ro.local to
14895         .data.rel.ro.local.
14896         (Layout::output_section_name): Us .data.rel.ro.local for any
14897         section which begins with that.
14898         * layout.h (class Layout): Update add_output_section_data
14899         declaration.  Add relro_segment_ field.
14900         * output.cc (Output_section::Output_section): Initialize is_relro_
14901         and is_relro_local_ fields.
14902         (Output_segment::add_output_section): Group relro sections.
14903         (Output_segment::is_first_section_relro): New function.
14904         (Output_segment::maximum_alignment): If there is a relro section,
14905         align the segment to the common page size.
14906         (Output_segment::set_section_addresses): Track whether we are
14907         looking at relro sections.  If the last section is a relro
14908         section, align to the common page size.
14909         (Output_segment::set_section_list_addresses): Add in_relro
14910         parameter.  Change all callers.  Align to the page size when
14911         moving from relro to non-relro section.
14912         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14913         segment.
14914         * output.h (class Output_section): Add is_relro_ and
14915         is_relro_local_ fields.
14916         (Output_section::is_relro): New function.
14917         (Output_section::set_is_relro): New function.
14918         (Output_section::is_relro_local): New function.
14919         (Output_section::set_is_relro_local): New function.
14920         (class Output_segment): Update declarations.
14921         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14922         * sparc.cc (Target_sparc::got_section): Likewise.
14923         * x86_64.cc (Target_x86_64::got_section): Likewise.
14924         * testsuite/relro_test_main.cc: New file.
14925         * testsuite/relro_test.cc: New file.
14926         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14927         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14928         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14929         (relro_test.so, relro_test_pic.o): New targets.
14930         * testsuite/Makefile.in: Rebuild.
14931
14932 2008-05-16  Ian Lance Taylor  <iant@google.com>
14933
14934         * output.cc (Output_segment::add_output_section): Remove front
14935         parameter.
14936         * output.h (class Output_segment): Remove
14937         add_initial_output_section and overloaded add_output_section.
14938         Update declaration of remaining add_output_section.
14939         * layout.cc (Layout::create_interp): Call add_output_section
14940         rather than add_initial_output_section.
14941         (Layout::finish_dynamic_section): Likewise.
14942
14943         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14944         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14945         know the dynamic type.
14946         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14947         field.  Initialize it in constructor.
14948         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14949         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14950         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14951         reloc.
14952
14953         * output.cc (Output_reloc::get_address): Change return type to
14954         Elf_Addr.
14955         * output.h (class Output_reloc): Update get_address declaration.
14956         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14957         for section addresses.
14958
14959 2008-05-09  Ian Lance Taylor  <iant@google.com>
14960
14961         PR 6493
14962         * gold.cc (gold_nomem): Use return value of write.
14963
14964 2008-05-08  Ian Lance Taylor  <iant@google.com>
14965
14966         * symtab.c (Symbol::init_base_output_data): Add version
14967         parameter.  Change all callers.
14968         (Symbol::init_base_output_segment): Likewise.
14969         (Symbol::init_base_constant): Likewise.
14970         (Symbol::init_base_undefined): Likewise.
14971         (Sized_symbol::init_output_data): Likewise.
14972         (Sized_symbol::init_output_segment): Likewise.
14973         (Sized_symbol::init_constant): Likewise.
14974         (Sized_symbol::init_undefined): Likewise.
14975         (Symbol_table::do_define_in_output_data): If the new symbol has a
14976         version, mark it as the default.
14977         (Symbol_table::do_define_in_output_segment): Likewise.
14978         (Symbol_table::do_define_as_constant): Likewise.
14979         * symtab.h (class Symbol): Update declarations.
14980         (class Sized_symbol): Likewise.
14981         * resolve.cc (Symbol::override_version): New function.
14982         (Symbol::override_base): Call override_version.
14983         (Symbol::override_base_with_special): Likewise.
14984         * testsuite/ver_script_8.script: New file.
14985         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14986         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14987         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14988         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14989
14990 2008-05-06  Ian Lance Taylor  <iant@google.com>
14991
14992         PR 6049
14993         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14994         functions.
14995         (class General_options): Remove existing --undefined, and add
14996         --no-undefined instead.  Add new --undefined as synonym for -u.
14997         * archive.cc (Archive::add_symbols): Check whether symbol was
14998         named with -u.
14999         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
15000         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
15001         all uses.  Add IS_UNDEFINED.  Update declarations to split
15002         different versions of init_base.  Declare init_base_undefined.
15003         (Symbol::is_defined): Handle IS_UNDEFINED.
15004         (Symbol::is_undefined): Likewise.
15005         (Symbol::is_weak_undefined): Call is_undefined.
15006         (Symbol::is_absolute): Handle IS_CONSTANT.
15007         (class Sized_symbol): Update declarations to split different
15008         versions of init.  Declare init_undefined.
15009         (class Symbol_table): Declare new functions.
15010         * symtab.cc (Symbol::init_base_object): Rename from init_base.
15011         Change all callers.
15012         (Symbol::init_base_output_data): Likewise.
15013         (Symbol::init_base_output_segment): Likewise.
15014         (Symbol::init_base_constant): Likewise.
15015         (Symbol::init_base_undefined): New function.
15016         (Sized_symbol::init_object): Rename from init.  Change all
15017         callers.
15018         (Sized_symbol::init_output_data): Likewise.
15019         (Sized_symbol::init_output_segment): Likewise.
15020         (Sized_symbol::init_constant): Likewise.
15021         (Sized_symbol::init_undefined): New function.
15022         (Symbol_table::add_undefined_symbols_from_command_line): New
15023         function.
15024         (Symbol_table::do_add_undefined_symbols_from_command_line): New
15025         function.
15026         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
15027         (Symbol::output_section): Likewise.
15028         (Symbol::set_output_section): Likewise.
15029         (Symbol_table::sized_finalize_symbol): Likewise.
15030         (Symbol_table::sized_write_globals): Likewise.
15031         * resolve.cc (Symbol_table::should_override): Likewise.
15032         (Symbol::override_base_with_special): Likewise.
15033
15034         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15035         symbol, change it to have default visibility.
15036         * testsuite/protected_1.cc: New file.
15037         * testsuite/protected_2.cc: New file.
15038         * testsuite/protected_3.cc: New file.
15039         * testsuite/protected_main_1.cc: New file.
15040         * testsuite/protected_main_2.cc: New file.
15041         * testsuite/protected_main_3.cc: New file.
15042         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15043         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15044         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15045         (protected_1.so): New target.
15046         (protected_1_pic.o, protected_2_pic.o): New targets.
15047         (protected_3_pic.o): New target.
15048         (check_PROGRAMS): Add protected_2.
15049         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15050         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15051         * testsuite/Makefile.in: Rebuild.
15052
15053         * options.h (DEFINE_var): Add set_user_set_##varname__.
15054         (DEFINE_bool_alias): New macro.
15055         (class General_options): Define -Bstatic using DEFINE_bool_alias
15056         rather than DEFINE_special.  Add --undefined as an alias for -z
15057         defs.
15058         * options.cc (General_options::parse_Bstatic): Remove.
15059
15060         * options.h (class General_options): Add --fatal-warnings.
15061         * main.cc (main): Implement --fatal-warnings.
15062         * errors.h (Errors::warning_count): New function.
15063
15064         * options.h (class General_options): Add -Bsymbolic-functions.
15065         * symtab.h (Symbol::is_preemptible): Check for
15066         -Bsymbolic-functions.
15067
15068 2008-05-05  Ian Lance Taylor  <iant@google.com>
15069
15070         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15071         as noVARNAME rather than no-VARNAME.
15072         (class General_options): Add option -z combreloc.
15073         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15074         get_address.
15075         (Output_reloc::sort_before) [SHT_REL]: New function.
15076         (Output_reloc::sort_before) [SHT_RELA]: New function.
15077         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15078         Sort_relocs_comparison.
15079         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15080         parameter.  Change all callers.
15081         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15082         sort_relocs parameter.  Change all callers.
15083         * output.cc (Output_reloc::get_address): New function, broken out
15084         of write_rel.
15085         (Output_reloc::write_rel): Call it.
15086         (Output_reloc::compare): New function.
15087         (Output_data_reloc_base::do_write): Optionally sort relocs.
15088
15089         * configure.ac: If targ_extra_obj is set, link it in.
15090         * configure.tgt: Initialize all variables.
15091         (x86_64*): Set targ_extra_obj and targ_extra_size.
15092         * configure: Rebuild.
15093
15094         * object.cc (Sized_relobj::include_section_group): Adjust section
15095         indexes read from group data.  Build vector to pass to
15096         layout_group.
15097         * layout.cc (Layout::layout_group): Add flags and shndxes
15098         parameters.  Remove contents parameter.  Change caller.  Update
15099         explicit instantiations.
15100         * layout.h (class Layout): Update layout_group declaration.
15101         * output.cc (Output_data_group::Output_data_group): Add flags and
15102         input_shndxes parameters.  Remove contents parameter.  Change
15103         caller.
15104         (Output_data_group::do_write): Change input_sections_ to
15105         input_shndxes_.
15106         * output.h (class Output_data_group): Update constructor
15107         declaration.  Rename input_sections_ to input_shndxes_.
15108         * testsuite/many_sections_test.cc: Add template.
15109
15110 2008-04-30  Cary Coutant  <ccoutant@google.com>
15111
15112         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15113
15114         * layout.cc (Layout::include_section): Refactored check for debug
15115         info section.
15116         (Layout::add_comdat): Add new parameters.  Change type
15117         of signature parameter.  Add object and shndx to signatures table.
15118         (Layout::find_kept_object): New function.
15119         * layout.h: Include <cstring>.
15120         (Layout::is_debug_info_section): New function.
15121         (Layout::add_comdat): Add new parameters.
15122         (Layout::find_kept_object): New function.
15123         (Layout::Kept_section): New struct.
15124         (Layout::Signatures): Change type of map range.
15125         * object.cc (Relobj::output_section_address): New function.
15126         (Sized_relobj::include_section_group): Add new parameters.  Change
15127         calls to Layout::add_comdat.  Change to build table of kept comdat
15128         groups and table mapping discarded sections to kept sections.
15129         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15130         (Sized_relobj::do_layout): Change calls to include_section_group and
15131         include_linkonce_section.
15132         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15133         value to zero when section is discarded.
15134         (Sized_relobj::map_to_kept_section): New function.
15135         * object.h (Relobj::output_section_address): New function.
15136         (Relobj::Comdat_group): New type.
15137         (Relobj::find_comdat_group): New function.
15138         (Relobj::Comdat_group_table): New type.
15139         (Relobj::Kept_comdat_section): New type.
15140         (Relobj::Kept_comdat_section_table): New type.
15141         (Relobj::add_comdat_group): New function.
15142         (Relobj::set_kept_comdat_section): New function.
15143         (Relobj::get_kept_comdat_section): New function.
15144         (Relobj::comdat_groups_): New field.
15145         (Relobj::kept_comdat_sections_): New field.
15146         (Symbol_value::input_value): Update comment.
15147         (Sized_relobj::map_to_kept_section) New function.
15148         (Sized_relobj::include_linkonce_section): Add new parameter.
15149         * target-reloc.h (Comdat_behavior): New type.
15150         (get_comdat_behavior): New function.
15151         (relocate_section): Add code to map a discarded section to the
15152         corresponding kept section when applying a relocation.
15153
15154 2008-04-30  Craig Silverstein  <csilvers@google.com>
15155
15156         * dwarf_reader.cc (next_generation_count): New static var.
15157         (Addr2line_cache_entry): New struct.
15158         (addr2line_cache): New static var.
15159         (Dwarf_line_info::one_addr2line): Added caching.
15160         (Dwarf_line_info::clear_addr2line_cache): New function.
15161         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15162         cache-size parameter.
15163         (Dwarf_line_info::one_addr2line_cache): New function.
15164         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15165         new cache-size argument to one_addr2line(), and clear cache.
15166
15167 2008-04-28  Cary Coutant  <ccoutant@google.com>
15168
15169         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15170         R_386_PC8 relocations.
15171
15172 2008-04-23  Ian Lance Taylor  <iant@google.com>
15173
15174         * object.cc (Sized_relobj::include_section_group): Check for
15175         invalid section group.
15176
15177         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15178         header size.
15179
15180         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15181         than read for file header.
15182         * archive.cc (Archive::include_member): Likewise.
15183
15184 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15185
15186         * aclocal.m4: Regenerate.
15187         * configure: Regenerate.
15188
15189 2008-04-19  Ian Lance Taylor  <iant@google.com>
15190
15191         * version.cc (version_string): Bump to 1.6.
15192
15193         * testsuite/Makefile.am (many_sections_r_test): New target.
15194         (many_sections_r_test_SOURCES): Remove.
15195         (many_sections_r_test_DEPENDENCIES): Remove.
15196         (many_sections_r_test_LDFLAGS): Remove.
15197         (many_sections_r_test_LDADD): Remove.
15198
15199         * object.cc (Sized_relobj::do_add_symbols): Always pass
15200         local_symbol_count_ to add_from_relobj.
15201
15202         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15203         every thousand variables.
15204         * testsuite/Makefile.in: Rebuild.
15205
15206         * object.cc (Xindex::initialize_symtab_xindex): New function.
15207         (Xindex::read_symtab_xindex): New function.
15208         (Xindex::sym_xindex_to_shndx): New function.
15209         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15210         available.
15211         (Sized_relobj::do_initialize_xindex): New function.
15212         (Sized_relobj::do_read_symbols): Adjust section links.
15213         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15214         parameter.  Change all callers.
15215         (Sized_relobj::include_section_group): Adjust section links and
15216         symbol section indexes.
15217         (Sized_relobj::do_layout): Adjust section links.
15218         (Sized_relobj::do_count_local_symbols): Adjust section links and
15219         symbol section indexes.
15220         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15221         ordinary and special symbols.
15222         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15223         dynsym_xindex parameters.  Change all callers.  Adjust section
15224         links.  Use SHN_XINDEX when needed.
15225         (Sized_relobj::get_symbol_location_info): Adjust section links.
15226         Don't get fooled by special symbols.
15227         * object.h (class Xindex): Define.
15228         (class Object): Add xindex_ parameter.  Declare virtual functoin
15229         do_initialize_xindex.
15230         (Object::adjust_sym_shndx): New function.
15231         (Object::set_xindex): New protected function.
15232         (class Symbol_value): Add is_ordinary_shndx_ field.
15233         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15234         (Symbol_value::value): Assert ordinary section.
15235         (Symbol_value::initialize_input_to_output_map): Likewise.
15236         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15237         Change all callers.
15238         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15239         all callers.
15240         (class Sized_relobj): Update declarations.
15241         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15242         parameter.  Change all callers.
15243         (Sized_relobj::adjust_shndx): New function.
15244         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15245         field.
15246         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15247         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15248         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15249         (Sized_dynobj::read_dynsym_section): Adjust section links.
15250         (Sized_dynobj::read_dynamic): Likewise.
15251         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15252         section links.
15253         (Sized_dynobj::do_initialize_xindex): New function.
15254         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15255         do_initialize_xindex.
15256         (Sized_dynobj::adjust_shndx): New function.
15257         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15258         dynsym_xindex_ fields.
15259         (Layout::finalize): Add a call to set_section_indexes before
15260         creating the symtab sections.
15261         (Layout::set_section_indexes): Don't do anything if the section
15262         already has a section index.
15263         (Layout::create_symtab_sections): Add shnum parameter.  Change
15264         caller.  Create .symtab_shndx section if needed.
15265         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15266         caller.
15267         (Layout::allocated_output_section_count): New function.
15268         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15269         needed.
15270         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15271         fields.  Update declarations.
15272         (Layout::symtab_xindex): New function.
15273         (Layout::dynsym_xindex): New function.
15274         (class Write_symbols_task): Add layout_ field.
15275         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15276         Change caller.
15277         * output.cc (Output_section_headers::Output_section_headers): Add
15278         shstrtab_section parameter.  Change all callers.
15279         (Output_section_headers::do_sized_write): Store overflow values
15280         for section count and section string table section index in
15281         section header zero.
15282         (Output_file_header::do_sized_write): Check for overflow of
15283         section count and section string table section index.
15284         (Output_symtab_xindex::do_write): New function.
15285         (Output_symtab_xindex::endian_do_write): New function.
15286         * output.h (class Output_section_headers): Add shstrtab_section_.
15287         Update declarations.
15288         (class Output_symtab_xindex): Define.
15289         (Output_section::has_out_shndx): New function.
15290         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15291         field.
15292         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15293         Change all callers.
15294         (Sized_symbol::init): Likewise.
15295         (Symbol::output_section): Check for ordinary symbol.
15296         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15297         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15298         callers.
15299         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15300         Change all callers.  Simplify handling of symbols from sections
15301         not included in the link.
15302         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15303         distinction.
15304         (Weak_alias_sorter::operator()): Assert that symbols are
15305         ordinary.
15306         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15307         distinction.
15308         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15309         parameters.  Change all callers.
15310         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15311         symbol distinction.  Use SHN_XINDEX when needed.
15312         (Symbol_table::write_section_symbol): Add symtab_xindex
15313         parameter.  Change all callers.
15314         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15315         SHN_XINDEX when needed.
15316         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15317         declarations.
15318         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15319         (Symbol::is_defined): Check is_ordinary.
15320         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15321         (Symbol::is_absolute, Symbol::is_common): Likewise.
15322         (class Sized_symbol): Update declarations.
15323         (class Symbol_table): Update declarations.
15324         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15325         parameters.  Change all callers.
15326         (Sized_symbol::override): Likewise.
15327         (Symbol_table::override): Likewise.
15328         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15329         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15330         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15331         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15332         to be in an ordinary section.
15333         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15334         object and is_ordinary parameters.  Change all callers.
15335         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15336         Change all callers.  Don't add undefined or non-ordinary symbols
15337         to reloc_map_.
15338         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15339         Change all callers.
15340         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15341         declarations.
15342         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15343         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15344         (Sized_relobj::relocate_sections): Likewise.
15345         * target-reloc.h (scan_relocs): Adjust section symbol index.
15346         (scan_relocatable_relocs): Likewise.
15347         * i386.cc (Scan::local): Check for ordinary symbols.
15348         * sparc.cc (Scan::local): Likewise.
15349         * x86_64.cc (Scan::local): Likewise.
15350         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15351         to symbol_section_and_value.
15352         * testsuite/many_sections_test.cc: New file.
15353         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15354         (check_PROGRAMS): Add many_sections_test.
15355         (many_sections_test_SOURCES): Define.
15356         (many_sections_test_DEPENDENCIES): Define.
15357         (many_sections_test_LDFLAGS): Define.
15358         (BUILT_SOURCES): Add many_sections_define.h.
15359         (many_sections_define.h): New target.
15360         (BUILT_SOURCES): Add many_sections_check.h.
15361         (many_sections_check.h): New target.
15362         (check_PROGRAMS): Add many_sections_r_test.
15363         (many_sections_r_test_SOURCES): Define.
15364         (many_sections_r_test_DEPENDENCIES): Define.
15365         (many_sections_r_test_LDFLAGS): Define.
15366         (many_sections_r_test_LDADD): Define.
15367         (many_sections_r_test.o): New target.
15368         * testsuite/Makefile.in: Rebuild.
15369
15370 2008-04-17  Cary Coutant  <ccoutant@google.com>
15371
15372         * errors.cc (Errors::info): New function.
15373         (gold_info): New function.
15374         * errors.h (Errors::info): New function.
15375         * gold.h (gold_info): New function.
15376         * object.cc (Input_objects::add_object): Print trace output.
15377         * options.cc (options::parse_set): New function.
15378         (General_options::parse_wrap): Deleted.
15379         (General_options::General_options): Deleted initializer.
15380         * options.h (options::String_set): New typedef.
15381         (options::parse_set): New function.
15382         (DEFINE_set): New macro.
15383         (General_options::wrap): Changed to use DEFINE_set. Changed
15384         callers of any_wrap_symbols and is_wrap_symbol.
15385         (General_options::trace, General_options::trace_symbol):
15386         New options.
15387         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15388         (General_options::wrap_symbols_): Deleted.
15389         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15390
15391 2008-04-17  David S. Miller  <davem@davemloft.net>
15392
15393         * options.cc (General_options::parse_V): New function.
15394         * options.h: Add entries for -V and -Qy.
15395
15396 2008-04-17  Ian Lance Taylor  <iant@google.com>
15397
15398         * common.cc (Symbol_table::allocate_commons): Remove options
15399         parameter.  Change caller.
15400         (Symbol_table::do_allocate_commons): Remove options parameter.
15401         Change caller.  Just call do_allocate_commons_list twice.
15402         (Symbol_table::do_allocate_commons_list): New function, broken out
15403         of do_allocate_commons.
15404         * common.h (class Allocate_commons_task): Remove options_ field.
15405         Update constructor.
15406         * symtab.cc (Symbol_table::Symbol_table): Initialize
15407         tls_commons_.
15408         (Symbol_table::add_from_object): Put TLS common symbols on
15409         tls_commons_ list.
15410         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15411         which are IN_OUTPUT_DATA.
15412         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15413         allocate_commons and do_allocate_commons declarations.  Declare
15414         do_allocate_commons_list.
15415         * gold.cc (queue_middle_tasks): Update creation of
15416         Allocate_commons_task to not pass options.
15417         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15418         (TLS_TEST_C_FLAGS): New variable.
15419         (tls_test_c_pic.o): New target.
15420         (tls_test_shared.so): Link in tls_test_c_pic.o.
15421         (tls_test_c_pic_ie.o): New target.
15422         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15423         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15424         (tls_test_c.o): New target.
15425         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15426         (tls_pic_test_LDADD): Likewise.
15427         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15428         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15429         (tls_test_c_gnu2.o): New target.
15430         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15431         tls_test_c_gnu2.o.
15432         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15433         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15434         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15435         * testsuite/tls_test.cc: Include "config.h".
15436         (t_last): Call t11_last.
15437         * testsuite/tls_test.h (t11, t11_last): Declare.
15438         * testsuite/tls_test_c.c: New file.
15439         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15440         * configure.ac: Check for OpenMP support.
15441         * configure, config.in, Makefile.in: Rebuild.
15442         * testsuite/Makefile.in: Rebuild.
15443
15444 2008-04-16  Cary Coutant  <ccoutant@google.com>
15445
15446         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15447         (Target_i386::tls_base_symbol_defined_): New field.
15448         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15449         (Target_i386::Scan::global): Likewise.
15450         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15451         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15452         (Target_x86_64::tls_base_symbol_defined_): New field.
15453         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15454         (Target_x86_64::Scan::global): Likewise.
15455
15456 2008-04-16  Cary Coutant  <ccoutant@google.com>
15457
15458         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15459         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15460         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15461         building shared libraries.
15462         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15463         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15464         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15465         * testsuite/Makefile.in: Rebuild.
15466         * testsuite/weak_undef.h: New file.
15467         * testsuite/weak_undef_file1.cc: Add extra test cases.
15468         * testsuite/weak_undef_file2.cc: Likewise.
15469         * testsuite/weak_undef_test.cc: Likewise.
15470
15471 2008-04-16  David S. Miller  <davem@davemloft.net>
15472
15473         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15474         Add issued_non_pic_error_ field.  Declare check_non_pic.
15475         (Target_sparc::Scan::check_non_pic): New function.
15476         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15477         (Target_sparc::Scan::global): Likewise.
15478
15479         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15480         * configure: Rebuild.
15481
15482         * options.h (DEFINE_enable): New macro.
15483         (new_dtags): New enable option.
15484         (initfirst, interpose, loadfltr, nodefaultlib,
15485         nodelete, nodlopen, nodump): New -z options.
15486         * layout.cc (Layout:finish_dynamic_section): If new
15487         dtags enabled, emit DT_RUNPATH.  Also, emit a
15488         DT_FLAGS_1 containing any specified -z flags.
15489
15490 2008-04-16  Ian Lance Taylor  <iant@google.com>
15491
15492         * copy-relocs.cc: New file.
15493         * copy-relocs.h: New file.
15494         * reloc.cc: Remove Copy_relocs code.
15495         * reloc.h: Likewise.
15496         * reloc-types.h (struct Reloc_types) [both versions]: Add
15497         get_reloc_addend_noerror.
15498         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15499         variants of add_global which take an addend which must be zero.
15500         * i386.cc: Include "copy-relocs.h".
15501         (class Target_i386): Change type of copy_relocs_ to variable,
15502         update initializer.
15503         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15504         Change all callers.
15505         (Target_i386::do_finalize_sections): Change handling of
15506         copy_relocs_.
15507         * sparc.cc: Include "copy-relocs.h".
15508         (class Target_sparc): Change type of copy_relocs_ to variable,
15509         update initializer.
15510         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15511         Change all callers.
15512         (Target_sparc::do_finalize_sections): Change handling of
15513         copy_relocs_.
15514         * x86_64.cc: Include "copy-relocs.h".
15515         (class Target_x86_64): Change type of copy_relocs_ to variable,
15516         update initializer.
15517         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15518         class.  Change all callers.
15519         (Target_x86_64::do_finalize_sections): Change handling of
15520         copy_relocs_.
15521         * Makefile.am (CCFILES): Add copy-relocs.cc.
15522         (HFILES): Add copy-relocs.h.
15523
15524         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15525
15526         * testsuite/script_test_4.sh: Permit leading zeroes.
15527
15528 2008-04-15  Ian Lance Taylor  <iant@google.com>
15529
15530         * script-sections.cc (Script_sections::create_segments): Use
15531         header_size_adjustment even when there is enough room for the
15532         headers.
15533         * testsuite/script_test_4.sh: New file.
15534         * testsuite/script_test_4.t: New file.
15535         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15536         (check_DATA): Add script_test_4.stdout.
15537         (MOSTLYCLEANFILES): Likewise.
15538         (script_test_4): New target.
15539         (script_test_4.stdout): New target.
15540         * testsuite/Makefile.in: Rebuild.
15541
15542         * sparc.cc: Add definitions for Output_data_plt_sparc class
15543         constants.
15544
15545 2008-04-14  David S. Miller  <davem@davemloft.net>
15546
15547         * sparc.cc: New file.
15548         * Makefile.am (TARGETSOURCES): Add sparc.cc
15549         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15550         * configure.tgt: Document targ_extra_size and
15551         targ_extra_big_endian.  Add entries for sparc-* and
15552         sparc64-*.
15553         * configure.ac: Handle targ_extra_size and
15554         targ_extra_big_endian.
15555         * Makefile.in: Rebuild.
15556         * configure: Likewise.
15557         * po/POTFILES.in: Likewise.
15558         * po/gold.pot: Likewise.
15559
15560 2008-04-14  Ian Lance Taylor  <iant@google.com>
15561
15562         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15563         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15564         in the name/type/flags to section mapping.  Don't call
15565         allocate_output_section.
15566         (Layout::choose_output_section): Change parameter from adjust_name
15567         to is_input_section.  Don't permit input sections after sections
15568         are attached to segments.  Don't call allocate_output_section.
15569         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15570         not write_enable_output_section.
15571         (Layout::make_output_section): Don't push to
15572         unattached_section_list_ nor call attach_to_segment.  Call
15573         attach_section_to_segment if sections are attached.
15574         (Layout::attach_sections_to_segments): New function.
15575         (Layout::attach_section_to_segment): New function.
15576         (Layout::attach_allocated_section_to_segment): Rename from
15577         attach_to_segment.  Remove flags parameter.
15578         (Layout::allocate_output_section): Remove function.
15579         (Layout::write_enable_output_section): Remove function.
15580         * layout.h (class Layout): Update for above changes.  Add new
15581         field sections_are_attached_.
15582         * output.h (Output_section::update_flags_for_input_section): New
15583         function.
15584         * output.cc (Output_section::add_input_section): Call
15585         update_flags_for_input_section.
15586         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15587
15588 2008-04-11  Cary Coutant  <ccoutant@google.com>
15589
15590         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15591         thought unnecessary.
15592         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15593
15594 2008-04-11  Ian Lance Taylor  <iant@google.com>
15595
15596         * output.h (class Output_section_data): Remove inline definition
15597         of set_addralign.
15598         * output.cc (Output_section_data::set_addralign): New function.
15599
15600 2008-04-11  Cary Coutant  <ccoutant@google.com>
15601
15602         Add support for TLS descriptors for i386 and x86_64.
15603         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15604         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15605         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15606         GOT_TYPE_TLS_DESC.
15607         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15608         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15609         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15610         relocations.
15611         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15612         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15613         Fix problem with initial-exec relocations.
15614         (Target_i386::Relocate::relocate_tls): Likewise.
15615         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15616         relaxation.
15617         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15618         support for section-plus-offset dynamic table entries.
15619         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15620         (Output_data_dynamic::Dynamic_entry): Add support for
15621         section-plus-offset dynamic table entries.
15622         (Output_data_dynamic::Classification): Likewise.
15623         (Output_data_dynamic::classification_): Renamed offset_.
15624         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15625         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15626         (Target_x86_64::make_plt_section): New function.
15627         (Target_x86_64::reserve_tlsdesc_entries): New function.
15628         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15629         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15630         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15631         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15632         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15633         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15634         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15635         add extra PLT entry for TLS descriptors.
15636         (Output_data_plt_x86_64::got_): New field.
15637         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15638         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15639         fields.
15640         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15641         descriptors.
15642         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15643         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15644         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15645         R_386_TLS_DESC_CALL relocations.
15646         (Target_x86_64::Scan::global): Likewise.
15647         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15648         for TLS descriptors.
15649         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15650         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15651         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15652         GD-to-IE relaxation.
15653         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15654         and TLS_DESCRIPTORS.
15655         * Makefile.in: Rebuild.
15656         * configure: Rebuild.
15657         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15658         (tls_test_shared2.so): New target.
15659         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15660         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15661         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15662         (tls_shared_gd_to_ie_test_LDADD): New variable.
15663         (tls_shared_gnu2_gd_to_ie_test): New target.
15664         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15665         New targets.
15666         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15667         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15668         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15669         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15670         (tls_shared_gnu2_test): New target.
15671         (tls_test_gnu2_shared.so): New target.
15672         (tls_shared_gnu2_test_SOURCES): New variable.
15673         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15674         (tls_shared_gnu2_test_LDFLAGS): New variable.
15675         (tls_shared_gnu2_test_LDADD): New variable.
15676         * testsuite/Makefile.in: Rebuild.
15677         * testsuite/Makefile.
15678
15679 2008-04-11  Ian Lance Taylor  <iant@google.com>
15680
15681         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15682         justsyms.t.
15683         * testsuite/Makefile.in: Rebuild.
15684
15685         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15686         long.
15687         * testsuite/script_test_2.cc (main): Adjust test.
15688
15689 2008-04-11  David S. Miller  <davem@davemloft.net>
15690             Ian Lance Taylor  <iant@google.com>
15691
15692         * options.h (General_options): Add entries for '-Y' and
15693         '-relax'.
15694         * options.cc (General_options:finalize): If -Y was used, add those
15695         entries to the library path instead of the default "/lib" and
15696         "/usr/lib".
15697
15698 2008-04-11  David S. Miller  <davem@davemloft.net>
15699
15700         * testsuite/justsyms.t: Start at 0x100.
15701         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15702         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15703         long.
15704         * testsuite/script_test_2.cc: Adjust string and section length
15705         checks.
15706
15707 2008-04-09  Ian Lance Taylor  <iant@google.com>
15708
15709         PR gold/5996
15710         * script-sections.cc (Sections_element::allocate_to_segment): Add
15711         orphan parameter.
15712         (Output_section_definition::allocate_to_segment): Likewise.
15713         (Orphan_output_section::allocate_to_segment): Likewise.
15714         (Script_sections::attach_sections_using_phdrs_clause): Don't
15715         propagate non-PT_LOAD segments to orphan sections.
15716         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15717         readelf rather than objdump.
15718         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15719         .interp section and PT_INTERP segment are the same size.
15720         * testsuite/Makefile.in: Rebuild.
15721
15722         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15723         aliases for symbols defined in the same object.
15724         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15725         (weak_alias_test_SOURCES): New variable.
15726         (weak_alias_test_DEPENDENCIES): New variable.
15727         (weak_alias_test_LDFLAGS): New variable.
15728         (weak_alias_test_LDADD): New variable.
15729         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15730         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15731         (weak_alias_test_3.o): New target.
15732         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15733         * testsuite/weak_alias_test_main.cc: New file.
15734         * testsuite/weak_alias_test_1.cc: New file.
15735         * testsuite/weak_alias_test_2.cc: New file.
15736         * testsuite/weak_alias_test_3.cc: New file.
15737
15738 2008-04-08  Ian Lance Taylor  <iant@google.com>
15739
15740         * options.h (class General_options): Add --noinhibit-exec option.
15741         * main.cc (main): Check --noinhibit-exec.
15742
15743         * options.h (class General_options): Define --wrap as a special
15744         option.  Add wrap_symbols_ field.
15745         (General_options::any_wrap_symbols): New function.
15746         (General_options::is_wrap_symbol): New function.
15747         * options.cc (General_options::parse_wrap): New function.
15748         (General_options::General_options): Initialize wrap_symbols_.
15749         * symtab.cc (Symbol_table::wrap_symbol): New function.
15750         (Symbol_table::add_from_object): Handle --wrap.
15751         * symtab.h (class Symbol_table): Declare wrap_symbol.
15752         * target.h (Target::wrap_char): New function.
15753         (Target::Target_info): Add wrap_char field.
15754         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15755         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15756         * testsuite/testfile.cc (Target_test::test_target_info):
15757         Likewise.
15758
15759         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15760         there is one.
15761
15762         * layout.h (class Layout): Add added_eh_frame_data_ field.
15763         * layout.cc (Layout::Layout): Initialize new field.
15764         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15765         output section until we find a section we merged successfully.
15766         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15767         that the size be non-zero.
15768
15769         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15770         qualifier.
15771
15772 2008-04-08  Craig Silverstein  <csilvers@google.com>
15773
15774         * configure.ac: Export new conditional variable HAVE_ZLIB.
15775         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15776         on HAVE_ZLIB.
15777         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15778         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15779
15780 2008-04-07  Ian Lance Taylor  <iant@google.com>
15781
15782         * version.cc (version_string): Set to "1.5".
15783
15784         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15785         Add issued_non_pic_error_ field.  Declare check_non_pic.
15786         (Target_x86_64::Scan::check_non_pic): New function.
15787         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15788         (Target_x86_64::Scan::global): Likewise.
15789
15790         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15791         addend parameter.  Change caller.  Handle merge sections.
15792         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15793         Address to Addend.  Don't add in the result of
15794         local_section_offset, pass down the addend and use the returned
15795         value.
15796         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15797         Update declarations of local_section_offset and symbol_value.
15798         * testsuite/two_file_test_1.cc (t18): New function.
15799         * testsuite/two_file_test_2.cc (f18): New function.
15800         * testsuite/two_file_test_main.cc (main): Call t18.
15801         * testsuite/two_file_test.h (t18, f18): Declare.
15802
15803         * configure.ac: Don't test for objdump, c++filt, or readelf.
15804         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15805         conditionals.
15806         (TEST_READELF): New variable.
15807         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15808         (check_PROGRAMS): Add two_file_strip_test.
15809         (two_file_strip_test): New target.
15810         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15811         (two_file_same_shared_strip_test_SOURCES): New variable.
15812         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15813         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15814         (two_file_same_shared_strip_test_LDADD): New variable.
15815         (two_file_shared_strip.so): New target.
15816         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15817         (ver_test_5.syms, ver_test_7.syms): Likewise.
15818         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15819         (strip_test_3.stdout): Use TEST_OBJDUMP.
15820         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15821
15822 2008-04-04  Cary Coutant  <ccoutant@google.com>
15823
15824         * symtab.h (Symbol::is_weak_undefined): New function.
15825         (Symbol::is_strong_undefined): New function.
15826         (Symbol::is_absolute): New function.
15827         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15828         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15829         absolute symbols.
15830         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15831         (weak_undef_test): New target.
15832         * testsuite/Makefile.in: Rebuild.
15833         * testsuite/weak_undef_file1.cc: New file.
15834         * testsuite/weak_undef_file2.cc: New file.
15835         * testsuite/weak_undef_test.cc: New file.
15836
15837 2008-04-03  Craig Silverstein  <csilvers@google.com>
15838
15839         * compressed_output.h (class Output_compressed_section): Use
15840         unsigned buffer.
15841         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15842         add zlib header.
15843         (zlib_compressed_suffix): Removed.
15844         (Output_compressed_section::set_final_data_size): Use unsigned
15845         buffers.
15846         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15847         Fix linker invocation.
15848         (flagstest_o_specialfile_and_compress_debug_sections):
15849         Likewise.
15850         * testsuite/Makefile.in: Regenerated.
15851
15852 2008-04-02  David S. Miller  <davem@davemloft.net>
15853
15854         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15855         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15856
15857 2008-04-02  Craig Silverstein  <csilvers@google.com>
15858
15859         * TODO: New file.
15860
15861 2008-04-02  Ian Lance Taylor  <iant@google.com>
15862
15863         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15864         parameters.  Update for new key type to views_.  Change all
15865         callers.
15866         (File_read::read): Adjust for byteshift in returned view.
15867         (File_read::add_view): New function, broken out of
15868         find_and_make_view.
15869         (File_read::make_view): New function, broken out of
15870         find_and_make_view.
15871         (File_read::find_or_make_view): Add offset and aligned
15872         parameters.  Rewrite accordingly.  Change all callers.
15873         (File_read::get_view): Add offset and aligned parameters.  Adjust
15874         for byteshift in return value.
15875         (File_read::get_lasting_view): Likewise.
15876         * fileread.h (class File_read): Update declarations.
15877         (class File_read::View): Add byteshift_ field.  Add byteshift to
15878         constructor.  Add byteshift method.
15879         * archive.h (Archive::clear_uncached_views): New function.
15880         (Archive::get_view): Add aligned parameter.  Change all callers.
15881         * object.h (Object::get_view): Add aligned parameter.  Change all
15882         callers.
15883         (Object::get_lasting_view): Likewise.
15884
15885         * fileread.cc (File_read::release): Don't call clear_views if
15886         there are multiple objects.
15887         * fileread.h (File_read::clear_uncached_views): New function.
15888         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15889         on the archive.
15890
15891 2008-03-31  Cary Coutant  <ccoutant@google.com>
15892
15893         Add thin archive support.
15894         * archive.cc (Archive::armagt): New const.
15895         (Archive::setup): Remove task parameter and calls to unlock.
15896         (Archive::unlock_nested_archives): New function.
15897         (Archive::read_header): Add nested_off parameter. Change
15898         all callers.
15899         (Archive::interpret_header): Likewise.
15900         (Archive::include_all_members): Change to handle thin
15901         archives.
15902         (Archive::include_member): Likewise.
15903         * archive.h (Archive::Archive): Add new parameters and
15904         initializers.
15905         (Archive::armagt): New const.
15906         (Archive::setup): Remove task parameter.
15907         (Archive::unlock_nested_archives): New function.
15908         (Archive::read_header): Add nested_off parameter.
15909         (Archive::interpret_header): Likewise.
15910         (Archive::Nested_archive_table): New typedef.
15911         (Archive::is_thin_archive_): New field.
15912         (Archive::nested_archives_): New field.
15913         (Archive::options_): New field.
15914         (Archive::dirpath_): New field.
15915         (Archive::task_): New field.
15916         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15917         for thin archives.  Pass additional parameters to
15918         Archive::Archive.  Unlock the archive file after calling
15919         Archive::setup.
15920
15921 2008-03-29  Ian Lance Taylor  <iant@google.com>
15922
15923         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15924         version symbol to be local.
15925         * testsuite/ver_test_4.sh: New file.
15926         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15927         (check_DATA): Add ver_test_4.syms.
15928         (ver_test_4.syms): New target.
15929         * testsuite/Makefile.in: Rebuild.
15930
15931         * output.cc
15932         (Output_section::Input_section_sort_entry::has_priority): New
15933         function.
15934         (Output_section::Input_section_sort_entry::match_file_name): New
15935         function.
15936         (Output_section::Input_section_sort_entry::match_section_name):
15937         Remove.
15938         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15939         Remove.
15940         (Output_section::Input_section_sort_entry::match_section_file):
15941         Remove.
15942         (Output_section::Input_section_sort_compare::operator()): Rewrite
15943         using new Input_section_sort_entry functions.  Sort crtbegin and
15944         crtend first.  Sort sections with no priority before sections with
15945         a priority.
15946         * testsuite/initpri1.c (d3): Check j != 4.
15947         (cd5): New constructor/destructor function.
15948         (main): Check j != 2.
15949
15950         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15951         new symbol when resolving, don't call set_is_default.
15952         * testsuite/ver_test_7.cc: New file.
15953         * testsuite/ver_test_7.sh: New file.
15954         * testsuite/Makefile.am (ver_test_7.so): New target.
15955         (ver_test_7.o): New target.
15956         (check_SCRIPTS): Add ver_test_7.sh.
15957         (check_DATA): Add ver_test_7.syms.
15958         (ver_test_7.syms): New target.
15959
15960 2008-03-28  Ian Lance Taylor  <iant@google.com>
15961
15962         * layout.cc (Layout::layout): If we see an input section with a
15963         name that needs sorting, set the must_sort flag for the output
15964         section.
15965         (Layout::make_output_section): If the name of the output section
15966         indicates that it might require sorting, set the may_sort flag.
15967         * output.h (Output_section::may_sort_attached_input_sections): New
15968         function.
15969         (Output_section::set_may_sort_attached_input_sections): New
15970         function.
15971         (Output_section::must_sort_attached_input_sections): New
15972         function.
15973         (Output_section::set_must_sort_attached_input_sections): New
15974         function.
15975         (class Output_section): Declare Input_section_sort_entry.  Define
15976         Input_section_sort_compare.  Declare
15977         sort_attached_input_sections.  Add new fields:
15978         may_sort_attached_input_sections_,
15979         must_sort_attached_input_sections_,
15980         attached_input_sections_are_sorted_.
15981         * output.cc (Output_section::Output_section): Initialize new
15982         fields.
15983         (Output_section::add_input_section): Add an entry to
15984         input_sections_ if may_sort or must_sort are true.
15985         (Output_section::set_final_data_size): Call
15986         sort_attached_input_sections if necessary.
15987         (Output_section::Input_section_sort_entry): Define new class.
15988         (Output_section::Input_section_sort_compare::operator()): New
15989         function.
15990         (Output_section::sort_attached_input_sections): New function.
15991         * configure.ac: Check whether the compiler supports constructor
15992         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15993         * testsuite/initpri1.c: New file.
15994         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15995         CONSTRUCTOR_PRIORITY.
15996         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15997         (initpri1_LDFLAGS): New variable.
15998         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15999
16000 2008-03-27  Ian Lance Taylor  <iant@google.com>
16001
16002         * common.cc (Sort_commons::operator): Correct sorting algorithm.
16003         * testsuite/common_test_1.c: New file.
16004         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
16005         (common_test_1_SOURCES): New variable.
16006         (common_test_1_DEPENDENCIES): New variable.
16007         (common_test_1_LDFLAGS): New variable.
16008
16009         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
16010         and commons_ correctly when NAME/VERSION does not override
16011         NAME/NULL.
16012         * testsuite/ver_test_6.c: New file.
16013         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
16014         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
16015         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
16016
16017 2008-03-26  Ian Lance Taylor  <iant@google.com>
16018
16019         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
16020         of an undefined symbol from a version script.
16021         * testsuite/Makefile.am (ver_test_5.so): New target.
16022         (ver_test_5.o): New target.
16023         (check_SCRIPTS): Add ver_test_5.sh.
16024         (check_DATA): Add ver_test_5.syms.
16025         (ver_test_5.syms): New target.
16026         * testsuite/ver_test_5.cc: New file.
16027         * testsuite/ver_test_5.script: New file.
16028         * testsuite/ver_test_5.sh: New file.
16029         * Makefile.in, testsuite/Makefile.in: Rebuild.
16030
16031         PR gold/5986
16032         Fix problems building gold with gcc 4.3.0.
16033         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16034         (gold_error_at_location, gold_warning_at_location): Use it.
16035         * configure.ac: Check whether we can compile and use a template
16036         function with a printf attribute.
16037         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16038         when jumping over bytes.
16039         * object.cc: Instantiate Object::read_section_data.
16040         * debug.h: Include <cstring>
16041         * dwarf_reader.cc: Include <algorithm>
16042         * main.cc: Include <cstring>.
16043         * options.cc: Include <cstring>.
16044         * output.cc: Include <cstring>.
16045         * script.cc: Include <cstring>.
16046         * script.h: Include <string>.
16047         * symtab.cc: Include <cstring> and <algorithm>.
16048         * target-select.cc: Include <cstring>.
16049         * version.cc: Include <string>.
16050         * testsuite/testmain.cc: Include <cstdlib>.
16051         * configure, config.in: Rebuild.
16052
16053 2008-03-25  Ian Lance Taylor  <iant@google.com>
16054
16055         * options.cc: Include "../bfd/bfdver.h".
16056         (options::help): Print bug reporting address.
16057
16058         * version.cc (print_version): Adjust output for current value of
16059         BFD_VERSION_STRING.
16060
16061         * NEWS: New file.
16062
16063         * options.cc (options::help): Print list of supported targets.
16064         * target-select.h: Include <vector>.
16065         (class Target_selector): Make machine_, size_, and is_big_endian_
16066         fields const.  Add bfd_name_ and instantiated_target_ fields.
16067         (Target_selector::Target_selector): Add bfd_name parameter.
16068         (Target_selector::recognize): Make non-virtual, call
16069         do_recognize.
16070         (Target_selector::recognize_by_name): Make non-virtual, call
16071         do_recognize_by_name.
16072         (Target_selector::supported_names): New function.
16073         (Target_selector::bfd_name): New function.
16074         (Target_selector::do_instantiate_target): New pure virtual
16075         function.
16076         (Target_selector::do_recognize): New virtual function.
16077         (Target_selector::do_recognize_by_name): New virtual function.
16078         (Target_selector::instantiate_target): New private function.
16079         (supported_target_names): Declare.
16080         * target-select.cc (Target_selector::Target_selector): Update for
16081         new parameter and fields.
16082         (select_target_by_name): Check that the name matches before
16083         calling recognize_by_name.
16084         (supported_target_names): New function.
16085         * i386.cc (class Target_selector_i386): Update Target_selector
16086         constructor call.  Remove recognize and recognize_by_name.  Add
16087         do_instantiate_target.
16088         * x86_64.cc (class Target_selector_x86_64): Likewise.
16089         * testsuite/testfile.cc (class Target_selector_test): Update for
16090         changes to Target_selector.
16091
16092         * README: Rewrite, with some notes on unsupported features.
16093
16094 2008-03-24  Cary Coutant  <ccoutant@google.com>
16095
16096         * i386.cc (Target_i386::Got_type): New enum declaration.
16097         (Target_i386::Scan::local): Updated callers of Output_data_got
16098         member functions.
16099         (Target_i386::Scan::global): Likewise.
16100         (Target_i386::Relocate::relocate): Likewise.
16101         (Target_i386::Relocate::relocate_tls): Likewise.
16102         * object.h (Got_offset_list): New class.
16103         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16104         (Sized_relobj::local_got_offset): Likewise.
16105         (Sized_relobj::set_local_got_offset): Likewise.
16106         (Sized_relobj::local_has_tls_got_offset): Removed.
16107         (Sized_relobj::local_tls_got_offset): Removed.
16108         (Sized_relobj::set_local_tls_got_offset): Removed.
16109         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16110         * output.cc (Output_data_got::add_global): Added got_type parameter.
16111         (Output_data_got::add_global_with_rel): Likewise.
16112         (Output_data_got::add_global_with_rela): Likewise.
16113         (Output_data_got::add_global_pair_with_rel): New function.
16114         (Output_data_got::add_global_pair_with_rela): New function.
16115         (Output_data_got::add_local): Added got_type parameter.
16116         (Output_data_got::add_local_with_rel): Likewise.
16117         (Output_data_got::add_local_with_rela): Likewise.
16118         (Output_data_got::add_local_pair_with_rel): New function.
16119         (Output_data_got::add_local_pair_with_rela): New function.
16120         (Output_data_got::add_global_tls): Removed.
16121         (Output_data_got::add_global_tls_with_rel): Removed.
16122         (Output_data_got::add_global_tls_with_rela): Removed.
16123         (Output_data_got::add_local_tls): Removed.
16124         (Output_data_got::add_local_tls_with_rel): Removed.
16125         (Output_data_got::add_local_tls_with_rela): Removed.
16126         * output.h (Output_data_got::add_global): Added got_type parameter.
16127         (Output_data_got::add_global_with_rel): Likewise.
16128         (Output_data_got::add_global_with_rela): Likewise.
16129         (Output_data_got::add_global_pair_with_rel): New function.
16130         (Output_data_got::add_global_pair_with_rela): New function.
16131         (Output_data_got::add_local): Added got_type parameter.
16132         (Output_data_got::add_local_with_rel): Likewise.
16133         (Output_data_got::add_local_with_rela): Likewise.
16134         (Output_data_got::add_local_pair_with_rel): New function.
16135         (Output_data_got::add_local_pair_with_rela): New function.
16136         (Output_data_got::add_global_tls): Removed.
16137         (Output_data_got::add_global_tls_with_rel): Removed.
16138         (Output_data_got::add_global_tls_with_rela): Removed.
16139         (Output_data_got::add_local_tls): Removed.
16140         (Output_data_got::add_local_tls_with_rel): Removed.
16141         (Output_data_got::add_local_tls_with_rela): Removed.
16142         * resolve.cc (Symbol::override_base_with_special): Removed
16143         reference to has_got_offset_ field.
16144         * symtab.cc (Symbol::init_fields): Replaced initialization
16145         of got_offset_ with got_offsets_.  Removed initialization
16146         of has_got_offset_
16147         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16148         (Symbol::got_offset): Likewise.
16149         (Symbol::set_got_offset): Likewise.
16150         (Symbol::has_tls_got_offset): Removed.
16151         (Symbol::tls_got_offset): Removed.
16152         (Symbol::set_tls_got_offset): Removed.
16153         (Symbol::got_offset_): Removed.
16154         (Symbol::tls_mod_got_offset_): Removed.
16155         (Symbol::tls_pair_got_offset_): Removed.
16156         (Symbol::got_offsets_): New field.
16157         (Symbol::has_got_offset): Removed.
16158         (Symbol::has_tls_mod_got_offset): Removed.
16159         (Symbol::has_tls_pair_got_offset): Removed.
16160         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16161         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16162         member functions.
16163         (Target_x86_64::Scan::global): Likewise.
16164         (Target_x86_64::Relocate::relocate): Likewise.
16165         (Target_x86_64::Relocate::relocate_tls): Likewise.
16166
16167 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16168
16169         * yyscript.y: Fix spelling error in comment.
16170
16171 2008-03-24  Ian Lance Taylor  <iant@google.com>
16172
16173         * options.h (class General_options): Define build_id option.
16174         * layout.h (class Layout): Declare write_build_id, create_note,
16175         create_build_id.  Add build_id_note_ member.
16176         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16177         "libiberty.h", "md5.h", "sha1.h".
16178         (Layout::Layout): Initialize eh_frame_data_,
16179         eh_frame_hdr_section_, and build_id_note_.
16180         (Layout::finalize): Call create_build_id.
16181         (Layout::create_note): New function, broken out of
16182         Layout::create_gold_note.
16183         (Layout::create_gold_note): Call create_note.
16184         (Layout::create_build_id): New function.
16185         (Layout::write_build_id): New function.
16186         (Close_task_runner::run): Call write_build_id.
16187
16188         * x86_64.cc: Correct license to GPLv3.
16189
16190 2008-03-23  Ian Lance Taylor  <iant@google.com>
16191
16192         * options.cc: Include "demangle.h".
16193         (parse_optional_string): New function.
16194         (parse_long_option): Handle takes_optional_argument.
16195         (parse_short_option): Update dash_z initializer.  Handle
16196         takes_optional_argument.
16197         (General_options::General_options): Initialize do_demangle_.
16198         (General_options::finalize): Set do_demangle_.  Handle demangling
16199         style.
16200         * options.h (parse_optional_string): Declare.
16201         (struct One_option): Add optional_arg field.  Update constructor.
16202         Update call constructor calls.  Add takes_optional_argument
16203         function.
16204         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16205         (DEFINE_optional_string): Define.
16206         (General_options::demangle): Change from DEFINE_bool to
16207         DEFINE_optional_string.
16208         (General_options::no_demangle): New function.
16209         (General_options::do_demangle): New function.
16210         (General_options::set_do_demangle): New function.
16211         (General_options::execstack_status_): Move definition to end of
16212         class definition.
16213         (General_options::static_): Likewise.
16214         (General_options::do_demangle_): New field.
16215         * object.cc (big_endian>::get_symbol_location_info): Call
16216         Options::do_demangle, not Options::demangle.
16217         * symtab.cc (demangle): Likewise.
16218
16219 2008-03-22  Ian Lance Taylor  <iant@google.com>
16220
16221         * gold.h: Include <cstddef> and <sys/types.h>
16222         * options.h: Include <cstring>.
16223
16224 2008-03-21  Ian Lance Taylor  <iant@google.com>
16225
16226         * Added source code to GNU binutils.
16227 \f
16228 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16229
16230 Copying and distribution of this file, with or without modification,
16231 are permitted in any medium without royalty provided the copyright
16232 notice and this notice are preserved.
16233
16234 Local Variables:
16235 mode: change-log
16236 left-margin: 8
16237 fill-column: 74
16238 version-control: never
16239 End: