Fix corrupted .eh_frame section with LTO and --gc-sections.
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-11-25  Cary Coutant  <ccoutant@google.com>
2
3         PR gold/17639
4         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
5         (Sized_relobj_file::do_layout): Handle deferred sections properly
6         during GC pass 1. Don't add reloc sections to deferred list twice.
7         * object.h (Sized_relobj_file::is_deferred_layout): New function.
8         (Sized_relobj_file::is_deferred_layout_): New data member.
9
10 2014-11-21  Alan Modra  <amodra@gmail.com>
11
12         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
13         for undefined weaks.
14
15 2014-11-20  Alan Modra  <amodra@gmail.com>
16
17         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
18         from --stub-group-size parameter divided by 1024.
19         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
20         template parameter.  Update all uses.
21         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
22         has_stub_value.  Set for long branches.  Don't report overflow for
23         branch to undefined weak symbols.  Print info message on
24         overflowing branch to stub.
25
26 2014-11-20  Alan Modra  <amodra@gmail.com>
27
28         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
29
30 2014-10-28  Alan Modra  <amodra@gmail.com>
31
32         Apply trunk patches
33         2014-10-22  Alan Modra  <amodra@gmail.com>
34         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
35         thread_starter.
36
37 2014-09-30  Cary Coutant  <ccoutant@google.com>
38
39         PR gold/17432
40         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
41
42 2014-09-30  Kito Cheng  <kito@0xlab.org>
43
44         PR gold/13597
45         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
46         hash table before sysv-style hash table.
47
48 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
49
50         * options.h (--pic-executable): Add negative to alias to -no-pie.
51
52 2014-09-26  Cary Coutant  <ccoutant@google.com>
53
54         PR gold/16773
55         * object.cc (Sized_relobj_file): Compute value of section symbols
56         for TLS sections the same as TLS symbols.
57
58 2014-09-25  Cary Coutant  <ccoutant@google.com>
59
60         PR gold/17432
61         * resolve.cc (Symbol_table::resolve): Override common placeholder
62         symbols, but adjust sizes.
63         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
64         symbols to common lists.
65
66 2014-09-24  Alan Modra  <amodra@gmail.com>
67
68         * po/POTFILES.in: Regenerate.
69
70 2014-09-23  Taiju Tsuiki  <tzik@google.com>
71             Cary Coutant  <ccoutant@google.com>
72
73         PR gold/14860
74         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
75         on input_sections_blocker.
76         * layout.cc (Write_sections_task::locks): Unblock
77         input_sections_blocker_.
78         * layout.h (Write_sections_task::Write_sections_task): Add
79         input_sections_blocker.
80         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
81         to DEPENDENCIES.
82         * testsuite/Makefile.in: Regenerate.
83
84 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
85
86         * testsuite/Makefile.am (plugin_test_10): New test.
87         * testsuite/Makefile.in: Regenerate
88         * testsuite/plugin_common_test_2.c (c1): Align to 8.
89         * testsuite/plugin_test_10.sh: New file.
90
91 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
92
93         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
94         * resolve.cc (Symbol_table::resolve): Don't override common symbols
95         during the replacement phase.
96
97 2014-09-17  Han Shen  <shenhan@google.com>
98             Jing Yu  <jingyu@google.com>
99
100         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
101         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
102         * aarch64.cc (Target_aarch64): Add data members
103         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
104         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
105         constructor.
106         (Target_aarch64::do_reloc_symbol_index): New method.
107         (Target_aarch64::do_reloc_addend): New method.
108         (Target_aarch64::add_tlsdesc_info): New method.
109         (Target_aarch64::do_dynsym_value): New method.
110         (Target_aarch64::do_make_data_plt): Add new parameters: got,
111         got_irelative. Pass them to Output_data_plt_aarch64_standard.
112         (Target_aarch64::make_data_plt): Add new parameters: got,
113         got_irelative. Pass them to do_make_data_plt.
114         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
115         (Target_aarch64::Relocate:tls_gd_to_le): New method.
116         (Target_aarch64::Relocate:tls_ie_to_le): New method.
117         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
118         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
119         (Target_aarch64::got_tlsdesc_section): New method.
120         (Target_aarch64::make_local_ifunc_plt_entry): New method.
121         (Target_aarch64::define_tls_base_symbol): New method.
122         (Target_aarch64::reserve_tlsdesc_entries): New method.
123         (Target_aarch64::got_mod_index_entry): New method.
124         (Target_aarch64::rela_tlsdesc_section): New method.
125         (Target_aarch64::rela_irelative_section): New method.
126         (Target_aarch64::Tlsdesc_info): New struct.
127         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
128         relocations and tlsdesc relocations.
129         (Target_aarch64::optimize_tls_reloc): Implement method.
130         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
131         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
132         in constructor.
133         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
134         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
135         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
136         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
137         (Output_data_plt_aarch64::rela_tlsdesc): New method.
138         (Output_data_plt_aarch64::rela_irelative): New method.
139         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
140         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
141         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
142         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
143         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
144         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
145         (Output_data_plt_aarch64_standard): New member variables:
146         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
147         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
148         New parameter: got, got_irelative.
149         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
150         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
151         (Output_data_plt_aarch64::do_write): Replace got_address with
152         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
153         (AArch64_relocate_functions::update_movnz): New method.
154         (AArch64_relocate_functions): Correct format.
155         (AArch64_relocate_functions::movnz): New method.
156         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
157         before the switch. Add new cases to switch.
158         Check ie_to_le relaxation on tlsie relocations. Add code handling
159         tlsgd tlsdesc cases.
160         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
161         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
162         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
163         Call reloc_name_in_error_message to print unsupported reloc.
164         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
165         make_data_plt.
166         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
167         relocs. Fill in some more dynamic tags.
168         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
169         Skip call tls_get_addr when tlsgd is relaxed.
170         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
171         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
172         tlsdesc->ie relaxation.
173
174 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
175
176         * mips.cc (Target_mips_nacl): New class.
177         (Target_selector_mips_nacl): New class.
178         (target_selector_mips32): Rename from target_selector_mips32be and use
179         Target_selector_mips_nacl instead of Target_selector_mips.
180         (target_selector_mips32el): Rename from target_selector_mips32 and use
181         Target_selector_mips_nacl instead of Target_selector_mips.
182         (target_selector_mips64): Rename from target_selector_mips64be and use
183         Target_selector_mips_nacl instead of Target_selector_mips.
184         (target_selector_mips64el): Rename from target_selector_mips64 and use
185         Target_selector_mips_nacl instead of Target_selector_mips.
186         (Target_mips::mips_info): Add const attribute.
187
188 2014-09-02  Cary Coutant  <ccoutant@google.com>
189
190         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
191         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
192         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
193         (Sized_incr_dynobj::do_section_name): Likewise.
194         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
195         (Sized_incr_dynobj::do_section_name): Likewise.
196         * object.h (Object::section_name): Likewise.
197         (Object::do_section_name): Likewise.
198         (Sized_relobj_file::do_section_name): Likewise.
199         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
200         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
201
202 2014-09-02  Cary Coutant  <ccoutant@google.com>
203
204         PR gold/17005
205         * ehframe.cc (Fde::write): Add output_offset parameter.
206         (Cie::write): Likewise.
207         (Eh_frame::set_final_data_size): Account for offset within output
208         section.
209         (Eh_frame::do_sized_write): Likewise.
210         * ehframe.h (Fde::write): Add output_offset parameter.
211         (Cie::write): Likewise.
212         * output.cc (Output_section::Input_section_sort_entry): Remove
213         section_has_name_; add output_section_name parameter. Use
214         output section name for non-input sections.
215         (Output_section::Input_section_sort_entry::section_has_name): Remove.
216         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
217         (Output_section::Input_section_sort_compare): Remove logic for
218         sections without names.
219         (Output_section::Input_section_sort_init_fini_compare): Likewise.
220         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
221         Likewise.
222         (Output_section::Input_section_sort_section_name_compare): Likewise.
223
224 2014-08-29 Han Shen <shenhan@google.com>
225            Jing Yu <jingyu@google.com>
226
227         * aarch64-reloc-property.cc
228         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
229         reference reloc property in the table.
230         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
231         3 other entries.
232         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
233         2 new overloaded methods.
234         (Output_data_got_aarch64::do_write): Add code to write out
235         static relocs.
236         (class Output_data_got_aarch64::Static_reloc): New class to wrap
237         static relocs.
238         (Output_data_got_aarch64::static_relocs): New vector to
239         hold static relocs.
240         (Target_aarch64::TCB_SIZE): New const static memeber.
241         (Target_aarch64::tcb_size): New method.
242         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
243         (Target_aarch64::Relocate::relocate_tls): New method.
244         (Target_aarch64::Scan::local): Add code handling new reloc types.
245         (Target_aarch64::Scan::global): Add code handling new reloc types.
246
247 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
248
249         * options.h (-no-pie): Add option.
250
251 2014-08-08  Jing Yu  <jingyu@google.com>
252             Han Shen  <shenhan@google.com>
253
254         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
255         (DEFFILES): add aarch64-reloc.def.
256         (TARGETSOURCES): Add aarch64-reloc-property.cc.
257         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
258         * Makefile.in: Regenerate.
259         * aarch64-reloc-property.cc: New file.
260         * aarch64-reloc-property.h: New file.
261         * aarch64-reloc.def: New file.
262         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
263         with tab to make the format consistent.
264         (Output_data_got_aarch64::symbol_table_): New method.
265         (Target_aarch64::do_plt_address_for_global): New method.
266         (Target_aarch64::do_plt_address_for_local): New method.
267         (Target_aarch64::do_select_as_default_target): New method.
268         (Target_aarch64::do_make_data_plt): New method.
269         (Target_aarch64::make_data_plt): New method.
270         (Output_data_plt_aarch64::has_irelative_section): New method.
271         (Output_data_plt_aarch64::address_for_global): New method.
272         (Output_data_plt_aarch64::address_for_local): New method.
273         (Output_data_plt_aarch64::irelative_rel_): New parameter.
274         (Output_data_plt_aarch64::add_entry): Implement contents.
275         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
276         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
277         the got_pov entry to plt0.
278         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
279         Implement contents.
280         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
281         (AArch64_howto): New struct.
282         (aarch64_howto[]): New static const array.
283         (AArch64_relocate_functions): New class.
284         (Target_aarch64::Scan::get_reference_flags): Remove method.
285         (Target_aarch64::Scan::local): Implement to support a few relocations.
286         (Target_aarch64::Scan::global): Implement to support a few relocations.
287         (Target_aarch64::make_plt_section): Implement contents.
288         (Target_aarch64::make_plt_entry): Implement contents.
289         (Target_aarch64::do_finalize_sections): Implement contents.
290         (Target_aarch64::Relocate::relocate): Implement a few relocations.
291         (Target_aarch64::relocate_section): Implement contents.
292
293 2014-08-06  Alan Modra  <amodra@gmail.com>
294
295         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
296
297 2014-08-06  Alan Modra  <amodra@gmail.com>
298
299         PR 13227
300         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
301
302 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
303
304         * object.cc (Relobj::is_section_name_included): Add
305         ".rodata.nptl_version" to not garbage collect this section.
306
307 2014-07-08  Cary Coutant  <ccoutant@google.com>
308
309         * expression.cc (struct Expression::Expression_eval_info): Add
310         new fields type_pointer, vis_pointer, and nonvis_pointer.
311         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
312         nonvis_pointer parameters. Adjust all calls.
313         (Symbol_expression::value): Update type, visibility, and nonvis bits
314         in caller.
315         * script.cc (Symbol_assignment::sized_finalize): Update type,
316         visibility, and remaining st_other bits for new symbol.
317         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
318         vis_pointer, and nonvis_pointer parameters.
319         * symtab.h (Symbol::set_type): New method.
320
321         * testsuite/Makefile.am (defsym_test): New test.
322         * testsuite/Makefile.in: Regenerate.
323         * testsuite/defsym_test.c: New file.
324         * testsuite/defsym_test.sh: New file.
325
326 2014-07-08  Cary Coutant  <ccoutant@google.com>
327
328         PR gold/15639
329         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
330         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
331         (Sized_dynobj::base_read_symbols): ...new method.
332         * object.h (Sized_relobj_file::base_read_symbols): New method.
333         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
334         (Sized_relobj_file::base_read_symbols): ...new method.
335         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
336         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
337         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
338
339 2014-07-04  Alan Modra  <amodra@gmail.com>
340
341         * po/POTFILES.in: Regenerate.
342
343 2014-07-02  Jing Yu  <jingyu@google.com>
344
345         * aarch64.cc: New file
346         * Makefile.am (TARGETSOURCES): Add aarch64.cc
347         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
348         * Makefile.in: Regenerate.
349         * configure.tgt: Add entries for aarch64*.
350         * configure.ac:  Likewise.
351         * configure: Likewise.
352
353 2014-06-27  Alan Modra  <amodra@gmail.com>
354
355         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
356
357 2014-06-24  Cary Coutant  <ccoutant@google.com>
358
359         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
360         sections.
361         (Dwo_file::sized_read_unit_index): Likewise.
362
363 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
364
365         * mips.cc: New file.
366         * Makefile.am (TARGETSOURCES): Add mips.cc
367         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
368         * configure.tgt: Add entries for mips*.
369         * configure.ac: Likewise.
370         * Makefile.in: Regenerate.
371         * configure: Likewise.
372
373 2014-06-09  Cary Coutant  <ccoutant@google.com>
374
375         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
376         unit_length is within section bounds.
377
378 2014-06-09  Cary Coutant  <ccoutant@google.com>
379
380         PR gold/16980
381         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
382         map.
383
384 2014-06-07  Alan Modra  <amodra@gmail.com>
385
386         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
387
388 2014-06-06  Cary Coutant  <ccoutant@google.com>
389
390         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
391         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
392         (Dwarf_pubnames_table::read_header): Likewise.
393         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
394         .debug_gnu_pubtypes.
395
396 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
397
398         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
399         * Makefile.in, configure: Regenerate.
400
401 2014-06-03  Alan Modra  <amodra@gmail.com>
402
403         * powerpc.cc (addis_12_2): Define.
404         (Stub_table::do_write): Support fusion on ELFv2 stubs.
405
406 2014-06-03  Alan Modra  <amodra@gmail.com>
407
408         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
409         st_other output.
410
411 2014-06-02  Alan Modra  <amodra@gmail.com>
412
413         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
414         Only ignore relocs on ELFv1.
415         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
416
417 2014-05-30  Cary Coutant  <ccoutant@google.com>
418
419         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
420         * testsuite/Makefile.in: Regenerate.
421         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
422
423 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
424
425         PR gold/16945
426         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
427         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
428
429 2014-05-15  Alan Modra  <amodra@gmail.com>
430
431         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
432         Compare FDE contents with DW_CFA_nop rather than 0.
433
434 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
435
436         * symtab.h (may_need_copy_reloc): Remove check for position independent
437         code.
438         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
439         position independence before pc absolute may_need_copy_reloc call.
440         Add check for executable output befor pc relative may_need_copy_reloc
441         call.
442         * i386.cc: Ditto.
443         * arm.cc: Ditto.
444         * sparc.cc: Ditto.
445         * tilegx.cc: Ditto.
446         * powerpc.cc: Add check for no position independence before
447         may_need_copy_reloc calls.
448         * testsuite/pie_copyrelocs_test.cc: New file.
449         * testsuite/pie_copyrelocs_shared_test.cc: New file.
450         * Makefile.am (pie_copyrelocs_test): New test.
451         * Makefile.in: Regenerate.
452
453 2014-05-08  Martin Liška  <mliska@suse.cz>
454
455         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
456
457 2014-05-06  Cary Coutant  <ccoutant@google.com>
458
459         PR gold/16900
460         * i386.cc (Output_data_got_plt_i386): New class.
461         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
462         parameter. Change all callers.
463         (Output_data_plt_i386::layout_): Remove.
464         (Output_data_plt_i386::got_plt_): Change type.
465         (Target_i386::got_plt_): Change type. Change all references.
466         (Target_i386::got_section): Create instance of new class.
467         (Output_data_got_plt_i386::do_write): New function.
468         * x86_64.cc (Output_data_got_plt_x86_64): New class.
469         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
470         parameter. Change all callers.
471         (Output_data_plt_x86_64::layout_): Remove.
472         (Output_data_plt_x86_64::got_plt_): Change type.
473         (Target_x86_64::got_plt_): Change type. Change all references.
474         (Target_x86_64::got_section): Create instance of new class.
475         (Output_data_got_plt_x86_64::do_write): New function.
476         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
477         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
478         class.
479
480 2014-05-05  Cary Coutant  <ccoutant@google.com>
481
482         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
483         if we have pubnames/pubtypes.
484
485 2014-05-02  Cary Coutant  <ccoutant@google.com>
486
487         * defstd.cc (in_segment): Define __ehdr_start here...
488         * layout.cc (Layout::finalize): ...Instead of here.  Set the
489         output segment when known.
490         * resolve.cc (Symbol::override_base_with_special): Remember
491         the original binding.
492         * symtab.cc (Symbol::set_output_segment): New function.
493         (Symbol::set_undefined): New function.
494         * symtab.h (Symbol::is_weak_undefined): Check original undef
495         binding.
496         (Symbol::is_strong_undefined): New function.
497         (Symbol::set_output_segment): New function.
498         (Symbol::set_undefined): New function.
499         * target-reloc.h (is_strong_undefined): Remove.
500         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
501         Check for hidden undefs.
502         (relocate_section): Call Symbol::is_strong_undefined.
503
504         * testsuite/Makefile.am (ehdr_start_test_1)
505         (ehdr_start_test_2, ehdr_start_test_3)
506         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
507         * testsuite/Makefile.in: Regenerate.
508         * testsuite/ehdr_start_def.cc: New source file.
509         * testsuite/ehdr_start_test.cc: New source file.
510         * testsuite/ehdr_start_test.t: New linker script.
511         * testsuite/ehdr_start_test_4.sh: New shell script.
512
513 2014-04-23  Cary Coutant  <ccoutant@google.com>
514
515         PR gold/16870
516         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
517
518 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
519
520         * layout.cc (Layout::include_section): Allow a target to decide
521         whether to include a section.
522         * target.h (Target::should_include_section): New function.
523         (Target::do_should_include_section): New function.
524
525 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
526
527         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
528         inline into ...
529         (Copy_relocs::emit): ... here.
530         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
531         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
532         (Copy_reloc_entry::entries_): Change from private to protected.
533
534 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
535
536         * icf.cc (get_section_contents): Replace copies of reloc
537         vectors with const references.
538
539 2014-04-02  Cary Coutant  <ccoutant@google.com>
540
541         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
542         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
543         * configure: Regenerate.
544         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
545         -fno-use-linker-plugin.
546         (LINK1, CXXLINK1): Add it to the link command.
547         * testsuite/Makefile.in: Regenerate.
548
549 2014-03-12  Alan Modra  <amodra@gmail.com>
550
551         * Makefile.in: Regenerate.
552
553 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
554
555         * symtab.h (Symbol::set_nonvis): New function.
556
557 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
558
559         * symtab.cc (Sized_symbol<32>::init_output_data):
560         Instantiate the template.
561         (Sized_symbol<64>::init_output_data): Likewise.
562
563 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
564
565         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
566         adjust dynamic symbol value.
567         * target.h (Target::adjust_dyn_symbol): New function.
568         (Target::do_adjust_dyn_symbol): New function.
569
570 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
571
572         * output.cc (Output_data_dynamic::Dynamic_entry::write):
573         Get the value of DYNAMIC_CUSTOM dynamic entry.
574         * output.h (Output_data_dynamic::add_custom): New function.
575         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
576         dynamic entry.
577         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
578         * target.h (Target::dynamic_tag_custom_value): New function.
579         (Target::do_dynamic_tag_custom_value): New function.
580
581 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
582
583         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
584         dynsym indexes.
585         * target.h (Target::has_custom_set_dynsym_indexes): New function.
586         (Target::do_has_custom_set_dynsym_indexes): New function.
587         (Target::set_dynsym_indexes): New function.
588         (Target::do_set_dynsym_indexes): New function.
589
590 2014-03-07  Alan Modra  <amodra@gmail.com>
591
592         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
593         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
594         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
595         (Powerpc_relocate_functions::has_overflow_bitfield,
596         overflowed): Use the above.
597         (Target_powerpc::Relocate::relocate): Correct overflow checking
598         for a number of relocations.  Modify overflow test for 16-bit
599         fields in instructions to signed/unsigned according to whether
600         the field takes a signed or unsigned value.
601
602 2014-03-05  Alan Modra  <amodra@gmail.com>
603
604         Update copyright years.
605
606 2014-03-05  Alan Modra  <amodra@gmail.com>
607
608         * powerpc.cc (Target_powerpc::Scan::local, global): Support
609         R_PPC64_ADDR64_LOCAL.
610         (Target_powerpc::Relocate::relocate): Likewise.
611
612 2014-03-03  Alan Modra  <amodra@gmail.com>
613
614         * dwp.cc (print_version): Update copyright year to current.
615
616 2014-02-10  Alan Modra  <amodra@gmail.com>
617
618         * po/gold.pot: Regenerate.
619
620 2014-02-06  Cary Coutant  <ccoutant@google.com>
621
622         Fix problem where -u is ignored when a weak undef is seen.
623
624         * archive.cc (Library_base::should_include_member): Reorder
625         code to check for -u option if a weak undef has already been seen.
626         * testsuite/Makefile.am (weak_undef_test_2): New test case.
627         * testsuite/Makefile.in: Regenerate.
628         * testsuite/weak_undef_file3.cc: New file.
629         * testsuite/weak_undef_file4.cc: New file.
630         * testsuite/weak_undef_test_2.cc: New file.
631
632 2014-02-05  Cary Coutant  <ccoutant@google.com>
633
634         Fix issues with gold undefined symbol diagnostics.
635
636         PR binutils/15435
637         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
638         check to here.
639         * target-reloc.h (is_strong_undefined): New function.
640         (relocate_section): Move undef vtable symbol check from here.
641         Check for is_strong_undefined.
642
643 2014-02-05  Cary Coutant  <ccoutant@google.com>
644
645         Fix problems with the --dynamic-list option.
646
647         PR gold/13577
648         * options.cc (General_options::parse_dynamic_list):
649         Set have_dynamic_list_.
650         (General_options::General_options): Initialize have_dynamic_list_.
651         (General_options::finalize): Turn off -Bsymbolic and
652         -Bsymbolic-functions if --dynamic-list provided.
653         * options.h (General_options::have_dynamic_list): New function.
654         (General_options::have_dynamic_list_): New data member.
655         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
656         correctly.
657
658         PR gold/16530
659         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
660         in --dynamic-list, mark it.
661
662         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
663         (dynamic_list_2): New test case.
664         * testsuite/Makefile.in: Regenerate.
665         * testsuite/dynamic_list_2.cc: New file.
666         * testsuite/dynamic_list_2.t: New file.
667         * testsuite/dynamic_list_lib1.cc: New file.
668         * testsuite/dynamic_list_lib2.cc: New file.
669         * testsuite/gc_dynamic_list_test.c: New file.
670         * testsuite/gc_dynamic_list_test.sh: New file.
671         * testsuite/gc_dynamic_list_test.t: New file.
672
673 2014-01-28  Cary Coutant  <ccoutant@google.com>
674
675         Add .gdb_index version 7 support.
676
677         * gold/dwarf_reader.cc: include <utility> (for make_pair).
678         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
679         debug sections.
680         (Dwarf_ranges_table::read_ranges_table): Likewise.
681         (Dwarf_pubnames_table::read_section): Check for GNU-style
682         sections, and for compressed debug sections.
683         (Dwarf_pubnames_table::read_header): Compute end address of table.
684         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
685         for end of list by offset, not by offset == 0.
686         (Dwarf_info_reader::do_read_string_table): Check for compressed
687         debug sections.
688         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
689         Initialize new data members.
690         (Dwarf_pubnames_table::next_name): return flag_byte.
691         (Dwarf_pubnames_table::end_of_table_): New data member.
692         (Dwarf_pubnames_table::is_gnu_style_): New data member.
693         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
694         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
695         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
696         read skeleton type unit DIEs.
697         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
698         (Gdb_index::do_write): Write flag_byte.
699         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
700         (Gdb_index::Cu_vector): Store flags along with cu indexes.
701         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
702         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
703
704 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
705
706         * version.cc (print_version): Update copyright year to 2014.
707
708 2013-12-19  Dimitry Andric  <dimitry@andric.com>
709
710         * stringpool.cc (Stringpool_template::reserve): Add
711         HAVE_UNORDERED_MAP case.
712         * stringpool.cc (Stringpool_template::print_stats): Likewise.
713
714 2013-12-18  Cary Coutant  <ccoutant@google.com>
715
716         * configure.ac: Check for <unordered_set> and <unordered_map>.
717         * config.in: Regenerate.
718         * configure: Regenerate.
719         * system.h: Use <unordered_set> and <unordered_map> if available.
720
721 2013-12-10  Roland McGrath  <mcgrathr@google.com>
722
723         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
724         with $(INSTALL_PROGRAM_ENV).
725         * Makefile.in: Regenerate.
726
727 2013-11-22  Cary Coutant  <ccoutant@google.com>
728
729         * configure.ac: Add check for which library is needed for
730         dlopen.
731         * configure: Regenerate.
732
733 2013-11-22  Cary Coutant  <ccoutant@google.com>
734
735         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
736         assembler.
737         * testsuite/Makefile.in: Regenerate.
738
739 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
740
741         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
742         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
743         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
744         (Target_x86_64<size>::Scan::local): Likewise.
745         (Target_x86_64<size>::Scan::global): Likewise.
746         (Target_x86_64<size>::Relocate::relocate): Likewise.
747         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
748         Likewise.
749         (Target_x86_64<size>::Scan::check_non_pic(): Handle
750         R_X86_64_PC32_BND.
751
752         * testsuite/Makefile.am (check_PROGRAMS): Add
753         exception_x86_64_bnd_test.
754         (exception_x86_64_bnd_test_SOURCES): New macro.
755         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
756         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
757         (exception_x86_64_bnd_test_LDADD): Likewise.
758         (exception_x86_64_bnd_1.o): New rule.
759         (exception_x86_64_bnd_2.o): Likewise.
760         * testsuite/Makefile.in: Regenerated.
761
762 2013-11-15  Alan Modra  <amodra@gmail.com>
763
764         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
765         accessor.
766         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
767         Only call ppc64_local_entry_offset for 64-bit.  Restrict
768         symval_for_branch lookup to ELFv1.
769         (Stub_table::add_plt_call_entry): Use unsigned int off.
770         (Output_data_glink::Address, invalid_address): New.
771         (Output_data_glink::add_eh_frame): Move out of line.  Add
772         support for ELFv2.
773         (Output_data_glink::add_global_entry, find_global_entry,
774         global_entry_address): New functions.
775         (Output_data_glink::global_entry_stubs_, end_branch_table_,
776         ge_size): New variables.
777         (Output_data_glink::set_final_data_size): Add global entry
778         stub sizing.
779         (Output_data_glink::do_write): Write global entry stubs.
780         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
781         parameter.  Return true for ELFv2.  Adjust callers.
782         (Target_powerpc::Scan::local, global): Restrict opd lookup to
783         ELFv1.  Similarly for ifunc and dynamic relocation processing
784         specific to ELFv1.  Recognize that symbols are defined on
785         their plt entries for ELFv2.
786         (Target_powerpc::symval_for_branch): Assert if called for
787         ELFv2 or ppc32.
788         (Target_powerpc::Relocate::relocate): Use global entry plt
789         stub for symbol value if such exists on ELFv2.
790         (Target_powerpc::Relocate::relocate): Don't call
791         symval_for_branch when ELFv2.  Do adjust for local entry
792         offset when ELFv2.
793         (Target_powerpc::do_dynsym_value): Set symbols to global entry
794         plt stub for ELFv2.
795         (Target_powerpc::do_plt_address_for_global): Similarly.
796
797 2013-11-14  Cary Coutant  <ccoutant@google.com>
798
799         Revert patch -- this did not fix the problem, and there is
800         no race there.
801
802         2013-11-14  Cary Coutant  <ccoutant@google.com>
803
804             PR gold/14860
805             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
806             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
807             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
808             updating fde_offsets_.
809             (Eh_frame_hdr::lock_): New data member.
810
811 2013-11-14  Cary Coutant  <ccoutant@google.com>
812
813         * dwp.cc (Dwo_file_entry): New type.
814         (File_list): Use Dwo_file_entry.
815         (Dwo_file::verify): New function.
816         (Dwo_file::verify_dwo_list): New function.
817         (Dwo_file::sized_verify_dwo_list): New function.
818         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
819         list.
820         (Dwp_options): New enum type.
821         (dwp_options): Add --verify-only.
822         (usage): Likewise.
823         (main): Likewise.
824         * dwp.h (gold_info): Add declaration.
825
826 2013-11-14  Cary Coutant  <ccoutant@google.com>
827
828         PR gold/14860
829         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
830         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
831         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
832         updating fde_offsets_.
833         (Eh_frame_hdr::lock_): New data member.
834
835 2013-11-06  Cary Coutant  <ccoutant@google.com>
836
837         PR gold/15758
838         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
839         before reloc sections.
840
841 2013-11-04  Alan Modra  <amodra@gmail.com>
842
843         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
844         (Symbol::needs_dynamic_reloc): Test new flag.
845         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
846         (Target_powerpc::Scan::get_reference_flags): Add target param.
847         Return FUNC_DESC_ABI for 64-bit ELFv1.
848         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
849         call.
850         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
851         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
852
853 2013-10-31  Cary Coutant  <ccoutant@google.com>
854
855         Restore support for dwp v2 DWARF package file format.
856
857         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
858         tu_length parameter.  Adjust all callers.
859         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
860         * dwp.cc: Include dwarf.h.
861         (Section_bounds): New struct type.
862         (Unit_set): New struct type.
863         (Dwo_file::Dwo_file): Initialize new data member.
864         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
865         Combine and rename to...
866         (Dwo_file::read_unit_index): ...this.
867         (Dwo_file::sized_read_compunit_index)
868         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
869         (Dwo_file::sized_read_unit_index): ...this.
870         (Dwo_file::copy_section): Remove section_name, is_str_offsets
871         parameters; add section_id parameter.
872         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
873         (Dwo_file::add_unit_set): ...this.
874         (Dwo_file::shndx_map_): Remove.
875         (Dwo_file::sect_offsets_): New data member.
876         (Dwp_output_file::Dwp_output_file): Initialize new data members.
877         (Dwp_output_file::add_section): Rename to...
878         (Dwp_output_file::add_contribution): ...this.
879         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
880         (Dwp_output_file::add_tu_set): Likewise.
881         (Dwp_output_file::Contribution): New type.
882         (Dwp_output_file::Section::contributions): New data member.
883         (Dwp_output_file::Cu_or_tu_set): Remove.
884         (Dwp_output_file::Section::Section): New ctor.
885         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
886         (Dwp_output_file::Dwp_index::Section_table): New type.
887         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
888         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
889         parameter.
890         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
891         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
892         (Dwp_output_file::Dwp_index::section_table): New member function.
893         (Dwp_output_file::Dwp_index::section_table_end): New member function.
894         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
895         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
896         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
897         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
898         (Dwp_output_file::Dwp_index::section_table_): New data member.
899         (Dwp_output_file::Dwp_index::section_mask_): New data member.
900         (Dwp_output_file::add_output_section): New member function.
901         (Dwp_output_file::write_new_section): New member function.
902         (Dwp_output_file::write_contributions): New member function.
903         (Dwp_output_file::section_id_map_): New data member.
904         (class Dwo_id_info_reader): Remove.
905         (class Unit_reader): New class.
906         (get_dwarf_section_name): New function.
907         (Dwo_file::read_executable): Adjust initializations of class data.
908         (Dwo_file::read): Add support for v2 package file format.
909         (Dwo_file::read_unit_index): Likewise.
910         (Dwo_file::sized_read_unit_index): Likewise.
911         (Dwo_file::copy_section): Likewise.
912         (Dwo_file::add_unit_set): Likewise.
913         (Dwp_output_file::add_output_section): Likewise.
914         (Dwp_output_file::add_contribution): Likewise.
915         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
916         for empty slot.
917         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
918         file format.
919         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
920         slot.
921         (Dwp_output_file::initialize): Remove unused function.
922         (Dwp_output_file::finalize): Add support for v2 package file format.
923         (Dwp_output_file::write_index): Likewise.
924         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
925         function prototype.
926
927 2013-10-31  Cary Coutant  <ccoutant@google.com>
928
929         * configure.ac: Fix check for -fmerge-constants.
930         * configure.ac: Regenerate.
931
932 2013-10-30  Roland McGrath  <mcgrathr@google.com>
933
934         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
935         Correct 9-byte nop sequence to match what the assembler generates.
936
937 2013-10-30  Alan Modra  <amodra@gmail.com>
938
939         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
940         ppc64_local_entry_offset, ppc64_local_entry_offset,
941         do_read_symbols): New functions.
942         (Powerpc_relobj::e_flags_, st_other_): New vars.
943         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
944         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
945         (Powerpc_relobj::e_flags_): New var.
946         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
947         and adjust for ELFv2.
948         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
949         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
950         (Powerpc_dynobj::do_find_special_sections): Likewise.
951         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
952         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
953         to ELFv2 local entry.
954         (Target_powerpc::do_relax): No thread safe barriers needed for
955         ELFv2.
956         (Output_data_plt_powerpc::initial_plt_entry_size_,
957         plt_entry_size): Delete.  Replace all uses with
958         first_plt_entry_offset() and plt_entry_size().
959         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
960         reserved_size parm.  Update callers.
961         (Output_data_plt_powerpc::entry_count): Update.
962         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
963         and use Target_powerpc::first_plt_entry_offset().
964         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
965         rename to plt_entry_size.
966         (Output_data_plt_powerpc::add_ifunc_entry,
967         add_local_ifunc_entry): Adjust reloc for ELFv2.
968         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
969         (glink_eh_frame_fde_64v2): New.
970         (Stub_table::plt_call_size): Support ELFv2 sizing.
971         (Output_data_glink::add_eh_frame): Use the new FDE.
972         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
973         (Stub_table::do_write): Write ELFv2 stubs and glink.
974         (Target_powerpc::Relocate::relocate): Replaces nop after call
975         with ld 2,24(1) and adjust local offset destination for ELFv2.
976
977 2013-10-30  Alan Modra  <amodra@gmail.com>
978
979         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
980         (Target_powerpc::Scan::global, local): Likewise.
981         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
982         on all ppc64 @h and @ha relocs.
983
984 2013-10-14  Alan Modra  <amodra@gmail.com>
985
986         * output.h (Output_data_got::add_constant): Tidy.
987         (Output_data_got::add_constant_pair): New function.
988         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
989         methods used so as to first call reserve_ent().
990
991 2013-10-11  Roland McGrath  <mcgrathr@google.com>
992
993         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
994         add_got_entry and add_got_entry_pair.
995
996         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
997         (HAVE_PUBNAMES): Likewise.
998         * configure: Regenerate.
999
1000         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
1001         * testsuite/Makefile.in: Regenerate.
1002
1003         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
1004         Remove const from declaration.
1005         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
1006         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
1007         * output.h (Output_file_header): Remove const from member target_
1008         and corresponding constructor argument.
1009         * output.cc (Output_file_header::Output_file_header): Update prototype.
1010         (Output_file_header::do_sized_write): Use this->target_ in place
1011         of parameters()->target().
1012
1013         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1014
1015         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1016         * configure: Regenerate.
1017         * Makefile.in: Regenerate.
1018         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1019         * testsuite/merge_string_literals_2.c: Likewise.
1020         * testsuite/Makefile.am
1021         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1022         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1023         literal -fmerge-constants.
1024         * testsuite/Makefile.in: Regenerate.
1025
1026         * i386.cc (Target_i386): Remove unused member dynbss_.
1027         * arm.cc (Target_arm): Likewise.
1028         * powerpc.cc (Target_powerpc): Likewise.
1029         * sparc.cc (Target_sparc): Likewise.
1030         * tilegx.cc (Target_tilegx): Likewise.
1031         * x86_64.cc (Target_x86_64): Likewise.
1032         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1033         type_signature_, type_offset_.
1034         * plugin.h (Plugin_hook): Remove unused member layout_.
1035         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1036         mapfile_.
1037         (Read_member): Remove unused members input_objects_, symtab_,
1038         mapfile_, layout_.
1039         (Check_library): Remove unused member symtab_.
1040         * archive.h (Lib_group): Remove unused member lib_.
1041         * archive.cc (Lib_group::Lib_group): Update initializer.
1042         * incremental.h (Incremental_binary): Remove unused member target_.
1043         (Incremental_script_entry): Removed unused member script_.
1044         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1045         * icf.h (Icf): Remove unused member num_tracked_relocs.
1046
1047         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1048         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1049         its only use.
1050         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1051
1052         * archive.h: Use struct rather than class for forward declaration
1053         of Read_symbols_data.
1054
1055 2013-10-07  Cary Coutant  <ccoutant@google.com>
1056
1057         PR gold/16010
1058         * testsuite/Makefile.am (icf_test): Fix dependencies.
1059         (icf_safe_test): Likewise.
1060         (icf_safe_so_test): Likewise.
1061         (large_symbol_alignment): Add empty _LDADD rule.
1062         * testsuite/Makefile.in: Regenerate.
1063
1064 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1065
1066         PR gold/15927
1067         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1068         relocation for R_X86_64_32 on x32.
1069
1070 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1071
1072         * output.cc (Output_segment::set_section_addresses): Take new
1073         Target* argument.  If target->isolate_execinstr() and the segment
1074         is executable and starts at a target->abi_pagesize() boundary,
1075         pad its end out to a target->abi_pagesize() boundary with code fill.
1076         * output.h (Output_segment::set_section_addresses): Update decl.
1077         * layout.h (Layout::check_output_data_for_reset_values): Take new
1078         argument RELAX_OUTPUTS.
1079         (Layout): New member relax_output_list_.
1080         (Layout::add_relax_output): New method.
1081         * layout.cc (Layout::Layout): Update constructor.
1082         (Layout::reset_relax_output): New method.
1083         (Layout::clean_up_after_relaxation): Call it.
1084         (Layout::prepare_for_relaxation): Update caller.
1085         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1086         Call reset_relax_output before re-processing segments for
1087         isolate_execinstr case.
1088         (Layout::write_data): Handle relax_output_list_.
1089         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1090         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1091
1092 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1093
1094         PR binutils/15834
1095         * object.h: Fix typos.
1096
1097 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1098
1099         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1100         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1101
1102 2013-08-07  Cary Coutant  <ccoutant@google.com>
1103
1104         Revert support for v2 DWP files:
1105
1106         2013-03-01  Cary Coutant  <ccoutant@google.com>
1107
1108             Add dwp support for v2 DWARF package file format.
1109             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1110             tu_length parameter.  Adjust all callers.
1111             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1112             * dwp.cc: Include dwarf.h.
1113             (Section_bounds): New struct type.
1114             (Unit_set): New struct type.
1115             (Dwo_file::Dwo_file): Initialize new data member.
1116             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1117             Combine and rename to...
1118             (Dwo_file::read_unit_index): ...this.
1119             (Dwo_file::sized_read_compunit_index)
1120             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1121             (Dwo_file::sized_read_unit_index): ...this.
1122             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1123             parameters; add section_id parameter.
1124             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1125             (Dwo_file::add_unit_set): ...this.
1126             (Dwo_file::shndx_map_): Remove.
1127             (Dwo_file::sect_offsets_): New data member.
1128             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1129             (Dwp_output_file::add_section): Rename to...
1130             (Dwp_output_file::add_contribution): ...this.
1131             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1132             (Dwp_output_file::add_tu_set): Likewise.
1133             (Dwp_output_file::Contribution): New type.
1134             (Dwp_output_file::Section::contributions): New data member.
1135             (Dwp_output_file::Cu_or_tu_set): Remove.
1136             (Dwp_output_file::Section::Section): New ctor.
1137             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1138             (Dwp_output_file::Dwp_index::Section_table): New type.
1139             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1140             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1141             parameter.
1142             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1143             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1144             (Dwp_output_file::Dwp_index::section_table): New member function.
1145             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1146             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1147             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1148             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1149             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1150             (Dwp_output_file::Dwp_index::section_table_): New data member.
1151             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1152             (Dwp_output_file::add_output_section): New member function.
1153             (Dwp_output_file::write_new_section): New member function.
1154             (Dwp_output_file::write_contributions): New member function.
1155             (Dwp_output_file::section_id_map_): New data member.
1156             (class Dwo_id_info_reader): Remove.
1157             (class Unit_reader): New class.
1158             (get_dwarf_section_name): New function.
1159             (Dwo_file::read_executable): Adjust initializations of class data.
1160             (Dwo_file::read): Add support for v2 package file format.
1161             (Dwo_file::read_unit_index): Likewise.
1162             (Dwo_file::sized_read_unit_index): Likewise.
1163             (Dwo_file::copy_section): Likewise.
1164             (Dwo_file::add_unit_set): Likewise.
1165             (Dwp_output_file::add_output_section): Likewise.
1166             (Dwp_output_file::add_contribution): Likewise.
1167             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1168             for empty slot.
1169             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1170             file format.
1171             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1172             slot.
1173             (Dwp_output_file::initialize): Remove unused function.
1174             (Dwp_output_file::finalize): Add support for v2 package file format.
1175             (Dwp_output_file::write_index): Likewise.
1176             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1177             function prototype.
1178
1179 2013-07-31  Cary Coutant  <ccoutant@google.com>
1180
1181         * object.cc (Sized_relobj::do_output_section_address): New function.
1182         (Sized_relobj): Instantiate explicitly.
1183         * object.h (Object::output_section_address): New function.
1184         (Object::do_output_section_address): New function.
1185         (Sized_relobj::do_output_section_address): New function.
1186         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1187
1188 2013-07-30  Cary Coutant  <ccoutant@google.com>
1189             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1190
1191         * parameters.cc (Parameters::entry): Return target-specific entry
1192         symbol name.
1193         * target.h (Target::entry_symbol_name): New function.
1194         (Target_info::entry_symbol_name): New data member.
1195
1196         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1197         * i386.cc (Target_i386::i386_info): Likewise.
1198         (Target_i386_nacl::i386_nacl_info): Likewise.
1199         * sparc.cc (Target_sparc::sparc_info): Likewise.
1200         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1201         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1202         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1203         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1204
1205 2013-07-22  Sterling Augustine  <saugustine@google.com>
1206
1207         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1208         Convert parameter shndx to local variable. Add parameters symtab
1209         and symtab_size.  Scan over section names.  Find relocation
1210         section corresponding to current section.  Create and initialize
1211         reloc_mapper_ and reloc_type_.
1212         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1213         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1214         cu_offset_.
1215         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1216         Initialize new fields unit_length_ and cu_offset_.
1217         (Dwarf_pubnames_table::read_section): Update prototype.
1218         (Dwarf_pubnames_table::cu_offset): New member function.
1219         (Dwarf_pubnames_table::subsection_size): Likewise.
1220         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1221         New fields.
1222         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1223         member functions public.
1224         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1225         Update comment.  Rework logic.  Move repeated parts to...
1226         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1227         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1228         pubtypes_table_, and stmt_list_offset.
1229         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1230         Gdb_index::find_pubtype_offset,
1231         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1232         (Gdb_index::pubnames_read): Update prototype and rework logic.
1233         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1234         Forward declare.
1235         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1236         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1237         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1238         Gdb_index::map_pubtable_to_dies):
1239         Declare functions.
1240         (Gdb_index::pubnames_read): Update declaration.
1241         (Gdb_index::Pubname_offset_map): New type.
1242         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1243         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1244         Gdb_index::stmt_list_offset): Declare.
1245         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1246         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1247         Gdb_index::pubtypes_offset_): Remove.
1248
1249 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1250
1251         * options.h (General_options): Add -Trodata-segment option.
1252         * parameters.cc (Parameters::check_rodata_segment): New function.
1253         (Parameters::set_target_once): Call it.
1254         * parameters.h (Parameters): Declare it (private member function).
1255         * layout.cc (load_seg_unusable_for_headers): New function, broken
1256         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1257         then validate rodata segment rather than text segment.
1258         (relaxation_loop_body): Call that.
1259         (is_text_segment): New function.  Don't admit a non-executable
1260         segment if TARGET->isolate_execinstr().
1261         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1262
1263 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1264
1265         PR gold/15070
1266         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1267         * nacl.h (Sniff_file::View::View): Request aligned view.
1268
1269 2013-07-11  Cary Coutant  <ccoutant@google.com>
1270
1271         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1272         correct BRLT entry size.
1273
1274 2013-07-03  Alan Modra  <amodra@gmail.com>
1275
1276         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1277         comment.
1278
1279 2013-07-01  Cary Coutant  <ccoutant@google.com>
1280
1281         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1282         reloc_type_.
1283         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1284         (Dwarf_ranges_table::lookup_reloc): New function.
1285         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1286         reloc_type_.
1287         (Dwarf_ranges_table::lookup_reloc): New function.
1288         (Dwarf_ranges_table::reloc_type_): New data member.
1289
1290 2013-06-27  Jing Yu  <jingyu@google.com>
1291
1292         PR gold/15662
1293         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1294         function.
1295         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1296         (Target_powerpc::do_relax): Call the above.
1297
1298 2013-06-27  Cary Coutant  <ccoutant@google.com>
1299
1300         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1301         on garbage collected .opd section.
1302
1303 2013-06-27  Alan Modra  <amodra@gmail.com>
1304
1305         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1306         is non-zero.
1307         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1308         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1309
1310 2013-06-14  Cary Coutant  <ccoutant@google.com>
1311
1312         * resolve.cc (Symbol::override_base): Don't override st_type
1313         from plugin placeholder symbols.
1314         (Symbol_table::resolve): Likewise.
1315         (Symbol_table::should_override): Don't complain about TLS mismatch
1316         if the TO symbol is a plugin placeholder.
1317         * testsuite/Makefile.am (plugin_test_tls): New test.
1318         * testsuite/Makefile.in: Regenerate.
1319         * testsuite/plugin_test_tls.sh: New test script.
1320         * testsuite/two_file_test_2_tls.cc: New test source.
1321         * testsuite/two_file_test_tls.cc: New test source.
1322
1323 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1324
1325         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1326         the maximum segment alignment is larger than the page size.
1327         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1328         correctly aligns the symbols with large alignemnt.
1329         * testsuite/Makefile.in: Regenerate.
1330         * testsuite/large_symbol_alignment.cc: New file.
1331
1332 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1333             Sriraman Tallam  <tmsriram@google.com>
1334
1335         * options.h (sort_section): New option.
1336         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1337         Rename from Input_section_sort_section_name_special_ordering_compare.
1338         (Input_section_sort_section_name_compare): New struct.
1339         * output.cc (Output_section::Input_section_sort_section_name_compare::
1340         operator()): New function.
1341         (Output_section::sort_attached_input_sections): Use new sort function
1342         for .text if --sort-section=name is specified.
1343         * layout.cc (Layout::make_output_section):
1344         Add sorting by name when --sort-section=name is specified.
1345         * testsuite/Makefile.am (text_section_grouping): Test option
1346         --sort-section=name.
1347         * testsuite/Makefile.in: Regenerate.
1348         * testsuite/section_sorting_name.cc: New file.
1349         * testsuite/section_sorting_name.sh: New file.
1350
1351 2013-05-21  Cary Coutant  <ccoutant@google.com>
1352
1353         * symtab.h (Symbol::is_cxx_vtable): New function.
1354         * target-reloc.h (relocate_section): Check for vtable symbol.
1355         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1356         * testsuite/Makefile.in: Regenerate.
1357         * testsuite/missing_key_func.cc: New test source.
1358         * testsuite/missing_key_func.sh: New test script.
1359
1360 2013-05-21  Cary Coutant  <ccoutant@google.com>
1361
1362         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1363         type of enclosing symbol.
1364         (Relocate_info::location): Check symbol type when describing symbol.
1365         * object.h (Symbol_location_info): Remove unused line_number;
1366         add enclosing_symbol_type.
1367         * testsuite/debug_msg.sh: Adjust expected output.
1368
1369 2013-05-13  Cary Coutant  <ccoutant@google.com>
1370
1371         * configure.ac: Export DEFAULT_TARGET.
1372         * configure: Regenerate.
1373         * Makefile.in: Regenerate.
1374         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1375         * testsuite/Makefile.in: Regenerate.
1376         * testsuite/debug_msg.sh: Delete duplicate tests.
1377         Don't check undef_int error message match for powerpc where the
1378         source file and line number aren't available.
1379
1380 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1381
1382         * options.h (General_options): Add --rosegment-gap option.
1383         * options.cc (finalize): --rosegment-gap implies --rosegment.
1384         * layout.cc (set_segment_offsets): Let user option override
1385         target->rosegment_gap().
1386
1387 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1388
1389         * options.h (General_options): Remove leading space from help
1390         messages for -nostdlib and --rosegment.
1391
1392 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1393
1394         PR ld/15365
1395         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1396
1397 2013-05-03  Alan Modra  <amodra@gmail.com>
1398
1399         * merge.cc (Output_merge_string::do_add_input_section): Correct
1400         scan for number of strings.  Rename vars to avoid shadowing.
1401         Include missing terminator in input_size_.
1402
1403 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1404
1405         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1406         Restore empty string handling.
1407
1408 2013-05-01  Cary Coutant  <ccoutant@google.com>
1409
1410         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1411         uninitialized warning.
1412
1413 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1414
1415         * output.cc (Output_section::add_merge_input_section): Allow
1416         to merge sections if the alignment is more than character size.
1417         * merge.h (Output_merge_string::Output_merge_string): Remove
1418         assert.
1419         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1420         only not-null strings. Check the alignment of strings.
1421         * stringpool.h
1422         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1423         alignment as the argument.
1424         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1425         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1426         Align non-zero length strings according to the addralign_.
1427         (Stringpool_template<Stringpool_char>::set_string_offsets):
1428         Updating offsets according to the given alignment.
1429         * testsuite/Makefile.am (text_section_grouping): Test if string
1430         literals are getting merged.
1431         * testsuite/Makefile.in: Regenerate.
1432         * testsuite/merge_string_literals_1.c: New file.
1433         * testsuite/merge_string_literals_2.c: Ditto.
1434         * testsuite/merge_string_literals.sh: Ditto.
1435
1436 2013-04-26  Ian Lance Taylor  <iant@google.com>
1437
1438         * target-reloc.h (relocate_section): If the reloc offset is out of
1439         range, pass VIEW as NULL to relocate.relocate.
1440         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1441         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1442         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1443         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1444         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1445         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1446
1447 2013-04-26  Geoff Pike  <gpike@chromium.org>
1448
1449         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1450         * layout.cc (Hash_task): New class.
1451         (Layout::queue_build_id_tasks): New function.
1452         (Layout::write_build_id): Handle single-thread portion of build ID
1453         computation.  (In some cases, all of it is single-threaded.)  Replace
1454         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1455         functionality in fewer lines of code.
1456         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1457         * options.h (General_options): make "--build-id" default to tree
1458         rather than sha1.  Add two new options related to --build-id=tree:
1459         --build-id-chunk-size-for-treehash and
1460         --build-id-min-file-size-for-treehash.
1461         * Makefile.am: add testing of --build-id=tree and related new options
1462         (these tests will be invoked by "make check").
1463         * Makefile.in: Regenerate.
1464
1465 2013-04-25  Alan Modra  <amodra@gmail.com>
1466
1467         * configure.tgt: Add powerpcle and powerpc64le.
1468
1469 2013-04-22  Alan Modra  <amodra@gmail.com>
1470
1471         PR gold/15355
1472         * layout.cc (Layout::segment_precedes): Allow more than one
1473         segment with the same type and flags.
1474
1475 2013-04-15  Cary Coutant  <ccoutant@google.com>
1476
1477         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1478         allocate space in file for BSS sections.
1479
1480 2013-04-15  Cary Coutant  <ccoutant@google.com>
1481
1482         * script-sections.cc (Orphan_output_section): Reset address
1483         to zero after each orphaned section for relocatable links.
1484
1485 2013-04-15  Cary Coutant  <ccoutant@google.com>
1486
1487         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1488         section starting address for relocatable link.
1489         * testsuite/Makefile.am (script_test_11): New test.
1490         * testsuite/Makefile.in: Regenerate.
1491         * testsuite/script_test_11.c: New source file.
1492         * testsuite/script_test_11.t: New linker script.
1493
1494 2013-04-13  Alan Modra  <amodra@gmail.com>
1495
1496         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1497         owner when sections are not adjacent and exceed group size.
1498         (Target_powerpc::group_sections): Handle corner case.
1499         (Target_powerpc::Branch_info::make_stub): Handle case where
1500         stub table doesn't exist due to branches in non-exec sections.
1501         (Target_powerpc::Relocate::relocate): Likewise.
1502
1503 2013-04-11  Alan Modra  <amodra@gmail.com>
1504
1505         PR gold/15354
1506         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1507         .branch_lt to match bfd ld.  Adjust comments throughout file.
1508
1509 2013-04-04  Ian Lance Taylor  <iant@google.com>
1510
1511         GCC PR c++/56840
1512         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1513         sections before checking whether they are included in the link.
1514
1515 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1516
1517         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1518         object before calling the plugin claim_file handler.  Pass the elf
1519         object of the archive to the plugin. Delete the elf object if the
1520         plugin claims the file.
1521
1522 2013-03-21  Alan Modra  <amodra@gmail.com>
1523
1524         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1525         segment when omagic.
1526
1527 2013-03-21  Alan Modra  <amodra@gmail.com>
1528
1529         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1530         comparison warning.
1531         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1532         uninitialized" warning.
1533
1534 2013-03-20  Alan Modra  <amodra@gmail.com>
1535
1536         * symtab.h (Symbol::clear_version): New function.
1537         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1538         is_needed by weak references.  Clear version for symbols defined
1539         in as-needed objects that are not needed.
1540
1541 2013-03-15  Alan Modra  <amodra@gmail.com>
1542
1543         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1544         static and public.  Add report_err param.  Return false for data refs.
1545         (Target_powerpc::rela_dyn_section): New overloaded function.
1546         (Target_powerpc::plt_, iplt_): Elucidate.
1547         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1548         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1549         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1550         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1551         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1552         push_branch and make_plt_entry for ifunc syms when
1553         reloc_needs_plt_for_ifunc.
1554         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1555         for ifunc unless reloc_needs_plt_for_ifunc.
1556
1557 2013-03-15  Alan Modra  <amodra@gmail.com>
1558
1559         * gc.h (gc_process_relocs): Don't look through function descriptors.
1560         * icf.cc (get_section_contents): Do so here instead.
1561
1562 2013-03-13  Alan Modra  <amodra@gmail.com>
1563
1564         * powerpc.cc (is_branch_reloc): Forward declare.
1565         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1566         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1567         false for 64-bit, true for 32-bit non-branch relocs.
1568         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1569         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1570         nm output.
1571         (icf_safe_test): Generate linker map file as well as nm output.
1572         (icf_safe_so_test): Likewise.
1573         * testsuite/Makefile.in: Regenerate.
1574         * testsuite/icf_test.sh: Parse linker map file to determine
1575         section folding.
1576         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1577         * testsuite/icf_safe_so_test.sh: Likewise.
1578         (X86_32_or_ARM_specific_safe_fold): Merge into..
1579         (arch_specific_safe_fold): ..this.
1580         (X86_64_specific_safe_fold): Delete unused function.
1581
1582 2013-03-12  Alan Modra  <amodra@gmail.com>
1583
1584         * gc.h (gc_process_relocs): Look through function descriptors
1585         to determine shndx, symvalue and addend used by ICF.  Tidy
1586         variable duplication.
1587
1588 2013-03-11  Alan Modra  <amodra@gmail.com>
1589
1590         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1591         * layout.cc (Layout_task_runner::run): ..to here.
1592         * symtab.h (struct Symbol_location): Extract from..
1593         (class Symbol_table): ..here.
1594         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1595         * target.h (class Target): Add function_location and
1596         do_function_location functions.
1597         (class Sized_target): Add do_function_location.
1598         * object.h (class Sized_relobj_file): Move find_shdr..
1599         (class Object): ..to here.
1600         * object.cc: Likewise.  Update to suit.  Instantiate.
1601         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1602         * powerpc.cc (class Powerpc_dynobj): New.
1603         (Target_powerpc::do_function_location): New function.
1604         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1605         (Powerpc_dynobj::do_read_symbols): New function.
1606         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1607
1608 2013-03-08  Ian Lance Taylor  <iant@google.com>
1609
1610         * options.cc (General_options::string_to_object_format): Accept
1611         "default".
1612
1613 2013-03-08  Alan Modra  <amodra@gmail.com>
1614
1615         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1616         pointer to Post_fde.
1617         (struct Post_fde): Move definition to here..
1618         * ehframe.cc (struct Post_fde): ..from here.
1619         (Cie::write): Don't alloc Post_fde.
1620         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1621
1622 2013-03-07  Alan Modra  <amodra@gmail.com>
1623
1624         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1625         relocation referencing .LC0.
1626         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1627
1628 2013-03-07  Alan Modra  <amodra@gmail.com>
1629
1630         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1631         always_inline.  Add assembly for powerpc to avoid GOT.
1632
1633 2013-03-07  Alan Modra  <amodra@gmail.com>
1634
1635         * testsuite/script_test_10.sh: Don't test .bss section
1636         header number.
1637
1638 2013-03-06  Alan Modra  <amodra@gmail.com>
1639
1640         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1641         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1642         all callers.  Handle folded sections.
1643         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1644         to Powerpc_relobj.
1645         (Global_symbol_visitor_opd::operator()): Likewise.
1646
1647 2013-03-04  Alan Modra  <amodra@gmail.com>
1648
1649         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1650         * testsuite/Makefile.in: Regenerate.
1651
1652 2013-03-01  Cary Coutant  <ccoutant@google.com>
1653
1654         Add dwp support for v2 DWARF package file format.
1655         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1656         tu_length parameter.  Adjust all callers.
1657         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1658         * dwp.cc: Include dwarf.h.
1659         (Section_bounds): New struct type.
1660         (Unit_set): New struct type.
1661         (Dwo_file::Dwo_file): Initialize new data member.
1662         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1663         Combine and rename to...
1664         (Dwo_file::read_unit_index): ...this.
1665         (Dwo_file::sized_read_compunit_index)
1666         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1667         (Dwo_file::sized_read_unit_index): ...this.
1668         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1669         parameters; add section_id parameter.
1670         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1671         (Dwo_file::add_unit_set): ...this.
1672         (Dwo_file::shndx_map_): Remove.
1673         (Dwo_file::sect_offsets_): New data member.
1674         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1675         (Dwp_output_file::add_section): Rename to...
1676         (Dwp_output_file::add_contribution): ...this.
1677         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1678         (Dwp_output_file::add_tu_set): Likewise.
1679         (Dwp_output_file::Contribution): New type.
1680         (Dwp_output_file::Section::contributions): New data member.
1681         (Dwp_output_file::Cu_or_tu_set): Remove.
1682         (Dwp_output_file::Section::Section): New ctor.
1683         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1684         (Dwp_output_file::Dwp_index::Section_table): New type.
1685         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1686         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1687         parameter.
1688         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1689         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1690         (Dwp_output_file::Dwp_index::section_table): New member function.
1691         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1692         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1693         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1694         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1695         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1696         (Dwp_output_file::Dwp_index::section_table_): New data member.
1697         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1698         (Dwp_output_file::add_output_section): New member function.
1699         (Dwp_output_file::write_new_section): New member function.
1700         (Dwp_output_file::write_contributions): New member function.
1701         (Dwp_output_file::section_id_map_): New data member.
1702         (class Dwo_id_info_reader): Remove.
1703         (class Unit_reader): New class.
1704         (get_dwarf_section_name): New function.
1705         (Dwo_file::read_executable): Adjust initializations of class data.
1706         (Dwo_file::read): Add support for v2 package file format.
1707         (Dwo_file::read_unit_index): Likewise.
1708         (Dwo_file::sized_read_unit_index): Likewise.
1709         (Dwo_file::copy_section): Likewise.
1710         (Dwo_file::add_unit_set): Likewise.
1711         (Dwp_output_file::add_output_section): Likewise.
1712         (Dwp_output_file::add_contribution): Likewise.
1713         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1714         for empty slot.
1715         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1716         file format.
1717         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1718         slot.
1719         (Dwp_output_file::initialize): Remove unused function.
1720         (Dwp_output_file::finalize): Add support for v2 package file format.
1721         (Dwp_output_file::write_index): Likewise.
1722         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1723         function prototype.
1724
1725 2013-03-01  Cary Coutant  <ccoutant@google.com>
1726
1727         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1728         function into class definition in header file.
1729         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1730         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1731         New function.
1732         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1733
1734 2013-02-28  Alan Modra  <amodra@gmail.com>
1735
1736         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1737         * target.cc (Target::do_plt_fde_location): New function.
1738         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1739         accessor function, and constructor param.
1740         (struct Post_fde, Post_fdes): Declare.
1741         (Cie::write): Add post_fdes param.
1742         * ehframe.cc (Fde::write): Use plt_fde_location.
1743         (struct Post_fde): Define.
1744         (Cie::write): Stash FDEs added post merge mapping.
1745         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1746         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1747         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1748         other FDEs.
1749         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1750         (Target_powerpc::has_glink): New function.
1751         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1752         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1753         glink_eh_frame_fde_32, default_fde): New data.
1754         (Stub_table::eh_frame_added_): New var.
1755         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1756         Make const.
1757         (Stub_table::add_eh_frame): New function.
1758         (Output_data_glink::add_eh_frame): New function.
1759         (Target_powerpc::make_glink_section): Call add_eh_frame.
1760
1761 2013-02-15  Ian Lance Taylor  <iant@google.com>
1762
1763         * options.h (DEFINE_uint64_alias): Define.
1764         (class General_options): Add -Ttext-segment as an alias for
1765         -Ttext.
1766
1767 2013-02-15  Alan Modra  <amodra@gmail.com>
1768
1769         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1770         (Stub_table::do_write): ..here, two places.
1771         (Stub_table::plt_call_size): Use it here too.
1772
1773 2013-02-11  Ian Lance Taylor  <iant@google.com>
1774
1775         * descriptors.cc (Descriptors::close_all): New function.
1776         * descriptors.h (class Descriptors): Declare close_all.
1777         (close_all_descriptors): New inline function.
1778         * plugin.cc: Include "descriptors.h".
1779         (Plugin_manager::cleanup): Call close_all_descriptors.
1780
1781 2013-02-06  Alan Modra  <amodra@gmail.com>
1782
1783         * README: Update coding style link.
1784
1785 2013-01-28  Cary Coutant  <ccoutant@google.com>
1786
1787         * dwp.cc (File_list): New typedef.
1788         (Dwo_name_info_reader): New class.
1789         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1790         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1791         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1792         (Dwo_file::read_executable): New function.
1793         (Dwo_file::read): Move common setup code to ...
1794         (Dwo_file::make_object): ... here.
1795         (dwp_options): Add --exec/-e.
1796         (usage): Likewise.
1797         (main): Likewise.
1798
1799 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1800
1801         * layout.cc (Layout::layout): Check for option text_reorder.
1802         (Layout::make_output_section): Ditto.
1803         * options.h (text_reorder): New option.
1804         * output.cc (Input_section_sort_compare): Remove special ordering
1805         of section names.
1806         (Output_section::
1807          Input_section_sort_section_name_special_ordering_compare::
1808          operator()): New function.
1809         (Output_section::sort_attached_input_sections): Use new sort function
1810         for .text.
1811         * output.h (Input_section_sort_section_name_special_ordering_compare):
1812         New struct.
1813         * testsuite/Makefile.am (text_section_grouping): Test option
1814         --no-text-reorder
1815         * testsuite/Makefile.in: Regenerate.
1816         * testsuite/text_section_grouping.sh: Check order of functions without
1817         default text reordering.
1818
1819 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1820
1821         * options.h (General_options): Change default to true for new_dtags.
1822
1823 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1824
1825         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1826         when enable_new_dtags is false.  Only add DT_RUNPATH when
1827         enable_new_dtags is true.
1828
1829 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1830
1831         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1832         used in declaration and definition consistent.
1833         (Target_powerpc::symval_for_branch): Ditto.
1834
1835 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1836
1837         * testsuite/plugin_final_layout.cc: Fix comment.
1838
1839 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1840
1841         * layout.cc (Layout::layout): Do not do default sorting for
1842         text sections when section ordering is specified.
1843         (make_output_section): Ditto.
1844         * testsuite/plugin_final_layout.cc: Name the function sections
1845         to catch reordering issues.
1846
1847 2013-01-15  Alan Modra  <amodra@gmail.com>
1848
1849         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1850         plt-thread-safe.
1851
1852 2013-01-15  Alan Modra  <amodra@gmail.com>
1853
1854         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1855         * testsuite/Makefile.in: Regenerate.
1856
1857 2013-01-14  Alan Modra  <amodra@gmail.com>
1858
1859         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1860         * testsuite/Makefile.in: Regenerate.
1861
1862 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1863
1864         PR bfd/14430
1865         Fix mingw gold build with plugins enabled
1866         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1867         * configure.ac: Export DLOPEN_LIBS and add headers check.
1868         * plugin.cc: Handle non-dlfcn case.
1869         * Makefile.in: Regenerate.
1870         * config.in: Regenerate.
1871         * configure: Regenerate.
1872         * testsuite/Makefile.in: Regenerate.
1873
1874 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1875
1876         * output.h (sort_attached_input_sections): Change to be public.
1877         * script-sections.cc
1878         (Output_section_definition::set_section_addresses): Sort
1879         attached input sections according to section order before linker
1880         script assigns section addresses.
1881         (Orphan_output_section::set_section_addresses): Sort
1882         attached input sections according to section order before linker
1883         script assigns section addresses.
1884         * Makefile.am (final_layout.sh): Use a simple linker script to
1885         check if section ordering still works.
1886         * Makefile.in: Regenerate.
1887
1888 2013-01-09  Ben Cheng  <bccheng@google.com>
1889
1890         * arm.cc (Target_arm::attributes_accept_div): New function.
1891         (Target_arm::attributes_forbid_div): New function.
1892         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1893         attribute using the same new functions as what bfd/elf32_arm.c
1894         does.
1895
1896 2013-01-07  Cary Coutant  <ccoutant@google.com>
1897
1898         PR gold/14993
1899         * output.cc (Output_section::add_input_section): For incremental
1900         updates, don't track input sections that are allocated from patch
1901         space.
1902
1903 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1904             Ian Lance Taylor  <iant@google.com>
1905
1906         PR gold/14897
1907         * configure.ac (--enable-ld): Removed.
1908         (install_as_default): Set to yes only for --enable-gold=default
1909         or --disable-ld.
1910         * configure: Regenerated.
1911
1912 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1913
1914         * options.h (General_options): Add -fuse-ld= for GCC linker
1915         option compatibility.
1916
1917 2013-01-04  Cary Coutant  <ccoutant@google.com>
1918
1919         * configure.ac: Fix typo restoring CXXFLAGS.
1920         * configure: Regenerate.
1921
1922 2013-01-04  Cary Coutant  <ccoutant@google.com>
1923
1924         * testsuite/Makefile.am (CXXLINK_S): New macro.
1925         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1926         * testsuite/Makefile.in: Regenerate.
1927
1928 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1929
1930         * version.cc (print_version): Update copyright year to 2013.
1931
1932 2012-12-20  Ian Lance Taylor  <iant@google.com>
1933
1934         * layout.cc (Layout::special_ordering_of_input_section): New
1935         function.
1936         (Layout::layout): If input section requires special ordering, must
1937         sort input sections.
1938         (Layout::make_output_section): May sort .text input sections.
1939         (Layout::is_section_name_prefix_grouped): Remove.
1940         * layout.h (class Layout): Declare
1941         special_ordering_of_input_section.  Don't declare
1942         is_section_name_prefix_grouped.
1943         * output.cc (Output_section::add_input_section): Revert last
1944         change.
1945         (Output_section::Input_section_sort::match_file_name): Don't crash
1946         if called on output section data.
1947         (Output_section::Input_section_sort_compare): Sort based on
1948         special ordering.
1949         (Output_section::Input_section_sort_section_order_index_compare):
1950         Revert last patch.
1951         (Output_section::sort_attached_input_sections): Likewise.
1952
1953 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1954
1955         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1956         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1957         * output.cc (Output_section::add_input_section): Check if section
1958         name contains special prefix.  Keep input sections to sort such
1959         sections.
1960         (Output_section::Input_section_sort_section_order_index_compare
1961          ::operator()): Group sections according to prefixes.
1962         (Output_section::sort_attached_input_sections): Add condition to
1963         Input_section_entry constructor call.
1964         * testsuite/Makefile.am (text_section_grouping): New test.
1965         * testsuite/Makefile.in: Regenerate.
1966         * testsuite/text_section_grouping.cc: New file.
1967         * testsuite/text_section_grouping.sh: New file.
1968
1969 2012-12-17  Nick Clifton  <nickc@redhat.com>
1970
1971         * Makefile.am: Add copyright notice.
1972         * NEWS: Likewise.
1973         * README: Likewise.
1974         * configure.ac: Likewise.
1975         * ftruncate.c: Likewise.
1976         * Makefile.in: Regenerate.
1977
1978 2012-12-14  Cary Coutant  <ccoutant@google.com>
1979
1980         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1981         --no-as-needed flag.
1982         (exception_separate_shared_12_test): Likewise.
1983         (incremental_copy_test): Likewise.
1984         * testsuite/Makefile.in: Regenerate.
1985
1986 2012-12-14  Cary Coutant  <ccoutant@google.com>
1987
1988         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1989         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1990
1991 2012-12-12  Alan Modra  <amodra@gmail.com>
1992
1993         * powerpc.cc (class Track_tls): New.
1994         (class Relocate, class Scan): Inherit Track_tls.
1995         (Target_powerpc::Scan::local, global): Track tls optimization
1996         and avoid creating plt entry for __tls_get_addr if all uses
1997         are optimized away.
1998         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1999
2000 2012-12-12  Alan Modra  <amodra@gmail.com>
2001
2002         * options.h (General_options): Add --toc-sort/--no-toc-sort.
2003         Replace no_toc_optimize with toc_optimize.
2004         * output.h (Output_section::input_sections): Provide non-const variant.
2005         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
2006         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
2007         accessors.
2008         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2009         (class Sort_toc_sections): New.
2010         (Target_powerpc::do_finalize_sections): Sort toc sections.
2011         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2012
2013 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2014
2015         * testsuite/binary_unittest.cc (read_all): New function.
2016         (Sized_binary_test): Use it instead of ::read.
2017         * fileread.cc (do_read): Don't assume pread always reads the whole
2018         amount in a single call.
2019
2020 2012-12-10  Alan Modra  <amodra@gmail.com>
2021
2022         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2023         Set EM_PPC64 or EM_PPC here.
2024         (Target_selector_powerpc::do_recognize): Delete.
2025
2026 2012-12-10  Alan Modra  <amodra@gmail.com>
2027
2028         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2029         stub_table_.
2030         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2031
2032 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2033
2034         * testsuite/binary_unittest.cc (Sized_binary_test):
2035         Use open_descriptor rather than ::open.
2036
2037 2012-12-07  Alan Modra  <amodra@gmail.com>
2038
2039         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2040         typedef and invalid_address constant.
2041         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2042         instantiate constants.
2043
2044 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2045
2046         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2047         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2048         * aclocal.m4: Regenerate.
2049         * configure: Regenerate.
2050         * Makefile.in: Regenerate.
2051         * testsuite/Makefile.in: Regenerate.
2052
2053 2012-12-07  Alan Modra  <amodra@gmail.com>
2054
2055         * options.h (General_options): Add no_toc_optimize.
2056         * powerpc.cc (ok_lo_toc_insn): New function.
2057         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2058
2059 2012-12-06  Alan Modra  <amodra@gmail.com>
2060
2061         * options.h (General_options): Add plt_align, plt_static_chain,
2062         plt_thread_safe.  Update stub_group_size help text.
2063         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2064         for new plt_thread_safe_ var.
2065         (use_plt_offset): Correct comments.
2066         (Target_powerpc::do_relax): Look for thread creation symbols to
2067         determine default plt_thread_safe value.  Clear plt call stubs
2068         as well as branch stubs each iteration.
2069         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2070         insn constants.
2071         (l, hi, ha, write_insn): Move earlier.
2072         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2073         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2074         plt stubs too.
2075         (Stub_table::update_size): Adjust.
2076         (Stub_table::prev_size, set_prev_size): Delete.
2077         (Stub_table::stub_align): Let --plt-align affect result.
2078         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2079         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2080         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2081         (Stub_table::do_write): Support more stub variants.
2082
2083 2012-12-04  Alan Modra  <amodra@gmail.com>
2084
2085         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2086         (Target_powerpc::do_define_standard_symbols): New function.
2087
2088 2012-12-03  Alan Modra  <amodra@gmail.com>
2089
2090         * output.h: Formatting, whitespace.
2091
2092 2012-12-03  Alan Modra  <amodra@gmail.com>
2093
2094         * layout.h (Layout::get_executable_sections): Declare.
2095         * layout.cc (Layout::get_executable_sections): New function.
2096         * arm.cc (Target_arm::group_sections): Use it.
2097         (Arm_output_section::group_sections): Delete now redundant test.
2098         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2099         param to handle relative relocs.
2100         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2101         (Output_data_reloc::add_absolute): Adjust.
2102         (Output_data_reloc::add_relative): New function.
2103         (Output_data::reset_data_size): New function.
2104         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2105         (Output_section::set_addralign): New function.
2106         (Output_section::checkpoint_set_addralign): New function.
2107         (Output_section::clear_section_offsets_need_adjustment): New function.
2108         (Output_section::input_sections): Make public.
2109         * powerpc.cc (class Output_data_brlt_powerpc): New.
2110         (class Stub_table, class Stub_control): New.
2111         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2112         stub_table_, set_stub_table, stub_table): New vectors and accessor
2113         functions.
2114         (Target_powerpc::do_may_relax, do_relax, push_branch,
2115         new_stub_table, stub_tables, brlt_section, group_sections,
2116         add_branch_lookup_table, find_branch_lookup_table,
2117         write_branch_lookup_table, make_brlt_section): New functions.
2118         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2119         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2120         branch_info_): New vars.
2121         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2122         make call stubs here.
2123         (Output_data_glink): Remove all call stub handling from this class.
2124         (Target_powerpc::Scan::local, global): Save interesting branch
2125         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2126         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2127         functions on final link.
2128         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2129         Handle long branch destinations too.
2130         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2131         do_plt_address_for_local): Adjust lookup of plt call stubs.
2132
2133 2012-11-30  Alan Modra  <amodra@gmail.com>
2134
2135         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2136         relocs against protected symbols when building 32-bit shared libs.
2137
2138 2012-11-30  Alan Modra  <amodra@gmail.com>
2139
2140         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2141         param.  Call got_section() to make .got.  Update all callers
2142         and their callers and so on.
2143
2144 2012-11-30  Alan Modra  <amodra@gmail.com>
2145
2146         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2147         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2148         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2149         value if it already exists.
2150
2151 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2152
2153         PR gold/14858
2154         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2155
2156 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2157
2158         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2159         than bfc instruction for data sandboxing.
2160
2161 2012-11-08  Alan Modra  <amodra@gmail.com>
2162
2163         * po/POTFILES.in: Regenerate.
2164
2165 2012-11-05  Alan Modra  <amodra@gmail.com>
2166
2167         * configure.ac: Apply 2012-09-10 change to config.in here.
2168         * configure: Regenerate.
2169
2170 2012-11-05  Alan Modra  <amodra@gmail.com>
2171
2172         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2173         (struct Opd_ent): Use "Address" rather than "Offset".
2174         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2175         (Target_powerpc::got_section): Make public.
2176         (Target_powerpc::scan_relocs): Move code setting symbols..
2177         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2178         Create _SDA_BASE_ only when referenced.
2179
2180 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2181
2182         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2183         from last change.
2184
2185 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2186
2187         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2188         for offset_in_output_section parameter.
2189         (Sized_target::relocate_special_relocatable): Likewise.
2190         * arm.cc (Target_arm::relocate_relocs): Likewise.
2191         (Target_arm::relocate_special_relocatable): Likewise.
2192         * i386.cc (Target_i386::relocate_relocs): Likewise.
2193         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2194         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2195         * target-reloc.h (relocate_relocs): Likewise.
2196         * testsuite/testfile.cc (Target_test): Likewise.
2197         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2198         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2199
2200         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2201         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2202
2203         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2204         parameter, which is unused in the [!F_SETFD] case.
2205
2206         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2207         SYMNDX to off_t before comparing it to this->data_size().
2208         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2209         * incremental.cc (Output_section_incremental_inputs::do_write):
2210         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2211
2212         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2213
2214 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2215
2216         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2217         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2218         in EABI_VER5.
2219
2220 2012-10-29  Cary Coutant  <ccoutant@google.com>
2221
2222         * dwp.cc (usage): Add file and exit status parameters;
2223         add --help and --version options.
2224         (print_version): New function.
2225         (main): Add --help and --version options.
2226
2227 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2228
2229         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2230         final_layout_sequence.txt.
2231         * testsuite/Makefile.in: Regenerated.
2232
2233 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2234
2235         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2236         COMPILE generated by automake.
2237         (LINK1): Likewise.
2238         (CXXCOMPILE1): Likewise.
2239         (CXXLINK1): Likewise.
2240         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2241         (LINK): Likewise.
2242         (CXXCOMPILE): Likewise.
2243         (CXXLINK): Likewise.
2244         * testsuite/Makefile.in: Regenerated.
2245
2246 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2247
2248         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2249         on bad fwrite return.
2250
2251 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2252
2253         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2254         on val.
2255
2256 2012-10-23  Cary Coutant  <ccoutant@google.com>
2257
2258         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2259         * testsuite/Makefile.in: Regenerate.
2260         * testsuite/dwp_test.h: New source file.
2261         * testsuite/dwp_test_1.cc: New source file.
2262         * testsuite/dwp_test_1.s: New source file.
2263         * testsuite/dwp_test_1.sh: New source file.
2264         * testsuite/dwp_test_1b.cc: New source file.
2265         * testsuite/dwp_test_1b.s: New source file.
2266         * testsuite/dwp_test_2.cc: New source file.
2267         * testsuite/dwp_test_2.s: New source file.
2268         * testsuite/dwp_test_2.sh: New source file.
2269         * testsuite/dwp_test_main.cc: New source file.
2270         * testsuite/dwp_test_main.s: New source file.
2271
2272 2012-10-23  Cary Coutant  <ccoutant@google.com>
2273
2274         * dwp.h: New header file.
2275         * dwp.cc: New source file.
2276         * gold.h: Move shared declarations to system.h.
2277         * system.h: New header file.
2278         * Makefile.am: Add dwp.
2279         * Makefile.in: Regenerate.
2280
2281 2012-10-23  Cary Coutant  <ccoutant@google.com>
2282
2283         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2284         Dwarf_info_reader::read_from_pointer.
2285         (Dwarf_pubnames_table::read_header): Likewise.
2286         (Dwarf_pubnames_table::next_name): Likewise.
2287         (Dwarf_die::read_attributes): Likewise.
2288         (Dwarf_die::skip_attributes): Likewise.
2289         (Dwarf_info_reader::read_from_pointer): New function template.
2290         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2291         (Dwarf_pubnames_table): Likewise.
2292         (Dwarf_info_reader::read_from_pointer): New function template.
2293         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2294         Dwarf_pubnames_table ctor.
2295
2296 2012-10-23  Cary Coutant  <ccoutant@google.com>
2297
2298         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2299         abbrev_shndx.
2300         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2301         abbrev_shndx_.
2302         (Dwarf_info_reader::set_abbrev_shndx): New method.
2303         (Dwarf_info_reader::abbrev_shndx_): New data member.
2304
2305 2012-10-23  Cary Coutant  <ccoutant@google.com>
2306
2307         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2308         from object, not parameters.
2309         (Dwarf_info_reader::parse): Likewise.
2310         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2311         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2312         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2313         methods.
2314
2315 2012-10-23  Cary Coutant  <ccoutant@google.com>
2316
2317         * fileread.cc (Input_file::Input_file): New constructor.
2318         * fileread.h (class Input_file): Add new constructor.
2319
2320 2012-10-18  Alan Modra  <amodra@gmail.com>
2321
2322         PR gold/14727
2323         * object.cc (Relobj::is_section_name_included): Also match
2324         .sdata personality section.
2325
2326 2012-10-18  Alan Modra  <amodra@gmail.com>
2327
2328         * target-reloc.h (class Default_comdat_behavior): New, package up..
2329         (get_comdat_behaviour): ..this.
2330         (relocate_section): Add Relocate_comdat_behavior template arg,
2331         adjust code to suit.
2332         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2333         (Target_arm::scan_reloc_section): Likewise.
2334         * i386.cc (Target_i386::relocate_section): Likewise.
2335         * sparc.cc (Target_sparc::relocate_section): Likewise.
2336         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2337         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2338         * powerpc.cc (class Relocate_comdat_behavior): New.
2339         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2340         gold::relocate_section with new template arg.
2341
2342 2012-10-18  Alan Modra  <amodra@gmail.com>
2343
2344         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2345         dynamic relocs for GOT_TPREL got entries, without symbol if
2346         resolving locally.
2347         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2348         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2349         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2350
2351 2012-10-17  Alan Modra  <amodra@gmail.com>
2352
2353         PR gold/14726
2354         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2355
2356 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2357
2358         * layout.cc (Layout::include_section): Keep sections marked
2359         SHF_EXCLUDE when doing relocatable links.
2360
2361 2012-10-16  Alan Modra  <amodra@gmail.com>
2362
2363         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2364         (Target_powerpc::do_finalize_sections): Call it.
2365         (Output_data_save_res): New class and supporting functions.
2366         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2367         normal symbols defined in object files.
2368
2369 2012-10-12  Alan Modra  <amodra@gmail.com>
2370
2371         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2372         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2373         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2374         section if scan_opd_relocs not yet called.
2375         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2376
2377 2012-10-12  Alan Modra  <amodra@gmail.com>
2378
2379         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2380         add_local_ifunc_entry): Revert last change.
2381         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2382
2383 2012-10-05  Alan Modra  <amodra@gmail.com>
2384
2385         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2386         do_plt_address_for_global): New functions.
2387         (Output_data_got_powerpc::do_write): Don't segfault when linking
2388         statically.
2389         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2390         add_local_ifunc_entry): Return true on adding entry..
2391         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2392         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2393         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2394         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2395         set up symbols here.
2396         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2397         syms here.  Do so even when no .iplt.  Don't segfault when linking
2398         statically.
2399         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2400         new variants without reloc param.
2401         (Glink_sym_ent::Glink_sym_ent): Likewise.
2402         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2403         reloc when refs will resolve to plt call stub.
2404         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2405         R_PPC_PLTREL24 to resolve locally.
2406         (Target_powerpc::Scan::global): Correct ifunc handling.
2407         (Target_powerpc::Relocate::relocate): Correct local sym glink
2408         lookup.  Don't destroy "value" when we have a plt call stub,
2409         and when checking plt call validity.
2410         (Target_powerpc::do_dynsym_value): Simplify.
2411
2412 2012-10-05  Alan Modra  <amodra@gmail.com>
2413
2414         * i386.cc (Output_data_plt_i386::address_for_global,
2415         address_for_local): Add plt offset to returned value.  Adjust uses.
2416         * sparc.cc (Output_data_plt_sparc::address_for_global,
2417         address_for_local): Likewise.
2418         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2419         address_for_local): Likewise.
2420         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2421         address_for_local): Likewise.
2422         * target.h (Target::plt_address_for_global, plt_address_for_local):
2423         Update comment.
2424         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2425         (Output_data_got::Got_entry::write): Nor here.
2426         * output.h: Comment fix.
2427
2428 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2429
2430         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2431         global_offset_table_ value for larget got.
2432         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2433
2434 2012-09-29  Alan Modra  <amodra@gmail.com>
2435
2436         * powerpc.cc (Target_powerpc::iplt_): New output section.
2437         (Target_powerpc::iplt_section, make_iplt_section,
2438         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2439         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2440         Target_powerpc::plt_entry_count): Count iplt entries too.
2441         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2442         reloc section in constructor.  New params.
2443         (Target_powerpc::make_plt_section): Create reloc section here instead.
2444         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2445         functions.
2446         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2447         (Output_data_glink::add_entry, find_entry): New functions to
2448         deal with local syms.
2449         (Glink_sym_ent): Add support for local syms.
2450         (Output_data_glink::do_write): Handle ifunc plt entries.
2451         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2452         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2453         (Target_powerpc::Relocate::relocate): Likewise.
2454         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2455
2456 2012-09-25  Alan Modra  <amodra@gmail.com>
2457
2458         * object.h (Sized_relobj_file::adjust_local_symbol,
2459         do_adjust_local_symbol): New functions.
2460         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2461         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2462         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2463         and irregular opd entry spacing.
2464         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2465         (Global_symbol_visitor_opd): New functor.
2466         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2467         on deleted opd entries.
2468
2469 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2470
2471         * tilegx.cc: New file.
2472         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2473         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2474         * configure.tgt: Add entries for tilegx*.
2475         * configure.ac: Likewise.
2476         * Makefile.in: Rebuild.
2477         * configure: Likewise.
2478         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2479         tilegx.
2480
2481 2012-09-13  Alan Modra  <amodra@gmail.com>
2482
2483         * target-reloc.h (scan_relocs): Call scan.local for relocs
2484         against symbols in discarded sections.  Pass is_discarded
2485         param.
2486         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2487         Add is_discarded param.
2488         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2489         is_discarded to flag opd entry as discarded.  Don't emit dyn
2490         relocs on such entries.
2491         (Target_powerpc::Scan::global): Similarly detect and handle
2492         such opd entries.
2493         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2494         opd_ent_.  Update all uses.
2495         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2496         (Target_powerpc::relocate_section): Zero out discarded opd
2497         entry relocs.
2498
2499 2012-09-12  Ian Lance Taylor  <iant@google.com>
2500
2501         PR gold/14570
2502         * output.cc: Rename Output_data_got template parameter from size
2503         to got_size for all functions.  Compile all variants of
2504         Output_data_got.
2505         (Output_data_got::Got_entry::write): Correct use of size for
2506         symbol value.  Use local_is_tls rather than casting to
2507         Sized_relobj_file.
2508         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2509         (class Sized_relobj_file): Add do_local_is_tls.
2510         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2511
2512 2012-09-11  Alan Modra  <amodra@gmail.com>
2513
2514         PR gold/14566
2515         * layout.cc (Layout::set_segment_offsets): When using
2516         common-page-size alignment, ensure we are on a new max-page-size
2517         page.
2518         * output.cc (Output_segment::set_section_addresses): Use
2519         abi_pagesize, not common_pagesize for relro boundary.
2520         (Output_segment::set_offset): Likewise.
2521
2522 2012-09-11  Alan Modra  <amodra@gmail.com>
2523
2524         * output.h (Output_data_got::add_global_tls, add_local_tls,
2525         add_local_tls_pair): New functions.
2526         (Output_data_got::add_local_pair_with_rel): Remove second
2527         reloc param.  Expand comment.
2528         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2529         use_plt_or_tls_offset_, similarly for constructor param.
2530         (Output_data_got::Got_entry::write): Add got_index param.
2531         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2532         add_local_tls_pair): New functions.
2533         (Output_data_got::Got_entry::write): Handle tls symbols
2534         with use_plt_or_tls_offset_ set specially.
2535         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2536         (Output_data_got::do_write): Replace iterator with index, pass
2537         index to entry write function.
2538         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2539         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2540         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2541         call.
2542         * i386.cc (Target_i386::Scan::local): Likewise.
2543         * sparc.cc (Target_sparc::Scan::local): Likewise.
2544         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2545         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2546         do_tls_offset_for_global): New functions.
2547         (Target_powerpc::Scan::local): Correct TLS relocations and got
2548         entry values.
2549         (Target_powerpc::Scan::global): Don't emit unnecessary
2550         dynamic relocations on TLS GOT entries.
2551
2552 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2553
2554         * config.in: Disable sanity check for kfreebsd.
2555
2556 2012-09-10  Sterling Augustine  <saugustine@google.com>
2557
2558         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2559         (Gdb_index::pubtypes_read): New parameter.
2560         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2561         to calls.
2562         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2563         pubtypes_object_.
2564
2565 2012-09-09  Alan Modra  <amodra@gmail.com>
2566
2567         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2568         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2569         * gc.h (gc_process_relocs): Call target gc_add_reference.
2570         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2571         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2572         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2573         unnecessary cast.
2574         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2575         to cater for when we don't need code offset.  Update use.
2576         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2577         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2578         set_opd_valid): New functions.
2579         (Target_powerpc::do_gc_add_reference): New function.
2580         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2581         stashed refs.
2582         (Target_powerpc::do_gc_mark_symbol): New function.
2583
2584 2012-09-06  Cary Coutant  <ccoutant@google.com>
2585
2586         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2587         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2588         (Dwarf_die::skip_attributes): Likewise.
2589         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2590         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2591         (main): Call it.
2592         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2593
2594 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2595
2596         * testsuite/script_test_3.t: Add .got.plt output section
2597         statement.
2598         * testsuite/script_test_4.t: Likewise.
2599
2600 2012-09-05  Alan Modra  <amodra@gmail.com>
2601
2602         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2603         update all uses and lose "enum" when using type.
2604
2605 2012-09-05  Alan Modra  <amodra@gmail.com>
2606
2607         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2608         * configure: Regenerate.
2609         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2610         (plugin_final_layout.stdout): Likewise.
2611         (memory_test): Set page sizes to 0x1000.
2612         * testsuite/Makefile.in: Regenerate.
2613         * testsuite/discard_locals_test.sh: Add FIXME comment.
2614         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2615         * testsuite/pr14265.t: Add .got output section statement.
2616         * testsuite/script_test_2.t: Likewise.
2617         * testsuite/script_test_3.t: Likewise.
2618         * testsuite/script_test_4.t: Likewise.
2619         * testsuite/script_test_5.t: Likewise.
2620         * testsuite/script_test_6.t: Likewise.
2621         * testsuite/script_test_7.t: Likewise.
2622         * testsuite/script_test_9.t: Likewise.
2623
2624 2012-09-05  Alan Modra  <amodra@gmail.com>
2625
2626         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2627         (Powerpc_relocate_functions::Status): New typedef.
2628         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2629         (Target_powerpc::Scan::local): Handle REL64.
2630         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2631         for REL32 and REL64.
2632         (Target_powerpc::symval_for_branch): New function, extracted from..
2633         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2634         checks.  Report overflow errors.
2635
2636 2012-09-05  Alan Modra  <amodra@gmail.com>
2637
2638         * object.h (Sized_relobj_file::emit_relocs): Delete.
2639         (Sized_relobj_file::emit_relocs_reltype): Delete.
2640         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2641         relocate_relocs for --emit-relocs.
2642         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2643         * output.h: Update comment.
2644         (Output_segment::first_section): New function.
2645         (Output_segment::first_section_load_address): Use first_section.
2646         * output.cc (Output_segment::first_section): New function extracted..
2647         (Output_segment::first_section_load_address): ..from here.  Delete.
2648         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2649         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2650         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2651         adjust call to target.h function.
2652         * i386.cc (Target_i386): Likewise.
2653         * sparc.cc (Target_sparc): Likewise.
2654         * x86_64.cc (Target_x86_64): Likewise.
2655         * powerpc.cc (Target_powerpc): Likewise.
2656         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2657         first tls section has section symbol for optimised local dynamic
2658         output relocs.
2659         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2660         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2661         optimised tls code.
2662         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2663         Rename to relocate_relocs.  Update error message.
2664
2665 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2666
2667         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2668         --just-symbols.
2669
2670 2012-08-31  Alan Modra  <amodra@gmail.com>
2671
2672         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2673         (Powerpc_relobj::toc_base_offset): New stub function.
2674         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2675         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2676         (Target_powerpc::Relocate::enum skip_tls): New.
2677         (Target_powerpc::call_tls_get_addr_): New var.
2678         (Target_powerpc::is_branch_reloc): Move to file scope.
2679         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2680         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2681         New functions.
2682         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2683         (powerpc_info): Correct common_pagesize for ppc64.
2684         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2685         (Powerpc_relocate_functions): Add overflow check enums and functions.
2686         Add non-shift version of rela, rela_ua.  Delete all rel public
2687         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2688         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2689         addr16_ha3, addr14 functions.
2690         (Output_data_got_powerpc::add_constant_pair): New function.
2691         (Output_data_got_powerpc::got_base_offset): Likewise.
2692         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2693         (instruction constants): Sort, add some more.
2694         (Output_data_glink::do_write): Add and use Address typedef.  Use
2695         object->toc_base_offset() stub for 64-bit.
2696         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2697         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2698         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2699         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2700         Always treat .opd relocs as against locally defined symbol.
2701         Correct condition for RELATIVE relocs.
2702         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2703         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2704         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2705         calculations.  Handle TLS relocs, and more.  Add overflow
2706         checking and adjust for Powerpc_relocate_functions changes.
2707         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2708         Reinstate --emit-relocs code with FIXME.
2709
2710 2012-08-30  Alan Modra  <amodra@gmail.com>
2711
2712         * layout.cc (Layout::set_segment_offsets): Set p_align to
2713         abi_pagesize, not common_pagesize.
2714         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2715         to determine whether file header can go in segment.
2716
2717 2012-08-30  Alan Modra  <amodra@gmail.com>
2718
2719         * output.h (Output_reloc::Output_reloc <output section>): Add
2720         is_relative param.  Adjust calls.
2721         (Output_reloc::add_output_section_relative): New functions.
2722         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2723         is_relative.
2724         (Output_reloc::symbol_value): Handle SECTION_CODE.
2725
2726 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2727
2728         * gold.cc (queue_middle_tasks): Call layout again when unique
2729         segments for sections is desired.
2730         * layout.cc (Layout::Layout): Initialize new members.
2731         (Layout::get_output_section_flags): New function.
2732         (Layout::choose_output_section): Call get_output_section_flags.
2733         (Layout::layout): Make output section for mapping to a unique segment.
2734         (Layout::insert_section_segment_map): New function.
2735         (Layout::attach_allocated_section_to_segment): Make unique segment for
2736         output sections marked so.
2737         (Layout::segment_precedes): Check for unique segments when sorting.
2738         * layout.h (Layout::Unique_segment_info): New struct.
2739         (Layout::Section_segment_map): New typedef.
2740         (Layout::insert_section_segment_map): New function.
2741         (Layout::get_output_section_flags): New function.
2742         (Layout::is_unique_segment_for_sections_specified): New function.
2743         (Layout::set_unique_segment_for_sections_specified): New function.
2744         (Layout::unique_segment_for_sections_specified_): New member.
2745         (Layout::section_segment_map_): New member.
2746         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2747         Rename is_gc_pass_one to is_pass_one.
2748         Rename is_gc_pass_two to is_pass_two.
2749         Rename is_gc_or_icf to is_two_pass.
2750         Check for which pass based on whether symbols data is present.
2751         Make it two pass when unique segments for sections is desired.
2752         * output.cc (Output_section::Output_section): Initialize new
2753         members.
2754         * output.h (Output_section::is_unique_segment): New function.
2755         (Output_section::set_is_unique_segment): New function.
2756         (Output_section::is_unique_segment_): New member.
2757         (Output_section::extra_segment_flags): New function.
2758         (Output_section::set_extra_segment_flags): New function.
2759         (Output_section::extra_segment_flags_): New member.
2760         (Output_section::segment_alignment): New function.
2761         (Output_section::set_segment_alignment): New function.
2762         (Output_section::segment_alignment_): New member.
2763         (Output_segment::Output_segment): Initialize is_unique_segment_.
2764         (Output_segment::is_unique_segment): New function.
2765         (Output_segment::set_is_unique_segment): New function.
2766         (Output_segment::is_unique_segment_): New member.
2767         * plugin.cc (allow_unique_segment_for_sections): New function.
2768         (unique_segment_for_sections): New function.
2769         (Plugin::load): Add new functions to transfer vector.
2770         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2771         * Makefile.in: Regenerate.
2772         * testsuite/plugin_final_layout.sh: Check if unique segment
2773         functionality works.
2774         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2775         are available.
2776         (allow_unique_segment_for_sections): New global.
2777         (unique_segment_for_sections): New global.
2778         (claim_file_hook): Call allow_unique_segment_for_sections.
2779         (all_symbols_read_hook): Call unique_segment_for_sections.
2780
2781 2012-08-22  Cary Coutant  <ccoutant@google.com>
2782
2783         * layout.cc (Layout::include_section): Don't assert on GROUP
2784         sections with --emit-relocs.
2785
2786 2012-08-21  Cary Coutant  <ccoutant@google.com>
2787
2788         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2789         if --export-dynamic-symbol names an undef symbol.
2790
2791 2012-08-18  Alan Modra  <amodra@gmail.com>
2792
2793         * powerpc.cc: Formatting and white space.
2794         (Powerpc_relobj): Rename got2_section_ to special_.
2795         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2796         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2797         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2798         (Target_powerpc): Add Address typedef and invalid_address.  Use
2799         throughout.
2800         (Target_powerpc::is_branch_reloc): New function.
2801         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2802         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2803         for dst_mask, value and addend.
2804         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2805         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2806         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2807         uint16_t for 24-bit offset.  Use get_output_section_offset and
2808         check return.
2809         (Target_powerpc::Scan::local): Handle more relocs.
2810         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2811         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2812         Plug in toc restoring insn after plt calls.  Translate branches
2813         to function descriptor symbols to corresponding entry point.
2814         (Target_powerpc::relocate_for_relocatable): Check return from
2815         get_output_section_offset.
2816         * symtab.h: Comment typo.
2817
2818 2012-08-14  Ian Lance Taylor  <iant@google.com>
2819
2820         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2821         unsupported_relocal_local to call unsupported_reloc_global.
2822
2823 2012-08-14  Nick Clifton  <nickc@redhat.com>
2824
2825         PR ld/14265
2826         * script-sections.cc (Sections_element::output_section_name): Add
2827         keep return parameter.
2828         (Output_section_element::match_name): Add keep return parameter.
2829         Return the value of the keep_ member.
2830         * script-sections.h (class Output_section): Update
2831         output_section_name prototype.
2832         * layout.cc (Layout::keep_input_section): New public member
2833         function.
2834         (Layout::choose_output_section): Pass keep parameter to
2835         output_section_name.
2836         * layout.h (class Layout): Add keep_input_section.
2837         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2838         sections.
2839         * testsuite/Makefile.am: Add a test.
2840         * testsuite/Makefile.in: Regenerate.
2841         * testsuite/pr14265.c: Source file for the test.
2842         * testsuite/pr14265.t: Linker script for the test.
2843         * testsuite/pr14265.sh: Shell script for the test.
2844
2845 2012-08-14  Alan Modra  <amodra@gmail.com>
2846
2847         * target.h (Target::output_section_name): New function.
2848         (Target::do_output_section_name): New function.
2849         * layout.cc (Layout::choose_output_section): Call the above.
2850         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2851
2852 2012-08-14  Alan Modra  <amodra@gmail.com>
2853
2854         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2855         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2856         for replace_constant call.
2857         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2858         (Output_data_glink::do_print_to_mapfile): New function.
2859         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2860         (Target_powerpc::Relocate::relocate): Likewise.
2861
2862 2012-08-14  Alan Modra  <amodra@gmail.com>
2863
2864         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2865         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2866         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2867         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2868         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2869         here.
2870         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2871         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2872         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2873         here.
2874         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2875         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2876
2877 2012-08-12  Alan Modra  <amodra@gmail.com>
2878
2879         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2880         (glink insn constants): Use uint32_t.
2881         (Output_data_glink::add_entry): Use insert, not [] operator.
2882
2883 2012-08-11  Alan Modra  <amodra@gmail.com>
2884
2885         * object.h (Sized_relobj_file::find_shdr): New function.
2886         (Sized_relobj_file::find_special_sections): New function.
2887         * object.cc (Sized_relobj_file::find_shdr): New function.
2888         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2889         (Sized_relobj_file::find_special_sections): New function, split out..
2890         (Sized_relobj_file::do_read_symbols): ..from here.
2891         * output.h (Output_data_got::replace_constant): New function.
2892         (Output_data_got::num_entries): New function.
2893         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2894         (Output_data_got::got_offset): Protected rather than private.
2895         (Output_data_got::replace_got_entry): New function.
2896         * output.cc (Output_data_got::replace_got_entry): New function.
2897         * powerpc.cc (class Powerpc_relobj): New.
2898         (class Powerpc_relocate_functions): Delete all psymval variants or
2899         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2900         Implement _ha functions using corresponding _hi function.
2901         (Powerpc_relobj::find_special_sections): New function.
2902         (Target_powerpc::do_make_elf_object): New function.
2903         (class Output_data_got_powerpc): New.
2904         (class Output_data_glink): New.
2905         (class Powerpc_scan_relocatable_reloc): New.
2906         Many more changes througout file.
2907
2908 2012-08-09  Nick Clifton  <nickc@redhat.com>
2909
2910         * po/vi.po: Updated Vietnamese translation.
2911
2912 2012-08-07  Ian Lance Taylor  <iant@google.com>
2913
2914         * layout.cc (Layout::add_target_dynamic_tags): If
2915         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2916         plt_rel.
2917
2918 2012-07-30  Nick Clifton  <nickc@redhat.com>
2919
2920         * po/gold.pot: Updated template.
2921         * po/es.po: Updated Spanish translation.
2922
2923 2012-07-18  Cary Coutant  <ccoutant@google.com>
2924
2925         PR gold/14344
2926         * configure.ac: Add check for -gpubnames support.
2927         * configure: Regenerate.
2928         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2929         support; force -gno-pubnames.
2930         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2931         support.
2932         (gdb_index_test_4): New test.
2933         * testsuite/Makefile.in: Regenerate.
2934         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2935         * testsuite/gdb_index_test_2.sh: Likewise.
2936         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2937         * testsuite/gdb_index_test_4.sh: New script.
2938         * testsuite/gdb_index_test_comm.sh: New script with common code;
2939         don't look for space after colon.
2940
2941 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2942
2943         * gold.cc (queue_middle_tasks): Update function order only after
2944         deferred objects due to plugins are processed.
2945
2946 2012-07-11  Ian Lance Taylor  <iant@google.com>
2947
2948         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2949         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2950         (Target_arm::scan_reloc_for_stub): Likewise.
2951         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2952         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2953         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2954         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2955         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2956
2957 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2958             Ian Lance Taylor  <iant@google.com>
2959
2960         PR gold/14309
2961         * configure.ac: Test whether std::tr1::hash<off_t> works.
2962         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2963         needed.
2964         * output.h (class Output_fill): Add virtual destructor.
2965         * configure, config.in: Rebuild.
2966
2967 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2968
2969         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2970
2971 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2972
2973         * plugin.cc (Plugin::load): Handle position independent executables.
2974
2975 2012-06-06  Cary Coutant  <ccoutant@google.com>
2976
2977         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2978         add .debug_macro.
2979         (lines_only_debug_sections): Likewise.
2980         (gdb_fast_lookup_sections): New static array.
2981         (is_gdb_debug_section): Rename formal parameter.
2982         (is_lines_only_debug_section): Likewise.
2983         (is_gdb_fast_lookup_section): New function.
2984         (Layout::include_section): Check for ".zdebug_" prefix; pass
2985         section name suffix to is_gdb_debug_section, et al.; check for
2986         fast-lookup sections when building .gdb_index.
2987         * options.h (--strip-debug-gdb): Update GDB version number.
2988
2989 2012-06-06  Cary Coutant  <ccoutant@google.com>
2990
2991         * configure.ac: Add check for fallocate.
2992         * configure: Regenerate.
2993         * config.in: Regenerate.
2994
2995         * options.h (class General_options): Add --mmap-output-file and
2996         --posix-fallocate options.
2997         * output.cc: (posix_fallocate): Remove; replace with...
2998         (gold_fallocate): New function.
2999         (Output_file::map_no_anonymous): Call gold_fallocate.
3000         (Output_file::map): Check --mmap-output-file option.
3001
3002 2012-06-05  Jing Yu  <jingyu@google.com>
3003
3004         * gold.h (textdomain): Add do {} to empty while(0).
3005         (bindtextdomain): Likewise.
3006
3007 2012-06-04  Cary Coutant  <ccoutant@google.com>
3008
3009         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3010         has_dynsym_index.
3011
3012 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3013
3014         * symtab.cc (Symbol_table::define_special_symbol):
3015         Initialize *poldsym to prevent uninitialized variable errors.
3016
3017 2012-05-23  Cary Coutant  <ccoutant@google.com>
3018
3019         * layout.cc (Layout::section_name_mapping): Add rules to handle
3020         exact match on .data.rel.ro.local or .data.rel.ro.
3021         (Layout::output_section_name): Check for exact matches.
3022
3023 2012-05-23  Cary Coutant  <ccoutant@google.com>
3024
3025         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3026         more carefully.
3027
3028 2012-05-22  Cary Coutant  <ccoutant@google.com>
3029
3030         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3031         object before exporting symbol.
3032
3033 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3034
3035         * testsuite/tls_test.cc: Include "config.h" first.
3036         * testsuite/tls_test_c.c: Likewise.
3037
3038 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3039             Nick Clifton  <nickc@redhat.com>
3040
3041         PR 14072
3042         * configure.in: Add check that sysdep.h has been included before
3043         any system header files.
3044         * configure: Regenerate.
3045         * config.in: Regenerate.
3046
3047 2012-05-14  Cary Coutant  <ccoutant@google.com>
3048
3049         * layout.cc (Layout::make_output_section): Mark .tdata section
3050         as RELRO.
3051         * testsuite/relro_test.cc: Add a TLS variable.
3052
3053 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3054
3055         PR gold/14091
3056         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3057         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3058         R_X86_64_64.
3059
3060 2012-05-08  Cary Coutant  <ccoutant@google.com>
3061
3062         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3063         (lines_only_debug_sections): Likewise.
3064
3065 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3066
3067         * nacl.cc: New file.
3068         * nacl.h: New file.
3069         * Makefile.am (CCFILES, HFILES): Add them.
3070         * Makefile.in: Regenerate.
3071         * i386.cc (Output_data_plt_i386_nacl): New class.
3072         (Output_data_plt_i386_nacl_exec): New class.
3073         (Output_data_plt_i386_nacl_dyn): New class.
3074         (Target_i386_nacl): New class.
3075         (Target_selector_i386_nacl): New class.
3076         (target_selector_i386): Use it instead of Target_selector_i386.
3077         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3078         (Target_x86_64_nacl): New class.
3079         (Target_selector_x86_64_nacl): New class.
3080         (target_selector_x86_64, target_selector_x32): Use it instead of
3081         Target_selector_x86_64.
3082         * arm.cc (Output_data_plt_arm_nacl): New class.
3083         (Target_arm_nacl): New class.
3084         (Target_selector_arm_nacl): New class.
3085         (target_selector_arm, target_selector_armbe): Use it instead of
3086         Target_selector_arm.
3087
3088         * target-select.cc (select_target): Take new Input_file* and off_t
3089         arguments, pass them on to recognize method of selector.
3090         * object.cc (make_elf_sized_object): Update caller.
3091         * parameters.cc (parameters_force_valid_target): Likewise.
3092         * incremental.cc (make_sized_incremental_binary): Likewise.
3093         * target-select.h: Update decl.
3094         (Target_selector::recognize): Take new Input_file* argument,
3095         pass it on to do_recognize.
3096         (Target_selector::do_recognize): Take new Input_file* argument.
3097         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3098         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3099         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3100         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3101
3102         * target.h (Target::Target_info): New members isolate_execinstr
3103         and rosegment_gap.
3104         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3105         * arm.cc (Target_arm::arm_info): Update initializer.
3106         * i386.cc (Target_i386::i386_info): Likewise.
3107         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3108         * sparc.cc (Target_sparc::sparc_info): Likewise.
3109         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3110         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3111         * layout.cc (Layout::attach_allocated_section_to_segment):
3112         Take new const Target* argument.  If target->isolate_execinstr(), act
3113         like --rosegment.
3114         (Layout::find_first_load_seg): Take new const Target* argument;
3115         if target->isolate_execinstr(), reject PF_X segments.
3116         (Layout::relaxation_loop_body): Update caller.
3117         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3118         reset file offset to zero when we hit LOAD_SEG, and then do a second
3119         loop over the segments before LOAD_SEG to reassign offsets after
3120         addresses have been determined.  Handle target->rosegment_gap().
3121         (Layout::attach_section_to_segment): Take new const Target* argument;
3122         pass it to attach_allocated_section_to_segment.
3123         (Layout::make_output_section): Update caller.
3124         (Layout::attach_sections_to_segments): Take new const Target* argument;
3125         pass it to attach_section_to_segment.
3126         * gold.cc (queue_middle_tasks): Update caller.
3127         * layout.h (Layout): Update method decls with new arguments.
3128
3129         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3130         Target_info pointer to use.
3131         (Target_arm::do_make_data_plt): New virtual method.
3132         (Target_arm::make_data_plt): New method that calls it.
3133         (Target_arm::make_plt_entry): Use it.
3134         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3135         for the section alignment.
3136         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3137         method.
3138         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3139         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3140         method.
3141         (Output_data_plt_arm::get_plt_entry_size): Call it.
3142         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3143         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3144         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3145         method.
3146         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3147         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3148         method instead of sizeof(plt_entry).
3149         (Output_data_plt_arm::add_entry): Likewise.
3150         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3151         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3152         than static method.
3153         (Target_arm::plt_entry_size): Likewise.
3154         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3155         Move to ...
3156         (Output_data_plt_arm_standard): ... here, new class.
3157         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3158         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3159         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3160
3161         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3162         Take additional argument for the PLT entry size.
3163         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3164         Use get_plt_entry_size method rather than plt_entry_size variable.
3165         (Output_data_plt_x86_64::reserve_slot): Likewise.
3166         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3167         (Output_data_plt_x86_64::add_entry): Likewise.
3168         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3169         (Output_data_plt_x86_64::address_for_global): Likewise.
3170         (Output_data_plt_x86_64::address_for_local): Likewise.
3171         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3172         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3173         Make method non-static.
3174         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3175         method.
3176         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3177         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3178         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3179         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3180         virtual method.
3181         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3182         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3183         virtual method.
3184         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3185         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3186         virtual method.
3187         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3188         (Output_data_plt_x86_64::plt_entry_size)
3189         (Output_data_plt_x86_64::first_plt_entry)
3190         (Output_data_plt_x86_64::plt_entry)
3191         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3192         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3193         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3194         (Output_data_plt_x86_64_standard): ... here, new class.
3195         (Target_x86_64::Target_x86_64): Take optional argument for the
3196         Target_info pointer to use.
3197         (Target_x86_64::do_make_data_plt): New virtual method.
3198         (Target_x86_64::make_data_plt): New method to call it.
3199         (Target_x86_64::init_got_plt_for_update): Use that.
3200         Call this->plt_->add_eh_frame method here.
3201         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3202         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3203         rather than static method.
3204         (Target_x86_64::plt_entry_size): Likewise.
3205         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3206         rather than plt_entry_size variable.  Move guts of PLT filling to...
3207         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3208         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3209         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3210
3211         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3212         additional argument for the section alignment.
3213         Don't do add_eh_frame_for_plt here.
3214         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3215         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3216         variable.
3217         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3218         method.
3219         (Output_data_plt_i386::get_plt_entry_size): Call it.
3220         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3221         (Output_data_plt_i386::add_eh_frame): New method to call it.
3222         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3223         method.
3224         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3225         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3226         method.
3227         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3228         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3229         method instead of plt_entry_size.
3230         (Output_data_plt_i386::plt_entry_size)
3231         (Output_data_plt_i386::plt_eh_frame_fde_size)
3232         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3233         (Output_data_plt_i386_standard): ... here, new class.
3234         (Output_data_plt_i386_exec): New class.
3235         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3236         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3237         (Output_data_plt_i386::exec_plt_entry): Move to ...
3238         (Output_data_plt_i386_exec::plt_entry): ... here.
3239         (Output_data_plt_i386_dyn): New class.
3240         (Output_data_plt_i386::first_plt_entry): Move to ...
3241         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3242         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3243         (Output_data_plt_i386_dyn::plt_entry): ... here.
3244         (Target_i386::Target_i386): Take optional argument for the Target_info
3245         pointer to use.
3246         (Target_i386::do_make_data_plt): New virtual method.
3247         (Target_i386::make_data_plt): New method to call it.
3248         (Target_i386::make_plt_section): Use that.
3249         Call this->plt_->add_eh_frame method here.
3250         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3251         rather than plt_entry_size variable.
3252         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3253         (Output_data_plt_i386::address_for_local): Likewise.
3254         (Output_data_plt_i386::do_write): Likewise.
3255         Move guts of PLT filling to...
3256         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3257         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3258         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3259         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3260
3261 2012-05-01  Cary Coutant  <ccoutant@google.com>
3262
3263         * dwarf_reader.cc (Dwarf_die::read_attributes)
3264         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3265         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3266         * reduced_debug_output.cc
3267         (Output_reduced_debug_info_section::get_die_end): Remove
3268         DW_FORM_GNU_ref_index.  Add default case.
3269
3270 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3271
3272         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3273         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3274         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3275         DW_AT_high_pc as offset from DW_AT_low_pc.
3276
3277         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3278         * testsuite/Makefile.in: Regenerate.
3279         * testsuite/gdb_index_test_3.c: New test source file.
3280         * testsuite/gdb_index_test_3.sh: New test source file.
3281
3282 2012-04-25  Ian Lance Taylor  <iant@google.com>
3283
3284         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3285         pointer.
3286         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3287         as a class, not a struct.
3288         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3289         (Target_arm::apply_cortex_a8_workaround): Likewise.
3290         * gc.h: Declare Reloc_types as a struct, not a class.
3291         * object.h: Declare Symbols_data as a struct.
3292         * reloc.h: Declare Read_relocs_data as a struct.
3293         * target.h: Declare Relocate_info as a struct.
3294
3295 2012-04-24  David S. Miller  <davem@davemloft.net>
3296
3297         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3298         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3299         and R_SPARC_WPLT30.
3300
3301 2012-04-24  Cary Coutant  <ccoutant@google.com>
3302
3303         * incremental-dump.cc (find_input_containing_global): Replace
3304         magic number with symbolic constant.
3305         (dump_incremental_inputs): Update version number.
3306         * incremental.cc (Output_section_incremental_inputs): Update version
3307         number; import symbolic constants from Incremental_inputs_reader.
3308         (Incremental_inputs::create_data_sections): Align relocations
3309         section correctly for 64-bit targets.
3310         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3311         constants; add padding.
3312         (Output_section_incremental_inputs::write_header): Add assert for
3313         header_size.
3314         (Output_section_incremental_inputs::write_input_files): Add assert
3315         for input_entry_size.
3316         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3317         add assert for object_info_size, input_section_entry_size,
3318         global_sym_entry_size.
3319         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3320         for data structure sizes; use them.
3321         (Incremental_input_entry_reader): Import symbolic constants from
3322         Incremental_inputs_reader; use them.
3323
3324 2012-04-23  David S. Miller  <davem@davemloft.net>
3325
3326         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3327         and elf_flags_set_.
3328         (Target_sparc::Target_sparc): Initialize new fields.
3329         (Target_sparc::do_make_elf_object): New function.
3330         (Target_sparc::do_adjust_elf_header): New function.
3331
3332 2012-04-23  Cary Coutant  <ccoutant@google.com>
3333
3334         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3335         CU range table of gdb index.
3336
3337 2012-04-20  David S. Miller  <davem@davemloft.net>
3338
3339         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3340         instead of false.
3341
3342 2012-04-16  David S. Miller  <davem@davemloft.net>
3343
3344         * sparc.cc (Target_sparc::got_address): New function.
3345         (Sparc_relocate_functions::gdop_hix22): New function.
3346         (Sparc_relocate_functions::gdop_lox10): New function.
3347         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3348         relocs.
3349         (Target_sparc::Scan::local): Likewise if the global symbol is not
3350         preemptible and is not IFUNC.
3351         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3352         transformations for local and non-preemptible non-IFUNC global
3353         symbols.
3354
3355         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3356         writing out 64-bit part of ranges.
3357
3358         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3359         -fpic and -fpie respectively.
3360         * Makefile.in: Regenerate.
3361
3362         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3363         (Target_sparc::Target_sparc): Initialize new field.
3364         (Target_sparc::do_plt_section_for_global): New function.
3365         (Target_sparc::do_plt_section_for_local): New function.
3366         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3367         (Target_sparc::make_plt_section): New function, broken out of
3368         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3369         (Target_sparc::make_plt_entry): Call make_plt_section.
3370         (Target_sparc::make_local_ifunc_plt_entry): New function.
3371         (Target_sparc::rela_ifunc_section): New function.
3372         (Target_sparc::plt_section): Remove const.
3373         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3374         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3375         and ifunc_count_ fields.
3376         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3377         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3378         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3379         (Output_data_plt_sparc::rela_ifunc): New function.
3380         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3381         (Output_data_plt_sparc::has_ifunc_section): New function.
3382         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3383         (Output_data_plt_sparc::address_for_global): New function.
3384         (Output_data_plt_sparc::address_for_local): New function.
3385         (Output_data_plt_sparc::plt_index_to_offset): New function.
3386         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3387         and entry_count.
3388         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3389         entry_count.
3390         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3391         R_SPARC_JMP_IREL to switch.
3392         (Target_sparc::Scan::check_non_pic): Likewise.
3393         (Target_sparc::Scan::local): Handle IFUNC symbols.
3394         (Target_sparc::Scan::local): Likewise.
3395         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3396         and plt_address_for_local.
3397         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3398         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3399
3400         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3401         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3402         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3403         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3404         global relocs too.
3405         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3406         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3407         calls.
3408         * sparc.cc (Target_sparc::Scan::global): Likewise.
3409         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3410
3411 2012-04-16  Cary Coutant  <ccoutant@google.com>
3412
3413         * archive.cc (Library_base::should_include_member): Check for
3414         --export-dynamic-symbol.
3415         * options.h (class General_options): Add --export-dynamic-symbol.
3416         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3417         --export-dynamic-symbol.
3418         (Symbol_table::gc_mark_undef_symbols): Likewise.
3419         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3420
3421 2012-04-12  David S. Miller  <davem@davemloft.net>
3422
3423         * sparc.cc (Reloc::wdisp10): New relocation method.
3424         (Reloc::h34): Likewise.
3425         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3426         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3427         R_SPARC_WDISP10.
3428         (Target_sparc::Scan::local): Likewise.
3429         (Target_sparc::Scan::global): Likewise.
3430         (Target_sparc::Relocate::relocate): Likewise.
3431
3432 2012-04-09  Cary Coutant  <ccoutant@google.com>
3433
3434         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3435         low_pc == 0.
3436
3437 2012-04-06  Ian Lance Taylor  <iant@google.com>
3438
3439         * timer.cc: #include <unistd.h>.
3440
3441 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3442
3443         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3444         * config.in: Regenerate.
3445         * configure: Regenerate.
3446
3447 2012-04-05  Nick Clifton  <nickc@redhat.com>
3448
3449         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3450         (AM_LC_MESSAGES): Add.
3451         * aclocal.m4: Regenerate.
3452         * config.in: Regenerate.
3453         * configure: Regenerate.
3454
3455 2012-03-21  Cary Coutant  <ccoutant@google.com>
3456
3457         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3458         * Makefile.in: Regenerate.
3459         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3460         (Sized_elf_reloc_mapper::symbol_section): New function.
3461         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3462         (make_elf_reloc_mapper): New function.
3463         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3464         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3465         (Dwarf_abbrev_table::do_get_abbrev): New function.
3466         (Dwarf_ranges_table::read_ranges_table): New function.
3467         (Dwarf_ranges_table::read_range_list): New function.
3468         (Dwarf_pubnames_table::read_section): New function.
3469         (Dwarf_pubnames_table::read_header): New function.
3470         (Dwarf_pubnames_table::next_name): New function.
3471         (Dwarf_die::Dwarf_die): New function.
3472         (Dwarf_die::read_attributes): New function.
3473         (Dwarf_die::skip_attributes): New function.
3474         (Dwarf_die::set_name): New function.
3475         (Dwarf_die::set_linkage_name): New function.
3476         (Dwarf_die::attribute): New function.
3477         (Dwarf_die::string_attribute): New function.
3478         (Dwarf_die::int_attribute): New function.
3479         (Dwarf_die::uint_attribute): New function.
3480         (Dwarf_die::ref_attribute): New function.
3481         (Dwarf_die::child_offset): New function.
3482         (Dwarf_die::sibling_offset): New function.
3483         (Dwarf_info_reader::check_buffer): New function.
3484         (Dwarf_info_reader::parse): New function.
3485         (Dwarf_info_reader::do_parse): New function.
3486         (Dwarf_info_reader::do_read_string_table): New function.
3487         (Dwarf_info_reader::lookup_reloc): New function.
3488         (Dwarf_info_reader::get_string): New function.
3489         (Dwarf_info_reader::visit_compilation_unit): New function.
3490         (Dwarf_info_reader::visit_type_unit): New function.
3491         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3492         Sized_elf_reloc_mapper.
3493         (Sized_dwarf_line_info::symbol_section): Remove function.
3494         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3495         (Sized_dwarf_line_info::read_line_mappings): Remove object
3496         parameter, adjust callers.
3497         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3498         * dwarf_reader.h: Include <sys/types.h>.
3499         (class Track_relocs): Remove forward declaration.
3500         (class Elf_reloc_mapper): New class.
3501         (class Sized_elf_reloc_mapper): New class.
3502         (class Dwarf_abbrev_table): New class.
3503         (class Dwarf_range_list): New class.
3504         (class Dwarf_ranges_table): New class.
3505         (class Dwarf_pubnames_table): New class.
3506         (class Dwarf_die): New class.
3507         (class Dwarf_info_reader): New class.
3508         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3509         (Sized_dwarf_line_info::symbol_section): Remove member function.
3510         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3511         base class.
3512         * gdb-index.cc: New source file.
3513         * gdb-index.h: New source file.
3514         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3515         and .debug_types sections, call Layout::add_to_gdb_index.
3516         (Sized_relobj_incr::do_section_name): Implement.
3517         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3518         return type; Implement.
3519         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3520         return type.
3521         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3522         parameter list and return type.
3523         (Sized_incr_dynobj::do_section_contents): Likewise.
3524         * layout.cc: Include gdb-index.h.
3525         (Layout::Layout): Initialize gdb_index_data_.
3526         (Layout::init_fixed_output_section): Check for .gdb_index section.
3527         (Layout::add_to_gdb_index): New function. Instantiate.
3528         * layout.h: Add forward declaration for class Gdb_index.
3529         (Layout::add_to_gdb_index): New member function.
3530         (Layout::gdb_index_data_): New data member.
3531         * main.cc: Include gdb-index.h.
3532         (main): Print statistics for gdb index.
3533         * object.cc (Object::section_contents): Move code into
3534         do_section_contents.
3535         (need_decompressed_section): Check for sections needed when building
3536         gdb index.
3537         (build_compressed_section_map): Likewise.
3538         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3539         gdb index.
3540         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3541         sections; call Layout::add_to_gdb_index.
3542         (Sized_relobj_file::do_decompressed_section_contents): Call
3543         do_section_contents directly.
3544         * object.h (Object::do_section_contents): Adjust parameter list and
3545         return type.
3546         (Object::do_decompressed_section_contents): Call do_section_contents
3547         directly.
3548         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3549         return type.
3550         * options.h (class General_options): Add --gdb-index option.
3551         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3552         list and return type.
3553         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3554         * reloc.h (Track_relocs::checkpoint): New function.
3555         (Track_relocs::reset): New function.
3556
3557         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3558         New test cases.
3559         * testsuite/Makefile.in: Regenerate.
3560         * testsuite/gdb_index_test.cc: New test source file.
3561         * testsuite/gdb_index_test_1.sh: New test source file.
3562         * testsuite/gdb_index_test_2.sh: New test source file.
3563
3564 2012-03-19  Doug Kwan  <dougkwan@google.com>
3565
3566         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3567         (Target_arm::do_finalize_sections): Remove code which defines
3568         __exidx_start and __exidx_end.  Make symbol table parameter
3569         anonymous as it is not used.
3570         * gold.cc (queue_middle_tasks): Call target hook to define any
3571         target-specific symbols.
3572         * target.h (Target::define_standard_symbols): New method.
3573         (Target::do_define_standard_symbols): Same.
3574         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3575         * testsuite/Makefile.in: Regenerate.
3576         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3577         and __exidx_end.
3578         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3579         relocations are generated for __exidx_start and __exidx_end.
3580
3581 2012-03-16  Doug Kwan  <dougkwan@google.com>
3582
3583         * testsuite/Makefile.am: Disable test initpri3b.
3584         * testsuite/Makefile.in: Regenerate.
3585
3586 2012-03-15  Doug Kwan  <dougkwan@google.com>
3587
3588         * arm.cc (Target_arm::got_section): Make .got section read-only
3589         if -z now is given.
3590
3591 2012-03-15  Ian Lance Taylor  <iant@google.com>
3592
3593         PR gold/13850
3594         * layout.cc (Layout::make_output_section): Correctly mark
3595         SHT_INIT_ARRAY, et. al., as relro.
3596
3597 2012-03-14  Doug Kwan  <dougkwan@google.com>
3598
3599         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3600         dynamic relocations for protected symbols in shared objects.
3601
3602 2012-03-13  Ian Lance Taylor  <iant@google.com>
3603
3604         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3605         keep the larger alignment.
3606
3607 2012-03-12  Cary Coutant  <ccoutant@google.com>
3608
3609         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3610         handling of DW_LNE_define_file.
3611
3612 2012-03-12  Cary Coutant  <ccoutant@google.com>
3613
3614         * reduced_debug_output.cc
3615         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3616         codes to switch.
3617
3618 2012-02-29  Cary Coutant  <ccoutant@google.com>
3619
3620         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3621
3622 2012-02-29  Cary Coutant  <ccoutant@google.com>
3623
3624         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3625         Call Object::decompressed_section_contents.
3626         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3627         New dtor.
3628         (Sized_dwarf_line_info::buffer_start_): New data member.
3629         * merge.cc (Output_merge_data::do_add_input_section): Call
3630         Object::decompressed_section_contents.
3631         (Output_merge_string::do_add_input_section): Likewise.
3632         * object.cc (need_decompressed_section): New function.
3633         (build_compressed_section_map): Decompress sections needed later.
3634         (Sized_relobj_file::do_decompressed_section_contents): New function.
3635         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3636         * object.h (Object::decompressed_section_contents): New function.
3637         (Object::discard_decompressed_sections): New function.
3638         (Object::do_decompressed_section_contents): New function.
3639         (Object::do_discard_decompressed_sections): New function.
3640         (Compressed_section_info): New type.
3641         (Compressed_section_map): Include decompressed section contents.
3642         (Sized_relobj_file::do_decompressed_section_contents): New function.
3643         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3644
3645 2012-02-16  Cary Coutant  <ccoutant@google.com>
3646
3647         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3648         * testsuite/Makefile.in: Regenerate.
3649
3650 2012-02-14  Cary Coutant  <ccoutant@google.com>
3651
3652         * options.cc (General_options::finalize): Disallow -pie and -static.
3653
3654 2012-02-03  Doug Kwan  <dougkwan@google.com>
3655
3656         * arm.cc (Arm_relocate_functions::abs8,
3657         Arm_relocate_functions::abs16): Use
3658         Bits::has_signed_unsigned_overflow32.
3659         (Arm_relocate_functions::thm_abs8): Correct range of
3660         overflow check.
3661         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3662         in assertions.
3663
3664 2012-02-02  Doug Kwan  <dougkwan@google.com>
3665
3666         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3667         position independent outputs, not just shared objects.
3668
3669 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3670
3671         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3672         * configure: Regenerated.
3673
3674 2012-01-27  Ian Lance Taylor  <iant@google.com>
3675
3676         * reloc.h (Bits): New class with static functions, copied from
3677         namespace utils in arm.cc.
3678         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3679         instead.
3680
3681 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3682
3683         * incremental.cc (write_info_blocks): Correct relocation offset.
3684
3685 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3686
3687         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3688         (Relocate::tls_gd_to_le): Likewise.
3689
3690 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3691
3692         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3693
3694 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3695
3696         * configure.ac: Check if -mcmodel=medium works.
3697         * configure: Regenerated.
3698
3699 2012-01-24  Cary Coutant  <ccoutant@google.com>
3700
3701         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3702         definition and ...
3703         (read_unsigned_LEB_128_x): ... this new function.
3704         (read_signed_LEB_128): Replaced with inline definition and ...
3705         (read_signed_LEB_128_x): ... this new function.
3706         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3707         (read_unsigned_LEB_128): Add inline definition.
3708         (read_signed_LEB_128_x): New function.
3709         (read_signed_LEB_128): Add inline definition.
3710         * testsuite/Makefile.am (leb128_unittest): New unit test.
3711         * testsuite/Makefile.in: Regenerate.
3712         * testsuite/leb128_unittest.cc: New unit test.
3713
3714 2012-01-23  Ian Lance Taylor  <iant@google.com>
3715
3716         PR gold/13617
3717         * i386.cc (Target_i386::do_code_fill): When using a jmp
3718         instruction, pad with nop instructions.
3719         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3720
3721 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3722
3723         * x86_64.cc (gc_process_relocs): Add typename on types used in
3724         template.
3725         (scan_relocs): Likewise.
3726         (relocate_section): Likewise.
3727         (apply_relocation): Likewise.
3728
3729 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3730
3731         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3732         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3733         under x32.
3734
3735 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3736
3737         * x86_64.cc: Initial support for x32.
3738
3739 2012-01-03  Cary Coutant  <ccoutant@google.com>
3740
3741         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3742         Use abstract base class for GOT.
3743         * gold/output.h (class Output_data_got_base): New abstract base class.
3744         (class Output_data_got): Derive from new base class, adjust ctors.
3745         (Output_data_got::reserve_slot): Make virtual; rename to
3746         do_reserve_slot; Adjust callers.
3747         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3748         pointer to abstract base class.
3749         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3750
3751 2011-12-18  Ian Lance Taylor  <iant@google.com>
3752
3753         * object.h (Relobj::local_symbol_value): New function.
3754         (Relobj::local_plt_offset): New function.
3755         (Relobj::local_has_got_offset): New function.
3756         (Relobj::local_got_offset): New function.
3757         (Relobj::set_local_got_offset): New function.
3758         (Relobj::do_local_symbol_value): New pure virtual function.
3759         (Relobj::do_local_plt_offset): Likewise.
3760         (Relobj::do_local_has_got_offset): Likewise.
3761         (Relobj::do_local_got_offset): Likewise.
3762         (Relobj::do_set_local_got_offset): Likewise.
3763         (Sized_relobj::do_local_has_got_offset): Rename from
3764         local_has_got_offset.
3765         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3766         (Sized_relobj::do_set_local_got_offset): Rename from
3767         set_local_got_offset.
3768         (Sized_relobj_file::do_local_plt_offset): Rename from
3769         local_plt_offset.
3770         (Sized_relobj_file::do_local_symbol_value): New function.
3771         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3772         local_plt_offset.
3773         * output.cc (Output_data_got::Got_entry::write): Change object to
3774         Relobj.  Use local_symbol_value.
3775         (Output_data_got::add_global_with_rel): Change rel_dyn to
3776         Output_data_reloc_generic*.  Use add_global_generic.
3777         (Output_data_got::add_global_with_rela): Remove.  Change all
3778         callers to use add_global_with_rel.
3779         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3780         Output_data_reloc_generic*.  Use add_global_generic.
3781         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3782         callers to use add_global_pair_with_rel.
3783         (Output_data_got::add_local): Change object to Relobj*.
3784         (Output_data_got::add_local_plt): Likewise.
3785         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3786         change rel_dyn to Output_data_reloc_generic*.  Use
3787         add_local_generic.
3788         (Output_data_got::add_local_with_rela): Remove.  Change all
3789         callers to use all_local_with_rel.
3790         (Output_data_got::add_local_pair_with_rel): Change object to
3791         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3792         add_output_section_generic.
3793         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3794         callers to use add_local_pair_with_rel.
3795         (Output_data_got::reserve_local): Change object to Relobj*.
3796         * output.h: (class Output_data_reloc_generic): Add pure virtual
3797         declarations for add_global_generic, add_local_generic,
3798         add_output_section_generic.
3799         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3800         functions for Output_data_reloc_generic.  Update declarations for
3801         changes listed in output.cc.
3802         (class Output_data_got): Change template parameter to got_size.
3803         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3804         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3805         function.
3806         (Sized_relobj_incr::do_local_plt_offset): New function.
3807         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3808         add_global_generic.
3809
3810 2011-12-17  Cary Coutant  <ccoutant@google.com>
3811
3812         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3813         * resolve.cc (Symbol_table::resolve): Likewise.
3814         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3815         arrays.
3816         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3817
3818 2011-12-16  Ian Lance Taylor  <iant@google.com>
3819
3820         * output.h (Output_data_reloc_generic::add): Only call
3821         add_dynamic_reloc if this is a dynamic reloc section.
3822
3823 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3824
3825         PR gold/13505
3826         * target-reloc.h (apply_relocation): Replace <64, false> with
3827         <size, big_endian>.
3828
3829 2011-11-25  Nick Clifton  <nickc@redhat.com>
3830
3831         * po/it.po: New Italian translation.
3832
3833 2011-11-17  Sterling Augustine  <saugustine@google.com>
3834
3835         * script.cc (script_include_directive): Implement.
3836         (read_script_file): New local variables name and search_path. Update
3837         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3838         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3839         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3840
3841 2011-11-11  Sterling Augustine  <saugustine@google.com>
3842
3843         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3844         (file_or_sections_cmd): Likewise.
3845
3846 2011-11-11  Doug Kwan  <dougkwan@google.com>
3847
3848         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3849         if --just-symbols is given.
3850
3851 2011-11-10  Doug Kwan  <dougkwan@google.com>
3852
3853         PR gold/13362
3854         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3855         when processing data relocs.
3856         * reloc.h (Relocate_functions::rel_unaligned): New method.
3857         (Relocate_functions::pcrel_unaligned): Ditto.
3858         (Relocate_functions::rel32_unaligned): Ditto.
3859         (Relocate_functions::pcrel32_unaligned): Ditto.
3860
3861 2011-11-09  Doug Kwan  <dougkwan@google.com>
3862
3863         PR gold/13362
3864         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3865         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3866         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3867         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3868         (Relocate_functions::rel_unaligned): New.
3869         (Relocate_functions::rel32_unaligned): New.
3870         * target-reloc.h (relocate_for_relocatable): Add code to handle
3871         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3872         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3873         arm_unaligned_reloc_r): New targets.
3874         * testsuite/Makefile.in: Regenerate.
3875         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3876         linking.
3877
3878 2011-11-02  Ian Lance Taylor  <iant@google.com>
3879
3880         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3881         NATIVE_LINKER.
3882         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3883         * options.cc (General_options::finalize): Use library search path
3884         from configure script if specified.  If not native and no sysroot,
3885         only search TOOLLIBDIR.
3886         * options.h (Search_directory::Search_directory): Change name to
3887         const std::string&.
3888         (General_options::add_to_library_path_with_sysroot): Change arg to
3889         const std::string&.
3890         * configure, Makefile.in, config.in: Rebuild.
3891
3892 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3893
3894         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3895         we are working around the ARM1176 Erratum.
3896         * options.h (General_options::fix_arm1176): Add option.
3897         * testsuite/Makefile.am: Add testcases, and keep current ones
3898         working.
3899         * testsuite/Makefile.in: Regenerate.
3900         * testsuite/arm_fix_1176.s: New file.
3901         * testsuite/arm_fix_1176.sh: Likewise.
3902
3903 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3904
3905         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3906         may_use_blx_.
3907         (Target_arm::may_use_blx): Remove method.
3908         (Target_arm::set_may_use_blx): Likewise.
3909         (Target_arm::may_use_v4t_interworking): New method.
3910         (Target_arm::may_use_v5t_interworking): Likewise.
3911         (Target_arm::may_use_blx_): Remove member variable.
3912         (Arm_relocate_functions::arm_branch_common): Check for v5T
3913         interworking.
3914         (Arm_relocate_functions::thumb_branch_common): Likewise.
3915         (Reloc_stub::stub_type_for_reloc): Likewise.
3916         (Target_arm::do_finalize_sections): Correct interworking checks.
3917         * testsuite/Makefile.am: Add new tests.
3918         * testsuite/Makefile.in: Regenerate.
3919         * testsuite/arm_farcall_arm_arm.s: New test.
3920         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3921         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3922         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3923         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3924         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3925         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3926         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3927
3928 2011-10-31  Cary Coutant  <ccoutant@google.com>
3929
3930         PR gold/13023
3931         * expression.cc (Expression::eval_with_dot): Add
3932         is_section_dot_assignment parameter.
3933         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3934         absolute and assigning to dot within a section.
3935         * script-sections.cc
3936         (Output_section_element_assignment::set_section_addresses): Pass
3937         dot_section to set_if_absolute.
3938         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3939         as is_section_dot_assignment flag to eval_with_dot.
3940         (Output_section_element_dot_assignment::set_section_addresses):
3941         Likewise.
3942         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3943         parameter.  Also set value if relative to dot_section; set the
3944         symbol's output_section.
3945         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3946         parameter.  Adjust all callers.
3947         (Expression::eval_maybe_dot): Likewise.
3948         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3949         Adjust all callers.
3950         * testsuite/script_test_2.t: Test assignment of an absolute value
3951         to dot within an output section element.
3952
3953 2011-10-31  Cary Coutant  <ccoutant@google.com>
3954
3955         * options.h (class General_options): Add --[no-]gnu-unique options.
3956         * symtab.cc (Symbol_table::sized_write_globals): Convert
3957         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3958
3959 2011-10-31  Cary Coutant  <ccoutant@google.com>
3960
3961         PR gold/13359
3962         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3963         unnecessary assertion.
3964         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3965
3966 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3967
3968         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3969         gc_mark_symbol.
3970         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3971         gc_mark_symbol.
3972         Change to just keep the section associated with symbol.
3973         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3974         they are externally visible and --export-dynamic is turned on.
3975         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3976
3977 2011-10-19  Ian Lance Taylor  <iant@google.com>
3978
3979         PR gold/13163
3980         * script-sections.cc
3981         (Output_section_element_dot_assignment::needs_output_section): New
3982         function.
3983
3984 2011-10-19  Ian Lance Taylor  <iant@google.com>
3985
3986         PR gold/13204
3987         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3988         --section-start option was seen.
3989         * options.h (General_options::any_section_start): New function.
3990
3991 2011-10-18  David S. Miller  <davem@davemloft.net>
3992
3993         PR binutils/13301
3994         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3995         member to track relocation locations that have moved during TLS
3996         reloc optimizations.
3997         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3998         (Target_sparc::Relocate::relocate): Adjust view down by 4
3999         bytes if it matches reloc_adjust_addr_.
4000         (Target_sparc::Relocate::relocate_tls): Always move the
4001         __tls_get_addr call delay slot instruction forward 4 bytes when
4002         performing relaxation.
4003
4004 2011-10-18  Cary Coutant  <ccoutant@google.com>
4005
4006         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
4007         (Output_file::map_no_anonymous): Check for non-zero
4008         return code from posix_fallocate.
4009
4010 2011-10-17  Cary Coutant  <ccoutant@google.com>
4011
4012         PR gold/13245
4013         * plugin.cc (is_visible_from_outside): Check for symbols
4014         referenced from dynamic objects.
4015         * resolve.cc (Symbol_table::resolve): Don't count references
4016         from dynamic objects as references from real ELF files.
4017         * testsuite/plugin_test_2.sh: Adjust expected result.
4018
4019 2011-10-17  Cary Coutant  <ccoutant@google.com>
4020
4021         * gold.cc: Include timer.h.
4022         (queue_middle_tasks): Stamp time.
4023         (queue_final_tasks): Likewise.
4024         * main.cc (main): Store timer in parameters.  Print timers
4025         for each pass.
4026         * parameters.cc (Parameters::Parameters): Initialize timer_.
4027         (Parameters::set_timer): New function.
4028         (set_parameters_timer): New function.
4029         * parameters.h (Parameters::set_timer): New function.
4030         (Parameters::timer): New function.
4031         (Parameters::timer_): New data member.
4032         (set_parameters_timer): New function.
4033         * timer.cc (Timer::stamp): New function.
4034         (Timer::get_pass_time): New function.
4035         * timer.h (Timer::stamp): New function.
4036         (Timer::get_pass_time): New function.
4037         (Timer::pass_times_): New data member.
4038
4039 2011-10-17  Cary Coutant  <ccoutant@google.com>
4040
4041         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4042         task for members of lib groups.
4043
4044 2011-10-17  Cary Coutant  <ccoutant@google.com>
4045
4046         PR gold/13288
4047         * fileread.cc (File_read::find_view): Add assert.
4048         (File_read::make_view): Move bounds check (replace with assert)...
4049         (File_read::find_or_make_view): ... to here.
4050
4051 2011-10-12  Cary Coutant  <ccoutant@google.com>
4052
4053         * output.cc (Output_file::open_base_file): Handle case where
4054         ::read returns less than requested size.
4055
4056 2011-10-10  Cary Coutant  <ccoutant@google.com>
4057
4058         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4059         Initialize defined_count_.
4060         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4061         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4062         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4063         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4064         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4065         * incremental.h (Sized_relobj_incr::defined_count_): New data
4066         member.
4067         (Sized_incr_dynobj::defined_count_): New data member.
4068         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4069         Return zeroes instead of internal error.
4070
4071 2011-10-10  Cary Coutant  <ccoutant@google.com>
4072
4073         PR gold/13249
4074         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4075         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4076         * output.h (class Output_reloc): Add use_plt_offset flag.
4077         (Output_reloc::type_): Adjust size of bit field.
4078         (Output_reloc::use_plt_offset_): New bit field.
4079         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4080         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4081         flag.  Adjust all callers.
4082         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4083         creating RELATIVE relocations.
4084
4085 2011-10-10  Nick Clifton  <nickc@redhat.com>
4086
4087         * po/es.po: Updated Spanish translation.
4088         * po/fi.po: Updated Finnish translation.
4089
4090 2011-10-03   Diego Novillo  <dnovillo@google.com>
4091
4092         * options.cc (parse_uint): Fix dereference of RETVAL.
4093
4094 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4095
4096         * layout.h (section_order_map_): New member.
4097         (get_section_order_map): New member function.
4098         * output.cc (Output_section::add_input_section): Check for patterns
4099         only when --section-ordering-file is specified.
4100         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4101         output_sections have been formed.
4102         * layout.cc (Layout_Layout): Initialize section_order_map_.
4103         * plugin.cc (update_section_order): Store order in order_map. Do not
4104         update the order.
4105         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4106         * testsuite/Makefile.in: Regenerate.
4107         * testsuite/plugin_section_order.c: New file.
4108         * testsuite/plugin_final_layout.cc: New file.
4109         * testsuite/plugin_final_layout.sh: New file.
4110
4111 2011-09-29  Cary Coutant  <ccoutant@google.com>
4112
4113         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4114         Check for NULL.
4115         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4116         symbols during incremental update.
4117         (Symbol_table::add_from_dynobj): Likewise.
4118
4119 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4120             Ian Lance Taylor  <iant@google.com>
4121
4122         * symtab.cc (Symbol_table::define_special_symbol): Always
4123         canonicalize version string.
4124
4125 2011-09-26  Cary Coutant  <ccoutant@google.com>
4126
4127         * gold.cc (queue_initial_tasks): Move option checks ...
4128         * options.cc (General_options::finalize): ... to here. Disable
4129         some options; make others fatal.
4130
4131 2011-09-26  Cary Coutant  <ccoutant@google.com>
4132
4133         gcc PR lto/47247
4134         * plugin.cc (get_symbols_v2): New function.
4135         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4136         (is_referenced_from_outside): New function.
4137         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4138         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4139         (get_symbols): Pass version parameter.
4140         (get_symbols_v2): New function.
4141         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4142         parameter.
4143         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4144         (onload): Add LDPT_GET_SYMBOLS_V2.
4145         (all_symbols_read_hook): Use get_symbols_v2; check for
4146         LDPR_PREVAILING_DEF_IRONLY_EXP.
4147         * testsuite/plugin_test_3.sh: Update expected results.
4148
4149 2011-09-23  Simon Baldwin  <simonb@google.com>
4150
4151         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4152         configuration options.
4153         * configure: Regenerate.
4154         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4155         * Makefile.in: Regenerate.
4156         * testsuite/Makefile.in: Regenerate.
4157
4158 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4159
4160         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4161
4162 2011-09-19  Cary Coutant  <ccoutant@google.com>
4163
4164         * incremental.cc (can_incremental_update): Fix typo in comment.
4165         * incremental.h (can_incremental_update): Likewise.
4166
4167 2011-09-18  Cary Coutant  <ccoutant@google.com>
4168
4169         * incremental.cc (can_incremental_update): New function.
4170         * incremental.h (can_incremental_update): New function.
4171         * layout.cc (Layout::init_fixed_output_section): Call it.
4172         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4173         * object.cc (Sized_relobj_file::do_layout): Call
4174         can_incremental_update.
4175
4176 2011-09-13  Cary Coutant  <ccoutant@google.com>
4177
4178         * configure.ac: Check for glibc support for gnu_indirect_function
4179         support with static linking, setting automake conditional
4180         IFUNC_STATIC.
4181         * Makefile.in: Regenerate.
4182         * configure: Regenerate.
4183
4184         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4185         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4186         for IFUNC_STATIC.
4187         * testsuite/Makefile.in: Regenerate.
4188
4189 2011-09-13  Cary Coutant  <ccoutant@google.com>
4190
4191         * incremental.cc (Sized_relobj_incr::do_layout): Call
4192         report_comdat_group for kept comdat sections.
4193         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4194         * testsuite/Makefile.in: Regenerate.
4195         * testsuite/incr_comdat_test_1.cc: New source file.
4196         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4197         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4198         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4199
4200 2011-09-13  Ian Lance Taylor  <iant@google.com>
4201
4202         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4203         variable external_symbols_offset.
4204
4205 2011-09-12  Ian Lance Taylor  <iant@google.com>
4206
4207         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4208         triggered if object has no symbols.
4209
4210 2011-09-09  David S. Miller  <davem@davemloft.net>
4211
4212         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4213         (Output_fill_debug_line::do_write): Likewise.
4214
4215 2011-08-29  Cary Coutant  <ccoutant@google.com>
4216
4217         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4218         casts to match formatting specs.
4219         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4220
4221 2011-08-26  Cary Coutant  <ccoutant@google.com>
4222
4223         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4224         remaining hole size when allocating.
4225         (Layout::make_output_section): Set fill methods for debug sections.
4226         * layout.h (Free_list::Free_list_node): Move from private to
4227         public.
4228         (Free_list::set_min_hole_size): New function.
4229         (Free_list::begin, Free_list::end): New functions.
4230         (Free_list::min_hole_): New data member.
4231         * output.cc: Include dwarf.h.
4232         (Output_fill_debug_info::do_minimum_hole_size): New function.
4233         (Output_fill_debug_info::do_write): New function.
4234         (Output_fill_debug_line::do_minimum_hole_size): New function.
4235         (Output_fill_debug_line::do_write): New function.
4236         (Output_section::Output_section): Initialize new data member.
4237         (Output_section::set_final_data_size): Ensure patch space is larger
4238         than minimum hole size.
4239         (Output_section::do_write): Fill holes in debug sections.
4240         * output.h (Output_fill): New class.
4241         (Output_fill_debug_info): New class.
4242         (Output_fill_debug_line): New class.
4243         (Output_section::set_free_space_fill): New function.
4244         (Output_section::free_space_fill_): New data member.
4245         * testsuite/Makefile.am (incremental_test_3): Add
4246         --incremental-patch option.
4247         (incremental_test_4): Likewise.
4248         (incremental_test_5): Likewise.
4249         (incremental_test_6): Likewise.
4250         (incremental_copy_test): Likewise.
4251         (incremental_common_test_1): Likewise.
4252         * testsuite/Makefile.in: Regenerate.
4253
4254 2011-08-26  Nick Clifton  <nickc@redhat.com>
4255
4256         * po/es.po: Updated Spanish translation.
4257
4258 2011-08-01  Cary Coutant  <ccoutant@google.com>
4259
4260         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4261         * gold/testsuite/Makefile.in: Regenerate.
4262         * gold/testsuite/justsyms_exec.c: New source file.
4263         * gold/testsuite/justsyms_lib.c: New source file.
4264
4265 2011-08-01  Cary Coutant  <ccoutant@google.com>
4266
4267         * layout.cc (Layout::set_segment_offsets): Don't realign text
4268         segment if -Ttext was specified.
4269         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4270         file type.
4271         * object.h (Sized_relobj_file::e_type): New function.
4272         (Sized_relobj_file::e_type_): New data member.
4273         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4274         base address for ET_EXEC files.
4275         * target.cc (Target::do_make_elf_object_implementation): Allow
4276         ET_EXEC files with --just-symbols option.
4277
4278 2011-07-28  Cary Coutant  <ccoutant@google.com>
4279
4280         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4281         Add thread_number parameter.
4282         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4283         * workqueue-threads.cc
4284         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4285         current thread if its thread number is greater than desired thread
4286         count.
4287         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4288         Add thread_number parameter.
4289         (Workqueue::should_cancel_thread): Likewise.
4290         (Workqueue::find_runnable_or_wait): Pass thread_number to
4291         should_cancel_thread.
4292         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4293         parameter.
4294
4295 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4296
4297         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4298         only after checking if it cannot be forced local.
4299         * symtab.h (is_externally_visible): Check if the symbol is not forced
4300         local.
4301
4302 2011-07-15  Ian Lance Taylor  <iant@google.com>
4303
4304         * options.h (class General_options): Add --print-output-format.
4305         Move -EL next to -EB, for  better --help output.
4306         * target-select.cc: Include <cstdio>, "options.h", and
4307         "parameters.h".
4308         (Target_selector::do_target_bfd_name): New function.
4309         (print_output_format): New function.
4310         * target-select.h (class Target_selector): Update declarations.
4311         (Target_selector::target_bfd_name): New function.
4312         (print_output_format): Declare.
4313         * main.cc: Include "target-select.h".
4314         (main): Handle --print-output-format.
4315         * gold.cc: Include "target-select.h".
4316         (queue_initial_tasks): Handle --print-output-format when there are
4317         no input files.
4318         * parameters.cc (parameters_force_valid_target): Give a better
4319         error message if -EB/-EL does not match target.
4320         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4321         function.
4322
4323 2011-07-15  Ian Lance Taylor  <iant@google.com>
4324
4325         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4326         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4327         (Output_data_plt_i386::do_write): Write address of .dynamic
4328         section to first entry in .got.plt section.
4329         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4330         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4331         Initialize layout_.
4332         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4333         section to first entry in .got.plt section.
4334         * layout.h (Layout::dynamic_section): New function.
4335
4336 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4337
4338         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4339         to claim_file call.
4340         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4341         input_section_position_, and input_section_glob_.
4342         (read_layout_from_file): Call function section_ordering_specified.
4343         * layout.h (is_section_ordering_specified): New function.
4344         (section_ordering_specified): New function.
4345         (section_ordering_specified_): New boolean member.
4346         * main.cc(main): Call load_plugins after layout object is defined.
4347         * output.cc (Output_section::add_input_section): Use
4348         function section_ordering_specified to check if section ordering is
4349         needed.
4350         * output.cc (Output_section::add_relaxed_input_section): Use
4351         function section_ordering_specified to check if section ordering is
4352         needed.
4353         (Output_section::update_section_layout): New function.
4354         (Output_section::sort_attached_input_sections): Check if input section
4355         must be reordered.
4356         * output.h (Output_section::update_section_layout): New function.
4357         * plugin.cc (get_section_count): New function.
4358         (get_section_type): New function.
4359         (get_section_name): New function.
4360         (get_section_contents): New function.
4361         (update_section_order): New function.
4362         (allow_section_ordering): New function.
4363         (Plugin::load): Add the new interfaces to the transfer vector.
4364         (Plugin_manager::load_plugins): New parameter.
4365         (Plugin_manager::all_symbols_read): New parameter.
4366         (Plugin_manager::claim_file): New parameter. Save the elf object for
4367         unclaimed objects.
4368         (Plugin_manager::get_elf_object): New function.
4369         (Plugin_manager::get_view): Change to directly use the bool to check
4370         if get_view is called from claim_file_hook.
4371         * plugin.h (input_objects): New function
4372         (Plugin__manager::load_plugins): New parameter.
4373         (Plugin_manager::claim_file): New parameter.
4374         (Plugin_manager::get_elf_object): New function.
4375         (Plugin_manager::in_claim_file_handler): New function.
4376         (Plugin_manager::in_claim_file_handler_): New member.
4377         (layout): New function.
4378         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4379         handler with an extra parameter. Make the elf object before calling
4380         claim_file handler.
4381         * testsuite/plugin_test.c (get_section_count): New function pointer.
4382         (get_section_type): New function pointer.
4383         (get_section_name): New function pointer.
4384         (get_section_contents): New function pointer.
4385         (update_section_order): New function pointer.
4386         (allow_section_ordering): New function pointer.
4387         (onload): Check if the new interfaces exist.
4388
4389 2011-07-13  Ian Lance Taylor  <iant@google.com>
4390
4391         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4392         relro section.
4393         * x86_64.cc (Target_x86_64::got_section): Likewise.
4394         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4395         (relro_now_test_SOURCES): New variable.
4396         (relro_now_test_DEPENDENCIES): New variable.
4397         (relro_now_test_LDFLAGS): New variable.
4398         (relro_now_test_LDADD): New variable.
4399         (relro_now_test.so): New target.
4400         * testsuite/Makefile.in: Rebuild.
4401
4402 2011-07-12  Ian Lance Taylor  <iant@google.com>
4403
4404         PR gold/12980
4405         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4406         GLOB_DAT relocation rather than a RELATIVE relocation for a
4407         protected symbol when creating a shared library.
4408         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4409         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4410         * testsuite/protected_main_1.cc (main): Test that protected
4411         function has same address.
4412
4413 2011-07-11  Ian Lance Taylor  <iant@google.com>
4414
4415         PR gold/12979
4416         * options.h (class General_options): Add -Bgroup.
4417         * options.cc (General_options::finalize): If -Bgroup is set,
4418         default to --unresolved-symbols=report-all.
4419         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4420         * target-reloc.h (issue_undefined_symbol_error): Handle
4421         --unresolved-symbols=report-all.
4422
4423 2011-07-08  Ian Lance Taylor  <iant@google.com>
4424
4425         PR gold/11985
4426         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4427         if linker script discards key sections.
4428         (Layout::create_dynamic_symtab): Likewise.
4429         (Layout::assign_local_dynsym_offsets): Likewise.
4430         (Layout::sized_create_version_sections): Likewise.
4431         (Layout::create_interp): Likewise.
4432         (Layout::finish_dynamic_section): Likewise.
4433         (Layout::set_dynamic_symbol_size): Likewise.
4434
4435 2011-07-08  Ian Lance Taylor  <iant@google.com>
4436
4437         PR gold/12386
4438         * options.h (class General_options): Add --unresolved-symbols.
4439         * target-reloc.h (issue_undefined_symbol_error): Check
4440         --unresolved-symbols.  Add comments.
4441
4442 2011-07-08  Ian Lance Taylor  <iant@google.com>
4443
4444         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4445         expression more complex.
4446
4447 2011-07-08  Ian Lance Taylor  <iant@google.com>
4448
4449         PR gold/11317
4450         * target-reloc.h (issue_undefined_symbol_error): New inline
4451         function, broken out of relocate_section.
4452         (relocate_section): Call issue_undefined_symbol_error.
4453         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4454         there is no TLS segment if we are about to issue an undefined
4455         symbol error.
4456         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4457
4458 2011-07-08  Ian Lance Taylor  <iant@google.com>
4459
4460         PR gold/12279
4461         * resolve.cc (Symbol_table::should_override): Add fromtype
4462         parameter.  Change all callers.  Give error when linking together
4463         TLS and non-TLS symbol.
4464         (Symbol_table::should_override_with_special): Add fromtype
4465         parameter.  Change all callers.
4466         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4467         there is no TLS segment if we have reported some errors.
4468         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4469
4470 2011-07-08  Ian Lance Taylor  <iant@google.com>
4471
4472         PR gold/12372
4473         * target.h (Target::plt_address_for_global): New function.
4474         (Target::plt_address_for_local): New function.
4475         (Target::plt_section_for_global): Remove.
4476         (Target::plt_section_for_local): Remove.
4477         (Target::do_plt_address_for_global): New virtual function.
4478         (Target::do_plt_address_for_local): New virtual function.
4479         (Target::do_plt_section_for_global): Remove.
4480         (Target::do_plt_section_for_local): Remove.
4481         (Target::register_global_plt_entry): Add Symbol_table and Layout
4482         parameters.
4483         * output.cc (Output_data_got::Got_entry::write): Use
4484         plt_address_for_global and plt_address_for_local.
4485         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4486         address of output section.
4487         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4488         got_irelative_, and irelative_count_ fields.  Update
4489         declarations.
4490         (Output_data_plt_i386::has_irelative_section): New function.
4491         (Output_data_plt_i386::entry_count): Add irelative_count_.
4492         (Output_data_plt_i386::set_final_data_size): Likewise.
4493         (class Target_i386): Add got_irelative_ and rel_irelative_
4494         fields.  Update declarations.
4495         (Target_i386::Target_i386): Initialize new fields.
4496         (Target_i386::do_plt_address_for_global): New function replacing
4497         do_plt_section_for_global.
4498         (Target_i386::do_plt_address_for_local): New function replacing
4499         do_plt_section_for_local.
4500         (Target_i386::got_section): Create got_irelative_.
4501         (Target_i386::rel_irelative_section): New function.
4502         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4503         fields.  Don't define __rel_iplt_{start,end}.
4504         (Output_data_plt_i386::add_entry): Add symtab and layout
4505         parameters.  Change all callers.  Use different PLT and GOT for
4506         IFUNC symbols.
4507         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4508         layout parameters.  Change all callers.  Use different PLT and
4509         GOT.
4510         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4511         (Output_data_plt_i386::rel_irelative): New function.
4512         (Output_data_plt_i386::address_for_global): New function.
4513         (Output_data_plt_i386::address_for_local): New function.
4514         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4515         IRELATIVE GOT when changing IFUNC GOT entries.
4516         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4517         reloc.
4518         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4519         if we didn't create an IRELATIVE GOT.
4520         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4521         plt_address_for_local.
4522         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4523         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4524         got_irelative_, and irelative_count_ fields.  Update
4525         declarations.
4526         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4527         Initialize new fields.  Remove symtab parameter.  Change all
4528         callers.
4529         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4530         irelative_count_.
4531         (Output_data_plt_x86_64::has_irelative_section): New function.
4532         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4533         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4534         fields.  Update declarations.
4535         (Target_x86_64::Target_x86_64): Initialize new fields.
4536         (Target_x86_64::do_plt_address_for_global): New function replacing
4537         do_plt_section_for_global.
4538         (Target_x86_64::do_plt_address_for_local): New function replacing
4539         do_plt_section_for_local.
4540         (Target_x86_64::got_section): Create got_irelative_.
4541         (Target_x86_64::rela_irelative_section): New function.
4542         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4543         all callers.  Don't create __rel_iplt_{start,end}.
4544         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4545         parameters.  Change all callers.  Use different PLT and GOT for
4546         IFUNC symbols.
4547         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4548         layout parameters.  Change all callers.  Use different PLT and
4549         GOT.
4550         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4551         parameters.  Change all callers.  Use different PLT and GOT for
4552         IFUNC symbols.
4553         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4554         (Output_data_plt_x86_64::rela_irelative): New function.
4555         (Output_data_plt_x86_64::address_for_global): New function.
4556         (Output_data_plt_x86_64::address_for_local): New function.
4557         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4558         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4559         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4560         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4561         parameters.
4562         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4563         reloc.
4564         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4565         symbols if we didn't create an IRELATIVE GOT.
4566         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4567         plt_address_for_local.
4568         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4569         * testsuite/ifuncvar1.c: New test file.
4570         * testsuite/ifuncvar2.c: New test file.
4571         * testsuite/ifuncvar3.c: New test file.
4572         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4573         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4574         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4575         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4576         * testsuite/Makefile.in: Rebuild.
4577
4578 2011-07-07  Cary Coutant  <ccoutant@google.com>
4579
4580         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4581         (two_file_test_1_ndebug.o): Likewise.
4582         (two_file_test_1b_ndebug.o): Likewise.
4583         (two_file_test_2_ndebug.o): Likewise.
4584         (two_file_test_main_ndebug.o): Likewise.
4585         (incremental_test_2): Link with no-debug versions.
4586
4587 2011-07-06  Cary Coutant  <ccoutant@google.com>
4588
4589         * gold/incremental.cc
4590         (Output_section_incremental_inputs::write_info_blocks): Check for
4591         hidden and internal symbols.
4592
4593 2011-07-06  Cary Coutant  <ccoutant@google.com>
4594
4595         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4596         Check disposition for startup file.
4597         (Incremental_inputs::report_command_line): Ignore
4598         --incremental-startup-unchanged option.
4599         * options.cc (General_options::parse_incremental_startup_unchanged):
4600         New function.
4601         (General_options::General_options): Initialize new data member.
4602         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4603         (General_options): Add --incremental-startup-unchanged option.
4604         (General_options::incremental_startup_disposition): New function.
4605         (General_options::incremental_startup_disposition_): New data member.
4606
4607 2011-07-06  Cary Coutant  <ccoutant@google.com>
4608
4609         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4610         input file index to Script_info ctor.
4611         (Sized_incremental_binary::do_file_has_changed): Find the
4612         command-line argument for files named in scripts.
4613         * incremental.h (Script_info::Script_info): New ctor
4614         with input file index.
4615         (Script_info::input_file_index): New function.
4616         (Script_info::input_file_index_): New data member.
4617         (Incremental_binary::get_library): Add const.
4618         (Incremental_binary::get_script_info): Add const.
4619         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4620         * testsuite/Makefile.am (incremental_test_5): New test case.
4621         (incremental_test_6): New test case.
4622         * testsuite/Makefile.in: Regenerate.
4623
4624 2011-07-06  Cary Coutant  <ccoutant@google.com>
4625
4626         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4627         debug output when command lines differ.
4628
4629 2011-07-06  Cary Coutant  <ccoutant@google.com>
4630
4631         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4632         --incremental-patch option.
4633         * layout.cc (Free_list::allocate): Extend allocation beyond original
4634         end if enabled.
4635         (Layout::make_output_section): Mark sections that should get
4636         patch space.
4637         * options.cc (parse_percent): New function.
4638         * options.h (parse_percent): New function.
4639         (DEFINE_percent): New macro.
4640         (General_options): Add --incremental-patch option.
4641         * output.cc (Output_section::Output_section): Initialize new data
4642         members.
4643         (Output_section::add_input_section): Print section name when out
4644         of patch space.
4645         (Output_section::add_output_section_data): Likewise.
4646         (Output_section::set_final_data_size): Add patch space when
4647         doing --incremental-full.
4648         (Output_section::do_reset_address_and_file_offset): Remove patch
4649         space.
4650         (Output_segment::set_section_list_addresses): Print debug output
4651         only if --incremental-update.
4652         * output.h (Output_section::set_is_patch_space_allowed): New function.
4653         (Output_section::is_patch_space_allowed_): New data member.
4654         (Output_section::patch_space_): New data member.
4655         * parameters.cc (Parameters::incremental_full): New function.
4656         * parameters.h (Parameters::incremental_full): New function
4657         * testsuite/Makefile.am (incremental_test_2): Add test for
4658         --incremental-patch option.
4659         * testsuite/Makefile.in: Regenerate.
4660         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4661         (t18): Remove function body.
4662
4663 2011-07-05  Doug Kwan  <dougkwan@google.com>
4664
4665         PR gold/12771
4666         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4667         Arm_Address type for relocation result.
4668         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4669         overflow check.
4670         (Arm_relocate_functions::abs32): Use unaligned access.
4671         (Arm_relocate_functions::rel32): Ditto.
4672         (Arm_relocate_functions::prel31): Ditto.
4673         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4674         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4675         static data relocations.
4676         * testsuite/Makefile.in: Regnerate.
4677         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4678
4679 2011-07-05  Ian Lance Taylor  <iant@google.com>
4680
4681         PR gold/12392
4682         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4683         symbols if necessary.
4684         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4685
4686 2011-07-05  Ian Lance Taylor  <iant@google.com>
4687
4688         PR gold/12952
4689         * resolve.cc (Symbol::override_base_with_special): Simply override
4690         version with special symbol version, ignoring previous version.
4691
4692 2011-07-05  Ian Lance Taylor  <iant@google.com>
4693
4694         * object.cc (Sized_relobj_file::include_section_group): Add
4695         information to comment about signature location.
4696
4697 2011-07-02  Ian Lance Taylor  <iant@google.com>
4698
4699         PR gold/12957
4700         * options.h (class General_options): Add -f and -F.
4701         * options.cc (General_options::finalize): Fatal error if -f/-F
4702         are used without -shared.
4703         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4704
4705 2011-07-02  Ian Lance Taylor  <iant@google.com>
4706
4707         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4708
4709 2011-07-01  Ian Lance Taylor  <iant@google.com>
4710
4711         PR gold/12525
4712         PR gold/12952
4713         * resolve.cc (Symbol::override_base_with_special): Don't override
4714         the version if the overriding symbol has a different name.
4715         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4716         all callers.  If we give an error about an undefined version,
4717         define the base version if necessary.
4718         * dynobj.h (class Versions): Update declaration.
4719         * testsuite/weak_alias_test_5.cc: New file.
4720         * testsuite/weak_alias_test.script: New file.
4721         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4722         and versioned_alias have the right value, and call t2.
4723         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4724         weak_alias_test_5.so.
4725         (weak_alias_test_LDADD): Likewise.
4726         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4727         * testsuite/Makefile.in: Rebuild.
4728
4729 2011-07-01  Ian Lance Taylor  <iant@google.com>
4730
4731         PR gold/12525
4732         * options.h (class General_options): Support -z notext.
4733         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4734         -Wl,-z,notext.
4735         (two_file_shared_nonpic.so): Likewise.
4736         (two_file_shared_mixed.so): Likewise.
4737         (two_file_shared_mixed_1.so): Likewise.
4738         (weak_undef_lib_nonpic.so): Likewise.
4739         (alt/weak_undef_lib_nonpic.so): Likewise.
4740         (tls_test_shared_nonpic.so): Likewise.
4741         * testsuite/Makefile.in: Rebuild.
4742
4743 2011-07-01  Ian Lance Taylor  <iant@google.com>
4744
4745         PR gold/12525
4746         * configure.ac: Test whether static linking works, setting
4747         the automake conditional HAVE_STATIC.
4748         * testsuite/Makefile.am: Disable tests using -static if
4749         HAVE_STATIC is not true.
4750         * configure, testsuite/Makefile.in: Rebuild.
4751
4752 2011-07-01  Ian Lance Taylor  <iant@google.com>
4753
4754         PR gold/12525
4755         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4756         Assert if we see DW_EH_PE_indirect.
4757         * target.h (Target::ehframe_datarel_base): New function.
4758         (Target::do_ehframe_datarel_base): New target function.
4759         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4760         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4761         function.
4762
4763 2011-07-01  Ian Lance Taylor  <iant@google.com>
4764
4765         PR gold/12571
4766         * options.h (class General_options): Add
4767         --ld-generated-unwind-info.
4768         * ehframe.cc (Fde::write): Add address parameter.  Change all
4769         callers.  If associated with PLT, fill in address and size.
4770         (Cie::set_output_offset): Only add merge mapping if there is an
4771         object.
4772         (Cie::write): Add address parameter.  Change all callers.
4773         (Eh_frame::add_ehframe_for_plt): New function.
4774         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4775         input_offset_ fields into union u_, with new plt field.
4776         (Fde::Fde): Adjust for new union field.
4777         (Fde::Fde) [Output_data version]: New constructor.
4778         (Fde::add_mapping): Only add merge mapping if there is an object.
4779         (class Cie): Update declarations.
4780         (class Eh_frame): Declare add_ehframe_for_plt.
4781         * layout.cc (Layout::layout_eh_frame): Break out code into
4782         make_eh_frame_section, and call it.
4783         (Layout::make_eh_frame_section): New function.
4784         (Layout::add_eh_frame_for_plt): New function.
4785         * layout.h (class Layout): Update declarations.
4786         * merge.cc (Merge_map::add_mapping): Add assertion.
4787         * i386.cc: Include "dwarf.h".
4788         (class Output_data_plt_i386): Make first_plt_entry,
4789         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4790         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4791         and plt_eh_frame_fde.
4792         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4793         boundary.  Call add_eh_frame_for_plt if appropriate.
4794         * x86_64.cc: Include "dwarf.h".
4795         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4796         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4797         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4798         and plt_eh_frame_fde.
4799         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4800         appropriate.
4801
4802 2011-06-29  Ian Lance Taylor  <iant@google.com>
4803
4804         PR gold/12629
4805         * object.cc (Sized_relobj_file::layout_section): Change shdr
4806         parameter to be const.
4807         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4808         out of do_layout.
4809         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4810         appropriate.  Call layout_eh_frame_section.
4811         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4812         sections.
4813         * object.h (class Sized_relobj_file): Update declarations.
4814
4815 2011-06-29  Ian Lance Taylor  <iant@google.com>
4816
4817         PR gold/12652
4818         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4819         modifier.
4820         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4821
4822 2011-06-29  Ian Lance Taylor  <iant@google.com>
4823
4824         PR gold/12675
4825         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4826         SHT_X86_64_UNWIND.
4827         * layout.cc (Layout::layout_eh_frame): Likewise.
4828
4829 2011-06-29  Ian Lance Taylor  <iant@google.com>
4830
4831         PR gold/12695
4832         * layout.cc (Layout::symtab_section_shndx): New function.
4833         * layout.h (class Layout): Declare symtab_section_shndx.
4834         * output.cc (Output_section::write_header): Call it.
4835
4836 2011-06-29  Ian Lance Taylor  <iant@google.com>
4837
4838         PR gold/12818
4839         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4840         symbols which are not used in a relocation.
4841
4842 2011-06-28  Ian Lance Taylor  <iant@google.com>
4843
4844         PR gold/12898
4845         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4846         script create indistinguishable segments.
4847         (Layout::set_segment_offsets): Use stable_sort when sorting
4848         segments.  Pass this to Compare_segments constructor.
4849         * layout.h (class Layout): Make segment_precedes non-static.
4850         (class Compare_segments): Change from struct to class.  Add
4851         layout_ field.  Add constructor.
4852         * script-sections.cc
4853         (Script_sections::attach_sections_using_phdrs_clause): Rename
4854         local orphan to is_orphan.  Don't report failure to put empty
4855         section in segment.  On attachment failure, report name of
4856         section, and attach to first PT_LOAD segment.
4857
4858 2011-06-28  Ian Lance Taylor  <iant@google.com>
4859
4860         PR gold/12934
4861         * target-select.cc (Target_selector::Target_selector): Add
4862         emulation parameter.  Change all callers.
4863         (select_target_by_bfd_name): Rename from select_target_by_name.
4864         Change all callers.
4865         (select_target_by_emulation): New function.
4866         (supported_emulation_names): New function.
4867         * target-select.h (class Target_selector): Add emulation_ field.
4868         Update declarations.
4869         (Target_selector::recognize_by_bfd_name): Rename from
4870         recognize_by_name.  Change all callers.
4871         (Target_selector::supported_bfd_names): Rename from
4872         supported_names.  Change all callers.
4873         (Target_selector::recognize_by_emulation): New function.
4874         (Target_selector::supported_emulations): New function.
4875         (Target_selector::emulation): New function.
4876         (Target_selector::do_recognize_by_bfd_name): Rename from
4877         do_recognize_by_name.  Change all callers.
4878         (Target_selector::do_supported_bfd_names): Rename from
4879         do_supported_names.  Change all callers.
4880         (Target_selector::do_recognize_by_emulation): New function.
4881         (Target_selector::do_supported_emulations): New function.
4882         (select_target_by_bfd_name): Change name in declaration.
4883         (select_target_by_emulation): Declare.
4884         (supported_emulation_names): Declare.
4885         * parameters.cc (parameters_force_valid_target): Try to find
4886         target based on emulation from -m option.
4887         * options.h (class General_options): Change doc string for -m.
4888         * options.cc (help): Print emulations.
4889         (General_options::parse_V): Likewise.
4890         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4891         Add emulation parameter.  Change all callers.
4892
4893 2011-06-28  Ian Lance Taylor  <iant@google.com>
4894
4895         * target.h (class Target): Add osabi_ field.
4896         (Target::osabi): New function.
4897         (Target::set_osabi): New function.
4898         (Target::Target): Initialize osabi_.
4899         (Target::do_adjust_elf_header): Make pure virtual.
4900         (Sized_target::do_adjust_elf_header): Declare.
4901         * target.cc (Sized_target::do_adjust_elf_header): New function.
4902         (class Sized_target): Instantiate all versions.
4903         * freebsd.h (class Target_freebsd): Remove.
4904         (Target_selector_freebsd::do_recognize): Call set_osabi on
4905         Target.
4906         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4907         (Target_selector_freebsd::set_osabi): Remove.
4908         * i386.cc (class Target_i386): Inherit from Sized_target rather
4909         than Target_freebsd.
4910         * x86_64.cc (class Target_x86_64): Likewise.
4911
4912 2011-06-28  Ian Lance Taylor  <iant@google.com>
4913
4914         * target.h (Target::can_check_for_function_pointers): Rewrite.
4915         Make non-virtual.
4916         (Target::can_icf_inline_merge_sections): Likewise.
4917         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4918         (Target::Target_info): Add can_icf_inline_merge_sections field.
4919         (Target::do_can_check_for_function_pointers): New virtual
4920         function.
4921         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4922         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4923         from can_check_for_function_pointers, move in file.
4924         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4925         section_may_have_icf_unsafe_poineters, move in file.
4926         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4927         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4928         Rename from can_check_for_function_pointers, move in file.
4929         (Target_i386::can_icf_inline_merge_sections): Remove.
4930         (Target_i386::i386_info): Initialize
4931         can_icf_inline_merge_sections.
4932         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4933         Initialize can_icf_inline_merge_sections.
4934         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4935         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4936         Rename from can_check_for_function_pointers, move in file.
4937         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4938         (Target_x86_64::x86_64_info): Initialize
4939         can_icf_inline_merge_sections.
4940         * testsuite/testfile.cc (Target_test::test_target_info):
4941         Likewise.
4942         * icf.cc (get_section_contents): Correct formatting.
4943
4944 2011-06-27  Ian Lance Taylor  <iant@google.com>
4945
4946         * symtab.cc (Symbol::versioned_name): New function.
4947         (Symbol_table::add_to_final_symtab): Use versioned_name when
4948         appropriate.
4949         (Symbol_table::sized_write_symbol): Likewise.
4950         * symtab.h (class Symbol): Declare versioned_name.
4951         * stringpool.h (class Stringpool_template): Add variant of add
4952         which takes a std::basic_string.
4953         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4954         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4955         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4956         (ver_test_12.o): New target.
4957         * testsuite/Makefile.in: Rebuild.
4958
4959 2011-06-27  Doug Kwan  <dougkwan@google.com>
4960
4961         * arm.cc (Arm_relocate_functions::thm_jump8,
4962         Arm_relocate_functions::thm_jump11): Use a wider signed
4963         type to compute offset.
4964         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4965         arm_thm_jump8.
4966         * testsuite/Makefile.in: Regenerate.
4967         * testsuite/arm_branch_in_range.sh: Check test results of
4968         arm_thm_jump11 and arm_thm_jump8.
4969         * testsuite/arm_thm_jump11.s: New test source file.
4970         * testsuite/arm_thm_jump11.t: New linker script.
4971         * testsuite/arm_thm_jump8.s: New test source file.
4972         * testsuite/arm_thm_jump8.t: New linker script.
4973
4974 2011-06-24  Ian Lance Taylor  <iant@google.com>
4975
4976         * layout.cc: Include "object.h".
4977         (ctors_sections_in_init_array): New static variable.
4978         (Layout::is_ctors_in_init_array): New function.
4979         (Layout::layout): Add entry to ctors_sections_in_init_array if
4980         appropriate.
4981         * layout.h (class Layout): Declare is_ctors_in_init_array.
4982         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4983         is_ctors_reverse_view is set.
4984         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4985         all callers.  Set is_ctors_reverse_view field of View_size.
4986         (Sized_relobj_file::reverse_words): New function.
4987         * object.h (Sized_relobj_file::View_size): Add
4988         is_ctors_reverse_view field.
4989         (class Sized_relobj_file): Update declarations.
4990         * testsuite/initpri3.c: New test.
4991         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4992         initpri3b.
4993         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4994         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4995         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4996         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4997         * testsuite/Makefile.in: Rebuild.
4998
4999 2011-06-24  Cary Coutant  <ccoutant@google.com>
5000
5001         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
5002         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
5003         (debug_msg_cdebug.err): New targets.
5004         * testsuite/Makefile.in: Regenerate.
5005         * testsuite/debug_msg.sh: Check output of link with compressed debug.
5006         Fix checks for link with shared library.
5007
5008 2011-06-24  Doug Kwan  <dougkwan@google.com>
5009
5010         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5011         skip empty text sections.
5012         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5013
5014 2011-06-22  Ian Lance Taylor  <iant@google.com>
5015
5016         PR gold/12910
5017         * options.h (class General_options): Add --ctors-in-init-array.
5018         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5019         friends as SHT_PROGBITS for merging sections.
5020         (Layout::layout): Remove special handling of .init_array and
5021         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5022         and .dtors if ctors_in_init_array.
5023         (Layout::make_output_section): Force correct section types for
5024         .init_array and friends.  Don't sort if doing relocatable link,
5025         Don't sort .ctors and .dtors if ctors_in_init_array.
5026         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5027         (Layout::output_section_name): Add relobj parameter.  Change all
5028         callers.  Handle .ctors. and .dtors. in code rather than table.
5029         Handle .ctors and .dtors if ctors_in_init_array.
5030         (Layout::match_file_name): New function, moved from output.cc.
5031         * layout.h (class Layout): Update declarations.
5032         * output.cc: Include "layout.h".
5033         (Input_section_sort_entry::get_priority): New function.
5034         (Input_section_sort_entry::match_file_name): Just call
5035         Layout::match_file_name.
5036         (Output_section::Input_section_sort_init_fini_compare::operator()):
5037         Handle .ctors and .dtors.  Sort by explicit priority rather than
5038         by name.
5039         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5040         * testsuite/initpri2.c: New test.
5041         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5042         (check_PROGRAMS): Add initpri2.
5043         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5044         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5045         * configure, testsuite/Makefile.in: Rebuild.
5046
5047 2011-06-19  Ian Lance Taylor  <iant@google.com>
5048
5049         PR gold/12880
5050         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5051         .interp section to a PT_INTERP segment even if we have seen a
5052         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5053         clause in a linker script.
5054         (Layout::finalize): Don't create a .interp section if we've
5055         already create a PT_INTERP segment.
5056         (Layout::create_interp): Always call choose_output_section (revert
5057         patch of 2011-06-17).  Don't create PT_INTERP segment.
5058         * script-sections.cc
5059         (Script_sections::create_note_and_tls_segments): Add a .interp
5060         section to a PT_INTERP segment even if we have seen a
5061         --dynamic-linker option.
5062
5063 2011-06-18  Ian Lance Taylor  <iant@google.com>
5064
5065         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5066         merely because a non-PT_LOAD segment has a dynamic reloc.
5067
5068 2011-06-18  Ian Lance Taylor  <iant@google.com>
5069
5070         * layout.cc (Layout::finish_dynamic_section): Don't create
5071         DT_FLAGS entry if not needed.
5072
5073 2011-06-18  Ian Lance Taylor  <iant@google.com>
5074
5075         PR gold/12745
5076         * layout.cc (Layout::layout_eh_frame): Correct handling of
5077         writable .eh_frame section.
5078
5079 2011-06-17  Ian Lance Taylor  <iant@google.com>
5080
5081         PR gold/12893
5082         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5083         symbol is redefined with the exact same object and value.
5084
5085 2011-06-17  Ian Lance Taylor  <iant@google.com>
5086
5087         PR gold/12880
5088         * layout.h (class Layout): Add interp_segment_ field.
5089         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5090         (Layout::attach_allocated_section_to_segment): If making shared
5091         library, put .interp section in PT_INTERP segment.
5092         (Layout::finalize): Also call create_interp if -dynamic-linker
5093         option was used.
5094         (Layout::create_interp): Assert that there is no PT_INTERP
5095         segment.  If not using a SECTIONS clause, use make_output_section.
5096         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5097         * script-sections.cc
5098         (Script_sections::create_note_and_tls_segments): If making shared
5099         library, put .interp section in PT_INTERP segment.
5100
5101 2011-06-17  Ian Lance Taylor  <iant@google.com>
5102
5103         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5104         when making a shared library.
5105
5106 2011-06-17  Ian Lance Taylor  <iant@google.com>
5107
5108         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5109         parameter.  Change all callers.  Don't issue warning about PC32
5110         against locally defined symbol.
5111
5112 2011-06-16  Ian Lance Taylor  <iant@google.com>
5113
5114         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5115         occurs in same object.
5116
5117 2011-06-14  Alan Modra  <amodra@gmail.com>
5118
5119         * po/POTFILES.in: Regenerate.
5120
5121 2011-06-09  Ian Lance Taylor  <iant@google.com>
5122
5123         * script-sections.cc
5124         (Orphan_output_section::set_section_addresses): For a relocatable
5125         link set address to 0.
5126
5127 2011-06-09  Cary Coutant  <ccoutant@google.com>
5128
5129         PR gold/12804
5130         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5131         used with --compress-debug-sections.
5132         * gold/object.cc (Sized_relobj_file::do_layout): Report
5133         uncompressed size of compressed input sections.
5134
5135 2011-06-08  Cary Coutant  <ccoutant@google.com>
5136
5137         PR gold/12804
5138         * testsuite/two_file_test_2_v1.cc: Change initialization of
5139         v2 to keep it in .data.
5140
5141 2011-06-07  Cary Coutant  <ccoutant@google.com>
5142
5143         * common.cc (Symbol_table::do_allocate_commons_list): Call
5144         gold_fallback.
5145         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5146         (Errors::fallback): New function.
5147         (gold_fallback): New function.
5148         * errors.h (Errors::fallback): New function.
5149         * gold.cc (gold_exit): Change status parameter to enum; adjust
5150         all callers.
5151         (queue_initial_tasks): Call gold_fallback.
5152         * gold.h: Include cstdlib.
5153         (Exit_status): New enum type.
5154         (gold_exit): Change status parameter to enum.
5155         (gold_fallback): New function.
5156         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5157         (Layout::create_symtab_sections): Likewise.
5158         (Layout::create_shdrs): Likewise.
5159         * main.cc (main): Adjust call to gold_exit.
5160         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5161         (Output_data_got::add_got_entry_pair): Likewise.
5162         (Output_section::add_input_section): Likewise.
5163         (Output_section::add_output_section_data): Likewise.
5164         (Output_segment::set_section_list_addresses): Likewise.
5165         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5166
5167 2011-06-07  Cary Coutant  <ccoutant@google.com>
5168
5169         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5170         for incremental links.
5171         * output.cc (Output_segment::set_section_list_addresses): Remove
5172         FIXME and test for TLS or BSS.
5173
5174 2011-06-07  Cary Coutant  <ccoutant@google.com>
5175
5176         * testsuite/Makefile.am: Add incremental_copy_test,
5177         incremental_common_test_1.
5178         * testsuite/Makefile.in: Regenerate.
5179         * testsuite/common_test_1_v1.c: New source file.
5180         * testsuite/common_test_1_v2.c: New source file.
5181         * testsuite/copy_test_v1.cc: New source file.
5182
5183 2011-06-07  Cary Coutant  <ccoutant@google.com>
5184
5185         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5186         update, allocate common from bss section's free list.
5187         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5188         linker-defined symbols.
5189         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5190         Skip GOT and PLT entries that are no longer referenced.
5191         (Output_section_incremental_inputs::write_info_blocks): Mark
5192         linker-defined symbols.
5193         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5194         * output.cc (Output_section::allocate): New function.
5195         * output.h (Output_section::allocate): New function.
5196         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5197         linker-defined symbols.
5198         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5199         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5200         (Symbol::init_base_output_data): Likewise.
5201         (Symbol::init_base_output_segment): Likewise.
5202         (Symbol::init_base_constant): Likewise.
5203         (Sized_symbol::init_output_data): Likewise.
5204         (Sized_symbol::init_output_segment): Likewise.
5205         (Sized_symbol::init_constant): Likewise.
5206         (Symbol_table::do_define_in_output_data): Likewise.
5207         (Symbol_table::do_define_in_output_segment): Likewise.
5208         (Symbol_table::do_define_as_constant): Likewise.
5209         * symtab.h (Symbol::is_predefined): New function.
5210         (Symbol::init_base_output_data): Add is_predefined parameter.
5211         (Symbol::init_base_output_segment): Likewise.
5212         (Symbol::init_base_constant): Likewise.
5213         (Symbol::is_predefined_): New data member.
5214         (Sized_symbol::init_output_data): Add is_predefined parameter.
5215         (Sized_symbol::init_output_segment): Likewise.
5216         (Sized_symbol::init_constant): Likewise.
5217         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5218
5219 2011-06-07  Cary Coutant  <ccoutant@google.com>
5220
5221         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5222         instead of emit_copy_reloc.
5223         (Copy_relocs::emit_copy_reloc): Refactor.
5224         (Copy_relocs::make_copy_reloc): New function.
5225         (Copy_relocs::add_copy_reloc): Remove.
5226         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5227         section.
5228         (Copy_relocs::make_copy_reloc): New function.
5229         (Copy_relocs::add_copy_reloc): Remove.
5230         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5231         unchanged input files.
5232         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5233         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5234         Reserve BSS space for COPY relocations.
5235         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5236         (Output_section_incremental_inputs::write_info_blocks): Record
5237         whether a symbol is copied from a shared object.
5238         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5239         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5240         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5241         (Incremental_input_entry_reader::get_output_symbol_index): Add
5242         is_copy parameter.
5243         (Incremental_binary::emit_copy_relocs): New function.
5244         (Incremental_binary::do_emit_copy_relocs): New function.
5245         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5246         new data member.
5247         (Sized_incremental_binary::add_copy_reloc): New function.
5248         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5249         (Sized_incremental_binary::Copy_reloc): New struct.
5250         (Sized_incremental_binary::Copy_relocs): New typedef.
5251         (Sized_incremental_binary::copy_relocs_): New data member.
5252         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5253         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5254         * target.h (Sized_target::emit_copy_reloc): New function.
5255         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5256
5257 2011-06-02  Cary Coutant  <ccoutant@google.com>
5258
5259         PR gold/12163
5260         * gold/archive.cc (Archive::Archive): Initialize new data member.
5261         (Archive::include_all_members): Return if archive has already been
5262         included.
5263         * gold/archive.h (Archive::include_all_members_): New data member.
5264
5265 2011-06-02  Nick Clifton  <nickc@redhat.com>
5266
5267         * dynobj.h: Fix spelling mistake in comment.
5268         * output.cc: Likewise.
5269
5270 2011-05-31  Doug Kwan  <dougkwan@google.com>
5271             Asier Llano
5272
5273         PR gold/12826
5274         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5275         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5276         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5277         redundant arm_exidx_test.so.
5278         * testsuite/Makefile.in: Regenerate.
5279         (check_SCRIPTS): Add pr12826.sh
5280         (check_DATA): Add pr12826.stdout
5281         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5282         * testsuite/pr12826.sh: New file.
5283         * testsuite/pr12826_1.s: Ditto.
5284         * testsuite/pr12826_1.s: Ditto.
5285
5286 2011-05-30  Ian Lance Taylor  <iant@google.com>
5287
5288         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5289         sections.
5290
5291 2011-05-29  Ian Lance Taylor  <iant@google.com>
5292
5293         PR gold/12804
5294         * testsuite/Makefile.am: Use different file name for two_file_test
5295         temporary file for each incremental test.
5296         * testsuite/Makefile.in: Rebuild.
5297
5298 2011-05-29  Ian Lance Taylor  <iant@google.com>
5299
5300         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5301         binary input file is empty.
5302
5303 2011-05-27  Ian Lance Taylor  <iant@google.com>
5304
5305         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5306         (ver_test_9.so): Likewise.
5307         * testsuite/Makefile.in: Rebuild.
5308
5309 2011-05-26 Cary Coutant  <ccoutant@google.com>
5310
5311         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5312         * incremental.cc (Incremental_inputs::report_input_section): Fix
5313         comment, indentation.
5314         (Incremental_inputs::report_comdat_group): New function.
5315         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5316         of data for incremental input file entry.
5317         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5318         group count, COMDAT group signatures.
5319         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5320         an unchanged input file.
5321         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5322         Initialize new data member.
5323         (Incremental_object_entry::add_comdat_group): New function.
5324         (Incremental_object_entry::get_comdat_group_count): New function.
5325         (Incremental_object_entry::get_comdat_signature_key): New function.
5326         (Incremental_object_entry::groups_): New data member.
5327         (Incremental_inputs::report_comdat_group): New function.
5328         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5329         data for incremental input file entry.
5330         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5331         (Incremental_input_entry_reader::get_input_section): Adjust size of
5332         data for incremental input file entry.
5333         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5334         (Incremental_input_entry_reader::get_comdat_group_signature): New
5335         function.
5336         * object.cc (Sized_relobj::include_section_group): Report kept
5337         COMDAT groups for incremental links.
5338
5339 2011-05-24  David Meyer  <pdox@google.com>
5340
5341         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5342         with name parameter.  Add found_name parameter.
5343         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5344         * dirsearch.h (class Dirsearch): Update declaration.
5345
5346 2011-05-24  Ian Lance Taylor  <iant@google.com>
5347
5348         * archive.cc (Library_base::should_include_member): Pull in object
5349         from archive if it defines the entry symbol.
5350         * parameters.cc (Parameters::entry): New function.
5351         * parameters.h (class Parameters): Declare entry.
5352         * output.h (class Output_file_header): Remove entry_ field.
5353         * output.cc (Output_file_header::Output_file_header): Remove entry
5354         parameter.  Change all callers.
5355         (Output_file_header::entry): Use parameters->entry.
5356         * gold.cc (queue_middle_tasks): Likewise.
5357         * plugin.cc (Plugin_hook::run): Likewise.
5358
5359 2011-05-24 Cary Coutant  <ccoutant@google.com>
5360
5361         * gold.cc (queue_initial_tasks): Pass incremental base filename
5362         to Output_file::open_base_file; don't print error message.
5363         * incremental-dump.cc (main): Adjust call to
5364         Output_file::open_for_modification.
5365         * incremental-dump.cc (main): Likewise.
5366         * incremental.cc (Incremental_inputs::report_command_line):
5367         Ignore --incremental-base option when comparing command lines.
5368         Ignore parameter when given as separate argument.
5369         * options.h (class General_options): Add --incremental-base.
5370         * output.cc (Output_file::Output_file):
5371         (Output_file::open_base_file): Add base_name and writable parameters;
5372         read base file into new file; print error message here.
5373         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5374         callers.
5375         * output.h (Output_file::open_for_modification): Rename to...
5376         (Output_file::open_base_file): ...this; add base_name and
5377         writable parameters; adjust all callers.
5378         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5379         callers.
5380         * testsuite/Makefile.am (incremental_test_4): Test
5381         --incremental-base.
5382         * testsuite/Makefile.in: Regenerate.
5383
5384 2011-05-24 Cary Coutant  <ccoutant@google.com>
5385
5386         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5387         incremental_test_4.
5388         * testsuite/Makefile.in: Regenerate.
5389         * testsuite/two_file_test_1_v1.cc: New test source file.
5390         * testsuite/two_file_test_1b_v1.cc: New test source file.
5391         * testsuite/two_file_test_2_v1.cc: New test source file.
5392
5393 2011-05-24 Cary Coutant  <ccoutant@google.com>
5394
5395         * dynobj.h (Dynobj::do_dynobj): New function.
5396         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5397         flag and soname for shared objects.
5398         * incremental.cc (Incremental_inputs::report_object): Make
5399         either Incremental_object_entry or Incremental_dynobj_entry; add
5400         soname to string table.
5401         (Incremental_inputs::report_input_section): Add assertion.
5402         (Output_section_incremental_inputs::set_final_data_size): Adjust
5403         type of input file entry for shared libraries; adjust size of
5404         shared library info entry.
5405         (Output_section_incremental_inputs::write_input_files): Write
5406         as_needed flag for shared libraries.
5407         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5408         of input file entry for shared libraries; write soname.
5409         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5410         soname from incremental info.
5411         * incremental.h (enum Incremental_input_flags): Add
5412         INCREMENTAL_INPUT_AS_NEEDED.
5413         (Incremental_input_entry::Incremental_input_entry): Initialize new
5414         data member.
5415         (Incremental_input_entry::set_as_needed): New function.
5416         (Incremental_input_entry::as_needed): New function.
5417         (Incremental_input_entry::do_dynobj_entry): New function.
5418         (Incremental_input_entry::as_needed_): New data member.
5419         (Incremental_object_entry::Incremental_object_entry): Don't check
5420         for shared library.
5421         (Incremental_object_entry::do_type): Likewise.
5422         (class Incremental_dynobj_entry): New class.
5423         (Incremental_input_entry_reader::as_needed): New function.
5424         (Incremental_input_entry_reader::get_soname): New function.
5425         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5426         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5427         size of shared library info entry.
5428         * layout.cc (Layout::finish_dynamic_section): Don't test for
5429         incremental link when adding DT_NEEDED entries.
5430         * object.h (Object::Object): Initialize new data member.
5431         (Object::dynobj): New function.
5432         (Object::set_as_needed): New function.
5433         (Object::as_needed): New function.
5434         (Object::do_dynobj): New function.
5435         (Object::as_needed_): New data member.
5436
5437 2011-05-24 Cary Coutant  <ccoutant@google.com>
5438
5439         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5440         info; adjust display of GOT entries.
5441         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5442         vector of input objects; remove file_status_.
5443         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5444         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5445         got_plt reader; call target hooks to reserve GOT entries.
5446         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5447         of input file info header and GOT info entry.
5448         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5449         relocation info.
5450         (Got_plt_view_info::got_descriptor): Remove.
5451         (Got_plt_view_info::sym_index): New data member.
5452         (Got_plt_view_info::input_index): New data member.
5453         (Local_got_offset_visitor::visit): Write input file index.
5454         (Global_got_offset_visitor::visit): Write 0 for input file index.
5455         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5456         with sym_index and input_index.
5457         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5458         incremental info GOT entry; replace got_descriptor with input_index.
5459         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5460         map from input file index to object.
5461         (Sized_relobj_incr::do_layout): Replace direct data member reference
5462         with accessor function.
5463         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5464         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5465         Adjust size of input file info header.
5466         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5467         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5468         (Incremental_input_entry_reader::get_input_section): Adjust size of
5469         input file info header.
5470         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5471         of incremental info GOT entry.
5472         (Incremental_got_plt_reader::get_got_desc): Remove.
5473         (Incremental_got_plt_reader::get_got_symndx): New function.
5474         (Incremental_got_plt_reader::get_got_input_index): New function.
5475         (Sized_incremental_binary::Sized_incremental_binary): Remove
5476         file_status_; add input_objects_.
5477         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5478         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5479         (Sized_incremental_binary::file_is_unchanged): Remove.
5480         (Sized_incremental_binary::set_input_object): New function.
5481         (Sized_incremental_binary::input_object): New function.
5482         (Sized_incremental_binary::file_status_): Remove.
5483         (Sized_incremental_binary::input_objects_): New data member.
5484         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5485         references.
5486         (Sized_relobj_incr::invalid_address): Move to base class.
5487         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5488         class.
5489         (Sized_relobj_incr::do_output_section_offset): Likewise.
5490         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5491         (Sized_relobj_incr::section_offsets_): Likewise.
5492         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5493         function.
5494         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5495         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5496         with accessor function.
5497         (Sized_relobj_file::do_layout): Likewise.
5498         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5499         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5500         (Sized_relobj_file::compute_final_local_value): Replace refs to
5501         section_offsets_ with accessor function.
5502         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5503         * object.h (Relobj::Relobj): Initialize new data members.
5504         (Relobj::add_dyn_reloc): New function.
5505         (Relobj::first_dyn_reloc): New function.
5506         (Relobj::dyn_reloc_count): New function.
5507         (Relobj::first_dyn_reloc_): New data member.
5508         (Relobj::dyn_reloc_count_): New data member.
5509         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5510         references.
5511         (Sized_relobj::Address): New typedef.
5512         (Sized_relobj::invalid_address): Move here from child class.
5513         (Sized_relobj::Sized_relobj): Initialize new data members.
5514         (Sized_relobj::sized_relobj): New function.
5515         (Sized_relobj::is_output_section_offset_invalid): Move here from
5516         child class.
5517         (Sized_relobj::get_output_section_offset): Likewise.
5518         (Sized_relobj::local_has_got_offset): Likewise.
5519         (Sized_relobj::local_got_offset): Likewise.
5520         (Sized_relobj::set_local_got_offset): Likewise.
5521         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5522         (Sized_relobj::clear_got_offsets): New function.
5523         (Sized_relobj::section_offsets): Move here from child class.
5524         (Sized_relobj::do_output_section_offset): Likewise.
5525         (Sized_relobj::do_set_section_offset): Likewise.
5526         (Sized_relobj::Local_got_offsets): Likewise.
5527         (Sized_relobj::local_got_offsets_): Likewise.
5528         (Sized_relobj::section_offsets_): Likewise.
5529         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5530         references.
5531         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5532         class.
5533         (Sized_relobj_file::sized_relobj): New function
5534         (Sized_relobj_file::local_has_got_offset): Move to base class.
5535         (Sized_relobj_file::local_got_offset): Likewise.
5536         (Sized_relobj_file::set_local_got_offset): Likewise.
5537         (Sized_relobj_file::get_output_section_offset): Likewise.
5538         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5539         (Sized_relobj_file::do_output_section_offset): Likewise.
5540         (Sized_relobj_file::do_set_section_offset): Likewise.
5541         (Sized_relobj_file::Local_got_offsets): Likewise.
5542         (Sized_relobj_file::local_got_offsets_): Likewise.
5543         (Sized_relobj_file::section_offsets_): Likewise.
5544         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5545         (all constructors).
5546         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5547         (Output_reloc::get_symbol_index): Likewise.
5548         (Output_reloc::local_section_offset): Likewise.
5549         (Output_reloc::get_address): Likewise.
5550         (Output_reloc::symbol_value): Likewise.
5551         (Output_data_got::reserve_slot): Move to class definition.
5552         (Output_data_got::reserve_local): New function.
5553         (Output_data_got::reserve_slot_for_global): Remove.
5554         (Output_data_got::reserve_global): New function.
5555         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5556         (all constructors, two instantiations).
5557         (Output_reloc::get_relobj): New function (two instantiations).
5558         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5559         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5560         (Output_data_reloc::add_global): Adjust type of relobj.
5561         (Output_data_reloc::add_global_relative): Likewise.
5562         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5563         (Output_data_reloc::add_local): Likewise.
5564         (Output_data_reloc::add_local_relative): Likewise.
5565         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5566         (Output_data_reloc::add_local_section): Likewise.
5567         (Output_data_reloc::add_output_section): Likewise.
5568         (Output_data_reloc::add_absolute): Likewise.
5569         (Output_data_reloc::add_target_specific): Likewise.
5570         (Output_data_got::reserve_slot): Move definition here.
5571         (Output_data_got::reserve_local): New function.
5572         (Output_data_got::reserve_global): New function.
5573         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5574         section_offsets_ with accessor function.
5575         (Sized_relobj_file::write_sections): Likewise.
5576         (Sized_relobj_file::do_relocate_sections): Likewise.
5577         * target.h (Sized_target::reserve_local_got_entry): New function.
5578         (Sized_target::reserve_global_got_entry): New function.
5579         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5580         (Target_x86_64::reserve_global_got_entry): New function.
5581         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5582
5583 2011-05-23 Cary Coutant  <ccoutant@google.com>
5584
5585         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5586         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5587         bit when checking got_type.
5588         * incremental.cc (Sized_incremental_binary::setup_readers):
5589         Store symbol table and string table locations; initialize bit vector
5590         of file status flags.
5591         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5592         unchanged files.
5593         (Sized_incremental_binary::do_process_got_plt): New function.
5594         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5595         (Output_section_incremental_inputs::set_final_data_size): Record
5596         file index for each input file.
5597         (Output_section_incremental_inputs::write_got_plt): Store file index
5598         instead of input entry offset for each GOT entry.
5599         * incremental.h
5600         (Incremental_input_entry::Incremental_input_entry): Initialize new
5601         data member.
5602         (Incremental_input_entry::set_offset): Store file index.
5603         (Incremental_input_entry::get_file_index): New function.
5604         (Incremental_input_entry::file_index_): New data member.
5605         (Incremental_binary::process_got_plt): New function.
5606         (Incremental_binary::do_process_got_plt): New function.
5607         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5608         data members.
5609         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5610         (Sized_incremental_binary::set_file_is_unchanged): New function.
5611         (Sized_incremental_binary::file_is_unchanged): New function.
5612         (Sized_incremental_binary::do_process_got_plt): New function.
5613         (Sized_incremental_binary::file_status_): New data member.
5614         (Sized_incremental_binary::main_symtab_loc_): New data member.
5615         (Sized_incremental_binary::main_strtab_loc_): New data member.
5616         * output.cc (Output_data_got::Got_entry::write): Add case
5617         RESERVED_CODE.
5618         (Output_data_got::add_global): Call add_got_entry.
5619         (Output_data_got::add_global_plt): Likewise.
5620         (Output_data_got::add_global_with_rel): Likewise.
5621         (Output_data_got::add_global_with_rela): Likewise.
5622         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5623         (Output_data_got::add_global_pair_with_rela): Likewise.
5624         (Output_data_got::add_local): Call add_got_entry.
5625         (Output_data_got::add_local_plt): Likewise.
5626         (Output_data_got::add_local_with_rel): Likewise.
5627         (Output_data_got::add_local_with_rela): Likewise.
5628         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5629         (Output_data_got::add_local_pair_with_rela): Likewise.
5630         (Output_data_got::reserve_slot): New function.
5631         (Output_data_got::reserve_slot_for_global): New function.
5632         (Output_data_got::add_got_entry): New function.
5633         (Output_data_got::add_got_entry_pair): New function.
5634         (Output_section::add_output_section_data): Edit FIXME.
5635         * output.h
5636         (Output_section_data_build::Output_section_data_build): New
5637         constructor with size parameter.
5638         (Output_data_space::Output_data_space): Likewise.
5639         (Output_data_got::Output_data_got): Initialize new data member; new
5640         constructor with size parameter.
5641         (Output_data_got::add_constant): Call add_got_entry.
5642         (Output_data_got::reserve_slot): New function.
5643         (Output_data_got::reserve_slot_for_global): New function.
5644         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5645         (Output_data_got::add_got_entry): New function.
5646         (Output_data_got::add_got_entry_pair): New function.
5647         (Output_data_got::free_list_): New data member.
5648         * target.h (Sized_target::init_got_plt_for_update): New function.
5649         (Sized_target::register_global_plt_entry): New function.
5650         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5651         Initialize new data member; call init; add constructor with PLT count.
5652         (Output_data_plt_x86_64::init): New function.
5653         (Output_data_plt_x86_64::add_relocation): New function.
5654         (Output_data_plt_x86_64::reserve_slot): New function.
5655         (Output_data_plt_x86_64::free_list_): New data member.
5656         (Target_x86_64::init_got_plt_for_update): New function.
5657         (Target_x86_64::register_global_plt_entry): New function.
5658         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5659         incremental updates.
5660         (Output_data_plt_x86_64::add_relocation): New function.
5661         * testsuite/object_unittest.cc (Object_test): Set default options.
5662
5663 2011-05-16  Ian Lance Taylor  <iant@google.com>
5664
5665         * options.h (class General_options): Make -i a synonym for -r.
5666
5667 2011-05-16  Ian Lance Taylor  <iant@google.com>
5668
5669         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5670
5671 2011-05-10 Cary Coutant  <ccoutant@google.com>
5672
5673         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5674         strip_all (-s).
5675
5676 2011-05-06  Ian Lance Taylor  <iant@google.com>
5677
5678         * layout.cc (Layout::layout): If the output section flags change,
5679         update the ordering.
5680
5681 2011-04-25 Cary Coutant  <ccoutant@google.com>
5682
5683         * incremental-dump.cc (dump_incremental_inputs): Print local
5684         symbol info for each input file.
5685         * incremental.cc
5686         (Output_section_incremental_inputs::set_final_data_size): Add local
5687         symbol info to input file entries in incremental info.
5688         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5689         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5690         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5691         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5692         implementation.
5693         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5694         (Sized_incr_relobj::do_relocate): Write the local symbols.
5695         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5696         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5697         Adjust size of input file header.
5698         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5699         (Incremental_inputs_reader::get_local_symbol_count): New function.
5700         (Incremental_inputs_reader::get_input_section): Adjust size of input
5701         file header.
5702         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5703         (Sized_incr_relobj::This): New typedef.
5704         (Sized_incr_relobj::sym_size): New const data member.
5705         (Sized_incr_relobj::Local_symbol): New struct.
5706         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5707         (Sized_incr_relobj::do_local_symbol_offset): New function.
5708         (Sized_incr_relobj::local_symbol_count_): New data member.
5709         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5710         (Sized_incr_relobj::local_symbol_index_): New data member.
5711         (Sized_incr_relobj::local_symbol_offset_): New data member.
5712         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5713         (Sized_incr_relobj::local_symbols_): New data member.
5714         * object.h (Relobj::output_local_symbol_count): New function.
5715         (Relobj::local_symbol_offset): New function.
5716         (Relobj::do_output_local_symbol_count): New function.
5717         (Relobj::do_local_symbol_offset): New function.
5718         (Sized_relobj::do_output_local_symbol_count): New function.
5719         (Sized_relobj::do_local_symbol_offset): New function.
5720
5721 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5722
5723         * descriptors.cc (set_close_on_exec): New function.
5724         (Descriptors::open): Use set_close_on_exec.
5725         * output.cc (S_ISLNK): Define if not defined.
5726
5727 2011-04-22 Cary Coutant  <ccoutant@google.com>
5728
5729         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5730         global symbol map.
5731         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5732         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5733         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5734         relocations.
5735         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5736         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5737         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5738         * incremental.h
5739         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5740         function.
5741         (Incremental_binary::apply_incremental_relocs): New function.
5742         (Incremental_binary::do_apply_incremental_relocs): New function.
5743         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5744         data member.
5745         (Sized_incremental_binary::add_global_symbol): New function.
5746         (Sized_incremental_binary::global_symbol): New function.
5747         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5748         (Sized_incremental_binary::symbol_map_): New data member.
5749         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5750         * target.h (Sized_target::apply_relocation): New function.
5751         * target-reloc.h (apply_relocation): New function.
5752         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5753
5754 2011-04-22  Doug Kwan  <dougkwan@google.com>
5755
5756         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5757         flag of a SHT_ARM_EXIDX section.
5758         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5759         * testsuite/Makefile.in: Regenerate.
5760         * testsuite/arm_exidx_test.s: New file.
5761         * testsuite/arm_exidx_test.sh: Same.
5762
5763 2011-04-20 Cary Coutant  <ccoutant@google.com>
5764
5765         PR gold/12689
5766         * archive.h (Incremental_archive_entry::Archive_member):
5767         Initialize arg_serial_ (second constructor).
5768
5769 2011-04-17  Ian Lance Taylor  <iant@google.com>
5770
5771         * object.cc (Relocate_info::location): Simplify location string.
5772         * errors.cc (Errors::error_at_location): Don't print program
5773         name.
5774         (Errors::warning_at_location): Likewise.
5775         (Errors::undefined_symbol): Likewise.
5776         * testsuite/debug_msg.sh: Update accordingly.
5777
5778 2011-04-14 Cary Coutant  <ccoutant@google.com>
5779
5780         * gold/layout.cc (Layout::symtab_section_offset): New function.
5781         * gold/layout.h (Layout::symtab_section_offset): New function.
5782         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5783
5784 2011-04-12  Ian Lance Taylor  <iant@google.com>
5785
5786         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5787         with MREMAP_MAYMOVE.
5788         * output.h (class Output_file): Add map_is_allocated_ field.
5789         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5790         not available, provide stubs.  If mremap is not available, #define
5791         it to gold_mremap.
5792         (MREMAP_MAYMOVE): Define if not defined.
5793         (Output_file::Output_file): Initialize map_is_allocated_.
5794         (Output_file::resize): Check map_is_allocated_.
5795         (Output_file::map_anonymous): If mmap fails, use malloc.
5796         (Output_file::unmap): Don't do anything for an anonymous map.
5797         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5798         is not available, provide stubs.
5799         (File_read::View::~View): Use free rather than delete[].
5800         (File_read::make_view): Use malloc rather than new[].  If mmap
5801         fails, use malloc.
5802         (File_read::find_or_make_view): Use malloc rather than new[].
5803         * gold.h: Remove HAVE_REMAP code.
5804         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5805         exists.  Rename mremap to gold_mremap.  If mmap is not available
5806         don't do anything.
5807         * configure, config.in: Rebuild.
5808
5809 2011-04-11  Ian Lance Taylor  <iant@google.com>
5810
5811         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5812         initialize local variable v.
5813
5814 2011-04-11  Cary Coutant  <ccoutant@google.com>
5815
5816         * archive.cc (Archive::include_member): Adjust call to
5817         report_object.
5818         (Add_archive_symbols::run): Track argument serial numbers.
5819         (Lib_group::include_member): Likewise.
5820         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5821         * archive.h (Incremental_archive_entry::Archive_member):
5822         Initialize arg_serial_.
5823         (Archive_member::arg_serial_): New data member.
5824         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5825         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5826         incremental link.
5827         (Sized_dynobj::do_for_all_local_got_entries): New function.
5828         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5829         function.
5830         * fileread.cc (get_mtime): New function.
5831         * fileread.h (get_mtime): New function.
5832         * gold.cc (queue_initial_tasks): Check for incremental update.
5833         (process_incremental_input): New function.
5834         (queue_middle_tasks): Don't force valid target for incremental
5835         update.
5836         * incremental-dump.cc (find_input_containing_global): Adjust
5837         size of symbol info entry.
5838         (dump_incremental_inputs): Dump argument serial number and
5839         in_system_directory flag; bias shndx by 1; print symbol names
5840         when dumping per-file symbol lists; use new symbol info readers.
5841         * incremental.cc
5842         (Output_section_incremental_inputs:update_data_size): New function.
5843         (Sized_incremental_binary::setup_readers): Setup input readers
5844         for each input file; build maps for files added from libraries
5845         and scripts.
5846         (Sized_incremental_binary::check_input_args): New function.
5847         (Sized_incremental_binary::do_check_inputs): Build map of argument
5848         serial numbers to input arguments.
5849         (Sized_incremental_binary::do_file_has_changed): Rename
5850         do_file_is_unchanged to this; compare file modification times.
5851         (Sized_incremental_binary::do_init_layout): New function.
5852         (Sized_incremental_binary::do_reserve_layout): New function.
5853         (Sized_incremental_binary::do_get_input_reader): Remove.
5854         (Sized_incremental_binary::get_symtab_view): New function.
5855         (Incremental_checker::can_incrementally_link_output_file): Remove.
5856         (Incremental_inputs::report_command_line): Exclude --debug options.
5857         (Incremental_inputs::report_archive_begin): Add parameter; track
5858         argument serial numbers; don't put input file entry for archive
5859         before archive members.
5860         (Incremental_inputs::report_archive_end): Put input file entry
5861         for archive after archive members.
5862         (Incremental_inputs::report_object): Add parameter; track argument
5863         serial numbers and in_system_directory flag.
5864         (Incremental_inputs::report_script): Add parameter; track argument
5865         serial numbers.
5866         (Output_section_incremental_inputs::set_final_data_size): Adjust
5867         size of symbol info entry; check for forwarding symbols.
5868         (Output_section_incremental_inputs::write_input_files): Write
5869         in_system_directory flag and argument serial number.
5870         (Output_section_incremental_inputs::write_info_blocks): Map section
5871         indices between incremental info and original input file; store
5872         input section index for each symbol.
5873         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5874         change operator() to visit().
5875         (class Global_got_offset_visitor): Likewise.
5876         (class Global_symbol_visitor_got_plt):
5877         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5878         classes.
5879         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5880         (Sized_incr_relobj::do_read_symbols): New function.
5881         (Sized_incr_relobj::do_layout): New function.
5882         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5883         (Sized_incr_relobj::do_add_symbols): New function.
5884         (Sized_incr_relobj::do_should_include_member): New function.
5885         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5886         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5887         (Sized_incr_relobj::do_section_size): New function.
5888         (Sized_incr_relobj::do_section_name): New function.
5889         (Sized_incr_relobj::do_section_contents): New function.
5890         (Sized_incr_relobj::do_section_flags): New function.
5891         (Sized_incr_relobj::do_section_entsize): New function.
5892         (Sized_incr_relobj::do_section_address): New function.
5893         (Sized_incr_relobj::do_section_type): New function.
5894         (Sized_incr_relobj::do_section_link): New function.
5895         (Sized_incr_relobj::do_section_info): New function.
5896         (Sized_incr_relobj::do_section_addralign): New function.
5897         (Sized_incr_relobj::do_initialize_xindex): New function.
5898         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5899         (Sized_incr_relobj::do_read_relocs): New function.
5900         (Sized_incr_relobj::do_gc_process_relocs): New function.
5901         (Sized_incr_relobj::do_scan_relocs): New function.
5902         (Sized_incr_relobj::do_count_local_symbols): New function.
5903         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5904         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5905         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5906         (Sized_incr_relobj::do_relocate): New function.
5907         (Sized_incr_relobj::do_set_section_offset): New function.
5908         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5909         (Sized_incr_dynobj::do_read_symbols): New function.
5910         (Sized_incr_dynobj::do_layout): New function.
5911         (Sized_incr_dynobj::do_add_symbols): New function.
5912         (Sized_incr_dynobj::do_should_include_member): New function.
5913         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5914         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5915         (Sized_incr_dynobj::do_section_size): New function.
5916         (Sized_incr_dynobj::do_section_name): New function.
5917         (Sized_incr_dynobj::do_section_contents): New function.
5918         (Sized_incr_dynobj::do_section_flags): New function.
5919         (Sized_incr_dynobj::do_section_entsize): New function.
5920         (Sized_incr_dynobj::do_section_address): New function.
5921         (Sized_incr_dynobj::do_section_type): New function.
5922         (Sized_incr_dynobj::do_section_link): New function.
5923         (Sized_incr_dynobj::do_section_info): New function.
5924         (Sized_incr_dynobj::do_section_addralign): New function.
5925         (Sized_incr_dynobj::do_initialize_xindex): New function.
5926         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5927         (make_sized_incremental_object): New function.
5928         (Incremental_library::copy_unused_symbols): New function.
5929         (Incremental_library::do_for_all_unused_symbols): New function.
5930         * incremental.h (enum Incremental_input_flags): New type.
5931         (class Incremental_checker): Remove.
5932         (Incremental_input_entry::Incremental_input_entry): Add argument
5933         serial number.
5934         (Incremental_input_entry::arg_serial): New function.
5935         (Incremental_input_entry::set_is_in_system_directory): New function.
5936         (Incremental_input_entry::is_in_system_directory): New function.
5937         (Incremental_input_entry::arg_serial_): New data member.
5938         (Incremental_input_entry::is_in_system_directory_): New data member.
5939         (class Script_info): Move here from script.h.
5940         (Script_info::Script_info): Add filename parameter.
5941         (Script_info::filename): New function.
5942         (Script_info::filename_): New data member.
5943         (Incremental_script_entry::Incremental_script_entry): Add argument
5944         serial number.
5945         (Incremental_object_entry::Incremental_object_entry): Likewise.
5946         (Incremental_object_entry::add_input_section): Build list of input
5947         sections with map to original shndx.
5948         (Incremental_object_entry::get_input_section_index): New function.
5949         (Incremental_object_entry::shndx_): New data member.
5950         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5951         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5952         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5953         serial number.
5954         (Incremental_inputs::report_archive_begin): Likewise.
5955         (Incremental_inputs::report_object): Likewise.
5956         (Incremental_inputs::report_script): Likewise.
5957         (class Incremental_global_symbol_reader): New class.
5958         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5959         and store flags and input file type.
5960         (Incremental_input_entry_reader::arg_serial): New function.
5961         (Incremental_input_entry_reader::type): Extract type from flags.
5962         (Incremental_input_entry_reader::is_in_system_directory): New function.
5963         (Incremental_input_entry_reader::get_input_section_count): Call
5964         accessor function for type.
5965         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5966         function for type; adjust size of global symbol entry.
5967         (Incremental_input_entry_reader::get_global_symbol_count): Call
5968         accessor function for type.
5969         (Incremental_input_entry_reader::get_object_count): Likewise.
5970         (Incremental_input_entry_reader::get_object_offset): Likewise.
5971         (Incremental_input_entry_reader::get_member_count): Likewise.
5972         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5973         (Incremental_input_entry_reader::get_member_offset): Likewise.
5974         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5975         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5976         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5977         (Incremental_input_entry_reader::get_global_symbol_reader): New
5978         function.
5979         (Incremental_input_entry_reader::get_output_symbol_index): New
5980         function.
5981         (Incremental_input_entry_reader::type_): Remove.
5982         (Incremental_input_entry_reader::flags_): New data member.
5983         (Incremental_inputs_reader::input_file_offset): New function.
5984         (Incremental_inputs_reader::input_file_index): New function.
5985         (Incremental_inputs_reader::input_file): Call input_file_offset.
5986         (Incremental_inputs_reader::input_file_at_offset): New function.
5987         (Incremental_relocs_reader::get_r_type): Reformat.
5988         (Incremental_relocs_reader::get_r_shndx): Reformat.
5989         (Incremental_relocs_reader::get_r_offset): Reformat.
5990         (Incremental_relocs_reader::data): New function.
5991         (Incremental_binary::Incremental_binary): Initialize new data members.
5992         (Incremental_binary::check_inputs): Add cmdline parameter.
5993         (Incremental_binary::file_is_unchanged): Remove.
5994         (Input_reader::arg_serial): New function.
5995         (Input_reader::get_unused_symbol_count): New function.
5996         (Input_reader::get_unused_symbol): New function.
5997         (Input_reader::do_arg_serial): New function.
5998         (Input_reader::do_get_unused_symbol_count): New function.
5999         (Input_reader::do_get_unused_symbol): New function.
6000         (Incremental_binary::input_file_count): New function.
6001         (Incremental_binary::get_input_reader): Change signature to use
6002         index instead of filename.
6003         (Incremental_binary::file_has_changed): New function.
6004         (Incremental_binary::get_input_argument): New function.
6005         (Incremental_binary::get_library): New function.
6006         (Incremental_binary::get_script_info): New function.
6007         (Incremental_binary::init_layout): New function.
6008         (Incremental_binary::reserve_layout): New function.
6009         (Incremental_binary::output_file): New function.
6010         (Incremental_binary::do_check_inputs): New function.
6011         (Incremental_binary::do_file_is_unchanged): Remove.
6012         (Incremental_binary::do_file_has_changed): New function.
6013         (Incremental_binary::do_init_layout): New function.
6014         (Incremental_binary::do_reserve_layout): New function.
6015         (Incremental_binary::do_input_file_count): New function.
6016         (Incremental_binary::do_get_input_reader): Change signature.
6017         (Incremental_binary::input_args_map_): New data member.
6018         (Incremental_binary::library_map_): New data member.
6019         (Incremental_binary::script_map_): New data member.
6020         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6021         new data members.
6022         (Sized_incremental_binary::output_section): New function.
6023         (Sized_incremental_binary::inputs_reader): Add const.
6024         (Sized_incremental_binary::symtab_reader): Add const.
6025         (Sized_incremental_binary::relocs_reader): Add const.
6026         (Sized_incremental_binary::got_plt_reader): Add const.
6027         (Sized_incremental_binary::get_symtab_view): New function.
6028         (Sized_incremental_binary::Inputs_reader): New typedef.
6029         (Sized_incremental_binary::Input_entry_reader): New typedef.
6030         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6031         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6032         (Sized_incremental_binary::do_file_has_changed): New function.
6033         (Sized_incremental_binary::do_init_layout): New function.
6034         (Sized_incremental_binary::do_reserve_layout): New function.
6035         (Sized_input_reader::Inputs_reader): Remove.
6036         (Sized_input_reader::Input_entry_reader): Remove.
6037         (Sized_input_reader::do_arg_serial): New function.
6038         (Sized_input_reader::do_get_unused_symbol_count): New function.
6039         (Sized_input_reader::do_get_unused_symbol): New function.
6040         (Sized_incremental_binary::do_input_file_count): New function.
6041         (Sized_incremental_binary::do_get_input_reader): Change signature;
6042         use index instead of filename.
6043         (Sized_incremental_binary::section_map_): New data member.
6044         (Sized_incremental_binary::input_entry_readers_): New data member.
6045         (class Sized_incr_relobj): New class.
6046         (class Sized_incr_dynobj): New class.
6047         (make_sized_incremental_object): New function.
6048         (class Incremental_library): New class.
6049         * layout.cc (Free_list::num_lists): New static data member.
6050         (Free_list::num_nodes): New static data member.
6051         (Free_list::num_removes): New static data member.
6052         (Free_list::num_remove_visits): New static data member.
6053         (Free_list::num_allocates): New static data member.
6054         (Free_list::num_allocate_visits): New static data member.
6055         (Free_list::init): New function.
6056         (Free_list::remove): New function.
6057         (Free_list::allocate): New function.
6058         (Free_list::dump): New function.
6059         (Free_list::print_stats): New function.
6060         (Layout_task_runner::run): Resize output file for incremental updates.
6061         (Layout::Layout): Initialize new data members.
6062         (Layout::set_incremental_base): New function.
6063         (Layout::init_fixed_output_section): New function.
6064         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6065         incremental updates.
6066         (Layout::create_gold_note): Do not create gold note section for
6067         incremental updates.
6068         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6069         for incremental updates.
6070         (Layout::set_section_offsets): For incremental updates, allocate space
6071         from free list.
6072         (Layout::create_symtab_sections): Layout with offsets relative to
6073         start of section; for incremental updates, allocate space from free
6074         list.
6075         (Layout::create_shdrs): For incremental updates, allocate space from
6076         free list.
6077         (Layout::finish_dynamic_section): For incremental updates, do not
6078         check --as-needed (fixed in subsequent patch).
6079         * layout.h (class Free_list): New class.
6080         (Layout::set_incremental_base): New function.
6081         (Layout::incremental_base): New function.
6082         (Layout::init_fixed_output_section): New function.
6083         (Layout::allocate): New function.
6084         (Layout::incremental_base_): New data member.
6085         (Layout::free_list_): New data member.
6086         * main.cc (main): Print Free_list statistics.
6087         * object.cc (Relobj::finalize_incremental_relocs): Add
6088         clear_counts parameter; clear counts only when clear_counts is set.
6089         (Sized_relobj::Sized_relobj): Initialize new base class.
6090         (Sized_relobj::do_layout): Don't report special sections.
6091         (Sized_relobj::do_for_all_local_got_entries): New function.
6092         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6093         symtab_off to all symbol table offsets.
6094         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6095         * object.h (class Got_offset_list): Move to top of file.
6096         (Object::Object): Allow case where input_file == NULL.
6097         (Object::~Object): Likewise.
6098         (Object::input_file): Assert that input_file != NULL.
6099         (Object::lock): Allow case where input_file == NULL.
6100         (Object::unlock): Likewise.
6101         (Object::is_locked): Likewise.
6102         (Object::token): Likewise.
6103         (Object::release): Likewise.
6104         (Object::is_incremental): New function.
6105         (Object::get_mtime): New function.
6106         (Object::for_all_local_got_entries): New function.
6107         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6108         (Object::set_is_in_system_directory): New function.
6109         (Object::is_in_system_directory): New function.
6110         (Object::do_is_incremental): New function.
6111         (Object::do_get_mtime): New function.
6112         (Object::do_for_all_local_got_entries): New function.
6113         (Object::is_in_system_directory_): New data member.
6114         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6115         (class Sized_relobj_base): New class.
6116         (class Sized_relobj): Derive from Sized_relobj_base.
6117         (class Sized_relobj::Symbols): Redeclare from base class.
6118         (class Sized_relobj::local_got_offset_list): Remove.
6119         (class Sized_relobj::Output_sections): Redeclare from base class.
6120         (class Sized_relobj::do_for_all_local_got_entries): New function.
6121         (class Sized_relobj::write_local_symbols): Add offset parameter.
6122         (class Sized_relobj::local_symbol_offset_): Update comment.
6123         (class Sized_relobj::local_dynsym_offset_): Update comment.
6124         * options.cc (Input_arguments::add_file): Remove const.
6125         * options.h (Input_file_argument::Input_file_argument):
6126         Initialize arg_serial_ (all constructors).
6127         (Input_file_argument::set_arg_serial): New function.
6128         (Input_file_argument::arg_serial): New function.
6129         (Input_file_argument::arg_serial_): New data member.
6130         (Input_arguments::Input_arguments): Initialize file_count_.
6131         (Input_arguments::add_file): Remove const.
6132         (Input_arguments::number_of_input_files): New function.
6133         (Input_arguments::file_count_): New data member.
6134         (Command_line::number_of_input_files): Call
6135         Input_arguments::number_of_input_files.
6136         * output.cc (Output_segment_headers::Output_segment_headers):
6137         Set current size.
6138         (Output_section::Input_section::current_data_size): New function.
6139         (Output_section::Output_section): Initialize new data members.
6140         (Output_section::add_input_section): Don't do merge sections for
6141         an incremental link; allocate space from free list for an
6142         incremental update.
6143         (Output_section::add_output_section_data): Allocate space from
6144         free list for an incremental update.
6145         (Output_section::update_data_size): New function.
6146         (Output_section::set_fixed_layout): New function.
6147         (Output_section::reserve): New function.
6148         (Output_segment::set_section_addresses): Remove const.
6149         (Output_segment::set_section_list_addresses): Remove const; allocate
6150         space from free list for an incremental update.
6151         (Output_segment::set_offset): Adjust size of RELRO segment for an
6152         incremental update.
6153         * output.h (Output_data::current_data_size): Move here from
6154         child classes.
6155         (Output_data::pre_finalize_data_size): New function.
6156         (Output_data::update_data_size): New function.
6157         (Output_section_headers::update_data_size): new function.
6158         (Output_section_data_build::current_data_size): Move to Output_data.
6159         (Output_data_strtab::update_data_size): New function.
6160         (Output_section::current_data_size): Move to Output_data.
6161         (Output_section::set_fixed_layout): New function.
6162         (Output_section::has_fixed_layout): New function.
6163         (Output_section::reserve): New function.
6164         (Output_section::update_data_size): New function.
6165         (Output_section::has_fixed_layout_): New data member.
6166         (Output_section::free_list_): New data member.
6167         (Output_segment::set_section_addresses): Remove const.
6168         (Output_segment::set_section_list_addresses): Remove const.
6169         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6170         New function.
6171         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6172         New function.
6173         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6174         parameter when calling Add_symbols constructor; store argument
6175         serial number for members of a lib group.
6176         (Add_symbols::locks): Allow case where token == NULL.
6177         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6178         (Read_member::~Read_member): New function.
6179         (Read_member::is_runnable): New function.
6180         (Read_member::locks): New function.
6181         (Read_member::run): New function.
6182         (Check_script::~Check_script): New function.
6183         (Check_script::is_runnable): New function.
6184         (Check_script::locks): New function.
6185         (Check_script::run): New function.
6186         (Check_library::~Check_library): New function.
6187         (Check_library::is_runnable): New function.
6188         (Check_library::locks): New function.
6189         (Check_library::run): New function.
6190         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6191         (Add_symbols::library_): New data member.
6192         (class Read_member): New class.
6193         (class Check_script): New class.
6194         (class Check_library): New class.
6195         * reloc.cc (Read_relocs::is_runnable): Allow case where
6196         token == NULL.
6197         (Read_relocs::locks): Likewise.
6198         (Scan_relocs::locks): Likewise.
6199         (Relocate_task::locks): Likewise.
6200         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6201         to clear counters.
6202         (Sized_relobj::incremental_relocs_scan): Fix comment.
6203         (Sized_relobj::do_relocate): Pass output file offset to
6204         write_local_symbols.
6205         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6206         from class declaration.
6207         * script.cc (read_input_script): Allocate Script_info; pass
6208         argument serial number to report_script.
6209         * script.h (class Script_info): Move to incremental.h.
6210         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6211         * symtab.h (Symbol_table::add_from_incrobj): New function.
6212         (Symbol_table::set_file_offset): New function.
6213
6214 2011-04-05  Cary Coutant  <ccoutant@google.com>
6215
6216         * incremental-dump.cc (dump_incremental_inputs): Change signature
6217         to take a Sized_incremental_binary; change caller.  Use readers
6218         in Sized_incremental_binary.
6219         * incremental.cc
6220         (Sized_incremental_binary::find_incremental_inputs_sections):
6221         Rename do_find_incremental_inputs_sections to this.
6222         (Sized_incremental_binary::setup_readers): New function.
6223         (Sized_incremental_binary::do_check_inputs): Check
6224         has_incremental_info_ flag; move setup code to setup_readers;
6225         use input readers.
6226         (Sized_incremental_binary::do_file_is_unchanged): New function.
6227         (Sized_incremental_binary::do_get_input_reader): New function.
6228         * incremental.h (class Incremental_binary): Move to end of file.
6229         (Incremental_binary::file_is_unchanged): New function.
6230         (Incremental_binary::do_file_is_unchanged): New function.
6231         (Incremental_binary::Input_reader): New class.
6232         (Incremental_binary::get_input_reader): New function.
6233         (class Sized_incremental_binary): Move to end of file.
6234         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6235         input section reader classes.
6236         (Sized_incremental_binary::has_incremental_info): New function.
6237         (Sized_incremental_binary::inputs_reader): New function.
6238         (Sized_incremental_binary::symtab_reader): New function.
6239         (Sized_incremental_binary::relocs_reader): New function.
6240         (Sized_incremental_binary::got_plt_reader): New function.
6241         (Sized_incremental_binary::do_file_is_unchanged): New function.
6242         (Sized_incremental_binary::Sized_input_reader): New class.
6243         (Sized_incremental_binary::get_input_reader): New function.
6244         (Sized_incremental_binary::find_incremental_inputs_sections):
6245         Rename do_find_incremental_inputs_sections to this.
6246         (Sized_incremental_binary::setup_readers): New function.
6247         (Sized_incremental_binary::has_incremental_info_): New data member.
6248         (Sized_incremental_binary::inputs_reader_): New data member.
6249         (Sized_incremental_binary::symtab_reader_): New data member.
6250         (Sized_incremental_binary::relocs_reader_): New data member.
6251         (Sized_incremental_binary::got_plt_reader_): New data member.
6252         (Sized_incremental_binary::current_input_file_): New data member.
6253
6254 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6255
6256         PR gold/12640
6257         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6258         violation.
6259
6260 2011-03-30  Cary Coutant  <ccoutant@google.com>
6261
6262         * archive.cc (Archive::include_member): Adjust call to report_object.
6263         (Add_archive_symbols::run): Add script_info to call to
6264         report_archive_begin.
6265         (Lib_group::include_member): Adjust call to report_object.
6266         (Add_lib_group_symbols::run): Adjust call to report_object.
6267         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6268         blocks.  Add object count for script input files.
6269         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6270         script_info parameter; change all callers.
6271         (Incremental_inputs::report_object): Add script_info parameter;
6272         change all callers.
6273         (Incremental_inputs::report_script): Store backpointer to
6274         incremental info entry.
6275         (Output_section_incremental_inputs::set_final_data_size): Record
6276         additional information for scripts.
6277         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6278         * incremental.h (Incremental_script_entry::add_object): New function.
6279         (Incremental_script_entry::get_object_count): New function.
6280         (Incremental_script_entry::get_object): New function.
6281         (Incremental_script_entry::objects_): New data member; adjust
6282         constructor.
6283         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6284         (Incremental_inputs::report_object): Add script_info parameter.
6285         (Incremental_inputs_reader::get_object_count): New function.
6286         (Incremental_inputs_reader::get_object_offset): New function.
6287         * options.cc (Input_arguments::add_file): Return reference to
6288         new input argument.
6289         * options.h (Input_argument::set_script_info): New function.
6290         (Input_argument::script_info): New function.
6291         (Input_argument::script_info_): New data member; adjust all
6292         constructors.
6293         (Input_file_group::add_file): Return reference to new input argument.
6294         (Input_file_lib::add_file): Likewise.
6295         (Input_arguments::add_file): Likewise.
6296         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6297         * script.cc (Parser_closure::Parser_closure): Add script_info
6298         parameter; adjust all callers.
6299         (Parser_closure::script_info): New function.
6300         (Parser_closure::script_info_): New data member.
6301         (read_input_script): Report scripts earlier to incremental info.
6302         (script_add_file): Set script_info in Input_argument.
6303         (script_add_library): Likewise.
6304         * script.h (Script_options::Script_info): Rewrite class.
6305
6306 2011-03-29  Cary Coutant  <ccoutant@google.com>
6307
6308         * archive.cc (Library_base::should_include_member): Move
6309         method here from class Archive.
6310         (Archive::Archive): Initialize base class.
6311         (Archive::should_include_member): Move to base class.
6312         (Archive::do_for_all_unused_symbols): New function.
6313         (Add_archive_symbols::run): Remove redundant access to
6314         incremental_inputs.
6315         (Lib_group::Lib_group): Initialize base class.
6316         (Lib_group::do_filename): New function.
6317         (Lib_group::include_member): Pass pointer to Lib_group to
6318         report_object.
6319         (Lib_group::do_for_all_unused_symbols): New function.
6320         (Add_lib_group_symbols::run): Report archive information for
6321         incremental links.
6322         * archive.h (class Library_base): New base class.
6323         (class Archive): Derive from Library_base.
6324         (Archive::filename): Move to base class.
6325         (Archive::set_incremental_info): Likewise.
6326         (Archive::incremental_info): Likewise.
6327         (Archive::Should_include): Likewise.
6328         (Archive::should_include_member): Likewise.
6329         (Archive::Armap_entry): Remove.
6330         (Archive::Unused_symbol_iterator): Remove.
6331         (Archive::unused_symbols_begin): Remove.
6332         (Archive::unused_symbols_end): Remove.
6333         (Archive::do_filename): New function.
6334         (Archive::do_get_mtime): New function.
6335         (Archive::do_for_all_unused_symbols): New function.
6336         (Archive::task_): Move to base class.
6337         (Archive::incremental_info_): Likewise.
6338         (class Lib_group): Derive from Library_base.
6339         (Lib_group::do_filename): New function.
6340         (Lib_group::do_get_mtime): New function.
6341         (Lib_group::do_for_all_unused_symbols): New function.
6342         (Lib_group::task_): Move to base class.
6343         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6344         function.
6345         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6346         function.
6347         * incremental.cc (Incremental_inputs::report_archive_begin):
6348         Use Library_base; call library's get_mtime; add incremental inputs
6349         entry before members.
6350         (class Unused_symbol_visitor): New class.
6351         (Incremental_inputs::report_archive_end): Use Library_base; use
6352         visitor class to record unused symbols; don't add incremental inputs
6353         entry after members.
6354         (Incremental_inputs::report_object): Use Library_base.
6355         * incremental.h
6356         (Incremental_archive_entry::Incremental_archive_entry): Remove
6357         unused Archive parameter.
6358         (Incremental_inputs::report_archive_begin): Use Library_base.
6359         (Incremental_inputs::report_archive_end): Likewise.
6360         (Incremental_inputs::report_object): Likewise.
6361         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6362         function.
6363         * object.h (Object::for_all_global_symbols): New function.
6364         (Object::do_for_all_global_symbols): New function.
6365         (Sized_relobj::do_for_all_global_symbols): New function.
6366         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6367         function.
6368         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6369         function.
6370
6371 2011-03-27  Ian Lance Taylor  <iant@google.com>
6372
6373         * archive.cc (Archive::interpret_header): Return -1 if something
6374         goes wrong.  Change callers accordingly.
6375
6376 2011-03-25  Cary Coutant  <ccoutant@google.com>
6377
6378         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6379         * testsuite/Makefile.in: Regenerate.
6380
6381 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6382
6383         * plugin.cc (get_view): New.
6384         (Plugin::load): Pass get_view to the plugin.
6385         (Plugin_manager::get_view): New.
6386
6387 2011-03-21  Ian Lance Taylor  <iant@google.com>
6388
6389         * testsuite/final_layout.sh: Rewrite to not use dc.
6390         * testsuite/relro_test.sh: Fail if dc is not present.
6391
6392 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6393
6394         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6395         Change == to -eq.
6396         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6397         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6398         Change == to -eq.
6399         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6400         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6401
6402 2011-03-14  Ian Lance Taylor  <iant@google.com>
6403
6404         * script-sections.cc (Sort_output_sections::script_compare):
6405         Rename from is_before, change return type.
6406         (Sort_output_sections::operator()): Adjust accordingly.
6407
6408 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6409
6410         PR gold/12572
6411         * testsuite/odr_violation2.cc: Add comment to make all error line
6412         numbers double digits.
6413         * testsuite/debug_msg.sh: Adjust expected errors.
6414
6415 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6416
6417         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6418         but mark earlier ones as non-canonical
6419         (offset_to_iterator): Update search target and example
6420         (do_addr2line): Return extra lines in a vector*
6421         (format_file_lineno): Extract from do_addr2line
6422         (one_addr2line): Add vector* out-param
6423         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6424         when a lineno entry appeared last for its instruction
6425         (Dwarf_line_info): Add vector* out-param
6426         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6427         * symtab.cc (Odr_violation_compare): Include the lineno in the
6428         comparison again.
6429         (linenos_from_loc): New. Combine the canonical line for an
6430         address with its other lines.
6431         (True_if_intersect): New. Helper functor to make
6432         std::set_intersection a query.
6433         (detect_odr_violations): Compare sets of lines instead of just
6434         one line for each function. This became less deterministic, but
6435         has fewer false positives.
6436         * symtab.h: Declarations.
6437         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6438         mix an optimized and non-optimized object in the same binary
6439         (odr_violation2.so): Same.
6440         * testsuite/Makefile.in: Regenerate from Makefile.am.
6441         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6442         * testsuite/debug_msg.sh: Update line numbers and add
6443         assertions.
6444         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6445         non-optimized context.
6446         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6447         isn't inlined, and use OdrDerived in an optimized context.
6448         * testsuite/odr_header1.h: Defines OdrDerived, where
6449         optimization will change the
6450         first-instruction-in-the-destructor's file and line number.
6451         * testsuite/odr_header2.h: Defines OdrBase.
6452
6453 2011-03-09  Ian Lance Taylor  <iant@google.com>
6454
6455         * fileread.cc (File_read::clear_views): Don't delete the whole
6456         file view.
6457
6458 2011-03-08  Ian Lance Taylor  <iant@google.com>
6459
6460         PR gold/12525
6461         * fileread.cc: #include <climits>.
6462         (GOLD_IOV_MAX): Define.
6463         (File_read::read_multiple): Limit number of entries by iov_max.
6464         * fileread.h (class File_read): Always set max_readv_entries to
6465         128.
6466
6467 2011-03-07  Ian Lance Taylor  <iant@google.com>
6468
6469         PR gold/12525
6470         * options.h (class General_options): Add -dy and -dn.
6471
6472 2011-03-02  Cary Coutant  <ccoutant@google.com>
6473
6474         * testsuite/script_test_9.t: Add TLS segment.
6475
6476 2011-03-02  Simon Baldwin  <simonb@google.com>
6477
6478         * configure.ac: Add check for gnu_indirect_function support in
6479         the toolchain building binutils.
6480         * configure: Rebuild.
6481
6482 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6483
6484         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6485         plugin only symbols.
6486         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6487         in plugin files as not needed in the symbol table.
6488
6489 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6490
6491         * output.cc (Output_section::add_input_section): Delay fill
6492         generation for section ordering.
6493
6494 2011-02-09  Ian Lance Taylor  <iant@google.com>
6495
6496         PR gold/12316
6497         * object.h (class Sized_relobj): Remove clear_local_symbols.
6498         * reloc.cc (Sized_relobj::do_relocate): Don't call
6499         clear_local_symbols.
6500
6501 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6502
6503         * plugin.cc (is_visible_from_outside): Return true for symbols
6504         in the -u option.
6505
6506 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6507
6508         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6509         filename.
6510
6511 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6512
6513         * icf.h (is_section_foldable_candidate): Change type of parameter
6514         to std::string.
6515         * icf.cc (Icf::find_identical_sections): Change type of local variable
6516         section_name to be std::string.
6517         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6518
6519 2011-01-25  Ian Lance Taylor  <iant@google.com>
6520
6521         * script.cc (script_add_extern): Rewrite to use
6522         add_symbol_reference.
6523
6524 2011-01-25  Doug Kwan  <dougkwan@google.com>
6525
6526         * icf.cc (get_section_contents): Always lock section's object.
6527
6528 2011-01-24  Ian Lance Taylor  <iant@google.com>
6529
6530         * options.h (class General_options): Accept
6531         --no-detect-odr-violations.
6532
6533 2011-01-24  Ian Lance Taylor  <iant@google.com>
6534
6535         * version.cc (version_string): Bump to 1.11.
6536
6537 2011-01-24  Ian Lance Taylor  <iant@google.com>
6538
6539         * plugin.cc (class Plugin_rescan): Define new class.
6540         (Plugin_manager::claim_file): Set any_claimed_.
6541         (Plugin_manager::save_archive): New function.
6542         (Plugin_manager::save_input_group): New function.
6543         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6544         necessary.
6545         (Plugin_manager::new_undefined_symbol): New function.
6546         (Plugin_manager::rescan): New function.
6547         (Plugin_manager::rescannable_defines): New function.
6548         (Plugin_manager::add_input_file): Set any_added_.
6549         * plugin.h (class Plugin_manager): define new fields rescannable_,
6550         undefined_symbols_, any_claimed_, and any_added_.  Declare
6551         Plugin_rescan as friend.  Declare new functions.
6552         (Plugin_manager::Rescannable): Define type.
6553         (Plugin_manager::Rescannable_list): Define type.
6554         (Plugin_manager::Undefined_symbol_list): Define type.
6555         (Plugin_manager::Plugin_manager): Initialize new fields.
6556         * archive.cc (Archive::defines_symbol): New function.
6557         (Add_archive_symbols::run): Pass archive to plugins if any.
6558         * archive.h (class Archive): Declare defines_symbol.
6559         * readsyms.cc (Input_group::~Input_group): New function.
6560         (Finish_group::run): Pass input_group to plugins if any.
6561         * readsyms.h (class Input_group): Declare destructor.
6562         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6563         any.
6564
6565 2011-01-10  Ian Lance Taylor  <iant@google.com>
6566
6567         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6568         section as relro.
6569         (Layout::set_segment_offsets): Reset increase_relro before calling
6570         set_section_addresses a second time.
6571
6572 2011-01-04  Cary Coutant  <ccoutant@google.com>
6573
6574         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6575         sections before NOBITS sections.
6576
6577 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6578
6579         * version.cc (print_version): Update copyright to 2011.
6580
6581 2010-12-23  Cary Coutant  <ccoutant@google.com>
6582
6583         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6584         of OS to this->add.  Add OD parameter to second form of the function.
6585
6586 2010-12-20  Ian Lance Taylor  <iant@google.com>
6587
6588         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6589         second of two consecutive entries with same offset.
6590
6591 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6592
6593         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6594         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6595         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6596         to avoid unneeded links against $(LDADD).
6597         * testsuite/Makefile.in: Regenerate.
6598
6599 2010-12-15  Ian Lance Taylor  <iant@google.com>
6600
6601         PR gold/12324
6602         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6603         for R_X86_64_32 and R_X86_64_PC32.
6604         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6605         ver_matching_def_pic.o.
6606         (ver_matching_def_pic.o): New target.
6607
6608 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6609
6610         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6611         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6612         Move definition before File_read::View member definitions.
6613         (File_read::View::~View): Initialize and hold lock before
6614         updating current_mapped_bytes.
6615
6616 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6617
6618         * dwarf_reader.cc: Remove outdated comment.
6619         * gold-threads.cc: Fix typo in error message.
6620         * archive.cc: Fix typos in comments.
6621         * archive.h: Likewise.
6622         * arm-reloc-property.cc: Likewise.
6623         * arm-reloc-property.h: Likewise.
6624         * arm-reloc.def: Likewise.
6625         * arm.cc: Likewise.
6626         * attributes.h: Likewise.
6627         * cref.cc: Likewise.
6628         * ehframe.cc: Likewise.
6629         * fileread.h: Likewise.
6630         * gold.h: Likewise.
6631         * i386.cc: Likewise.
6632         * icf.cc: Likewise.
6633         * incremental.h: Likewise.
6634         * int_encoding.cc: Likewise.
6635         * layout.h: Likewise.
6636         * main.cc: Likewise.
6637         * merge.h: Likewise.
6638         * object.cc: Likewise.
6639         * object.h: Likewise.
6640         * options.cc: Likewise.
6641         * readsyms.cc: Likewise.
6642         * reduced_debug_output.cc: Likewise.
6643         * reloc.cc: Likewise.
6644         * script-sections.cc: Likewise.
6645         * sparc.cc: Likewise.
6646         * symtab.h: Likewise.
6647         * target-reloc.h: Likewise.
6648         * target.cc: Likewise.
6649         * target.h: Likewise.
6650         * timer.cc: Likewise.
6651         * timer.h: Likewise.
6652         * x86_64.cc: Likewise.
6653
6654 2010-12-09  Cary Coutant  <ccoutant@google.com>
6655
6656         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6657         stack.
6658         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6659         parameter; change all callers.
6660         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6661         * options.h (warn_execstack): New option.
6662
6663 2010-12-07  Doug Kwan  <dougkwan@google.com>
6664
6665         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6666         like function call relocations.
6667
6668 2010-12-07  Ian Lance Taylor  <iant@google.com>
6669
6670         * archive.cc (Archive::get_elf_object_for_member): Permit
6671         punconfigured to be NULL.
6672         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6673         (Archive::include_member): Pass NULL to get_elf_object_for_member
6674         if we searched for the archive and this is the first included
6675         object.
6676
6677 2010-12-01  Ian Lance Taylor  <iant@google.com>
6678
6679         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6680         track_relocs_type_ field.
6681         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6682         Set track_relocs_type_.
6683         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6684         contents when using RELA relocs.
6685         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6686         reloc_map_.
6687         * reloc.cc (Track_relocs::next_addend): New function.
6688         * reloc.h (class Track_relocs): Declare next_addend.
6689
6690 2010-12-01  Ian Lance Taylor  <iant@google.com>
6691
6692         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6693         virtual destructor.
6694
6695 2010-12-01  Ian Lance Taylor  <iant@google.com>
6696
6697         * README: Update compilers known to work and fail.
6698
6699 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6700
6701         * configure.in: For --enable-gold, handle value `default' instead of
6702         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6703         not the default.
6704         * configure: Regenerate.
6705
6706 2010-11-18  Doug Kwan  <dougkwan@google.com>
6707
6708         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6709         and right_alignment to be zero.  Store result alignment only if it is
6710         greater than existing alignment.
6711
6712 2010-11-16  Cary Coutant  <ccoutant@google.com>
6713
6714         PR gold/12220
6715         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6716         Check for ".zdebug_line".
6717
6718 2010-11-16  Doug Kwan  <dougkwan@google.com>
6719             Cary Coutant  <ccoutant@google.com>
6720
6721         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6722         by reference; adjust all callers.
6723         * output.cc (Output_segment::set_section_addresses): Adjust references
6724         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6725         list is empty.
6726         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6727         end at page boundary.
6728
6729 2010-11-16  Cary Coutant  <ccoutant@google.com>
6730
6731         PR gold/12220
6732         * layout.cc (Layout::choose_output_section): Transform names of
6733         compressed sections even when using a script with a SECTIONS clause.
6734         (Layout::output_section_name): Remove code to transform
6735         compressed debug section names.
6736         * output.cc (Output_section::add_input_section): Use uncompressed
6737         section size when tracking input sections.
6738
6739 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6740
6741         * symtab.h (Symbol::NON_PIC_REF): Remove.
6742         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6743         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6744         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6745         (Symbol::use_plt_offset): Take a flags argument and pass it
6746         directly to needs_dynamic_reloc.  Restrict check for undefined
6747         weak symbols to function calls.
6748         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6749         (Target_arm::Scan::global): Use it.
6750         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6751         (Target_arm::Relocate::relocate): Likewise.
6752         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6753         parameter with an r_type parameter.  Use get_reference_flags
6754         to get the flags.
6755         (Target_arm::Relocate::relocate): Update accordingly.
6756         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6757         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6758         (Target_i386::Scan::global): Likewise.
6759         (Target_i386::Relocate::relocate): Likewise.
6760         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6761         parameter with an r_type parameter.  Use get_reference_flags
6762         to get the flags.
6763         (Target_i386::Relocate::relocate): Update accordingly.
6764         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6765         (Target_powerpc::Scan::global): Use it.
6766         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6767         (Target_powerpc::Relocate::relocate): Likewise.
6768         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6769         (Target_sparc::Scan::global): Use it.
6770         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6771         (Target_sparc::Relocate::relocate): Likewise.
6772         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6773         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6774         (Target_x86_64::Scan::global): Likewise.
6775         (Target_x86_64::Relocate::relocate): Likewise.
6776
6777 2010-11-08  Doug Kwan  <dougkwan@google.com>
6778             Cary Coutant  <ccoutant@google.com>
6779
6780         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6781         (Arm_exidx_merge_section::section_contents_): New data member.
6782         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6783         (Arm_input_section::~Arm_input_section): De-allocate memory.
6784         (Arm_input_section::original_contents_): New data member.
6785         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6786         in parameters instead of calling Object::section_contents without
6787         locking.
6788         (Arm_output_section::group_section): New parameter TASK.  Pass it
6789         to callees that need locking objects.
6790         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6791         to lock EXIDX input sections.  Fix a formatting issue.  Call
6792         Arm_exidx_merged_section::build_contents to create merged section
6793         contents.
6794         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6795         to lock object of stub table owner.
6796         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6797         TEXT_SIZE to initialize data member TEXT_SIZE_.
6798         (Arm_exidx_input_section::addralign): Fix typo in comment.
6799         (Arm_exidx_input_section::text_size): New method.
6800         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6801         that require locking objects.  Lock objects before scanning for stubs
6802         and updating local symbols.
6803         (Arm_input_section<big_endian>::init): Copy contents of original
6804         input section.
6805         (Arm_input_section<big_endian>::do_write): Use saved contents of
6806         original input section instead of calling Object::section_contents
6807         without locking.
6808         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6809         size without calling Object::section_size().
6810         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6811         for size.  Allocate a buffer for merged EXIDX entries.
6812         (Arm_exidx_merged_section::build_contents): New method.
6813         (Arm_exidx_merged_section::do_write): Move merge section contents
6814         building code to Arm_exidx_merged_section::build_contetns.  Write
6815         out contetns in buffer instead of building it on the fly.
6816         (Arm_relobj::make_exidx_input_section): Also pass text section size
6817         to Arm_exidx_input_section constructor.
6818         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6819         (Arm_dynobj::do_read_symbols): Fix memory leak.
6820         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6821         * target.h: (class Task): Add forward declaration.
6822         (Target::relax): Add new parameter TASK and pass it to
6823         Target::do_relax().
6824         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6825
6826 2010-11-05  Cary Coutant  <ccoutant@google.com>
6827
6828         PR gold/10708
6829         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6830         object when reading from the file.
6831         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6832         second layout pass.
6833         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6834         when reading section contents.
6835         (get_section_contents): Likewise.
6836         (icf::find_identical_sections): Likewise.
6837         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6838         object when reading from the file.
6839         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6840         the object when doing deferred section layout.
6841
6842 2010-11-03  Nick Clifton  <nickc@redhat.com>
6843
6844         PR gold/12001
6845         * script.h (class Symbol_assignment: name): New member.  Returns
6846         the name of the symbol.
6847         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6848         Returns true if the given symbol name is on the list of
6849         assignments wating to be processed.
6850         * archive.cc (should_incldue_member): If the symbol is undefined,
6851         check to see if it is on the list of symbols pending assignment.
6852
6853 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6854
6855         * script-sections.cc (Script_sections::find_memory_region): Check
6856         for a NULL output section pointer.
6857
6858 2010-10-29  Doug Kwan  <dougkwan@google.com>
6859
6860         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6861         Output_section::add_relaxed_input_section.
6862         * output.cc (Output_section::add_relaxed_input_section): Add new
6863         arguments LAYOUT and NAME.  Set section order index.
6864         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6865         Copy section order index.
6866         * output.h (Output_section::add_relaxed_input_section): Add new
6867         arguments LAYOUT and NAME.
6868
6869 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6870
6871         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6872         NATIVE_OR_CROSS_LINKER.
6873         * testsuite/Makefile.in: Regenerate.
6874
6875 2010-10-20  Doug Kwan  <dougkwan@google.com>
6876
6877         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6878         without SHF_LINK_ORDER flags.
6879         * layout.cc (Layout::choose_output_section): Do not filter
6880         SHF_LINK_ORDER flag in a relocatable link.
6881
6882 2010-10-17  Cary Coutant  <ccoutant@google.com>
6883
6884         * output.h (Output_segment::set_section_addresses): Change function
6885         signature.  Update all callers.
6886         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6887         sections.
6888         (Output_segment::set_section_addresses): Align after last TLS
6889         section.  Add padding before last relro section instead of after.
6890
6891 2010-10-17  Doug Kwan  <dougkwan@google.com>
6892
6893         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6894         GOT output section to be writable.
6895
6896 2010-10-14  Cary Coutant  <ccoutant@google.com>
6897
6898         * debug.h (DEBUG_INCREMENTAL): New flag.
6899         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6900         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6901         mode.
6902         * incremental.cc (report_command_line): Ignore all forms of
6903         --incremental.
6904         * layout.cc (Layout::Layout): Check parameters for incremental link
6905         mode.
6906         * options.cc (General_options::parse_incremental): New function.
6907         (General_options::parse_no_incremental): New function.
6908         (General_options::parse_incremental_full): New function.
6909         (General_options::parse_incremental_update): New function.
6910         (General_options::incremental_mode_): New data member.
6911         (General_options::finalize): Check incremental_mode_.
6912         * options.h (General_options): Update help text for --incremental.
6913         Add --no-incremental, --incremental-full, --incremental-update.
6914         (General_options::Incremental_mode): New enum type.
6915         (General_options::incremental_mode): New function.
6916         (General_options::incremental_mode_): New data member.
6917         * parameters.cc (Parameters::incremental_mode_): New data member.
6918         (Parameters::set_options): Set incremental_mode_.
6919         (Parameters::set_incremental_full): New function.
6920         (Parameters::incremental): New function.
6921         (Parameters::incremental_update): New function.
6922         (set_parameters_incremental_full): New function.
6923         * parameters.h (Parameters::set_incremental_full): New function.
6924         (Parameters::incremental): New function.
6925         (Parameters::incremental_update): New function.
6926         (Parameters::incremental_mode_): New data member.
6927         (set_parameters_incremental_full): New function.
6928         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6929         incremental link mode.
6930         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6931         (Sized_relobj::do_relocate_sections): Likewise.
6932         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6933         option.
6934         * testsuite/Makefile.in: Regenerate.
6935         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6936
6937 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6938
6939         * script-sections.h (class Script_sections): Make
6940         Sections_elements typedef public.
6941         * script-sections.cc (class Sort_output_sections): Add elements_
6942         field.  Add constructor which sets it; change all callers.
6943         (Sort_output_sections::is_before): New function.
6944         (Sort_output_sections::operator()): Call is_before.
6945         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6946         conditional.
6947         * testsuite/script_test_10.sh: New test. Test script section
6948         order.
6949         * testsuite/script_test_10.t: Likewise.
6950         * testsuite/script_test_10.s: Likewise.
6951         * testsuite/Makefile.am: Wrap the cross linker tests and the
6952         common tests into NATIVE_OR_CROSS_LINKER.
6953         (check_SCRIPTS): Add script_test_10.sh.
6954         (check_DATA): Add script_test_10.stdout.
6955         (script_test_10.o, script_test_10): New targets.
6956         (script_test_10.stdout): New target.
6957         * configure, testsuite/Makefile.in: Regenerate.
6958
6959 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6960
6961         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6962         error for the deprecated relocations.
6963         (Target_arm::Scan::global): Likewise.
6964         (Target_arm::Relocate::relocate): Likewise.
6965
6966 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6967
6968         * fileread.cc (Input_file::find_file): Initialize *found_name
6969         and *namep when using the fallback search for case 4.
6970
6971 2010-10-11  Cary Coutant  <ccoutant@google.com>
6972
6973         * options.h (class General_options): Redefine -z lazy as an alias for
6974         the negation of -z now.
6975
6976 2010-10-11  Ian Lance Taylor  <iant@google.com>
6977
6978         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6979         binding.
6980
6981 2010-10-06  Nick Clifton  <nickc@redhat.com>
6982
6983         * script-sections.cc(class Memory_region): Remove
6984         current_lma_offset_ field.  Rename current_vma_offset_ to
6985         current_offset_.  Add last_section_ field.
6986         (Memory_region::get_current_vma_address): Rename to
6987         get_current_address.
6988         (Memory_region::get_current_lma_address): Delete.
6989         (Memory_region::increment_vma_offset): Rename to
6990         increment_offset.
6991         (Memory_region::increment_lma_offset): Delete.
6992         (Memory_region::attributes_compatible): New method.  Returns
6993         true if the provided section is compatible with the region.
6994         (Memory_region::get_last_section): New method.  Returns the last
6995         section to use the region.
6996         (Memory_region::set_last_section): New method.  Stores the last
6997         section to use the region.
6998         (Script_sections::block_in_region): New method.  Returns true if
6999         a block of memory is contained within a region.
7000         (Script_sections::find_memory_region): New method.  Locates a
7001         memory region to be used to set a VMA or LMA address.
7002         (Output_section_definition::set_section_addresses): Add code to
7003         check for addresses set by memory regions.
7004         (Output_segment::set_section_addresses): Remove memory region
7005         walking code.
7006         (Script_sections::create_segment): Add a warning if a header
7007         segment is created outside of any region.
7008         * script-sections.h (class Script_sections): Add prototypes for
7009         find_memory_region and block_in_region methods.
7010         * testsuite/memory_test.s: Use .long instead of .word.
7011         * testsuite/memory_test.t: Add some more output sections.
7012         * testsuite/memory_test.sh: Update expected output.
7013
7014 2010-10-02  Doug Kwan  <dougkwan@google.com>
7015
7016         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7017         defintion to symtab.h
7018         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7019         declaration to defintion.
7020
7021 2010-10-01  Nick Clifton  <nickc@redhat.com>
7022
7023         * expression.cc (eval): Replace dummy argument with NULL.
7024         (eval_maybe_dot): Check for a NULL result section pointer.
7025         (Symbol_expression::value): Likewise.
7026         (Dot_expression::value): Likewise.
7027         (BINARY_EXPRESSION): Likewise.
7028         (Max_expression::value): Likewise.
7029         (Min_expression::value): Likewise.
7030         (Absolute_expression::value): Likewise.
7031         (Addr_expression::value_from_output_section): Likewise.
7032         (Loaddddr_expression::value_from_output_section): Likewise.
7033         (Segment_start_expression::value): Likewise.
7034         * script-sections.cc
7035         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7036         argument with NULL.
7037         (Sections_elememt_dot_assignment::set_section_addresses):
7038         Likewise.
7039         (Output_data_expression::do_write_to_buffer): Likewise.
7040         (Output_section_definition::finalize_symbols): Likewise.
7041         (Output_section_definition::set_section_addresses): Likewise.
7042
7043 2010-09-30  Doug Kwan  <dougkwan@google.com>
7044
7045         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7046
7047 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7048
7049         * target.h (Target::can_icf_inline_merge_sections): New virtual
7050         function.
7051         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7052         virtual function.
7053         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7054         virtual function.
7055         * icf.cc (get_section_contents): Inline merge sections only when
7056         target allows it.
7057
7058 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7059
7060         * configure: Regenerate.
7061
7062 2010-09-17  Ian Lance Taylor  <iant@google.com>
7063
7064         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7065         * testsuite/Makefile.am (memory_test.o): New target.
7066         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7067         memory_test.t.
7068         * testsuite/Makefile.in: Rebuild.
7069
7070 2010-09-17  Doug Kwan  <dougkwan@google.com>
7071
7072         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7073         defintion if relocation uses GOT entries of the symbol.
7074         * testsuite/icf_safe_test.sh: Fix test.
7075         * testsuite/icf_safe_so_test.sh: Fix test.
7076
7077 2010-09-16  Cary Coutant  <ccoutant@google.com>
7078
7079         * script_sections.cc (class Memory_region): Remove "NULL" from
7080         vector initializations.
7081
7082 2010-09-15  Cary Coutant  <ccoutant@google.com>
7083
7084         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7085         Resolve forwarding symbols.
7086
7087 2010-09-15  Doug Kwan  <dougkwan@google.com>
7088
7089         * gold/testsuite/script_test_3.t: Add ARM special sections.
7090         * gold/testsuite/script_test_4.t: Same.
7091         * gold/testsuite/script_test_5.t: Same.
7092         * gold/testsuite/script_test_6.t: Same.
7093         * gold/testsuite/script_test_7.t: Same.
7094         * gold/testsuite/script_test_7.t: Same.
7095         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7096
7097 2010-09-14  Cary Coutant  <ccoutant@google.com>
7098
7099         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7100         (Target_x86_64::Relocate::relocate_tls): Replace check for
7101         saw_tls_block_reloc_ with test for executable section.
7102
7103 2010-09-12  Cary Coutant  <ccoutant@google.com>
7104
7105         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7106         position-independent executables to shared libraries need dynamic
7107         relocations.
7108         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7109         position-independent executables.
7110         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7111         * testsuite/Makefile.in: Regenerate.
7112
7113 2010-09-10  Nick Clifton  <nickc@redhat.com>
7114
7115         PR gold/11997
7116         * testsuite/memory_test.t: Discard any sections that are not
7117         needed.
7118
7119 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7120
7121         PR gold/11996
7122         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7123         "This::" to work around a bug in gcc 4.2.
7124
7125         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7126
7127 2010-09-09  Rafael Espindola  <espindola@google.com>
7128
7129         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7130         sections with different PF_X flags in the same segment.
7131         (Layout::find_first_load_seg): Search all segments to find the first
7132         one.
7133         * options.h (rosegment): New.
7134
7135 2010-09-08  Rafael Espindola  <espindola@google.com>
7136
7137         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7138
7139 2010-09-08  Doug Kwan  <dougkwan@google.com>
7140
7141         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7142         (Arm_relobj::do_relocate_sections): Add new parameter for output
7143         file to match the parent.
7144         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7145         of local symbols instead of input values.  Update code to track
7146         changes in gold::relocate_section.
7147         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7148         (Sized_relobj::compute_final_local_value_internal): New methods.
7149         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7150         body into private version of Sized_relobj::compute_final_local_value.
7151         Call the inline method.
7152         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7153         merged symbol value if there is one.
7154         (Symbol_value::has_output_value): New method defintiion.
7155         (Sized_relobj::Compute_final_local_value_status): New enum type.
7156         (Sized_relobj::compute_final_local_value): New methods.
7157         (Sized_relobj::compute_final_local_value_internal): New methods.
7158         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7159         and arm_cortex_a8.sh.
7160         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7161         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7162         New tests.
7163         * Makefile.in: Regenerate.
7164         * testsuite/arm_bl_out_of_range.s: Update test.
7165         * testsuite/thumb_bl_out_of_range.s: Ditto.
7166         * testsuite/thumb_blx_out_of_range.s: Ditto.
7167         * testsuite/arm_branch_out_of_range.sh: New file.
7168         * testsuite/arm_cortex_a8.sh: Ditto.
7169         * testsuite/arm_cortex_a8_b.s: Ditto.
7170         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7171         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7172         * testsuite/arm_cortex_a8_bl.s: Ditto.
7173         * testsuite/arm_cortex_a8_blx.s: Ditto.
7174         * testsuite/arm_cortex_a8_local.s: Ditto.
7175         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7176         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7177
7178 2010-09-08  Rafael Espindola  <espindola@google.com>
7179
7180         * Makefile.am (memory_test.stdout): Run readelf with -W.
7181         * Makefile.in: Regenerate.
7182         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7183         64 bit output.
7184
7185 2010-09-08  Rafael Espindola  <espindola@google.com>
7186
7187         * script-sections.cc (Script_sections::add_memory_region): Convert
7188         field precision to int.
7189         * script.cc (script_set_section_region, script_set_section_region):
7190         Convert field precision to int.
7191
7192 2010-09-08  Rafael Espindola  <espindola@google.com>
7193
7194         * arm.cc (do_finalize_sections): Create the __exidx_start and
7195         __exdix_end symbols even when the section is missing.
7196
7197 2010-09-08  Nick Clifton  <nickc@redhat.com>
7198
7199         * README: Remove claim that MEMORY is not supported.
7200         * expression.cc (script_exp_function_origin)
7201         (script_exp_function_length): Move from here to ...
7202         * script.cc: ... here.
7203         (script_set_section_region, script_add_memory)
7204         (script_parse_memory_attr, script_include_directive): New
7205         functions.
7206         * script-sections.cc
7207         (class Memory_region): New class.
7208         (class Output_section_definition): Add set_memory_region,
7209         set_section_vma, set_section_lma and get_section_name methods.
7210         (class Script_Sections): Add add_memory_region,
7211         find_memory_region, find_memory_region_origin,
7212         find_memory_region_length and set_memory_region methods.
7213         Have set_section_addresses method walk the list of set memory
7214         regions.
7215         Extend the print methos to display memory regions.
7216         * script-sections.h: Add prototypes for new methods.
7217         Add enum for MEMORY region attributes.
7218         * yyscript.y: Add support for parsing MEMORY regions.
7219         * script-c.h: Add prototypes for new functions.
7220         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7221         * testsuite/Makefile.in: Regenerate.
7222         * testsuite/memory_test.sh: New script.
7223         * testsuite/memory_test.s: New assembler source file.
7224         * testsuite/memory_test.t: New linker script.
7225
7226 2010-08-27  Doug Kwan  <dougkwan@google.com>
7227
7228         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7229         reference override an existing dynamic weak reference.
7230         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7231         * testsuite/Makefile.in: Regenerate.
7232         * testsuite/dyn_weak_ref.sh: New file.
7233         * testsuite/dyn_weak_ref_1.c: Ditto.
7234         * testsuite/dyn_weak_ref_2.c: Ditto.
7235
7236 2010-08-27  Ian Lance Taylor  <iant@google.com>
7237
7238         * incremental.h (class Incremental_input_entry): Add virtual
7239         destructor.
7240
7241 2010-08-27  Ian Lance Taylor  <iant@google.com>
7242
7243         * testsuite/start_lib_test_3.c: Mark t3 as used.
7244
7245 2010-08-27  Nick Clifton  <nickc@redhat.com>
7246
7247         * options.cc (version_script): Fix small typo in previous
7248         whitespace tidyup.
7249
7250 2010-08-25  Nick Clifton  <nickc@redhat.com>
7251
7252         * archive.cc: Formatting fixes: Remove whitespace between
7253         typename and following asterisk.  Remove whitespace between
7254         function name and opening parenthesis.
7255         * archive.h: Likewise.
7256         * arm.cc: Likewise.
7257         * attributes.cc: Likewise.
7258         * attributes.h: Likewise.
7259         * common.cc: Likewise.
7260         * copy-relocs.cc: Likewise.
7261         * dirsearch.h: Likewise.
7262         * dynobj.cc: Likewise.
7263         * ehframe.cc: Likewise.
7264         * ehframe.h: Likewise.
7265         * expression.cc: Likewise.
7266         * fileread.cc: Likewise.
7267         * fileread.h: Likewise.
7268         * gc.h: Likewise.
7269         * gold-threads.cc: Likewise.
7270         * gold.cc: Likewise.
7271         * i386.cc: Likewise.
7272         * icf.h: Likewise.
7273         * incremental-dump.cc: Likewise.
7274         * incremental.cc: Likewise.
7275         * layout.cc: Likewise.
7276         * layout.h: Likewise.
7277         * main.cc: Likewise.
7278         * merge.cc: Likewise.
7279         * merge.h: Likewise.
7280         * object.cc: Likewise.
7281         * object.h: Likewise.
7282         * options.cc: Likewise.
7283         * options.h: Likewise.
7284         * output.cc: Likewise.
7285         * output.h: Likewise.
7286         * plugin.cc: Likewise.
7287         * plugin.h: Likewise.
7288         * powerpc.cc: Likewise.
7289         * reloc.cc: Likewise.
7290         * script-c.h: Likewise.
7291         * script-sections.cc: Likewise.
7292         * script.cc: Likewise.
7293         * stringpool.cc: Likewise.
7294         * symtab.cc: Likewise.
7295         * symtab.h: Likewise.
7296         * target.cc: Likewise.
7297         * timer.cc: Likewise.
7298         * timer.h: Likewise.
7299         * version.cc: Likewise.
7300         * x86_64.cc: Likewise.
7301
7302 2010-08-24  Nick Clifton  <nickc@redhat.com>
7303
7304         PR 11899
7305         * layout.cc (segment_precedes): Sort segments by their physical
7306         addresses, if they have been set.
7307
7308 2010-08-23  Cary Coutant  <ccoutant@google.com>
7309
7310         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7311         symbols data.
7312         (Lib_group::include_member): Unlock object after deleting its
7313         symbols data.
7314         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7315         the bug fixed here.
7316
7317 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7318             Cary Coutant  <ccoutant@google.com>
7319
7320         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7321         constructor, and set_blocker.
7322         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7323         readsyms_blocker_.
7324         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7325         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7326         * testsuite/Makefile.am (start_lib_test): New test case.
7327         * testsuite/Makefile.in: Regenerate.
7328         * testsuite/start_lib_test_main.c: New file.
7329         * testsuite/start_lib_test_1.c: New file.
7330         * testsuite/start_lib_test_2.c: New file.
7331         * testsuite/start_lib_test_3.c: New file.
7332
7333 2010-08-19  Ian Lance Taylor  <iant@google.com>
7334
7335         * Makefile.in: Rebuild with automake 1.11.1.
7336         * aclocal.m4: Likewise.
7337         * testsuite/Makefile.in: Likewise.
7338
7339 2010-08-19  Ian Lance Taylor  <iant@google.com>
7340
7341         PR 10893
7342         * i386.cc (class Output_data_plt_i386): Update declarations.
7343         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7344         local_ifuncs_ fields.
7345         (Target_i386::do_plt_section_for_global): New function.
7346         (Target_i386::do_plt_section_for_local): New function.
7347         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7348         parameter; change all callers.  Initialize global_ifuncs_ and
7349         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7350         __rel_iplt_end.
7351         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7352         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7353         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7354         symbols.
7355         (Target_i386::make_plt_section): New function, broken out of
7356         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7357         (Target_i386::make_plt_entry): Call make_plt_section.
7358         (Target_i386::make_local_ifunc_plt_entry): New function.
7359         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7360         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7361         R_386_IRELATIVE to switch.
7362         (Target_i386::Scan::global): Likewise.
7363         (Target_i386::Relocate::relocate): Likewise.
7364         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7365         switch.
7366         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7367         (Target_x86_64::do_plt_section_for_global): New function.
7368         (Target_x86_64::do_plt_section_for_local): New function.
7369         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7370         parameter; change all callers.  If doing a static link define
7371         __rela_iplt_start and __rela_iplt_end.
7372         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7373         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7374         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7375         to point to .plt.
7376         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7377         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7378         switch.
7379         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7380         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7381         R_X86_64_IRELATIVE to switch.
7382         (Target_x86_64::Scan::global): Likewise.
7383         (Target_x86_64::Relocate::relocate): Likewise.
7384         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7385         switch.
7386         * target.h (class Target): Add plt_section_for_global and
7387         plt_section_for_local functions.  Add do_plt_section_for_global
7388         and do_plt_section_for_local virtual functions.
7389         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7390         clarifying comments.
7391         (Symbol::use_plt_offset): Handle IFUNC symbol.
7392         * object.cc (Sized_relobj::Sized_relobj): Initialize
7393         local_plt_offsets_.
7394         (Sized_relobj::local_has_plt_offset): New function.
7395         (Sized_relobj::local_plt_offset): New function.
7396         (Sized_relobj::set_local_plt_offset): New function.
7397         (Sized_relobj::do_count): Handle IFUNC symbol.
7398         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7399         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7400         is_ifunc_symbol functions.
7401         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7402         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7403         local_plt_offsets_ field.
7404         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7405         * output.h (class Output_section_data): Add non-const
7406         output_section function.
7407         (class Output_data_got): Update declarations.
7408         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7409         Add use_plt_offset parameter to global and local constructors.
7410         Change all callers.  Change local_sym_index_ field to 31 bits.
7411         Change GSYM_CODE and CONSTANT_CODE accordingly.
7412         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7413         doing a static link don't set sh_link field.
7414         (Output_data_got::Got_entry::write): Use PLT offset if
7415         appropriate.
7416         (Output_data_got::add_global_plt): New function.
7417         (Output_data_got::add_local_plt): New function.
7418         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7419         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7420         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7421         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7422         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7423         IFUNC conditional.
7424         * testsuite/ifunc-sel.h: New file.
7425         * testsuite/ifuncmain1.c: New file.
7426         * testsuite/ifuncmain1vis.c: New file.
7427         * testsuite/ifuncmod1.c: New file.
7428         * testsuite/ifuncdep2.c: New file.
7429         * testsuite/ifuncmain2.c: New file.
7430         * testsuite/ifuncmain3.c: New file.
7431         * testsuite/ifuncmod3.c: New file.
7432         * testsuite/ifuncmain4.c: New file.
7433         * testsuite/ifuncmain5.c: New file.
7434         * testsuite/ifuncmod5.c: New file.
7435         * testsuite/ifuncmain6pie.c: New file.
7436         * testsuite/ifuncmod6.c: New file.
7437         * testsuite/ifuncmain7.c: New file.
7438         * configure, testsuite/Makefile.in: Rebuild.
7439
7440 2010-08-18  Ian Lance Taylor  <iant@google.com>
7441
7442         * incremental.cc
7443         (Output_section_incremental_inputs::write_input_files): Add cast
7444         to avoid signed/unsigned comparison warning.
7445         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7446
7447 2010-08-12  Cary Coutant  <ccoutant@google.com>
7448
7449         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7450
7451 2010-08-13  Ian Lance Taylor  <iant@google.com>
7452
7453         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7454
7455 2010-08-12  Cary Coutant  <ccoutant@google.com>
7456             Doug Kwan  <dougkwan@google.com>
7457
7458         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7459         defintion overrides non-weak undef, remember that the original undef
7460         is not weak.
7461         * symtab.cc (Symbol_table::sized_write_global): For undef without
7462         an original weak binding, set binding to global in output.
7463         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7464         * testsuite/Makefile.in: Regenerate.
7465         * testsuite/strong_ref_weak_def.sh: New file.
7466         * testsuite/strong_ref_weak_def_1.c: Ditto.
7467         * testsuite/strong_ref_weak_def_2.c: Ditto.
7468
7469 2010-08-12  Cary Coutant  <ccoutant@google.com>
7470
7471         * testsuite/incremental_test.sh: Rewrite.
7472         * testsuite/incremental_test_1.c: Rewrite.
7473         * testsuite/incremental_test_2.c: Rewrite.
7474
7475 2010-08-12  Cary Coutant  <ccoutant@google.com>
7476
7477         * arm.cc (Target_arm::got_size): Add const.
7478         (Target_arm::got_entry_count): New function.
7479         (Target_arm::plt_entry_count): New function.
7480         (Target_arm::first_plt_entry_offset): New function.
7481         (Target_arm::plt_entry_size): New function.
7482         (Output_data_plt_arm::entry_count): New function.
7483         (Output_data_plt_arm::first_plt_entry_offset): New function.
7484         (Output_data_plt_arm::get_plt_entry_size): New function.
7485         * i386.cc (Target_i386::got_size): Add const.
7486         (Target_i386::got_entry_count): New function.
7487         (Target_i386::plt_entry_count): New function.
7488         (Target_i386::first_plt_entry_offset): New function.
7489         (Target_i386::plt_entry_size): New function.
7490         (Output_data_plt_i386::entry_count): New function.
7491         (Output_data_plt_i386::first_plt_entry_offset): New function.
7492         (Output_data_plt_i386::get_plt_entry_size): New function.
7493         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7494         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7495         * incremental.cc: Include target.h.
7496         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7497         parameter.  Adjust all callers.  Find incremental_got_plt section.
7498         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7499         section.
7500         (Output_section_incremental_inputs::set_final_data_size): Calculate
7501         size of incremental_got_plt section.
7502         (Output_section_incremental_inputs::do_write): Write the
7503         incremental_got_plt section.
7504         (Got_plt_view_info): New struct.
7505         (Local_got_offset_visitor): New class.
7506         (Global_got_offset_visitor): New class.
7507         (Global_symbol_visitor_got_plt): New class.
7508         (Output_section_incremental_inputs::write_got_plt): New function.
7509         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7510         Add parameter.  Adjust all callers.
7511         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7512         (Incremental_inputs::got_plt_section): New function.
7513         (Incremental_inputs::got_plt_section_): New data member.
7514         (Incremental_got_plt_reader): New class.
7515         * layout.cc (Layout::create_incremental_info_sections): Add the
7516         incremental_got_plt section.
7517         * object.h (Got_offset_list::get_list): New function.
7518         (Got offset_list::for_all_got_offsets): New function.
7519         (Sized_relobj::local_got_offset_list): New function.
7520         * powerpc.cc (Target_powerpc::got_size): Add const.
7521         (Target_powerpc::got_entry_count): New function.
7522         (Target_powerpc::plt_entry_count): New function.
7523         (Target_powerpc::first_plt_entry_offset): New function.
7524         (Target_powerpc::plt_entry_size): New function.
7525         (Output_data_plt_powerpc::entry_count): New function.
7526         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7527         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7528         * sparc.cc (Target_sparc::got_size): Add const.
7529         (Target_sparc::got_entry_count): New function.
7530         (Target_sparc::plt_entry_count): New function.
7531         (Target_sparc::first_plt_entry_offset): New function.
7532         (Target_sparc::plt_entry_size): New function.
7533         (Output_data_plt_sparc::entry_count): New function.
7534         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7535         (Output_data_plt_sparc::get_plt_entry_size): New function.
7536         * symtab.h (Symbol::got_offset_list): New function.
7537         (Symbol_table::for_all_symbols): New function.
7538         * target.h (Sized_target::got_entry_count): New function.
7539         (Sized_target::plt_entry_count): New function.
7540         (Sized_target::plt_entry_size): New function.
7541         * x86_64.cc (Target_x86_64::got_size): Add const.
7542         (Target_x86_64::got_entry_count): New function.
7543         (Target_x86_64::plt_entry_count): New function.
7544         (Target_x86_64::first_plt_entry_offset): New function.
7545         (Target_x86_64::plt_entry_size): New function.
7546         (Output_data_plt_x86_64::entry_count): New function.
7547         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7548         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7549
7550 2010-08-12  Cary Coutant  <ccoutant@google.com>
7551
7552         * archive.cc: Include incremental.h.
7553         (Archive::Archive): Initialize incremental_info_.
7554         (Archive::include_member): Record archive members in incremental info.
7555         (Add_archive_symbols::run): Record begin and end of an archive in
7556         incremental info.
7557         (Lib_group::include_member): Record objects in incremental info.
7558         * archive.h (Incremental_archive_entry): Forward declaration.
7559         (Archive::set_incremental_info): New member function.
7560         (Archive::incremental_info): New member function.
7561         (Archive::Unused_symbol_iterator): New class.
7562         (Archive::unused_symbols_begin): New member function.
7563         (Archive::unused_symbols_end): New member function.
7564         (Archive::incremental_info_): New data member.
7565         * incremental-dump.cc (find_input_containing_global): New function.
7566         (dump_incremental_inputs): Dump new incremental info sections.
7567         * incremental.cc: Include symtab.h.
7568         (Output_section_incremental_inputs): New class.
7569         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7570         new incremental info sections.
7571         (Sized_incremental_binary::do_check_inputs): Likewise.
7572         (Incremental_inputs::report_archive): Remove.
7573         (Incremental_inputs::report_archive_begin): New function.
7574         (Incremental_inputs::report_archive_end): New function.
7575         (Incremental_inputs::report_object): New function.
7576         (Incremental_inputs::finalize_inputs): Remove.
7577         (Incremental_inputs::report_input_section): New function.
7578         (Incremental_inputs::report_script): Rewrite.
7579         (Incremental_inputs::finalize): Do nothing but finalize string table.
7580         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7581         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7582         (Incremental_inputs::create_data_sections): New function.
7583         (Incremental_inputs::relocs_entsize): New function.
7584         (Output_section_incremental_inputs::set_final_data_size): New function.
7585         (Output_section_incremental_inputs::do_write): New function.
7586         (Output_section_incremental_inputs::write_header): New function.
7587         (Output_section_incremental_inputs::write_input_files): New function.
7588         (Output_section_incremental_inputs::write_info_blocks): New function.
7589         (Output_section_incremental_inputs::write_symtab): New function.
7590         * incremental.h (Incremental_script_entry): Forward declaration.
7591         (Incremental_object_entry): Forward declaration.
7592         (Incremental_archive_entry): Forward declaration.
7593         (Incremental_inputs): Forward declaration.
7594         (Incremental_inputs_header_data): Remove.
7595         (Incremental_inputs_header): Remove.
7596         (Incremental_inputs_header_write): Remove.
7597         (Incremental_inputs_entry_data): Remove.
7598         (Incremental_inputs_entry): Remove.
7599         (Incremental_inputs_entry_write): Remove.
7600         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7601         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7602         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7603         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7604         Likewise.
7605         (Incremental_input_entry): New class.
7606         (Incremental_script_entry): New class.
7607         (Incremental_object_entry): New class.
7608         (Incremental_archive_entry): New class.
7609         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7610         (Incremental_inputs::report_inputs): Remove.
7611         (Incremental_inputs::report_archive): Remove.
7612         (Incremental_inputs::report_archive_begin): New function.
7613         (Incremental_inputs::report_archive_end): New function.
7614         (Incremental_inputs::report_object): Change prototype.
7615         (Incremental_inputs::report_input_section): New function.
7616         (Incremental_inputs::report_script): Change prototype.
7617         (Incremental_inputs::get_reloc_count): New function.
7618         (Incremental_inputs::set_reloc_count): New function.
7619         (Incremental_inputs::create_data_sections): New function.
7620         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7621         (Incremental_inputs::inputs_section): New function.
7622         (Incremental_inputs::symtab_section): New function.
7623         (Incremental_inputs::relocs_section): New function.
7624         (Incremental_inputs::get_stringpool): Add const.
7625         (Incremental_inputs::command_line): Add const.
7626         (Incremental_inputs::inputs): Remove.
7627         (Incremental_inputs::command_line_key): New function.
7628         (Incremental_inputs::input_file_count): New function.
7629         (Incremental_inputs::input_files): New function.
7630         (Incremental_inputs::relocs_entsize): New function.
7631         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7632         (Incremental_inputs::finalize_inputs): Remove.
7633         (Incremental_inputs::Input_info): Remove.
7634         (Incremental_inputs::lock_): Remove.
7635         (Incremental_inputs::inputs_): Change type.
7636         (Incremental_inputs::inputs_map_): Remove.
7637         (Incremental_inputs::current_object_entry_): New data member.
7638         (Incremental_inputs::inputs_section_): New data member.
7639         (Incremental_inputs::symtab_section_): New data member.
7640         (Incremental_inputs::relocs_section_): New data member.
7641         (Incremental_inputs::reloc_count_): New data member.
7642         (Incremental_inputs_reader): New class.
7643         (Incremental_symtab_reader): New class.
7644         (Incremental_relocs_reader): New class.
7645         * layout.cc (Layout::finalize): Move finalization of incremental info
7646         and creation of incremental info sections to follow finalization of
7647         symbol table.  Set offsets for postprocessing sections.
7648         (Layout::create_incremental_info_sections): Call
7649         Incremental_inputs::create_data_sections.  Add incremental symtab
7650         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7651         sections to layout after input sections.
7652         * layout.h (struct Timespec): Forward declaration.
7653         (Layout::incremental_inputs): Add const.
7654         (Layout::create_incremental_info_sections): Add parameter.
7655         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7656         * object.cc: Include incremental.h.
7657         (Relobj::finalize_incremental_relocs): New function.
7658         (Sized_relobj::do_layout): Record input sections in incremental info.
7659         * object.h (Object::output_section): New function.
7660         (Object::output_section_offset): Moved from Relobj.
7661         (Object::get_incremental_reloc_base): New function.
7662         (Object::get_incremental_reloc_count): New function.
7663         (Object::do_output_section): New function.
7664         (Object::do_output_section_offset): Moved from Relobj.
7665         (Object::do_get_incremental_reloc_base): New function.
7666         (Object::do_get_incremental_reloc_count): New function.
7667         (Object::Object): Initialize new data members.
7668         (Relobj::output_section): Renamed do_output_section and moved to
7669         protected.
7670         (Relobj::output_section_offset): Moved to Object.
7671         (Relobj::do_get_incremental_reloc_base): New function.
7672         (Relobj::do_get_incremental_reloc_count): New function.
7673         (Relobj::allocate_incremental_reloc_counts): New function.
7674         (Relobj::count_incremental_reloc): New function.
7675         (Relobj::finalize_incremental_relocs): New function.
7676         (Relobj::next_incremental_reloc_index): New function.
7677         (Relobj::reloc_counts_): New data member.
7678         (Relobj::reloc_bases_): New data member.
7679         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7680         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7681         (Sized_relobj::incremental_relocs_scan): New function.
7682         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7683         (Sized_relobj::incremental_relocs_write): New function.
7684         (Sized_relobj::incremental_relocs_write_reltype): New function.
7685         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7686         incremental link.
7687         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7688         archives and object files elsewhere.
7689         (Add_symbols::run): Report object files here.
7690         (Finish_group::run): Report end of archive at end of group.
7691         * reloc.cc: Include layout.h, incremental.h.
7692         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7693         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7694         (Sized_relobj::incremental_relocs_scan): New function.
7695         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7696         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7697         (Sized_relobj::incremental_relocs_write): New function.
7698         (Sized_relobj::incremental_relocs_write_reltype): New function.
7699         * script.cc (read_input_script): Rewrite test for incremental link.
7700         Change call to Incremental_inputs::report_script.
7701         * symtab.h (Symbol_table::first_global_index): New function.
7702         (Symbol_table::output_count): New function.
7703
7704 2010-08-12  Doug Kwan  <dougkwan@google.com>
7705
7706         * arm.cc (Target_arm::merge_object_attributes): Check command line
7707         options --no-wchar-size-warning and --no-enum-size-warning.
7708         * options.h (General_options): Add ld-compatible options
7709         --no-enum-size-warning and --no-wchar-size-warning.
7710
7711 2010-08-04  Ian Lance Taylor  <iant@google.com>
7712
7713         * x86_64.cc (Target_x86_64::Scan::local): Use
7714         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7715         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7716         (Target_x86_64::Scan::global): Likewise.
7717         (Target_x86_64::Relocate::relocate): Likewise.
7718         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7719         Likewise.
7720
7721 2010-08-03  Cary Coutant  <ccoutant@google.com>
7722
7723         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7724         to reserve space in merged_strings vector. Keep total input size
7725         for stats.
7726         (Output_merge_string::do_print_merge_stats): Print total input size.
7727         * merge.h (Output_merge_string): Add input_size_ field.
7728         * stringpool.cc (Stringpool_template::string_length): Move
7729         implementations out of Stringpool_template class and place in
7730         stringpool.h.
7731         * stringpool.h (string_length): Move out of Stringpool_template.
7732
7733 2010-08-03  Ian Lance Taylor  <iant@google.com>
7734
7735         PR 11712
7736         * layout.cc (relaxation_loop_body): If address of load segment is
7737         set, adjust address to include headers if possible.
7738
7739 2010-08-03  Ian Lance Taylor  <iant@google.com>
7740
7741         * version.cc (version_string): Bump to 1.10.
7742
7743 2010-08-03  Ian Lance Taylor  <iant@google.com>
7744
7745         PR 11805
7746         * layout.h (enum Output_section_order): Define.
7747         (class Layout): Update declarations.
7748         * layout.cc (Layout::get_output_section): Add order parameter.
7749         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7750         is_first_non_relro parameters.  Change all callers.
7751         (Layout::choose_output_section): Likewise.
7752         (Layout::add_output_section_data): Likewise.
7753         (Layout::make_output_section): Likewise.  Set order.
7754         (Layout::default_section_order): New function.
7755         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7756         * output.cc (Output_section::Output_section): Initialize order_.
7757         Don't initialize deleted fields.
7758         (Output_segment::Output_segment): Don't initialize deleted
7759         fields.
7760         (Output_segment::add_output_section_to_load): New function
7761         replacing add_output_section.  Change all callers to call this or
7762         add_output_section_to_nonload.
7763         (Output_segment::add_output_section_to_nonload): New function.
7764         (Output_segment::remove_output_section): Rewrite.
7765         (Output_segment::add_initial_output_data): Likewise.
7766         (Output_segment::has_any_data_sections): Likewise.
7767         (Output_segment::is_first_section_relro): Likewise.
7768         (Output_segment::maximum_alignment): Likewise.
7769         (Output_segment::has_dynamic_reloc): New function replacing
7770         dynamic_reloc_count.  Change all callers.
7771         (Output_segment::has_dynamic_reloc_list): New function replacing
7772         dynamic_reloc_count_list.  Change all callers.
7773         (Output_segment::set_section_addresses): Rewrite.
7774         (Output_segment::set_offset): Rewrite.
7775         (Output_segment::find_first_and_last_list): Remove.
7776         (Output_segment::set_tls_offsets): Rewrite.
7777         (Output_segment::first_section_load_address): Likewise.
7778         (Output_segment::output_section_count): Likewise.
7779         (Output_segment::section_with_lowest_load_address): Likewise.
7780         (Output_segment::write_section_headers): Likewise.
7781         (Output_segment::print_sections_to_map): Likewise.
7782         * output.h (class Output_data): Remove dynamic_reloc_count_
7783         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7784         (Output_data::add_dynamic_reloc): Rewrite.
7785         (Output_data::has_dynamic_reloc): New function.
7786         (Output_data::dynamic_reloc_count): Remove.
7787         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7788         is_last_relro_, is_first_non_relro_, is_interp_,
7789         is_dynamic_linker_section_ fields.  Add order and set_order
7790         functions.  Remove is_relro_local, set_is_relro_local,
7791         is_last_relro, set_is_last_relro, is_first_non_relro,
7792         set_is_first_non_relro functions, is_interp, set_is_interp,
7793         is_dynamic_linker_section, and set_is_dynamic_linker_section
7794         functions.
7795         (class Output_segment): Change Output_data_list from std::list to
7796         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7797         output_bss_ fields.  Update declarations.
7798
7799 2010-08-02  Ian Lance Taylor  <iant@google.com>
7800
7801         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7802         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7803         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7804
7805 2010-08-02  Ian Lance Taylor  <iant@google.com>
7806
7807         PR 11855
7808         * script.cc (Script_options::Script_options): Initialize
7809         symbol_definitions_ and symbol_references_.
7810         (Script_options::add_symbol_assignment): Update
7811         symbol_definitions_ and symbol_references_.
7812         (Script_options::add_symbol_reference): New function.
7813         (script_symbol): New function.
7814         * script.h (class Script_options): Add symbol_definitions_ and
7815         symbol_references_ fields.
7816         (Script_options::referenced_const_iterator): New type.
7817         (Script_options::referenced_begin): New function.
7818         (Script_options::referenced_end): New function.
7819         (Script_options::is_referenced): New function.
7820         (Script_options::any_unreferenced): New function.
7821         * script-c.h (script_symbol): Declare.
7822         * yyscript.y (exp): Call script_symbol.
7823         * symtab.cc: Include "script.h".
7824         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7825         Change all callers.  Check symbols referenced by scripts.
7826         (Symbol_table::add_undefined_symbols_from_command_line): Add
7827         layout parameter.  Change all callers.
7828         (Symbol_table::do_add_undefined_symbols_from_command_line):
7829         Likewise.  Break out loop body.  Check symbols referenced by
7830         scripts.
7831         (Symbol_table::add_undefined_symbol_from_command_line): New
7832         function broken out of
7833         do_add_undefined_symbols_from_command_line.
7834         * symtab.h (class Symbol_table): Update declarations.
7835         * archive.cc: Include "layout.h".
7836         (Archive::should_include_member): Add layout parameter.  Change
7837         all callers.  Check for symbol mentioned in expression.
7838         * archive.h (class Archive): Update declaration.
7839         * object.cc (Sized_relobj::do_should_include_member): Add layout
7840         parameter.
7841         * object.h (Object::should_include_member): Add layout parameter.
7842         Change all callers.
7843         (Object::do_should_include_member): Add layout parameter.
7844         (class Sized_relobj): Update declaration.
7845         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7846         parameter.
7847         * dynobj.h (class Sized_dynobj): Update declaration.
7848         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7849         layout parameter.
7850         * plugin.h (class Sized_pluginobj): Update declaration.
7851
7852 2010-08-02  Ian Lance Taylor  <iant@google.com>
7853
7854         PR 11866
7855         * output.cc (Output_segment::set_offset): Search for the first and
7856         last sections rather than assuming that the list is in order.
7857         (Output_segment::find_first_and_last_list): New function.
7858         * output.h (class Output_segment): Update declarations.
7859         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7860         (relro_strip_test_SOURCES): New variable.
7861         (relro_strip_test_DEPENDENCIES): New variable.
7862         (relro_strip_test_LDFLAGS): New variable.
7863         (relro_strip_test_LDADD): New variable.
7864         (relro_strip_test.so): New target.
7865
7866 2010-08-02  Ian Lance Taylor  <iant@google.com>
7867
7868         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7869         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7870         (Target_i386::got_tlsdesc_section): New function.
7871         (Target_i386::got_section): Create space for GOT entries for
7872         TLSDESC relocations.
7873         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7874         R_386_TLS_GOTDESC.
7875         (Target_i386::Scan::global): Likewise.
7876         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7877         using TLSDESC GOT.
7878         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7879         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7880         (Target_x86_64::got_tlsdesc_section): New function.
7881         (Target_x86_64::got_section): Create space for GOT entries for
7882         TLSDESC relocations.
7883         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7884         R_386_TLS_GOTDESC.
7885         (Target_x86_64::Scan::global): Likewise.
7886         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7887         using TLSDESC GOT.
7888
7889 2010-08-02  Ian Lance Taylor  <iant@google.com>
7890
7891         * testsuite/final_layout.sh: Use dc to convert from hex to
7892         decimal.
7893
7894 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7895
7896         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7897         paramter to the call to gold::gc_process_relocs.
7898         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7899         paramter to the call to gold::gc_process_relocs.
7900         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7901         parameter to the call to gold::gc_process_relocs.
7902         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7903         template parameter to the call to gold::gc_process_relocs.
7904         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7905         paramter to the call to gold::gc_process_relocs.
7906         * gc.h (get_embedded_addend_size): New function.
7907         (gc_process_relocs): Save the size of the reloc for use by ICF.
7908         * icf.cc (get_section_contents): Get the addend from the text section
7909         for SHT_REL relocation sections.
7910         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7911         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7912         * int_encoding.h (read_from_pointer): New overloaded function.
7913         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7914         * testsuite/icf_sht_rel_addend_test.sh: New file.
7915         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7916         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7917
7918 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7919
7920         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7921         * Makefile.in: Regenerate.
7922         * testsuite/Makefile.in: Regenerate.
7923
7924 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7925
7926         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7927         * gold/testsuite/debug_msg.cc: Likewise.
7928         * gold/testsuite/odr_violation1.cc
7929         * gold/testsuite/odr_violation2.cc
7930
7931 2010-07-21  Cary Coutant  <ccoutant@google.com>
7932
7933         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7934         string, and length fields.
7935         (Output_merge_string::Merged_strings_list): New type.
7936         (Output_merge_string::Merged_strings_lists): New typedef.
7937         (Output_merge_string): Replace merged_strings_ with
7938         merged_strings_lists_.
7939         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7940         Merged_strings_list per input object and section.  Don't store pointer
7941         to the string.  Don't store length with each merged string entry.
7942         (Output_merge_string::finalize_merged_data): Loop over list of merged
7943         strings lists.  Recompute length of each merged string.
7944
7945 2010-07-15  Cary Coutant  <ccoutant@google.com>
7946
7947         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7948         here.
7949
7950 2010-07-14  Ian Lance Taylor  <iant@google.com>
7951
7952         * descriptors.cc (Descriptors::open): Report correct name in error
7953         message.
7954
7955 2010-07-13  Doug Kwan  <dougkwan@google.com>
7956
7957         * arm.cc (Arm_input_section::Arm_input_section): For a
7958         SHT_ARM_EXIDX section, always keeps the input sections.
7959         (Arm_input_section::set_exidx_section_link): New method.
7960         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7961         has_errors_ to false.
7962         (Arm_exidx_input_section::has_errors,
7963         Arm_exidx_input_section::set_has_errors): New methods.
7964         (Arm_exidx_input_section::has_errors_): New data member.
7965         (Arm_relobj::get_exidx_shndx_list): New method.
7966         (Arm_output_section::append_text_sections_to_list): Do not skip
7967         section without SHF_EXECINSTR.
7968         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7969         errors.
7970         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7971         section header.  Make error messages more verbose.  Check for
7972         a non-executable section linked to an EXIDX section.
7973         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7974         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7975         check that there is no deferred EXIDX section if we exit early.
7976         Instead of not making an EXIDX section in case of an error, make one
7977         and set the has_errors flag of it.
7978         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7979         in a relocatable link.
7980         (Target_arm::do_relax): Look for the EXIDX output section instead of
7981         assuming that it is called .ARM.exidx.
7982         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7983         section list.  Do not check for SHF_EXECINSTR section flags but
7984         skip any input section with errors.
7985         * output.cc (Output_section::Output_section): Initialize
7986         always_keeps_input_sections_ to false.
7987         (Output_section::add_input_section): Check for
7988         always_keeps_input_sections_.
7989         *  output.h (Output_section::always_keeps_input_sections,
7990         Output_section::set_always_keeps_input_sections): New methods.
7991         (Output_section::always_keeps_input_sections): New data member.
7992
7993 2010-07-13  Rafael Espindola  <espindola@google.com>
7994
7995         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7996         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7997
7998 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7999             Ian Lance Taylor  <iant@google.com>
8000
8001         * output.h (Output_section_lookup_maps::add_merge_section):
8002         Correct check of whether value was inserted.
8003         (Output_section_lookup_maps::add_merge_input_section): Likewise.
8004         (Output_section_lookup_maps::add_relaxed_input_section):
8005         Likewise.
8006         * arm.cc (Target_arm::got_section): Remove used local os.
8007         * i386.cc (Target_i386::got_section): Likewise.
8008         * x86_64.cc (Target_x86_64::got_section): Likewise.
8009         * sparc.cc (Target_sparc::got_section): Likewise.
8010         (Target_sparc::relocate): Remove unused local have_got_offset.
8011         * powerpc.cc (Target_powerpc::relocate): Likewise.
8012
8013 2010-07-13  Ian Lance Taylor  <iant@google.com>
8014
8015         * compressed_output.cc (zlib_decompress): Fix signature in
8016         !HAVE_ZLIB_H case.
8017
8018         * archive.cc (Archive::include_member): Unlock an external member
8019         of a thin archive.  Don't bother to delete an object we know is
8020         NULL.
8021
8022 2010-07-12  Cary Coutant  <ccoutant@google.com>
8023
8024         * compressed_output.cc (zlib_decompress): New function.
8025         (get_uncompressed_size): New function.
8026         (decompress_input_section): New function.
8027         * compressed_output.h (get_uncompressed_size): New function.
8028         (decompress_input_section): New function.
8029         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8030         Handle compressed debug sections.
8031         * layout.cc (is_compressed_debug_section): New function.
8032         (Layout::output_section_name): Map compressed section names to
8033         canonical names.
8034         * layout.h (is_compressed_debug_section): New function.
8035         (is_debug_info_section): Recognize compressed debug sections.
8036         * merge.cc: Include compressed_output.h.
8037         (Output_merge_data::do_add_input_section): Handle compressed
8038         debug sections.
8039         (Output_merge_string::do_add_input_section): Handle compressed
8040         debug sections.
8041         * object.cc: Include compressed_output.h.
8042         (Sized_relobj::Sized_relobj): Initialize new data members.
8043         (build_compressed_section_map): New function.
8044         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8045         * object.h (Object::section_is_compressed): New method.
8046         (Object::do_section_is_compressed): New method.
8047         (Sized_relobj::Compressed_section_map): New type.
8048         (Sized_relobj::do_section_is_compressed): New method.
8049         (Sized_relobj::compressed_sections_): New data member.
8050         * output.cc (Output_section::add_input_section): Handle compressed
8051         debug sections.
8052         * reloc.cc: Include compressed_output.h.
8053         (Sized_relobj::write_sections): Handle compressed debug sections.
8054
8055 2010-07-08  Cary Coutant  <ccoutant@google.com>
8056
8057         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8058         weak when resolving to a dynamic def.
8059         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8060         for weak undef/dynamic def cases. Adjust callers.
8061         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8062         undef_binding_weak_.
8063         (Symbol_table::sized_write_globals): Adjust symbol binding.
8064         (Symbol_table::sized_write_symbol): Add binding parameter.
8065         * symtab.h (Symbol::set_undef_binding): New method.
8066         (Symbol::is_undef_binding_weak): New method.
8067         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8068         (Symbol_table::should_override): Add new parameter.
8069         (Symbol_table::sized_write_symbol): Add new parameter.
8070
8071         * testsuite/weak_undef_file1.cc: Add new test case.
8072         * testsuite/weak_undef_file2.cc: Fix header comment.
8073         * testsuite/weak_undef_test.cc: Add new test case.
8074
8075 2010-06-29  Doug Kwan  <dougkwan@google.com>
8076
8077         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8078         Initialize USE_SYMBOL_.
8079         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8080         definition.
8081         (Arm_reloc_property::uses_symbol_): New data member declaration.
8082         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8083         uses symbol value and symbol is undefined but not weakly undefined.
8084
8085 2010-06-28  Rafael Espindola  <espindola@google.com>
8086
8087         * plugin.cc (Plugin::load): Use dlerror.
8088
8089 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8090
8091         * symtab.cc (detect_odr_violations): When reporting an ODR
8092         violation, report an object where the symbol is defined.
8093
8094 2010-06-25  Doug Kwan  <dougkwan@google.com>
8095
8096         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8097         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8098         definition.
8099         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8100         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8101         target hook to detect function points.
8102         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8103         * icf.h (Icf::check_section_for_function_pointers): Change type of
8104         parameter SECTION_NAME to const reference to std::string.  Use
8105         target hook to determine if section may have unsafe pointers.
8106         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8107         method definition.
8108
8109 2010-06-21  Rafael Espindola  <espindola@google.com>
8110
8111         * fileread.cc (Input_file::find_fie): New
8112         (Input_file::open): Use Input_file::find_fie.
8113         * fileread.h (Input_file::find_fie): New
8114         * plugin.cc (set_extra_library_path): New.
8115         (Plugin::load): Add set_extra_library_path to the transfer vector.
8116         (Plugin_manager::set_extra_library_path): New.
8117         (Plugin_manager::add_input_file): Use the extra search path if set.
8118         (set_extra_library_path(): New.
8119         * plugin.h (Plugin_manager): Add set_extra_library_path and
8120         extra_search_path_.
8121
8122 2010-06-19  Cary Coutant  <ccoutant@google.com>
8123
8124         * layout.cc (gdb_sections): Add .debug_types.
8125         (lines_only_debug_sections): Likewise.
8126
8127 2010-06-18  Rafael Espindola  <espindola@google.com>
8128
8129         * plugin.cc (add_input_file,add_input_library)
8130         (Plugin_manager::add_input_file): Make filename arguments const.
8131         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8132         const.
8133
8134 2010-06-16  Doug Kwan  <dougkwan@google.com>
8135
8136         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8137         .ARM.attributes section if we have not merged any input
8138         attributes sections.
8139
8140 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8141
8142         * arm.cc: Allow combining objects with no EABI version
8143         information.
8144
8145 2010-06-15  Rafael Espindola  <espindola@google.com>
8146
8147         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8148
8149 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8150
8151         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8152         (struct iovec): Correct !HAVE_READV definition.
8153
8154 2010-06-10  Cary Coutant  <ccoutant@google.com>
8155
8156         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8157         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8158         reloc sections.
8159         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8160
8161         PR 11683
8162         * symtab.h (Symbol::is_placeholder): New member function.
8163         * target-reloc.h (relocate_section): Check for placeholder symbols.
8164
8165         * testsuite/Makefile.am (plugin_test_8): New test.
8166         (plugin_test_9): New test.
8167         * testsuite/Makefile.in: Regenerate.
8168
8169 2010-06-09  Nick Clifton  <nickc@redhat.com>
8170
8171         * yyscript.y (input_list_element): Allow strings prefixed with
8172         the '-' character.  Treat these as libraries.
8173         * script.cc (script_add_library): New function.  Adds a library
8174         specified by "-l<name>" found in an input script.
8175         * script-c.h: Add prototype for script_add_library.
8176
8177 2010-06-07  Doug Kwan  <dougkwan@google.com>
8178
8179         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8180         Restrict stub-group size to be within long conditional branch
8181         range when working around cortex-A8 erratum.
8182
8183 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8184
8185         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8186         #ifdef typo.
8187
8188 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8189
8190         PR gold/11658
8191         * output.cc
8192         (Output_section::Input_section_sort_entry::compare_section_ordering):
8193         Change to return non-zero correctly.
8194         (Output_section::Input_section_sort_section_order_index_compare
8195         ::operator()): Change to fix ambiguity in comparisons.
8196
8197 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8198
8199         * gold.h (is_wildcard_string): New function.
8200         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8201         (Layout::layout_eh_frame): Ditto.
8202         (Layout::find_section_order_index): New method.
8203         (Layout::read_layout_from_file): New method.
8204         * layout.h (Layout::find_section_order_index): New method.
8205         (Layout::read_layout_from_file): New method.
8206         (Layout::input_section_position_): New private member.
8207         (Layout::input_section_glob_): New private member.
8208         * main.cc (main): Call read_layout_from_file here.
8209         * options.h (--section-ordering-file): New option.
8210         * output.cc (Output_section::input_section_order_specified_): New
8211         member.
8212         (Output_section::Output_section): Initialize new member.
8213         (Output_section::add_input_section): Add new parameter.
8214         Keep input sections when --section-ordering-file is used.
8215         (Output_section::set_final_data_size): Sort input sections when
8216         section ordering file is specified.
8217         (Output_section::Input_section_sort_entry): Add new parameter.
8218         Check sorting type.
8219         (Output_section::Input_section_sort_entry::compare_section_ordering):
8220         New method.
8221         (Output_section::Input_section_sort_compare::operator()): Change to
8222         consider section_order_index.
8223         (Output_section::Input_section_sort_init_fini_compare::operator()):
8224         Change to consider section_order_index.
8225         (Output_section::Input_section_sort_section_order_index_compare
8226         ::operator()): New method.
8227         (Output_section::sort_attached_input_sections): Change to sort
8228         according to section order when specified.
8229         (Output_section::add_input_section<32, true>): Add new parameter.
8230         (Output_section::add_input_section<64, true>): Add new parameter.
8231         (Output_section::add_input_section<32, false>): Add new parameter.
8232         (Output_section::add_input_section<64, false>): Add new parameter.
8233         * output.h (Output_section::add_input_section): Add new parameter.
8234         (Output_section::input_section_order_specified): New
8235         method.
8236         (Output_section::set_input_section_order_specified): New method.
8237         (Input_section::Input_section): Initialize section_order_index_.
8238         (Input_section::section_order_index): New method.
8239         (Input_section::set_section_order_index): New method.
8240         (Input_section::section_order_index_): New member.
8241         (Input_section::Input_section_sort_section_order_index_compare): New
8242         struct.
8243         (Output_section::input_section_order_specified_): New member.
8244         * script-sections.cc (is_wildcard_string): Delete and move modified
8245         method to gold.h.
8246         (Output_section_element_input::Output_section_element_input): Modify
8247         call to is_wildcard_string.
8248         (Output_section_element_input::Input_section_pattern
8249         ::Input_section_pattern): Ditto.
8250         (Output_section_element_input::Output_section_element_input): Ditto.
8251         * testsuite/Makefile.am (final_layout): New test case.
8252         * testsuite/Makefile.in: Regenerate.
8253         * testsuite/final_layout.cc: New file.
8254         * testsuite/final_layout.sh: New file.
8255
8256 2010-06-01  Rafael Espindola  <espindola@google.com>
8257
8258         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8259
8260 2010-06-01  Rafael Espindola  <espindola@google.com>
8261
8262         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8263         visibility of symbols.
8264
8265 2010-05-27  Doug Kwan  <dougkwan@google.com>
8266
8267         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8268         from start of output section instead of address for a local symbol
8269         in a merged or relaxed section when doing a relocatable link.
8270
8271 2010-05-26  Rafael Espindola  <espindola@google.com>
8272
8273         PR 11604
8274         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8275         adding sections the garbage collector removed.
8276         * gold/testsuite/Makefile.am: Add test.
8277         * gold/testsuite/Makefile.in: Regenerate.
8278         * gold/testsuite/plugin_test_7.sh: New.
8279         * gold/testsuite/plugin_test_7_1.c: New.
8280         * gold/testsuite/plugin_test_7_2.c: New.
8281
8282 2010-05-26  Rafael Espindola  <espindola@google.com>
8283
8284         * script-sections.cc (Output_section_definition::set_section_addresses):
8285         Check for --section-start.
8286
8287 2010-05-26  Doug Kwan  <dougkwan@google.com>
8288
8289         * arm.cc (Arm_scan_relocatable_relocs): New class.
8290         (Target_arm::relocate_special_relocatable): New method.
8291         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8292         (Arm_relocate_functions::thumb_branch_common): Same.
8293         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8294         instead of Default_scan_relocatable_relocs.
8295         * target-reloc.h (relocate_for_relocatable): Let target handle
8296         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8297         * target.h (Sized_target::relocate_special_relocatable): New method.
8298
8299 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8300
8301         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8302
8303 2010-05-23  Doug Kwan  <dougkwan@google.com>
8304
8305         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8306         instead of a cast.
8307         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8308         with a direct branch, not a conditional branch, to a stub.
8309         * merge.cc (Output_merge_base::record_input_section): New method
8310         defintion.
8311         (Output_merge_data::do_add_input_section): Record input section if
8312         keeps-input-sections flag is set.
8313         (Output_merge_string::do_add_input_section): Ditto.
8314         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8315         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8316         INPUT_SECTIONS_.
8317         (Output_merge_base::keeps_input_sections,
8318         Output_merge_base::set_keeps_input_sections,
8319         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8320         method definitions.
8321         (Output_merge_base::Input_sections): New type declaration.
8322         (Output_merge_base::input_sections_begin,
8323         Output_merge_base::input_sections_end,
8324         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8325         (Output_merge_base::bool keeps_input_sections_,
8326         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8327         Output_merge_base::input_sections_): New data members.
8328         (Output_merge_data::do_set_keeps_input_sections): New method
8329         defintion.
8330         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8331         * output.cc (Output_section::Input_section::relobj): Move method
8332         defintion from class declaration to here and handle merge sections.
8333         (Output_section::Input_section::shndx): Ditto.
8334         (Output_section::Output_section): Remove initializations of removed
8335         data members and initialize new data member LOOKUP_MAPS_.
8336         (Output_section::add_input_section): Set keeps-input-sections flag
8337         for a newly created merge output section as appropriate.  Adjust code
8338         to use Output_section_lookup_maps class.
8339         (Output_section::add_relaxed_input_section): Adjst code for lookup
8340         maps code refactoring.
8341         (Output_section::add_merge_input_section): Add a new parameter
8342         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8343         class.  If adding input section to a newly created merge output
8344         section fails, remove the new merge section.
8345         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8346         Adjust code for use of the Output_section_lookup_maps class.
8347         (Output_section::find_merge_section): Ditto.
8348         (Output_section::build_lookup_maps): New method defintion.
8349         (Output_section::find_relaxed_input_section): Adjust code to use
8350         Output_section_lookup_maps class.
8351         (Output_section::get_input_sections): Export merge sections.  Adjust
8352         code to use Output_section_lookup_maps class.
8353         (Output_section:::add_script_input_section): Adjust code to use
8354         Output_section_lookup_maps class.  Update lookup maps for merge
8355         sections also.
8356         (Output_section::discard_states): Use Output_section_lookup_maps.
8357         (Output_section::restore_states): Same.
8358         * output.h (Merge_section_properties): Move class defintion out of
8359         Output_section.
8360         (Output_section_lookup_maps): New class.
8361         (Output_section::Input_section::is_merge_section): New method
8362         defintion.
8363         (Output_section::Input_section::relobj): Move defintion out of class
8364         defintion.  Declare method only.
8365         (Output_section::Input_section::shndx): Ditto.
8366         (Output_section::Input_section::output_merge_base): New method defintion.
8367         (Output_section::Input_section::u2_.pomb): New union field.
8368         (Output_section::Merge_section_by_properties_map,
8369         Output_section::Output_section_data_by_input_section_map,
8370         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8371         Remove types.
8372         (Output_section::add_merge_input_section): Add new parameter
8373         KEEPS_INPUT_SECTIONS.
8374         (Output_section::build_lookup_maps): New method declaration.
8375         (Output_section::merge_section_map_,
8376         Output_section::merge_section_by_properties_map_,
8377         Output_section::relaxed_input_section_map_,
8378         Output_section::is_relaxed_input_section_map_valid_): Remove data
8379         members.
8380         (Output_section::lookup_maps_): New data member.
8381
8382 2010-05-21  Doug Kwan  <dougkwan@google.com>
8383
8384         PR gold/11619
8385         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8386         avoid a compilation error.
8387
8388 2010-05-19  Rafael Espindola  <espindola@google.com>
8389
8390         * script-sections.cc (Output_section_definition::allocate_to_segment):
8391         Update the phdrs_list even when the output section is NULL.
8392         * testsuite/Makefile.am: Add test.
8393         * testsuite/Makefile.in: Regenerate.
8394         * testsuite/script_test_9.cc: New.
8395         * testsuite/script_test_9.sh: New.
8396         * testsuite/script_test_9.t: New.
8397
8398 2010-05-19  Doug Kwan  <dougkwan@google.com>
8399
8400         * arm.cc (Arm_input_section::original_size): New method.
8401         (Arm_input_section::do_addralign): Add a cast.
8402         (Arm_input_section::do_output_offset): Remove static cast.
8403         (Arm_input_section::original_addralign,
8404          Arm_input_section::original_size_): Change type to uint32_t.
8405         (Arm_input_section::init): Add safe casts for section alignment
8406         and size.
8407         (Arm_input_section::set_final_data_size): Do not set address and
8408         offset of stub table.
8409         (Arm_output_section::fix_exidx_coverage): Change use of of
8410         Output_section::Simple_input_section to that of
8411         Output_section::Input_section.
8412         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8413         except for the first pass.
8414         * output.cc (Output_section::get_input_sections): Change type of
8415         input_sections to std::list<Input_section>.
8416         (Output_section::add_script_input_section): Rename from
8417         Output_section::add_simple_input_section.  Change type of SIS
8418         parameter from Simple_input_section to Input_section.
8419         * output.h (Output_section::Simple_input_section): Remove class.
8420         (Output_section::Input_section): Change class visibility to public.
8421         (Output_section::Input_section::addralign): Use stored alignments
8422         for special input sections if set.
8423         (Output_section::Input_section::set_addralign): New method.
8424         (Output_section::get_input_sections): Change parameter type from
8425         list of Simple_input_section to list of Input_section.
8426         (Output_section::add_script_input_section): Rename from
8427         Output_section::add_simple_input_section. Change first parameter's
8428         type from Simple_input_section to Input_section and remove the
8429         second and third parameters.
8430         * script-sections.cc (Input_section::Input_section_list): Change
8431         type to list of Output_section::Input_section/
8432         (Input_section_info::Input_section_info): Change parameter type of
8433         INPUT_SECTION to Output_section::Input_section.
8434         (Input_section_info::input_section): Change return type.
8435         (Input_section_info::input_section_): Change type to
8436         Output_section::Input_section.
8437         (Output_section_element_input::set_section_addresses): Adjust code
8438         to use Output_section::Input_section instead of
8439         Output_section::Simple_input_section.  Adjust code for renaming
8440         of Output_section::add_simple_input_section.
8441         (Orphan_output_section::set_section_addresses): Ditto.
8442
8443 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8444
8445         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8446         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8447
8448 2010-05-18  Rafael Espindola  <espindola@google.com>
8449
8450         * options.cc (General_options::finalize): Handle -nostdlib.
8451         * options.h (nostdlib): New option.
8452         * script.cc (script_add_search_dir): Handle -nostdlib.
8453
8454 2010-05-12  Doug Kwan  <dougkwan@google.com>
8455
8456         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8457         attributes section only if there no attributes section after merging.
8458         (Target_arm::merge_object_attributes): Move value of
8459         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8460         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8461         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8462         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8463         and arm_attr_merge_7.stdout.
8464         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8465         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8466         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8467         arm_attr_merge_7b.o): New rules.
8468         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8469         arm_attr_merge_7
8470         * testsuite/Makefile.in: Regenerate.
8471         * testsuite/arm_attr_merge.sh: New file.
8472         * testsuite/arm_attr_merge_[67][ab].s: Same.
8473
8474 2010-05-05  Nick Clifton  <nickc@redhat.com>
8475
8476         * po/es.po: Updated Spanish translation.
8477
8478 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8479
8480         * Makefile.am (install-exec-local): Properly install gold as
8481         default cross linker.
8482         * Makefile.in: Regenerated.
8483
8484 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8485             Nick Clifton  <nickc@redhat.com>
8486
8487         * configure.ac (install_as_default): Define and set to false
8488         unless --enable-gold or --enable-gold=both/gold has been
8489         specified.
8490         * configure: Regenerate.
8491
8492         * Makefile.am (install-exec-local): Install the executable as
8493         'ld.gold'.  If install_as_default is true then also install it as
8494         'ld'.
8495         * Makefile.in: Regenerated.
8496
8497 2010-04-24  Ian Lance Taylor  <iant@google.com>
8498
8499         * layout.cc (Layout::layout_reloc): In relocatable link don't
8500         combine reloc sections for grouped sections.
8501
8502 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8503
8504         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8505         sections that are not ordinary to icf.
8506         * icf.cc (get_section_contents): Handle relocation pointing to section
8507         with no object or shndx information.
8508         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8509         * testsuite/Makefile.in: Regenerate.
8510         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8511         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8512
8513 2010-04-22  Ian Lance Taylor  <iant@google.com>
8514
8515         * expression.cc (Expression::Expression_eval_info): Add
8516         result_alignment_pointer field.
8517         (Expression::eval_with_dot): Add result_alignment_pointer
8518         parameter.  Change all callers.
8519         (Expression::eval_maybe_dot): Likewise.
8520         (class Binary_expression): Add alignment_pointer parameter to
8521         left_value and right_value.  Change all callers.
8522         (BINARY_EXPRESSION): Set result alignment.
8523         (class Trinary_expression): Add alignment_pointer parameter to
8524         arg2_value and arg3_value.  Change all callers.
8525         (Trinary_cond::value): Set result alignment.
8526         (Max_expression::value, Min_expression::value): Likewise.
8527         (Align_expression::value): Likewise.
8528         * script-sections.cc (class Sections_element): Add dot_alignment
8529         parameter to set_section_addresses virtual function.  Update
8530         instantiations.
8531         (class Output_section_element): Likewise.
8532         (Script_sections::create_segments): Add dot_alignment parameter.
8533         Change all callers.
8534         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8535         (Script_sections::set_phdrs_clause_addresses): Likewise.
8536         * script-sections.h: Update declarations.
8537         * script.h: Update declarations.
8538         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8539         min_p_align.
8540         * testsuite/script_test_3.t: Set large alignment.
8541         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8542         segment has expected alignment.
8543
8544 2010-04-22  Nick Clifton  <nickc@redhat.com>
8545
8546         * po/gold.pot: Updated by the Translation project.
8547         * po/vi.po: Updated Vietnamese translation.
8548
8549 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8550
8551         * testsuite/Makefile.am (check_PROGRAMS): Add
8552         icf_virtual_function_folding_test.
8553         * testsuite/Makefile.in: Regenerated.
8554
8555 2010-04-15  Andrew Haley  <aph@redhat.com>
8556
8557         * options.h (merge_exidx_entries): New option.
8558         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8559         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8560         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8561         (Target_arm::merge_exidx_entries): New function.
8562         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8563         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8564         to Arm_exidx_fixup constructor.
8565         Add new arg, merge_exidx_entries.
8566         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8567         Arm_output_section::fix_exidx_coverage.
8568
8569 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8570
8571         * icf.cc (get_section_contents): Check for preemptible functions.
8572         Ignore addend when appropriate.
8573         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8574         section folded.
8575         (add_from_relobj): Check for section folded.
8576         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8577         * symtab.h (should_add_dynsym_entry): Add new parameter.
8578         * target-reloc.h (scan_relocs): Check for section folded.
8579         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8580         Check reloc types for function pointers in shared objects.
8581         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8582         case.
8583         (icf_preemptible_functions_test): New test case.
8584         (icf_string_merge_test): New test case.
8585         * testsuite.Makefile.in: Regenerate.
8586         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8587         bar_glob.  Refactor code.
8588         * testsuite/icf_preemptible_functions_test.cc: New file.
8589         * testsuite/icf_preemptible_functions_test.sh: New file.
8590         * testsuite/icf_string_merge_test.cc: New file.
8591         * testsuite/icf_string_merge_test.sh: New file.
8592         * testsuite/icf_virtual_function_folding_test.cc: New file.
8593         * testsuite/icf_virtual_function_folding_test.sh: New file.
8594
8595 2010-04-14  Doug Kwan  <dougkwan@google.com>
8596
8597         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8598         for local symbol recounting if we remove a section due to ICF.
8599         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8600         there are no regular objects in input.
8601
8602 2010-04-13  Doug Kwan  <dougkwan@google.com>
8603
8604         * arm.cc (Arm_input_section::set_final_data_size): Compute
8605         accurate final data size instead of using current data size.
8606
8607 2010-04-09  Doug Kwan  <dougkwan@google.com>
8608
8609         * layout.cc (Layout::choose_output_section): Handle script section
8610         types.
8611         (Layout::make_output_section_for_script): Add section type parameter.
8612         Handle script section types.
8613         * layout.h (Layout::make_output_section_for_script): Add section
8614         type parameter.
8615         * output.cc (Output_section::Output_section): Initialize data member
8616         is_noload_.
8617         (Output_section::do_reset_address_and_file_offset): Do not set address
8618         to 0 if section is a NOLOAD section.
8619         * output.h (Output_section::is_noload): New method.
8620         (Output_section::set_is_noload): Ditto.
8621         (Output_section::is_noload_): New data member.
8622         * script-c.h (Script_section_type): New enum type.
8623         (struct Parser_output_section_header): Add new file section_type.
8624         * script-sections.cc (Sections_element::output_section_name): Add
8625         parameter for returning script section type.
8626         (Output_section_definition::output_section_name): Ditto.
8627         (Output_section_definition::section_type)P; New method.
8628         (Output_section_definiton::script_section_type_name): Ditto.
8629         (Output_section_definition::script_section_type_): New data member.
8630         (Output_section_definition::Output_section_definition): Initialize
8631         data member Output_section_definition::script_section_type_.
8632         (Output_section_definition::create_sections): Pass script section type
8633         to Layout::make_output_section_for_script.
8634         (Output_section_definition::output_section_name): Return script
8635         section type to caller.
8636         (Output_section_definition::set_section_address): Do not advance
8637         dot value and load address if section type is NOLOAD.  Set address
8638         of NOLOAD sections regardless of section flags.
8639         (Output_section_definition::print): Print section type if it is
8640         not SCRIPT_SECTION_TYPE_NONE.
8641         (Output_section_definition::section_type): New method.
8642         (Output_section_definition::script_section_type_name): Ditto.
8643         (Script_sections::output_section_name): Add new parameter
8644         PSECTION_TYPE for returning script section type.  Pass it to
8645         section elements.  Handle discard sections.
8646         (Sort_output_sections::operator()): Handle NOLOAD sections.
8647         * script-sections.h (Script_sections::Section_type): New enum type.
8648         (Script_sections::output_section_name): Add a new parameter for
8649         returning script section type.
8650         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8651         INFO and NOLOAD.
8652         * yyscript.y (union): Add new field SECTION_TYPE.
8653         (COPY, DSECT, INFO, NOLOAD): New tokens.
8654         (opt_address_and_section_type): Change type to output_section_header.
8655         (section_type): New non-terminal
8656         (section_header): Handle section type.
8657         (opt_address_and_section_type): Return section type value.
8658
8659 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8660
8661         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8662         * testsuite/plugin_common_test_2.c (foo): Likewise.
8663
8664 2010-04-08  Doug Kwan  <dougkwan@google.com>
8665
8666         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8667         Output_merge_data.
8668         * output.cc (Output_section::add_merge_input_section): Simplify
8669         code and return status of Output_merge_base::add_input_section.
8670         Update merge section map only if Output_merge_base::add_input_section
8671         returns true.
8672
8673 2010-04-07  Doug Kwan  <dougkwan@google.com>
8674
8675         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8676         if section is marked as containing instructions but has no mapping
8677         symbols.
8678         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8679         correct section index.
8680         (Arm_relobj::find_linked_text_section): Ditto.
8681
8682 2010-04-07  Cary Coutant  <ccoutant@google.com>
8683
8684         * archive.cc (include_member): Destroy Read_symbols_data object before
8685         releasing file.
8686         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8687         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8688         (Read_symbols_data::~Read_symbols_data) New destructor.
8689         (Section_relocs::Section_relocs) New constructor.
8690         (Section_relocs::~Section_relocs) New destructor.
8691         (Read_relocs_data::Read_relocs_data) New constructor.
8692         (Read_relocs_data::~Read_relocs_data) New destructor.
8693         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8694         pointers to NULL after deleting.
8695
8696 2010-04-07  Doug Kwan  <dougkwan@google.com>
8697
8698         * arm.cc: Replace "endianity" with "endianness" in comments.
8699         (Arm_exidx_cantunwind): Ditto.
8700         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8701         (Arm_relobj::merge_flags_and_attributes): New method.
8702         (Arm_relobj::merge_flags_and_attributes_): New data member.
8703         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8704         (Arm_relobj::scan_sections_for_stubs): Ditto.
8705         (Arm_relobj::do_read_symbols): Check to see if we really want to
8706         merge processor-specific flags and attributes.  Exit early if
8707         an object is empty except for section names and the undefined symbol.
8708         (Target_arm::do_finalize_sections): Move check for ELF format to
8709         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8710         attributes from a regular object only when we have determined that
8711         it is aapropriate.  Do not create an .ARM.attributes section in
8712         output if there is no regular input object.
8713         (Target_arm::merge_processor_specific_flags): Check
8714         --warn-mismatch before printing any error.
8715         (Target_arm::merge_object_attributes): Ditto.
8716         * gold.cc (queue_middle_tasks): Handle the case in which there is
8717         no regular object in input.
8718         * options.cc (General_options::parse_EB): New method.
8719         (General_options::parse_EL): Same.
8720         (General_options::General_options): Initialize endianness_.
8721         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8722         New options.
8723         (General_options::Endianness): New enum.
8724         (General_options::endianness): New method.
8725         (General_options::endianness_): New data member.
8726         * parameters.cc (Parameters::set_options): Check target endianness.
8727         (Parameters::set_target_once): Ditto.
8728         (Parameters::check_target_endianness): New method.
8729         (parameters_force_valid_target): If either -EL or -EB is specified,
8730         use it to define endianness of default target.
8731         * parameters.h (Parameters::check_target_endianness): New method
8732         declaration.
8733         * target.h (class Target): Change "endianity" to "endianness"
8734         in comments.
8735
8736 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8737
8738         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8739         * configure: Regenerate.
8740         * Makefile.in: Regenerate.
8741         * testsuite/Makefile.in: Regenerate.
8742
8743 2010-04-06  Cary Coutant  <ccoutant@google.com>
8744
8745         gcc PR lto/42757
8746         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8747         prevailing definitions of common symbols.
8748         * testsuite/plugin_test_6.sh: New test case.
8749         * testsuite/plugin_common_test_1.c: New test case.
8750         * testsuite/plugin_common_test_2.c: New test case.
8751         * testsuite/Makefile.am (plugin_test_6): New test case.
8752         * testsuite/Makefile.in: Regenerate.
8753
8754 2010-04-06  Nick Clifton  <nickc@redhat.com>
8755
8756         * po/vi.po: New Vietnamese translation.
8757
8758 2010-03-30  Doug Kwan  <dougkwan@google.com>
8759
8760         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8761
8762 2010-03-25  Doug Kwan  <dougkwan@google.com>
8763
8764         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8765         to avoid a conversion warning on a 32-bit host.
8766
8767 2010-03-24  Ian Lance Taylor  <iant@google.com>
8768
8769         * testsuite/script_test_3.t: Add a TLS segment.
8770         * testsuite/Makefile.am (check_PROGRAMS): Add
8771         tls_phdrs_script_test.
8772         (tls_phdrs_script_test_SOURCES): Define.
8773         (tls_phdrs_script_test_DEPENDENCIES): Define.
8774         (tls_phdrs_script_test_LDFLAGS): Define.
8775         (tls_phdrs_script_test_LDADD): Define.
8776         * testsuite/Makefile.in: Rebuild.
8777
8778 2010-03-23  Cary Coutant  <ccoutant@google.com>
8779
8780         * fileread.cc (find_or_make_view): Fix comment.
8781
8782 2010-03-23  Ian Lance Taylor  <iant@google.com>
8783
8784         * script-sections.cc (class Orphan_section_placement): Define
8785         PLACE_TLS and PLACE_TLS_BSS.
8786         (Orphan_section_placement::Orphan_section_placement): Initialize
8787         new places.
8788         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8789         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8790         (tls_script_test_SOURCES): Define.
8791         (tls_script_test_DEPENDENCIES): Define.
8792         (tls_script_test_LDFLAGS): Define.
8793         (tls_script_test_LDADD): Define.
8794         * testsuite/Makefile.in: Rebuild.
8795
8796 2010-03-22  Doug Kwan  <dougkwan@google.com>
8797
8798         * arm.cc (Arm_relocate_functions::abs8,
8799         Arm_relocate_functions::abs16): Use correct check for overflow
8800         specified in the ARM ELF specs.
8801         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8802         target of a BLX instruction specially.
8803         (Reloc_stub::stub_type_for_reloc): Ditto.
8804         (Relocate::relocate): Use symbolic names instead of numeric relocation
8805         codes to report error.
8806         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8807         workaround.
8808         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8809         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8810         thumb2_blx_out_of_range.stdout
8811         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8812         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8813         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8814         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8815         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8816         thumb2_blx_in_range, thumb2_blx_in_range.o,
8817         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8818         thumb2_blx_out_of_range.o): New rules.
8819         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8820         thumb2_blx_in_range and thumb2_blx_out_of_range.
8821         * testsuite/Makefile.in: Regenerate.
8822         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8823         * testsuite/thumb_blx_in_range.s: New file.
8824         * testsuite/thumb_blx_out_of_range.s: New file.
8825
8826 2010-03-22  Rafael Espindola  <espindola@google.com>
8827
8828         * archive.cc (Should_include): Move to archive.h.
8829         (should_include_member): Make it a member of Archive.
8830         (Lib_group): New.
8831         (Add_lib_group_symbols): New.
8832         * archive.h: Include options.h.
8833         (Archive_member): Moved from Archive.
8834         (Should_include): Moved from archive.cc.
8835         (Lib_group): New.
8836         (Add_lib_group_symbols): New.
8837         * dynobj.cc (do_should_include_member): New.
8838         * dynobj.h (do_should_include_member): New.
8839         * gold.cc (queue_initial_tasks): Update call to queue.
8840         * main.cc (main): Print lib group stats.
8841         * object.cc (do_should_include_member): New.
8842         * object.h: Include archive.h.
8843         (Object::should_include_member): New.
8844         (Object::do_should_include_member): New.
8845         (Sized_relobj::do_should_include_member): New.
8846         * options.cc (General_options::parse_start_lib): New.
8847         (General_options::parse_end_lib): New.
8848         (Input_arguments::add_file): Handle lib groups.
8849         (Input_arguments::start_group): Check we are not in a lib.
8850         (Input_arguments::start_lib): New.
8851         (Input_arguments::end_lib): New.
8852         * options.h (General_options): Add start_lib and end_lib.
8853         (Input_argument::lib_): New.
8854         (Input_argument::lib): New.
8855         (Input_argument::is_lib): New.
8856         (Input_file_lib): New.
8857         (Input_arguments::in_lib_): New.
8858         (Input_arguments::in_lib): New.
8859         (Input_arguments::start_lib): New.
8860         (Input_arguments::end_lib_): New.
8861         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8862         in unused members as preempted.
8863         (Sized_pluginobj::do_should_include_member): New.
8864         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8865         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8866         return the blocker.
8867         (Read_symbols::do_whole_lib_group): New.
8868         (Read_symbols::do_lib_group): New.
8869         (Read_symbols::do_read_symbols): Handle lib groups.
8870         (Read_symbols::get_name): Handle lib groups.
8871         * readsyms.h (Read_symbols): Add an archive member pointer.
8872         (Read_symbols::do_whole_lib_group): New.
8873         (Read_symbols::do_lib_group): New.
8874         (Read_symbols::member_): New.
8875         * script.cc (read_input_script): Update call to queue_soon.
8876
8877 2010-03-19  Doug Kwan  <dougkwan@google.com>
8878
8879         * arm.cc (Stub_table::Stub_table): Initialize new data members
8880         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8881         (Stub_table::add_reloc_stub): Assign stub offset and update
8882         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8883         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8884         New data members.
8885         (Stub_table::update_data_size_and_addralign): Use
8886         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8887         instead of going over all reloc stubs.
8888         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8889         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8890         Stringpool_template::offset_ to size of Stringpool_char.
8891         (Stringpool_template::new_key_offset): Remove code to initialize
8892         Stringpool_template::offset_.
8893         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8894         Stringpool_template::offset_ to zero.
8895
8896 2010-03-15  Doug Kwan  <dougkwan@google.com>
8897
8898         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8899         offset_.
8900         (Stringpool_template::new_key_offset): New method.
8901         (Stringpool_template::add_string): Assign offsets when adding new
8902         strings.
8903         (Stringpool_template::set_string_offsets): Do not set string offsets
8904         when not optimizing.
8905         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8906         member size_.
8907         (Chunked_vector::clear): Clear size_.
8908         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8909         (Chunked_vector::size): Return size_.
8910         (Chunked_vector::push_back): Use size_ to find insert position.
8911         (Chunked_vector::size_): New data member.
8912         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8913         (Stringpool_template::new_key_offset): New method declaration.
8914         (Stringpool_template::offset_): New data member.
8915
8916 2010-03-15   Rafael Espindola  <espindola@google.com>
8917
8918         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8919         Add_symbols' constructor.
8920         * readsyms.h (Add_symbols): Remove the input_group member.
8921
8922 2010-03-10  Ian Lance Taylor  <iant@google.com>
8923
8924         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8925         target to ask whether a reference to a symbol requires a stack
8926         split.
8927         * target.h (Target::is_call_to_non_split): New function.
8928         (Target::do_is_call_to_non_split): Declare virtual function.
8929         * target.cc: Include "symtab.h".
8930         (Target::do_is_call_to_non_split): New function.
8931         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8932
8933 2010-03-10  Cary Coutant  <ccoutant@google.com>
8934
8935         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8936         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8937         (File_read::open[2]): Add whole_file_view_ to list of views.
8938         (File_read::make_view): Remove test of whole_file_view_.
8939         (File_read::find_or_make_view): Create whole_file_view_ if
8940         necessary.
8941         (File_read::clear_views): Replace bool parameter with enum;
8942         adjust all callers.  Don't delete views with permanent data;
8943         do delete cached views and views from archives if
8944         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8945         if clearing the corresponding view.
8946         * fileread.h (File_read::Clear_views_mode): New enum.
8947         (File_read::View::is_permanent_view): New method.
8948         (File_read::clear_views): Replace bool parameter
8949         with enum; adjust all callers.
8950         * options.h (General_options): Change keep_files_mapped option;
8951         add map_whole_files.
8952         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8953         releasing the file.
8954         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8955         the file.
8956
8957 2010-03-10  David S. Miller  <davem@davemloft.net>
8958
8959         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8960
8961 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8962
8963         * icf.cc (get_section_contents): Add '@' marker after processing the
8964         merge reloc.
8965
8966 2010-03-08  Doug Kwan  <dougkwan@google.com>
8967
8968         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8969         due to a conversion warning.
8970         (Arm_relobj::update_output_local_symbol_count): Check for local
8971         symbol with unset output index.
8972
8973 2010-03-05  Ian Lance Taylor  <iant@google.com>
8974
8975         * options.h (class General_options): Add --spare-dynamic-tags.
8976         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8977         --spare-dynamic-tags.
8978
8979 2010-03-05  Ian Lance Taylor  <iant@google.com>
8980
8981         * incremental.cc: Include "libiberty.h".
8982
8983 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8984
8985         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8986         function, is_info_ member.
8987         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8988         (Versions::Versions): Update caller.
8989         (Versions::define_base_version): Likewise.
8990         (Versions::add_def): Likewise.
8991
8992 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8993
8994         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8995         (Scan::possible_function_pointer_reloc): New function.
8996         (Scan::local_reloc_may_be_function_pointer): Change to call
8997         possible_function_pointer_reloc.
8998         (Scan::global_reloc_may_be_function_pointer): Ditto.
8999         * icf.h (Icf::check_section_for_function_pointers): Change to reject
9000         relocations in ".data.rel.ro._ZTV" section.
9001         * testsuite/icf_safe_so_test.sh: Change to pass i386.
9002         * testsuite/icf_safe_so_test.cc: Ditto.
9003         * testsuite/icf_safe_test.cc: Ditto.
9004         * testsuite/icf_safe_test.sh: Ditto.
9005
9006 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9007             Ian Lance Taylor  <iant@google.com>
9008
9009         * target-reloc.h (relocate_section): Check the symbol table index
9010         for -1U before setting the local symbol index.
9011         (scan_relocatable_relocs): If copying the relocation, record that
9012         the local symbol is required.
9013         * object.h (Symbol_value::is_output_symtab_index_set): New
9014         function.
9015         (Symbol_value::may_be_discarded_from_output_symtab): New
9016         function.
9017         (Symbol_value::has_output_symtab_entry): New function.
9018         (Symbol_value::needs_output_symtab_entry): Remove.
9019         (Symbol_value::output_symtab_index): Make sure the symbol index is
9020         set.
9021         (Symbol_value::set_output_symtab_index): Make sure the symbol
9022         index is not set.  Make sure the new index is valid.
9023         (Symbol_value::set_must_have_output_symtab_entry): New function.
9024         (Symbol_value::has_output_dynsym_entry): New function.
9025         (Symbol_value::set_output_dynsym_index): Make sure the new index
9026         is valid.
9027         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9028         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9029         local symbol if permitted.
9030         (Sized_relobj::do_finalize_local_symbols): Call
9031         is_output_symtab_index_set rather than needs_output_symtab_entry.
9032         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9033         rather than needs_output_symtab_entry.  Call
9034         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9035         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9036         is_output_symtab_index_set rather than needs_output_symtab_entry.
9037         * testsuite/discard_locals_relocatable_test.c: New file.
9038         * testsuite/discard_locals_test.sh: Test -r.
9039         * testsuite/Makefile.am (check_DATA): Add
9040         discard_locals_relocatable_test1.syms,
9041         discard_local_relocatable_test2.syms.
9042         (MOSTLYCLEANFILES): Likewise.  Also add
9043         discard_locals_relocatable_test1.lout and
9044         discard_locals_relocatable_test2.out.
9045         (discard_locals_relocatable_test1.syms): New target.
9046         (discard_locals_relocatable_test.o): New target.
9047         (discard_locals_relocatable_test1.out): New target.
9048         (discard_locals_relocatable_test2.syms): New target.
9049         (discard_locals_relocatable_test2.out): New target.
9050         (various): Add missing ../ld-new dependencies.
9051         * testsuite/Makefile.in: Rebuild.
9052
9053 2010-03-03  Nick Clifton  <nickc@redhat.com>
9054
9055         * po/fi.po: New Finnish translation.
9056
9057 2010-03-01  Doug Kwan  <dougkwan@google.com>
9058
9059         * layout.cc (Layout::Layout): Force section types of .init_array*,
9060         .preinit_array* and .fini_array* sections.
9061         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9062         Fix check of return value of std::string::find.().
9063         (Output_section::Input_section_sort_compare::operator()): Remove
9064         comment about .init_array.
9065         (Output_section::Input_section_sort_init_fini_compare::operator()):
9066         New method.
9067         (Output_section::sort_attached_input_sections): Handle .init_array
9068         and .fini_array specially.
9069         * output.h (Output_section::Inut_section_sort_compare): Update
9070         comment.
9071         (Output_section::Input_section_sort_init_fini_compare): New struct.
9072
9073 2010-02-26  Doug Kwan  <dougkwan@google.com>
9074
9075         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9076         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9077         * testsuite/debug_msg.sh: Avoid matching source line number for
9078         use of global variable undef_int.
9079
9080 2010-02-26  Doug Kwan  <dougkwan@google.com>
9081
9082         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9083         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9084         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9085         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9086         * options.cc (General_options::General_options): Initialize member
9087         fix_v4bx_.
9088         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9089         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9090         and rm_no_fix_v4bx.stdout
9091         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9092         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9093         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9094         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9095         and arm_no_fix_v4bx.
9096         * Makefile.in: Regenerate.
9097         * testsuite/arm_fix_v4bx.s: New file.
9098         * testsuite/arm_fix_v4bx.sh: Ditto.
9099
9100 2010-02-24  Doug Kwan  <dougkwan@google.com>
9101
9102         * arm.cc (Target_arm::got_section): Make the .got section the first
9103         non RELRO section in the data segment.
9104         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9105         suffixes of section names.
9106
9107 2010-02-24  Doug Kwan  <dougkwan@google.com>
9108
9109         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9110         flags and attributes merging if an input file is a binary file.
9111         * fileread.cc (Input_file::open): Record format of original file.
9112         * fileread.h (Input_file::Format): New enum type.
9113         (Input_file::Input_file): Initialize data member format_.
9114         (Input_file::format): New method definition.
9115         (Input_file::format_):: New data member.
9116
9117 2010-02-24  Doug Kwan  <dougkwan@google.com>
9118
9119         * arm.cc (Arm_output_data_got): New class.
9120         (ARM_TCB_SIZE): New constant
9121         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9122         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9123         If user uses a script with a SECTIONS clause, issue only a warning
9124         for a misplaced EXIDX input section.  Otherwise, issue an error.
9125         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9126         garbage collection.
9127         (Target_arm::got_mode_index_entry): Handle static linking.
9128         (Target_arm::Scan::local): Ditto.
9129         (Target_arm::Scan::global): Ditto.
9130         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9131         all incorrectly implemented relocations.
9132         (Target_arm::fix_exidx_coverage): Pass layout to
9133         Arm_output_section::fix_exidx_coverage.
9134         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9135         from ".ARM.exidx." and ".ARM.extab.".
9136
9137 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9138
9139         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9140         section if it does not already exist.
9141         * attributes.cc (Attributes_section_data::Attributes_section_data):
9142         Don't crash if size is zero.
9143
9144 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9145             Ian Lance Taylor  <iant@google.com>
9146
9147         * gold.cc (queue_middle_tasks): If no input files were opened,
9148         exit.
9149         * workqueue.h (Task_function::Task_function): Assert that there is
9150         a blocker.
9151
9152 2010-02-22  Doug Kwan  <dougkwan@google.com>
9153
9154         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9155         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9156         types to avoid warnings due to different uint64_t implementations
9157         on different hosts.
9158
9159 2010-02-21  Doug Kwan  <dougkwan@google.com>
9160
9161         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9162         handling of the maximum backward branch offset.
9163         (Arm_relocate_functions::thumb_branch_common): Ditto.
9164         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9165         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9166         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9167         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9168         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9169         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9170         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9171         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9172         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9173         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9174         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9175         thumb2_bl_out_of_range.o): New rules.
9176         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9177         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9178         thumb2_bl_out_of_range
9179         * testsuite/Makefile.in: Regenerate.
9180         * testsuite/arm_bl_in_range.s: New file.
9181         * testsuite/arm_bl_out_of_range.s: Ditto.
9182         * testsuite/arm_branch_in_range.sh: Ditto.
9183         * testsuite/arm_branch_range.t: Ditto.
9184         * testsuite/thumb2_branch_range.t: Ditto.
9185         * testsuite/thumb_bl_in_range.s: Ditto.
9186         * testsuite/thumb_bl_out_of_range.s: Ditto.
9187         * testsuite/thumb_branch_range.t: Ditto.
9188
9189 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9190
9191         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9192         Add reloc offset information.
9193         * icf.cc (get_section_contents): Change iterators to point to the new
9194         vectors. Add reloc offset information to the contents.
9195         * icf.h (Icf::Sections_reachable_info): New typedef.
9196         (Icf::Sections_reachable_list): New typedef.
9197         (Icf::Offset_info): New typedef.
9198         (Icf::Reloc_info): New struct typedef.
9199         (Icf::Reloc_info_list): New typedef.
9200         (Icf::symbol_reloc_list): Delete method.
9201         (Icf::addend_reloc_list): Delete method.
9202         (Icf::section_reloc_list): Delete method.
9203         (Icf::reloc_info_list): New method.
9204         (Icf::reloc_info_list_): New member.
9205
9206 2010-02-19  Doug Kwan  <dougkwan@google.com>
9207
9208         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9209         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9210         * arm.cc (Arm_relocation_functions): New forward declaration.
9211         (Target_arm::Target_arm): Initialize new data members
9212         got_mod_index_offset_ and tls_base_symbol_defined_.
9213         (Target_arm::Relocate::relocate_tls): New method.
9214         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9215          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9216         New methods.
9217         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9218         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9219         (Target_arm::got_mod_index_offset_,
9220         Target_arm::tls_base_symbol_defined_): New data members.
9221         (Target_arm::Scan::local, Target::Scan::global,
9222         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9223         relocations.
9224
9225 2010-02-18  Doug Kwan  <dougkwan@google.com>
9226
9227         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9228         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9229         text section as a parameter becuase some broken tools may not set
9230         the link in section header.
9231         (Target_arm::has_got_section): New method.
9232         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9233         without any mapping symbol as data only.  Remove warning.
9234         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9235         link in its section header, try to discover the link by inspecting the
9236         REL31 relocation at the beginning of the section.
9237         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9238         in error message.
9239         (Target_arm::Scan::global): Treat any reference to the symbol
9240         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9241
9242 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9243
9244         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9245         (Scan::global_reloc_may_be_function_pointer): New function.
9246         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9247         (Scan::global_reloc_may_be_function_pointer): New function.
9248         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9249         (Scan::global_reloc_may_be_function_pointer): New function.
9250         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9251         (Scan::global_reloc_may_be_function_pointer): New function.
9252         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9253         (Scan::global_reloc_may_be_function_pointer): New function.
9254         (Scan::possible_function_pointer_reloc): New function.
9255         (Target_x86_64::can_check_for_function_pointers): New function.
9256         * gc.h (gc_process_relocs): Scan relocation types to determine if
9257         function pointers were taken for targets that support it.
9258         * icf.cc (Icf::find_identical_sections): Include functions for
9259         folding in safe ICF whose pointer is not taken.
9260         * icf.h (Secn_fptr_taken_set): New typedef.
9261         (fptr_section_id_): New member.
9262         (section_has_function_pointers): New function.
9263         (set_section_has_function_pointers): New function.
9264         (check_section_for_function_pointers): New function.
9265         * options.h: Fix comment for safe ICF option.
9266         * target.h (can_check_for_function_pointers): New function.
9267         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9268         Modify icf_safe_test for X86-64.
9269         * testsuite/Makefile.in: Regenerate.
9270         * testsuite/icf_safe_so_test.cc: New file.
9271         * testsuite/icf_safe_so_test.sh: New file.
9272         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9273         (main): Change to take pointer to function kept_func_3.
9274         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9275         folding is done correctly for X86-64.
9276
9277 2010-02-12  David S. Miller  <davem@davemloft.net>
9278
9279         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9280         is_symbolless parameter.
9281         (Output_reloc<SHT_REL>::is_symbolless): New.
9282         (Output_reloc<SHT_REL>::is_symbolless_): New.
9283         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9284         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9285         (Output_reloc<SHT_RELA>::is_symbolless): New.
9286         (Output_data_reloc::add_global): Handle is_symbolless.
9287         (Output_data_reloc::add_global_relative): Likewise.
9288         (Output_data_reloc::add_local): Likewise.
9289         (Output_data_reloc::add_local_relative): Likewise.
9290         (Output_data_reloc::add_symbolless_global_addend): New.
9291         (Output_data_reloc::add_symbolless_local_addend): New.
9292         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9293         is_symbolless.
9294         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9295         instead of ->is_relative_
9296         (Output_reloc::write): Likewise.
9297         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9298         (Output_reloc::write_rel): Simplify.
9299
9300         * sparc.cc (Target_sparc::Scan::local): Use
9301         ->add_symbolless_local_addend as needed.
9302         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9303         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9304         based upon relocation offset.
9305
9306 2010-02-11  Doug Kwan  <dougkwan@google.com>
9307
9308         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9309         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9310         beginning of function.
9311         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9312         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9313         parameter is_32bit in calls to should_apply_static_reloc.
9314         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9315         (check_DATA): Add arm_abs_global.stdout.
9316         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9317         arm_abs_global.stdout): New rules.
9318         (MOSTLLYCLEANFILES): Add arm_abs_global
9319         * Makefile.in: Regenerate.
9320         * testsuite/arm_abs_global.s: New file.
9321         * testsuite/arm_abs_global.sh: Ditto.
9322         * testsuite/arm_abs_lib.s: Ditto.
9323
9324 2010-02-11  Ian Lance Taylor  <iant@google.com>
9325
9326         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9327         Read_relocs task.
9328         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9329         Allocate_commons_task first.
9330         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9331         task, rather than symtab_lock_.
9332         (Gc_process_relocs::~Gc_process_relocs): New function.
9333         (Gc_process_relocs::is_runnable): Check this_blocker_.
9334         (Gc_process_relocs::locks): Use next_blocker_ rather than
9335         blocker_.
9336         (Scan_relocs::~Scan_relocs): New function.
9337         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9338         symtab_lock_.
9339         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9340         next_blocker_.
9341         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9342         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9343         constructor accordingly.
9344         (class Gc_process_relocs): Likewise.
9345         (class Scan_relocs): Likewise.
9346         * common.h (class Allocate_commons_task): Remove symtab_lock_
9347         field, and corresponding constructor parameter.
9348         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9349         symtab_lock_.
9350         (Allocate_commons_task::locks): Likewise.
9351
9352 2010-02-11  Ian Lance Taylor  <iant@google.com>
9353
9354         * gold-threads.h (class Once): Define.
9355         (class Initialize_lock): Rewrite as child of Once.
9356         * gold-threads.cc (class Once_initialize): Define.
9357         (once_pointer_control): New static variable.
9358         (once_pointer, once_arg): New static variables.
9359         (c_run_once): New static function.
9360         (Once::Once, Once::run_once, Once::internal_run): New functions.
9361         (class Initialize_lock_once): Remove.
9362         (initialize_lock_control): Remove.
9363         (initialize_lock_pointer): Remove.
9364         (initialize_lock_once): Remove.
9365         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9366         (Initialize_lock::initialize): Rewrite.
9367         (Initialize_lock::do_run_once): New function.
9368         * archive.cc (Archive::interpret_header): Only clear name if it is
9369         not already empty.
9370         * fileread.cc: Include "gold-threads.h"
9371         (file_counts_lock): New static variable.
9372         (file_counts_initialize_lock): Likewise.
9373         (File_read::release): Only increment counts when using --stats.
9374         Use a lock around the increment.
9375         * parameters.cc (class Set_parameters_target_once): Define.
9376         (set_parameters_target_once): New static variable.
9377         (Parameters::Parameters): Move here from parameters.h.
9378         (Parameters::set_target): Rewrite.
9379         (Parameters::set_target_once): New function.
9380         (Parameters::clear_target): Move here and rewrite.
9381         * parameters.h (class Parameters): Update declarations.  Add
9382         set_parameters_target_once_ field.
9383         (Parameters::Parameters): Move to parameters.cc.
9384         (Parameters::clear_target): Likewise.
9385         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9386         task.
9387         (Start_group::~Start_group): New function.
9388         (Start_group::is_runnable): New function.
9389         (Start_group::locks, Start_group::run): New functions.
9390         (Finish_group::run): Change saw_undefined to size_t.
9391         * readsyms.h (class Start_group): Define.
9392         (class Finish_group): Change saw_undefined_ field to size_t.
9393         (Finish_group::Finish_group): Remove saw_undefined and
9394         this_blocker parameters.  Change all callers.
9395         (Finish_group::set_saw_undefined): New function.
9396         (Finish_group::set_blocker): New function.
9397         * symtab.h (class Symbol_table): Change saw_undefined to return
9398         size_t.  Change saw_undefined_ field to size_t.
9399         * target-select.cc (Set_target_once::do_run_once): New function.
9400         (Target_selector::Target_selector): Initialize set_target_once_
9401         field.  Don't initialize lock_ and initialize_lock_ fields.
9402         (Target_selector::instantiate_target): Rewrite.
9403         (Target_selector::set_target): New function.
9404         * target-select.h (class Set_target_once): Define.
9405         (class Target_selector): Update declarations.  Make
9406         Set_target_once a friend.  Remove lock_ and initialize_lock_
9407         fields.  Add set_target_once_ field.
9408
9409 2010-02-10  Ian Lance Taylor  <iant@google.com>
9410
9411         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9412         queueing any tasks.
9413         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9414         (queue_middle_tasks): Add all blockers before queueing any tasks.
9415         (queue_final_tasks): Likewise.
9416         * token.h (Task_token::add_blockers): New function.
9417         * object.h (Input_objects::number_of_relobjs): New function.
9418
9419 2010-02-10  Ian Lance Taylor  <iant@google.com>
9420
9421         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9422         shared, not if not position independent.
9423         * x86_64.cc (Relocate::relocate_tls): Likewise.
9424         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9425         (tls_pie_pic_test): New target.
9426         * testsuite/Makefile.in: Rebuild.
9427
9428         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9429         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9430         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9431         * testsuite/Makefile.in: Rebuild.
9432
9433 2010-02-09  David S. Miller  <davem@davemloft.net>
9434
9435         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9436         R_SPARC_RELATIVE using ->add_local_relative().
9437         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9438
9439         * output.h (Output_data_dynamic::add_section_size): New method
9440         that takes two Output_data objects.
9441         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9442         entry param.  Handle it in initializers.
9443         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9444         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9445         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9446         arg.
9447         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9448         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9449         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9450         for dynrel_includes_plt.
9451         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9452         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9453         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9454         before .rela.plt
9455         (Target_sparc::do_finalize_sections): Update to pass true for
9456         dynrel_includes_plt.
9457         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9458         output before .rela.plt
9459         (Target_powerpc::do_finalize_sections): Update to pass true for
9460         dynrel_includes_plt when 32-bit.
9461
9462 2010-02-08  Doug Kwan  <dougkwan@google.com>
9463
9464         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9465         method.
9466         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9467         Arm_relobj::scan_section_for_cortex_a8_stubs,
9468         Arm_relobj::do_relocation_section): Instead of calling
9469         Output_section::output_address, use faster
9470         Arm_relobj::simple_input_section_output_address.
9471
9472 2010-02-08  David S. Miller  <davem@davemloft.net>
9473
9474         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9475         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9476         relocation helper function.
9477
9478         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9479         just like R_SPARC_GOT{10,13,22}.
9480         (Target_sparc::Scan::local): Likewise.
9481         (Target_sparc::Relocate:relocate): Likewise.
9482
9483 2010-02-06  Ian Lance Taylor  <iant@google.com>
9484
9485         * configure.ac: Rewrite targetobjs duplicate removal code to use
9486         only shell constructs.
9487         * configure: Rebuild.
9488
9489 2010-02-05  Doug Kwan  <dougkwan@google.com>
9490
9491         PR 11247
9492         * arm.cc (Arm_relobj::section_is_scannable): New method.
9493         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9494         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9495
9496 2010-02-04  Doug Kwan  <dougkwan@google.com>
9497
9498         PR 11247
9499         * arm-reloc-property.cc (cstdio): Include.
9500         * configure.ac (targetobjs): Remove duplicates.
9501         * configure: Regenerate.
9502         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9503         big and little endian version for a given address size.
9504
9505 2010-02-03  Doug Kwan  <dougkwan@google.com>
9506
9507         * arm-reloc-property.cc
9508         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9509         definition.
9510         * arm-reloc-property.h
9511         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9512         New method definition.
9513         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9514         declaration.
9515         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9516         overflow to N.
9517         (GOT_PREL): Change implemented to Y.
9518         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9519         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9520         (Arm_relocate_functions::movw_abs_nc): Remove method.
9521         (Arm_relocate_functions::movt_abs): Ditto.
9522         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9523         (Arm_relocate_functions::thm_movt_abs): Ditto.
9524         (Arm_relocate_functions::movw_rel_nc): Ditto.
9525         (Arm_relocate_functions::movw_rel): Ditto.
9526         (Arm_relocate_functions::movt_rel): Ditto.
9527         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9528         (Arm_relocate_functions:thm_movw_rel): Ditto.
9529         (Arm_relocate_functions:thm_movt_rel): Ditto.
9530         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9531         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9532         New method definitions.
9533         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9534         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9535         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9536         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9537         (Target_arm::Relocate::relocate): Check for non-static or
9538         unimplemented relocation code and exit early.  Change calls to
9539         Target_arm::reloc_uses_thumb_bit and
9540         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9541         instead.  Refactor code to handle similar relocations to increase
9542         code sharing.  Remove check for unsupported relocation code in switch
9543         statement.
9544         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9545         relocation property table to find out size.  Change error message to
9546         print out the name of a relocation code instead of the numeric value.
9547         (Target_arm::scan_reloc_for_stub): Use relocation property table
9548         instead of calling Target_arm::reloc_uses_thumb_bit().
9549
9550 2010-02-02  Doug Kwan  <dougkwan@google.com>
9551
9552         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9553         types of relaxed input section.
9554
9555 2010-02-02  Doug Kwan  <dougkwan@google.com>
9556
9557         * Makefile.am (HFILES): Add arm-reloc-property.h.
9558         (DEFFILES): New.
9559         (TARGETSOURCES): Add arm-reloc-property.cc
9560         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9561         (libgold_a_SOURCES): $(DEFFILES)
9562         * Makefile.in: Regenerate.
9563         * arm-reloc-property.cc: New file.
9564         * arm-reloc-property.h: New file.
9565         * arm-reloc.def: New file.
9566         * arm.cc: Update comments.
9567         (arm-reloc-property.h): New included header.
9568         (arm_reloc_property_table): New global variable.
9569         (Target_arm::do_select_as_default_target): New method definition.
9570         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9571         arm-reloc-property to targ_extra_obj.
9572         * parameters.cc (set_parameters_target): Call
9573         Target::select_as_default_target().
9574         * target.h (Target::select_as_default_target): New method definition.
9575         (Target::do_select_as_default_target): Same.
9576
9577 2010-02-01  Doug Kwan  <dougkwan@google.com>
9578
9579         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9580         first_output_text_section_.
9581         (Arm_exidx_fixup::first_output_text_section): New method definition.
9582         (Arm_exidx_fixup::first_output_text_section_): New data member.
9583         (Arm_exidx_fixup::process_exidx_section): Record the first text
9584         output section seen.
9585         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9586         and entsize in output section header.
9587
9588 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9589
9590         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9591         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9592         (Arm_relocate_functions::thm_alu11): New Method.
9593         (Arm_relocate_functions::thm_pc8): New Method.
9594         (Arm_relocate_functions::thm_pc12): New Method.
9595         (Target_arm::Scan::local): Handle the relocations.
9596         (Target_arm::Scan::global): Likewise.
9597         (Target_arm::Relocate::relocate): Likewise.
9598         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9599
9600 2010-01-29  Doug Kwan  <dougkwan@google.com>
9601
9602         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9603         of relocation types as ld.
9604
9605 2010-01-29  Doug Kwan  <dougkwan@google.com>
9606
9607         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9608         to public.
9609         (Arm_relocate_functions::thumb_branch_common): Ditto.
9610         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9611         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9612         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9613         Arm_relocate_functions::jump24): Remove.
9614         (Target_arm::Relocate::relocate): Adjust code to call
9615         Arm_relocation_functions::arm_branch_common and
9616         Arm_relocation_functions::thumb_branch_common instead of their removed
9617         wrappers.  Merge switch-cases together to reduce source code size.
9618
9619 2010-01-29  Doug Kwan  <dougkwan@google.com>
9620
9621         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9622         output_local_symbol_count_needs_update_.
9623         (Arm_relobj::output_local_symbol_count_needs_update,
9624          Arm_relobj::set_output_local_symbol_count_needs_update,
9625          Arm_relobj::update_output_local_symbol_count): New methods.
9626         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9627         member.
9628         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9629         of pointed function as in a R_ARM_PREL31 relocation.
9630         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9631         for output local symbol count updating.
9632         (Target_arm::do_relax): Update output local symbol counts in objects
9633         if necessary.
9634         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9635
9636 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9637
9638         * arm.cc: Added support for the ARM relocations:
9639         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9640         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9641         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9642         movw_prel_nc).
9643         (Arm_relocate_functions::movw_rel): New method.
9644         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9645         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9646         thm_movw_prel_nc).
9647         (Arm_relocate_functions::thm_movw_rel): New method.
9648         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9649         thm_movt_prel).
9650         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9651         relocations.
9652         (Target_arm::Scan::global): Likewise.
9653         (Target_arm::Relocate::relocate): Likewise.
9654         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9655         Likewise.
9656
9657 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9658
9659         * arm.cc: Added support for ARM group relocations.
9660         (Target_arm::reloc_needs_sym_origin): New method.
9661         (Arm_relocate_functions::calc_grp_kn): New method.
9662         (Arm_relocate_functions::calc_grp_residual): New method.
9663         (Arm_relocate_functions::calc_grp_gn): New method.
9664         (Arm_relocate_functions::arm_grp_alu): New Method.
9665         (Arm_relocate_functions::arm_grp_ldr): New Method.
9666         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9667         (Arm_relocate_functions::arm_grp_ldc): New Method.
9668         (Target_arm::Scan::local): Handle the ARM group relocations.
9669         (Target_arm::Scan::global): Likewise.
9670         (Target_arm::Relocate::relocate): Likewise.
9671         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9672         Likewise.
9673
9674 2010-01-26  Doug Kwan  <dougkwan@google.com>
9675
9676         * arm.cc (set): Include.
9677         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9678         pointer type.
9679         (Arm_output_section::Text_section_list): New type.
9680         (Arm_output_section::append_text_sections_to_list): New method.
9681         (Arm_output_section::fix_exidx_coverage): Ditto.
9682         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9683         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9684         Relobj::set_section_offset() instead of
9685         Sized_relobj::invalidate_section_offset().
9686         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9687         parameter for section headers. Ignore relocation sections for
9688         unallocated sections and EXIDX sections.
9689         (Target_arm::fix_exidx_coverage): New method.
9690         (Target_arm::output_section_address_less_than): New type.
9691         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9692         linked text section instead of the EXIDX section.
9693         (Arm_output_section::create_stub_group): Add an assertion to check
9694         that this is not an EXIDX output section.
9695         (Arm_output_section::append_text_sections_to_list): New method.
9696         (Arm_output_section::fix_exidx_coverage): Ditto.
9697         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9698         Arm_relobj::section_needs_reloc_stub_scanning.
9699         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9700         first pass.
9701         (Target_arm::fix_exidx_coverage): New method.
9702         * object.h (Relobj::set_output_section): New method.
9703         (Sized_relobj::invalidate_section_offset): Remove method.
9704         (Sized_relobj::do_invalidate_section_offset): Remove method.
9705         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9706
9707 2010-01-25  Doug Kwan  <dougkwan@google.com>
9708
9709         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9710         Fix warning due to signed and unsigned comparison on a 32-bit host.
9711
9712 2010-01-22  Doug Kwan  <dougkwan@google.com>
9713
9714         * arm.cc (Target_arm::do_relax): Record an output section for section
9715         offset adjustment it contains any stub table that has changed.
9716         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9717         offsets in an output section if necessary.
9718         * output.cc (Output_section::Output_section): Initialize
9719         section_offsets_need_adjustments_.
9720         (Output_section::add_input_section_for_script): Renamed to
9721         Output_section::add_simple_input_section.
9722         (Output_section::save_states): Add a comment.
9723         (Output_section::discard_states): New method defintion.
9724         (Output_section::adjust_section_offsets): Same.
9725         * output.h (Output_section::add_input_section_for_script): Renamed to
9726         Output_section::add_simple_input_section.
9727         (Output_section::discard_states): New method declaration.
9728         (Output_section::adjust_section_offsets): Same.
9729         (Output_section::section_offsets_need_adjustment,
9730         Output_section::set_section_offsets_need_adjustment): New method
9731         definitions.
9732         (Output_section::section_offsets_need_adjustment_): New data member.
9733         * script-sections.cc
9734         (Output_section_element_input::set_section_address): Adjust code for
9735         renaming of Output_section::add_input_section_for_script.
9736         (Orphan_output_section::set_section_address): Same.
9737
9738 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9739
9740         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9741         Fix_v4bx enum values .
9742         * gold/options.h (General_options): New option definitions.
9743         (General_options::fix_v4bx): New method.
9744         (General_options::Fix_v4bx): New enum.
9745         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9746         (General_options::parse_fix_v4bx_interworking): New method.
9747
9748 2010-01-22  Doug Kwan  <dougkwan@google.com>
9749
9750         * arm.cc (Arm_exidx_fixup): New class.
9751
9752 2010-01-21  Doug Kwan  <dougkwan@google.com>
9753
9754         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9755         classes.
9756         (Arm_exidx_section_offset_map): New type.
9757
9758 2010-01-21  Doug Kwan  <dougkwan@google.com>
9759
9760         * arm.cc (Arm_exidx_input_section): New class.
9761         (Arm_relobj::exidx_input_section_by_link,
9762         Arm_relobj::exidx_input_section_by_shndx,
9763         Arm_relobj::make_exidx_input_section): New methods.
9764         (read_arm_attributes_section): Remove.
9765         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9766         information about them.
9767         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9768         to here.
9769
9770 2010-01-20  Doug Kwan  <dougkwan@google.com>
9771
9772         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9773         Input_section_specifier to Section_id.
9774         (Target_arm::new_arm_input_section: Adjust code for change of key
9775         type.
9776         (Target_arm::find_arm_input_section): Ditto.
9777         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9778         (Section_id): Remove.
9779         (Garbage_collection::Section_id_hash): Remove.
9780         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9781         (Section_id): Remove.
9782         (Icf::Section_id_hash): Remove.
9783         * object.h (Section_id, Const_section_id, Section_id_hash,
9784         Const_section_id_hash): New type definitions.
9785         * output.cc (Output_section::add_relaxed_input_section): Change to
9786         use Const_section_id instead of Input_section_specifier as key type.
9787         (Output_section::add_merge_input_section): Ditto.
9788         (Output_section::build_relaxation_map): Change to use Section_id
9789         instead of Input_section_specifier as key type.
9790         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9791         Ditto.
9792         (Output_section::convert_input_sections_to_relaxed_sections): Change
9793         to use Const_section_id instead of Input_section_specifier as key type.
9794         (Output_section::find_merge_section): Ditto.
9795         (Output_section::find_relaxed_input_section): Ditto.
9796         * output.h (Input_section_specifier): Remove class.
9797         (Output_section::Output_section_data_by_input_section_map): Change
9798         key type to Const_section_id.
9799         (Output_section::Output_relaxed_input_section_by_input_section_map):
9800         Ditto.
9801         (Output_section::Relaxation_map): Change key type to Section_id.
9802
9803 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9804
9805         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9806         (class Arm_v4bx_stub): New class.
9807         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9808         (Stub_factory::make_arm_v4bx_stub): New method.
9809         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9810         (Stub_table::empty): Handle v4bx stubs.
9811         (Stub_table::add_arm_v4bx_stub): New method.
9812         (Stub_table::find_arm_v4bx_stub): New method.
9813         (Arm_relocate_functions::v4bx): New method.
9814         (Target_arm::fix_v4bx): New method.
9815         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9816         (Stub_table::relocate_stubs): Likewise.
9817         (Stub_table::do_write): Likewise.
9818         (Stub_table::update_data_size_and_addralign): Likewise.
9819         (Stub_table::finalize_stubs):  Likewise.
9820         (Target_arm::Scan::local): Likewise.
9821         (Target_arm::Scan::global): Likewise.
9822         (Target_arm::do_finalize_sections): Likewise.
9823         (Target_arm::Relocate::relocate): Likewise.
9824         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9825         Likewise.
9826         (Target_arm::scan_reloc_for_stub): Likewise.
9827         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9828
9829 2010-01-19  Ian Lance Taylor  <iant@google.com>
9830
9831         * output.cc (Output_section_headers::do_sized_write): Write large
9832         segment count to sh_info field.
9833         (Output_file_header::do_sized_write): For large segment count,
9834         write PN_XNUM to e_phnum field.
9835
9836 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9837
9838         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9839         (Arm_relocate_functions::thm_jump8): New function.
9840         (Arm_relocate_functions::thm_jump11): New function.
9841         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9842         R_ARM_THM_JUMP11.
9843         (Target_arm::Scan::global): Likewise.
9844         (Target_arm::Relocate::relocate): Likewise.
9845         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9846         Likewise.
9847
9848 2010-01-14  Doug Kwan  <dougkwan@google.com>
9849
9850         * arm.cc (map, utility): Include headers.
9851         (Target_arm::apply_cortex_a8_workaround): New method.
9852         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9853         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9854         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9855         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9856         the --[no-]fix-cortex-a8 command line options.
9857         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9858         (Target_arm::relocate_stub): Use addend in instruction template.
9859         * options.h (DEFINE_bool): Set the user-set flag.
9860         (General_options): Add --[no-]-fix-cortex options.
9861         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9862         : Update fast look-up map after conversion.
9863
9864 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9865
9866         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9867         in the first pass of do_layout.
9868
9869 2010-01-13  Doug Kwan  <dougkwan@google.com>
9870
9871         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9872         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9873         apparent compiler problem of not folding static constant integral
9874         data members of elfcpp::Elf_sizes<32>.
9875
9876 2010-01-13  Doug Kwan  <dougkwan@google.com>
9877
9878         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9879         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9880         Arm_relobj::scan_section_for_cortex_a8_erratum,
9881         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9882         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9883         sections to scan for relocation stubs into a new method
9884         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9885         relocation and Cortex-A8 stub scanning.
9886         (Target_arm::do_relax): Force stubs to be after stubbed sections
9887         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9888         the beginning of a new relaxation pass.  Update a comment.
9889         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9890
9891 2010-01-12  Ian Lance Taylor  <iant@google.com>
9892
9893         * target-reloc.h (visibility_error): New inline function.
9894         (relocate_section): Call visibility_error.
9895         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9896         (MOSTLYCLEANFILES): Likewise.
9897         (protected_4_pic.o, protected_3.err): New targets.
9898         * testsuite/protected_4.cc: New file.
9899
9900 2010-01-12  Doug Kwan  <dougkwan@google.com>
9901
9902         * arm.cc (Cortex_a8_reloc): New class.
9903         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9904         and cortex_a8_relocs_info_.
9905         (Target_arm::fix_cortex_a8): New method definition.
9906         (Target_arm::Cortex_a8_relocs_info): New type.
9907         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9908         New data member declarations.
9909         (Target_arm::scan_reloc_for_stub): Record information about
9910         relocations for THUMB branches that might be exempted from the
9911         Cortex-A8 workaround.
9912         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9913         at the beginning of a relaxation pass.
9914
9915 2010-01-12  Doug Kwan  <dougkwan@google.com>
9916
9917         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9918         (Arm_relobj::Mapping_symbol_position,
9919          Arm_reloj::Mapping_symbol_position_less,
9920          Arm_relobj::Mapping_symbols_info): New types.
9921         (Target_arm::is_mapping_symbol_name): New method definition.
9922         (Arm_relobj::do_count_local_symbols): Save information about mapping
9923         symbols.
9924
9925 2010-01-11  Doug Kwan  <dougkwan@google.com>
9926
9927         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9928         Arm_relocate_functions::thumb32_branch_upper,
9929         Arm_relocate_functions::thumb32_branch_lower,
9930         Arm_relocate_functions::thumb32_cond_branch_offset,
9931         Arm_relocate_functions::thumb32_cond_branch_upper,
9932         Arm_relocate_functions::thumb32_cond_branch_lower,
9933         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9934         branch offset encoding.
9935         (Arm_relocate_functions::thumb_branch_common): Use new branch
9936         offset encoding methods to avoid code duplication.
9937         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9938         (Stub_addend_reader::operator()): Use new branch encoding method
9939         to avoid code duplication.
9940
9941 2010-01-11  Doug Kwan  <dougkwan@google.com>
9942
9943         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9944         (Target_arm::do_finalize_sections): Define special EXIDX section
9945         symbols only if referenced.
9946         * gc.h (Garbage_collection::add_reference): New method.
9947         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9948         code duplication.
9949
9950 2010-01-11  Ian Lance Taylor  <iant@google.com>
9951
9952         * script.cc (Version_script_info::build_expression_list_lookup):
9953         Change complaing about duplicate wildcard match from error to
9954         warning.
9955
9956         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9957         of 2009-12-30.
9958         (Version_script_info::Version_script_info): Initialize globs_,
9959         default_version_, default_is_global_, and exact_.  Don't
9960         initialize globals_ or locals_.
9961         (Version_script_info::build_lookup_tables): Build local symbols
9962         first.
9963         (Version_script_info::unquote): New function.
9964         (Version_script_info::add_exact_match): New function.
9965         (Version_script_info::build_expression_list_lookup): Remove lookup
9966         parameter.  Add is_global parameter.  Change all callers.  Handle
9967         wildcard pattern specially.  Unquote pattern.  Call
9968         add_exact_match.
9969         (Version_script_info::get_name_to_match): New function.
9970         (Version_script_info::get_symbol_version): New function.
9971         (Version_script_info::get_symbol_version_helper): Remove.
9972         (Version_script_info::check_unmatched_names): Call unquote.
9973         * script.h (class Version_script_info): Change get_symbol_version
9974         to be non-inline and add is_global parameter; change all callers.
9975         Rewrite symbol_is_local.  Update declarations.  Define struct
9976         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9977         Remove globals_ and locals_ members.  Add exact_, globs_,
9978         default_version_, is_global_.
9979         (Version_script_info::Glob): Remove pattern, add expression and
9980         is_global.  Update constructor.  Change all callers.
9981         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9982         default version.
9983         (Versions::symbol_section_contents): If a symbol is undefined, or
9984         defined in a dynamic object, set the version index to
9985         VER_NDX_LOCAL.
9986         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9987         symbol_is_local.
9988         (Symbol_table::add_from_pluginobj): Likewise.
9989         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9990
9991 2010-01-11  Doug Kwan  <dougkwan@google.com>
9992
9993         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9994         (incremental_dump_LDADD): Add linking option for libintl.
9995         * Makefile.in: Regenerate.
9996
9997 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9998
9999         PR gold/11144
10000         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
10001         instead of -Ds.
10002         * testsuite/Makefile.in: Regenerated.
10003
10004 2010-01-10  Doug Kwan  <dougkwan@google.com>
10005
10006         * options.h (DEFINE_var): Use parentheses around argument varname__
10007         in macro body to avoid any unintended subsequent substitutions.
10008
10009 2010-01-10  Ian Lance Taylor  <iant@google.com>
10010
10011         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10012         candidates before doing symbol resolution.
10013
10014         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10015         ODR candidates if only one is weak.
10016
10017 2010-01-08  Ian Lance Taylor  <iant@google.com>
10018
10019         * script.cc (Version_script_info::build_expression_list_lookup):
10020         Don't warn about ambiguous version, just record the ambiguity.
10021         (Version_script_info::get_symbol_version_helper): Give error if
10022         version is ambiguous.
10023
10024 2010-01-08  Doug Kwan  <dougkwan@google.com>
10025
10026         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10027         prev_data_size_ and prev_addralign_.  Remove initializer for
10028         deleted data member has_been_changed_.
10029         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10030         to determine if the table is empty.
10031         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10032         Remove.
10033         (Stub_table::add_reloc_stub): Define method in class definition
10034         instead of just declaring it there.
10035         (Stub_table::add_cortex_a8_stub): New method definition.
10036         (Stub_table::update_data_size_and_addralign): Ditto.
10037         (Stub_table::finalize_stubs): Ditto.
10038         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10039         (Stub_table::do_addralign_): Return address alignment in the
10040         (Stub_table::do_reset_address_and_file_offset): Define method in
10041         class definition instead of declaring it there.  Set current data
10042         size to be the data size of the previous pass.
10043         (Stub_table::set_final_data_size): Use current data size as the
10044         final data size.
10045         (Stub_table::relocate_stub): Change parameter type of stub from
10046         Reloc_stub pointer to Stub pointer.
10047         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10048         (Stub_table::Cortex_a8_stub_list): New typedef.
10049         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10050          Stub_table::prev_addralign_): New data member.
10051         (Arm_relobj::Arm_relobj): Initialize data member
10052         section_has_cortex_a8_workaround_.
10053         (Arm_relobj::section_has_cortex_a8_workaround,
10054          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10055          definitions.
10056         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10057         declarations.
10058         (Target_arm::relocate_stub): Change parameter type of stub from
10059         Reloc_stub pointer to Stub pointer.
10060         (Insn_template::size, Insn_template::alignment): Handle
10061         THUMB16_SPECIAL_TYPE.
10062         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10063          Stub_table::update_data_size_and_addralign,
10064          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10065         definitions.
10066         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10067         (Stub_table::do_write): Ditto.
10068         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10069
10070 2010-01-08  Ian Lance Taylor  <iant@google.com>
10071
10072         PR 11108
10073         * symtab.h (class Symbol): Remove fields is_target_special_ and
10074         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10075         (Symbol::is_defined_in_discarded_section): New function.
10076         (Symbol::set_is_defined_in_discarded_section): New function.
10077         (Symbol::has_plt_offset): Rewrite.
10078         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10079         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10080         Don't initialize is_target_special_ or has_plt_offset_.
10081         Initialize is_defined_in_discarded_section_.
10082         (Symbol_table::add_from_relobj): If appropriate, set
10083         is_defined_in_discarded_section.
10084         * resolve.cc (Symbol::override_base_with_special): Don't test
10085         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10086         * target-reloc.h (relocate_section): Do special handling for
10087         symbols defined in discarded sections for global symbols as well
10088         as local symbols.
10089
10090 2010-01-08  Ian Lance Taylor  <iant@google.com>
10091
10092         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10093         the SHT_SYMTAB case.
10094
10095 2010-01-08  Ian Lance Taylor  <iant@google.com>
10096
10097         * object.cc (Sized_relobj::do_layout): Don't get confused if
10098         layout_eh_frame returns NULL.
10099
10100 2010-01-08  Ian Lance Taylor  <iant@google.com>
10101
10102         PR 11084
10103         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10104         dynamic symbol table, use the normal symbol table.
10105         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10106         symbol table.
10107
10108 2010-01-08  Ian Lance Taylor  <iant@google.com>
10109
10110         PR 11072
10111         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10112         sections.
10113
10114 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10115
10116         * version.cc (print_version): Change to "Copyright 2010".
10117
10118 2010-01-08  Ian Lance Taylor  <iant@google.com>
10119
10120         PR 10287
10121         PR 11063
10122         * i386.cc (class Target_i386): Change return type of plt_section
10123         to be non-const.
10124         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10125         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10126         tls_desc_rel_ field.
10127         (Output_data_plt_i386::rel_tls_desc): New function.
10128         (Target_i386::rel_tls_desc_section): New function.
10129         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10130         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10131         R_386_TLS_DESC reloc in rel_tls_desc_section.
10132         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10133         Define struct Tlsdesc_info.
10134         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10135         (Target_x86_64::do_reloc_symbol_index): New function.
10136         (Target_x86_64::add_tlsdesc_info): New function.
10137         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10138         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10139         tlsdesc_rel_ field.
10140         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10141         all callers.
10142         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10143         (Target_x86_64::rela_tlsdesc_section): New function.
10144         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10145         handling.
10146         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10147         (Target_x86_64::do_reloc_addend): New function.
10148         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10149         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10150         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10151         (Output_reloc::type): New function.
10152         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10153         (Output_reloc::is_target_specific): New function.
10154         (Output_reloc::target_arg): New function.
10155         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10156         absolute relocs and target specific relocs.
10157         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10158         add_target_specific.
10159         (class Output_data_reloc) [SHT_RELA]: Likewise.
10160         * output.cc (Output_reloc::Output_reloc): Add four new versions
10161         for absolute relocs and target specific relocs.
10162         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10163         (Output_reloc::get_symbol_index): Likewise.
10164         (Output_reloc::local_section_offset): Check that local_sym_index_
10165         is not TARGET_CODE or 0.
10166         (Output_reloc::symbol_value): Likewise.
10167         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10168         reloc.
10169         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10170         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10171         functions.
10172         * layout.cc (add_target_dynamic_tags): Use output section for
10173         DT_PLTRELSZ and DT_JMPREL.
10174
10175 2010-01-07  Ian Lance Taylor  <iant@google.com>
10176
10177         PR 11061
10178         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10179         function.
10180         (class Output_data_reloc_generic): Define.
10181         (class Output_data_reloc_base): Change base class to
10182         Output_data_reloc_generic.  Change add() method to call
10183         bump_relative_reloc_count for a relative reloc.  Remove
10184         sort_relocs_ field.
10185         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10186         to sort_relocs().
10187         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10188         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10189         appropriate.
10190         * layout.h (class Layout): Update declaration.
10191
10192 2010-01-07  Ian Lance Taylor  <iant@google.com>
10193
10194         * output.h (class Output_data): Add const version of
10195         output_section and do_output_section.
10196         (class Output_section_data): Add const version of
10197         do_output_section.
10198         (class Output_section): Likewise.
10199         * layout.cc (Layout::add_target_dynamic_tags): New function.
10200         * layout.h (class Layout): Update declarations.
10201         * arm.cc (Target_arm::do_finalize_sections): Use
10202         add_target_dynamic_tags.
10203         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10204         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10205         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10206         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10207
10208 2010-01-07  Ian Lance Taylor  <iant@google.com>
10209
10210         PR 11042
10211         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10212         object as needed.
10213
10214 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10215             Ian Lance Taylor  <iant@google.com>
10216
10217         PR 11019
10218         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10219         Xindex::read_symtab_xindex.
10220
10221 2010-01-07  Doug Kwan  <dougkwan@google.com>
10222
10223         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10224         (Insn_template::thumb16_bcond_insn): New method declaration.
10225         (Insn_template): Fix spelling.
10226         (Stub::thumb16_special): New method declaration.
10227         (Stub::do_write): Define virtual method which was previously pure
10228         virtual.
10229         (Stub::do_thumb16_special): New method declaration.
10230         (Stub::do_fixed_endian_write): New template member.
10231         (Reloc_stub::do_write): Remove.
10232         (Reloc_stub::do_fixed_endian_write): Remove.
10233         (Cortex_a8_stub): New class definition.
10234         (Stub_factory::make_cortex_a8_stub): New method definition.
10235         (Stub_factory::Stub_factory): Add missing static storage class
10236         qualifier for elf32_arm_stub_a8_veneer_blx.
10237
10238 2010-01-07  Ian Lance Taylor  <iant@google.com>
10239
10240         PR 10980
10241         * options.h (class General_options): Add --warn-unresolved-symbols
10242         and --error-unresolved-symbols.
10243         * errors.cc (Errors::undefined_symbol): Implement
10244         --warn-unresolved-symbols.
10245
10246         * options.h (class General_options): Add -z text and -z textoff.
10247         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10248
10249 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10250
10251         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10252         (Garbage_collection::cident_sections): New function.
10253         (Garbage_collection::add_cident_section): New function.
10254         (Garbage_collection::cident_sections_): New member.
10255         (gc_process_relocs): Add references to sections whose names are C
10256         identifiers.
10257         * gold.h (cident_section_start_prefix): New constant.
10258         (cident_section_stop_prefix): New constant.
10259         (is_cident): New function.
10260         * layout.cc (Layout::define_section_symbols): Replace string constants
10261         with the newly defined constants.
10262         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10263         C identifiers.
10264         * testsuite/Makefile.am: Add gc_orphan_section_test.
10265         * testsuite/Makefile.in: Regenerate.
10266         * testsuite/gc_orphan_section_test.cc: New file.
10267         * testsuite/gc_orphan_section_test.sh: New file.
10268
10269 2010-01-06  Ian Lance Taylor  <iant@google.com>
10270
10271         PR 10980
10272         * options.h (class General_options): Add --warn-shared-textrel.
10273         * layout.cc (Layout::finish_dynamic_section): Implement
10274         --warn-shared-textrel.
10275
10276         PR 10980
10277         * options.h (class General_options): Add --warn-multiple-gp.
10278
10279 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10280
10281         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10282         $(THREADSLIB) and $(LIBDL).
10283         * Makefile.in: Rebuild.
10284
10285 2010-01-06  Ian Lance Taylor  <iant@google.com>
10286
10287         PR 10980
10288         * options.cc (General_options::parse_section_start): New function.
10289         (General_options::section_start): New function.
10290         (General_options::General_options): Initialize all members.
10291         * options.h: Include <map>
10292         (class General_options): Add --section-start.  Add section_starts_
10293         member.
10294         * layout.cc (Layout::attach_allocated_section_to_segment): If
10295         --section-start was used, set the address of the segment.  Remove
10296         local sort_sections.
10297         (Layout::relaxation_loop_body): If the address of the load segment
10298         has been set by --section-start, don't use it.
10299         * output.h (Output_segment::update_flags_for_output_section): New
10300         function.
10301         * output.cc (Output_segment::add_output_section): Call
10302         update_flags_for_output_section.
10303
10304 2010-01-05  Ian Lance Taylor  <iant@google.com>
10305
10306         PR 10980
10307         * options.h (class General_options): Add --undefined-version.
10308         * script.cc (struct Version_expression): Add was_matched_by_symbol
10309         field.
10310         (Version_script_info::matched_symbol): New function.
10311         (Version_script_info::get_symbol_version_helper): Call
10312         matched_symbol.
10313         (Version_script_info::check_unmatched_names): New function.
10314         * script.h (class Version_script_info): Update declarations.
10315         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10316
10317         * options.h (class General_options): Use DEFINE_bool_alias for
10318         allow_multiple_definition.
10319         * resolve.cc (Symbol_table::should_override): Don't test
10320         allow_multiple_definition.
10321
10322         PR 10980
10323         * options.h (class General_options): Add --cref.
10324         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10325         until after printing cref table.
10326         * cref.cc: Include "symtab.h".
10327         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10328         (Cref_table_compare::operator()): New function.
10329         (Cref_inputs::gather_cref): New function.
10330         (filecol): New static const.
10331         (Cref_inputs::print_cref): New function.
10332         (Cref::print_cref): New function.
10333         * cref.h: Include <cstdio>.
10334         (class Cref): Update declarations.
10335         * mapfile.h (Mapfile::file): New function.
10336         * object.h (class Object): Define Symbols.  Declare virtual
10337         do_get_global_symbols.
10338         (Object::get_global_symbols): New function.
10339         * object.cc (Input_objects::add_object): Pass object to cref_ if
10340         --cref.
10341         (Input_objects::archive_start): Likewise.
10342         (Input_objects::archive_stop): Likewise.
10343         (Input_objects::print_cref): New function.
10344         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10345         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10346         --cref.
10347         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10348         function.
10349         * plugin.h (class Sized_pluginobj): Update declarations.
10350
10351 2010-01-05  Ian Lance Taylor  <iant@google.com>
10352
10353         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10354         to is_default_version.  Rename insdef to insdefault.
10355         (Symbol_table::add_from_relobj): Rename def to is_default_version
10356         and local to is_forced_local.
10357         (Symbol_table::add_from_pluginobj): Likewise.
10358         (Symbol_table::add_from_dynobj): Likewise.
10359         (Symbol_table::define_special_symbol): Rename insdef to
10360         insdefault.
10361
10362 2010-01-04  Ian Lance Taylor  <iant@google.com>
10363
10364         PR 10980
10365         * options.h (class General_options): Add
10366         --allow-multiple-definition and -z muldefs.
10367         * resolve.cc (Symbol_table::should_override): Don't warn about a
10368         multiple symbol definition if --allow-multiple-definition or -z
10369         muldefs.
10370
10371         PR 10980
10372         * options.h (class General_options): Add --add-needed and
10373         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10374         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10375         error if --copy-dt-needed-entries aka --add-needed is used and
10376         would cause a change in behaviour.
10377
10378         PR 10980
10379         * options.h (class General_options): Add -G as a short version of
10380         --shared.  Add no-op options -assert, -g, and -i.
10381
10382 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10383
10384         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10385         check for .text or .gnu.linkonce.t sections.
10386         * icf.cc (Icf::find_identical_sections): Ditto.
10387         Change the detection for mangled function name within the section
10388         name.
10389         * icf.h (is_section_foldable_candidate): New function.
10390
10391 2009-12-30  Ian Lance Taylor  <iant@google.com>
10392
10393         PR 10980
10394         * options.h (class General_options): Permit two dashes with
10395         --retain-symbols-file.
10396
10397 2009-12-30  Ian Lance Taylor  <iant@google.com>
10398
10399         PR 10979
10400         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10401         don't put the file header and segment headers in the text
10402         segment.
10403
10404         PR 10979
10405         * common.cc (Sort_commons::operator()): Stabilize sort when both
10406         entries are NULL.
10407         (Symbol_table::do_allocate_commons_list): When allocating common
10408         symbols, skip a symbol which is no longer common.
10409         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10410         an object before checking its type.
10411         * testsuite/common_test_2.c: New file.
10412         * testsuite/common_test_3.c: New file.
10413         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10414         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10415         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10416         (common_test_2_pic.o, common_test_2.so): New targets.
10417         (common_test_3_pic.o, common_test_3.so): New targets.
10418         * testsuite/Makefile.in: Rebuild.
10419
10420         PR 10979
10421         * script.cc (read_input_script): If we see a new SECTIONS clause,
10422         and we have added an input section, give an error.
10423         * layout.h (class Layout): Add have_added_input_section function.
10424         Add have_added_input_section_ field.
10425         * layout.cc (Layout::Layout): Initialize
10426         have_added_input_section_.
10427         (Layout::layout): Set have_added_input_section_.
10428         (Layout::layout_eh_frame): Likewise.
10429
10430 2009-12-30  Ian Lance Taylor  <iant@google.com>
10431
10432         PR 10931
10433         * options.h (class General_options): Add --sort-common option.
10434         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10435         * common.cc (Sort_common): Add sort_order parameter to
10436         constructor.  Add sort_order_ field.
10437         (Sort_commons::operator): Check sort_order_.
10438         (Symbol_table::allocate_commons): Determine the sort order.
10439         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10440         Change all callers.
10441         (Symbol_table::do_allocate_commons_list): Likewise.
10442
10443 2009-12-30  Ian Lance Taylor  <iant@google.com>
10444
10445         PR 10916
10446         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10447         symbols from this object, don't change the visibility of an
10448         undefined symbol.
10449         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10450
10451 2009-12-30  Ian Lance Taylor  <iant@google.com>
10452
10453         PR 10861
10454         * script.h (class Version_script_info): Define Language enum.
10455         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10456         new fields globals_, locals_, and is_finalized_.
10457         * script.cc: Various formatting fixes.
10458         (class Parser_closure): Change language_stack_ from a vector of
10459         std::string to one of Version_script_info::Language.  Adjust all
10460         uses accordingly.
10461         (class Lazy_demangler): Remove.
10462         (struct Version_expression): Change language from std::string to
10463         Version_script_info::Language.
10464         (Version_script_info::Version_script_info): New function.
10465         (Version_script_info::~Version_script_info): Don't call clear.
10466         (Version_script_info::finalize): New function.
10467         (Version_script_info::build_lookup_tables): New function.
10468         (Version_script_info::build_expression_list_lookup): New
10469         function.
10470         (Version_script_info::get_symbol_version_helper): Rewrite to use
10471         lookup tables.
10472         (Version_script_info::print_expression_list): Adjust to use
10473         Version_script_info::Language.
10474         (script_push_lex_into_version_mode): Check that the version script
10475         has not been finalized.
10476         (version_script_push_lang): Change language string to
10477         Version_script_info::Language.
10478         * options.cc (Command_line::version_script): New function.
10479         * options.h (class General_options): Add finalize_dynamic_list
10480         function.  Change version_script from declaration to definition.
10481         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10482         * testsuite/version_script.map: Remove duplicate def of foo.
10483         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10484         version_script.map.
10485         * testsuite/Makefile.in: Rebuild.
10486
10487 2009-12-30  Ian Lance Taylor  <iant@google.com>
10488
10489         PR 10843
10490         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10491         if the input symbol index is 0, make the output symbol index 0.
10492
10493 2009-12-30  Ian Lance Taylor  <iant@google.com>
10494
10495         PR 10670
10496         * options.h (class General_options): Add -x/--discard-all.
10497         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10498         --discard-all.  If the local symbol needs a dynamic entry, check
10499         that before handling --discard-locals.
10500
10501 2009-12-30  Ian Lance Taylor  <iant@google.com>
10502
10503         PR 10450
10504         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10505         flags to PF_R.
10506         (Output_segment::add_output_section): Don't change the flags if
10507         the type is PT_TLS.
10508
10509         PR 10450
10510         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10511         GNU hash table if they need a dynamic value.  Otherwise, don't add
10512         them if they are defined in a dynamic object or are forced local.
10513
10514 2009-12-29  Ian Lance Taylor  <iant@google.com>
10515
10516         PR 10450
10517         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10518         .gnu.hash table for a 32-bit target.
10519
10520         PR 10450
10521         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10522         regular and a dynamic object only needs a dynamic symbol table
10523         entry if it is externally visible.
10524
10525         PR 10450
10526         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10527         constructor.  Add global_offset_table_ field.
10528         (Target_i386::got_section): Set global_offset_table_.
10529         (Target_i386::do_finalize_sections): Set global_offset_table_
10530         size.
10531         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10532         in constructor.  Add global_offset_table_ field.
10533         (Target_x86_64::got_section): Set global_offset_table_.
10534         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10535         size.
10536
10537         * layout.cc (Layout::Layout): Initialize increase_relro_.
10538         (Layout::get_output_section): Add is_relro, is_last_relro, and
10539         is_first_non_relro parameters.  Change all callers.
10540         (Layout::choose_output_section): Likewise.
10541         (Layout::add_output_section_data): Likewise.
10542         (Layout::make_output_section): Likewise.
10543         (Layout::set_segment_offsets): Clear increase_relro when using a
10544         linker script.
10545         * layout.h (class Layout): Add increase_relro method.  Add
10546         increase_relro_ field.  Update declarations.
10547         * output.cc (Output_section::Output_section): Initialize
10548         is_last_relro_ and is_first_non_relro_.
10549         (Output_segment::add_output_section): Group relro sections is
10550         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10551         (Output_segment::maximum_alignment): Remove relro handling.
10552         (Output_segment::set_section_addresses): Add increase_relro
10553         parameter.  Change all callers.  Add initial alignment to align
10554         relro sections on separate page.  Remove old relro handling.
10555         (Output_segment::set_section_list_addresses): Remove in_relro
10556         parameter.  Change all callers.
10557         (Output_segment::set_offset): Add increase parameter.  Change all
10558         callers.  Remove old relro handling.
10559         * output.h (class Output_section): Add new methods: is_last_relro,
10560         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10561         Add is_last_relro_ and is_first_non_relro_ fields.
10562         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10563         Create separate .got.plt section.  Call increase_relro.
10564         * x86_64.cc (Target_x86_64::got_section): Likewise.
10565         * testsuite/relro_script_test.t: Add .got.plt.
10566
10567         PR 10450
10568         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10569         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10570         (Layout::finalize): Call set_dynamic_symbol_size.
10571         (Layout::set_dynamic_symbol_size): New function.
10572         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10573         set_dynamic_symbol_size.
10574
10575         PR 10450
10576         * output.h (class Output_section): Add is_entsize_zero_ field.
10577         * output.cc (Output_section::Output_section): Initialize
10578         is_entsize_zero_.
10579         (Output_section::set_entsize): If two different entsizes are
10580         requested, force it to zero.
10581         (Output_section::add_input_section): Set flags for .debug_str
10582         before updating section flags.  Set entsize.
10583         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10584         and SHF_STRING if all input sections have those flags.
10585
10586 2009-12-29   Rafael Espindola  <espindola@google.com>
10587
10588         * main.cc (main): Fix the sys time reporting.
10589         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10590         reporting.
10591
10592 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10593
10594         * options.cc (General_options::parse_version): Allow -v to exit
10595         without an error if there is nothing to link.
10596
10597 2009-12-29  Ian Lance Taylor  <iant@google.com>
10598
10599         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10600         using a version of gcc before 4.1.
10601         * configure: Rebuild.
10602
10603 2009-12-28  Chris Demetriou  <cgd@google.com>
10604
10605         * attributes.cc (Output_attributes_section_data::do_write): Use
10606         std::vector::front rather than std::vector::data.
10607
10608 2009-12-28  Ian Lance Taylor  <iant@google.com>
10609
10610         * symtab.h (class Symbol_table): Add enum Defined.
10611         * resolve.cc (Symbol_table::should_override): Add defined
10612         parameter.  Change all callers.  Test whether object is NULL
10613         before calling a method on it.
10614         (Symbol_table::report_resolve_problem): Add defined parameter.
10615         Change all callers.
10616         (Symbol_table::should_override_with_special): Likewise.
10617         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10618         parameter.  Change all callers.
10619         (Symbol_table::do_define_in_output_data): Likewise.
10620         (Symbol_table::define_in_output_segment): Likewise.
10621         (Symbol_table::do_define_in_output_segment): Likewise.
10622         (Symbol_table::define_as_constant): Likewise.
10623         (Symbol_table::do_define_as_constant): Likewise.
10624         * script.h (class Symbol_assignment): Add is_defsym parameter to
10625         constructor; change all callers.
10626         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10627         parameter.  Change all callers.  Add is_defsym_ field.
10628         (class Parser_closure): Add parsing_defsym parameter to
10629         constructor; change all callers.  Add parsing_defsym accessor
10630         function.  Add parsing_defsym_ field.
10631
10632 2009-12-28  Ian Lance Taylor  <iant@google.com>
10633
10634         * gold.cc (queue_middle_tasks): Fix formatting.
10635         * object.cc (Relobj::is_section_name_included): Likewise.
10636
10637 2009-12-23  Ian Lance Taylor  <iant@google.com>
10638
10639         * i386.cc (Target_i386::do_calls_non_split): Recognize
10640         -fsplit-stack prologue for a function with a static chain.
10641         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10642         -fsplit-stack prologue when using %r11.
10643
10644 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10645
10646         * options.cc (General_options::parse_version): Make -v continue and do
10647         the link like GNU ld does.
10648
10649 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10650
10651         * Makefile.am (CCFILES): Add timer.cc.
10652         (HFILES): Add timer.h.
10653         * configure.ac: Check for sysconf and times.
10654         * main.cc: include timer.h.
10655         (main): Use Timer instead of get_run_time.
10656         * timer.cc: New.
10657         * timer.h: New.
10658         * workqueue.cc: include timer.h.
10659         (Workqueue::find_and_run_task):
10660         Report user, sys and wall time.
10661         * Makefile.in: Regenerate.
10662         * config.in: Regenerate.
10663         * configure: Regenerate.
10664
10665 2009-12-16  Doug Kwan  <dougkwan@google.com>
10666
10667         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10668         sections.
10669         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10670         relaxed input sections.
10671         * output.cc (Output_section::find_relaxed_input_section): Change
10672         return type to Output_relaxed_input_section pointer.  Adjust code
10673         for new type of relaxed_input_section_map_.
10674         * output.h (Output_section::find_relaxed_input_section): Change
10675         return type to Output_relaxed_input_section pointer.
10676         (Output_section::Output_relaxed_input_section_by_input_section_map):
10677         New type.
10678         (Output_section::relaxed_input_section_map_): Change type to
10679         Output_section::Output_relaxed_input_section_by_input_section_map.
10680         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10681         input section.
10682
10683 2009-12-15  Ian Lance Taylor  <iant@google.com>
10684
10685         * layout.cc (Layout::create_shstrtab): Only write out after input
10686         sections if we are compressing debug sections.
10687
10688 2009-12-15  Ian Lance Taylor  <iant@google.com>
10689
10690         * archive.cc (Archive::add_symbols): Only look up a symbol without
10691         a version if there is, in fact, a version.
10692
10693 2009-12-14  Ian Lance Taylor  <iant@google.com>
10694
10695         Revert -Wshadow changes, all changes from:
10696         2009-12-11  Doug Kwan  <dougkwan@google.com>
10697         2009-12-11  Nick Clifton  <nickc@redhat.com>
10698         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10699
10700 2009-12-11  Doug Kwan  <dougkwan@google.com>
10701
10702         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10703         due to -Wshadow.
10704         * attributes.cc (Object_attribute::size): Ditto.
10705         (Attributes_section_data::size): Ditto.
10706         (Attributes_section_data::Attributes_section_data): Ditto.
10707         (Output_attributes_section_data::do_write): Ditto.
10708         * attributes.h (Object_attribute::set_type): Ditto.
10709         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10710
10711 2009-12-11  Nick Clifton  <nickc@redhat.com>
10712
10713         * archive.cc: Fix shadowed variable warnings.
10714         * arm.cc: Likewise.
10715         * compressed_output.cc: Likewise.
10716         * compressed_output.h: Likewise.
10717         * configure: Likewise.
10718         * dwarf_reader.cc: Likewise.
10719         * dynobj.cc: Likewise.
10720         * dynobj.h: Likewise.
10721         * ehframe.cc: Likewise.
10722         * ehframe.h: Likewise.
10723         * errors.cc: Likewise.
10724         * expression.cc: Likewise.
10725         * fileread.cc: Likewise.
10726         * fileread.h: Likewise.
10727         * freebsd.h: Likewise.
10728         * i386.cc: Likewise.
10729         * icf.cc: Likewise.
10730         * incremental.h: Likewise.
10731         * layout.cc: Likewise.
10732         * layout.h: Likewise.
10733         * mapfile.cc: Likewise.
10734         * merge.cc: Likewise.
10735         * merge.h: Likewise.
10736         * object.cc: Likewise.
10737         * object.h: Likewise.
10738         * options.h: Likewise.
10739         * output.cc: Likewise.
10740         * output.h: Likewise.
10741         * parameters.cc: Likewise.
10742         * plugin.cc: Likewise.
10743         * powerpc.cc: Likewise.
10744         * reduced_debug_output.cc: Likewise.
10745         * reduced_debug_output.h: Likewise.
10746         * reloc.cc: Likewise.
10747         * reloc.h: Likewise.
10748         * resolve.cc: Likewise.
10749         * script-sections.cc: Likewise.
10750         * script.cc: Likewise.
10751         * script.h: Likewise.
10752         * sparc.cc: Likewise.
10753         * symtab.cc: Likewise.
10754         * symtab.h: Likewise.
10755         * target-select.cc: Likewise.
10756         * target-select.h: Likewise.
10757         * token.h: Likewise.
10758         * workqueue.cc: Likewise.
10759         * workqueue.h: Likewise.
10760         * x86_64.cc: Likewise.
10761
10762 2009-12-10  Doug Kwan  <dougkwan@google.com>
10763
10764         * arm.cc (attributes.h): New include.
10765         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10766         (Arm_relobj::~Arm_relobj): Delete object pointed by
10767         attributes_section_data_.
10768         (Arm_relobj::attributes_section_data): New method definition.
10769         (Arm_relobj::attributes_section_data_): New data member declaration.
10770         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10771         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10772         attributes_section_data_.
10773         (Arm_dynobj::attributes_section_data): New method definition.
10774         (Arm_dynobj::attributes_section_data_): New data member declaration.
10775         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10776         initialization value of may_use_blx_ to false.
10777         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10778         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10779         object attributes to compute results instead of hard-coding.
10780         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10781         Target_arm::get_secondary_compatible_arch,
10782         Target_arm::set_secondary_compatible_arch
10783         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10784         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10785         New method declarations.
10786         (Target_arm::get_aeabi_object_attribute): New method definition.
10787         (Target_arm::attributes_section_data_): New data member declaration.
10788         (read_arm_attributes_section): New template definition.
10789         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10790         (Arm_dynobj::do_read_symbols): Ditto.
10791         (Target_arm::do_finalize_sections): Merge attributes sections from
10792         input.  Check for BLX use after attributes section merging.
10793         Fix __exidx_start and __exidx_end visibility.  Create an
10794         .ARM.attributes section if necessary.
10795         (Target_arm::get_secondary_compatible_arch,
10796         Target_arm::set_secondary_compatible_arch,
10797         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10798         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10799         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10800         New method definitions.
10801
10802 2009-12-09  Ian Lance Taylor  <iant@google.com>
10803
10804         * plugin.cc (Plugin::load): Don't cast from void* to a function
10805         pointer.
10806
10807 2009-12-09  Ian Lance Taylor  <iant@google.com>
10808
10809         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10810         information fields.
10811
10812 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10813
10814         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10815         Replace two_file_shared_1.so with two_file_shared_2.so.
10816         * testsuite/Makefile.in: Regenerated.
10817
10818 2009-12-08  Doug Kwan  <dougkwan@google.com>
10819
10820         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10821         (HFILES): Add attributes.h and int_encoding.h.
10822         * Makefile.in: Regenerate.
10823         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10824         function definitions to int_encoding.cc
10825         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10826         prototypes to int_encoding.h
10827         * reduced_debug_output.cc (int_encoding.h): New include.
10828         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10829         function definitions to int_encoding.cc
10830         (insert_into_vector, read_from_pointer): Move template definitions to
10831         int_encoding.h
10832         * attributes.cc: New file.
10833         * attributes.h: New file.
10834         * int_encoding.cc: New file.
10835         * int_encoding.h: New file.
10836
10837 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10838
10839         PR gold/11055
10840         * incremental-dump.cc (dump_incremental_inputs): New.
10841         (main): Use dump_incremental_inputs.
10842
10843 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10844
10845         PR gold/10893
10846         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10847         checking elfcpp::STT_FUNC.
10848         (Target_i386::Relocate::relocate): Likewise.
10849         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10850
10851         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10852         symbols from shared libraries into normal FUNC symbols.
10853
10854         * symtab.h (Symbol): Add is_func and use it.
10855
10856 2009-12-05  Doug Kwan  <dougkwan@google.com>
10857
10858         * arm.cc (Target_arm::arm_info): Initialize new fields
10859         attributes_section and attributes_vendor.
10860         * i386.cc (Target_i386::i386_info): Same.
10861         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10862         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10863         fields attributes_section and attributes_vendor.
10864         * sparc.cc (Target_sparc::sparc_info): Same.
10865         * target.h (Target::attributes_section, Target::attributes_vendor,
10866         Target::is_attributes_section, Target::attribute_arg_type,
10867         Target::attributes_order): New method definitions.
10868         (Target::Target_info::attributes_section,
10869         Target::Target_info::attributes_vendor): New fields.
10870         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10871         virtual method definitions.
10872         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10873         attributes_section and attributes_vendor.
10874         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10875
10876 2009-12-05  Doug Kwan  <dougkwan@google.com>
10877
10878         * arm.cc: Update comments about interworking and stub generation.
10879         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10880         considered as non-PIC.
10881         (Arm_relocate_functions::base_abs): Fix formatting.
10882         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10883         of function to use GOT entry address instead of offset.
10884         (Target_arm::Scan::global): Issue an error if a symbol would need a
10885         PLT does not get one because it is untyped.  Remove code to create
10886         dynamic symbols for relative branches.
10887         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10888         takes unsigned integer instead of boolean.
10889
10890 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10891
10892         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10893         (two_file_test_LDADD): Likewise.
10894         (common_test_1_LDADD): Likewise.
10895         (exception_test_LDADD) Likewise.
10896         (weak_test_LDADD): Likewise.
10897         (many_sections_test_LDADD): Likewise.
10898         (initpri1_LDADD): Likewise.
10899         (script_test_1_LDADD): Likewise.
10900         (script_test_2_LDADD): Likewise.
10901         (justsyms_LDADD): Likewise.
10902         (binary_test_LDADD): Likewise.
10903         (large_LDADD): Likewise.
10904         * testsuite/Makefile.in: Regenerated.
10905
10906 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10907
10908         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10909         (Symbol_table::override_with_special): Likewise.
10910         (Symbol_table::add_from_object): Likewise.
10911
10912 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10913
10914         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10915         Don't set the data_offset twice.
10916
10917 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10918
10919         * testsuite/Makefile.in: Regenerate.
10920
10921 2009-12-03  Doug Kwan  <dougkwan@google.com>
10922
10923         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10924         (Target_arm::do_finalize_sections): Add parameter for symbol table
10925         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10926         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10927         parameter for symbol table pointer.
10928         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10929         an additional parameter for a pointer to symbol table.
10930         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10931         parameter for a symbol table pointer.
10932         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10933         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10934         Ditto.
10935         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10936         parameter for a symbol table pointer.
10937
10938 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10939
10940         * incremental.cc (Incremental_inputs_header)
10941         (Incremental_inputs_header_write, Incremental_inputs_entry)
10942         (Incremental_inputs_entry_write): Move ...
10943         * incremental.h (Incremental_inputs_header)
10944         (Incremental_inputs_header_write, Incremental_inputs_entry)
10945         (Incremental_inputs_entry_write): here.
10946
10947 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10948
10949         * incremental.cc (make_sized_incremental_binary): Set the target.
10950         Error if it is incompatible.
10951         * output.h (Output_file): Add filename method.
10952
10953 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10954
10955         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10956         from the get_* methods.
10957
10958 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10959
10960         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10961         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10962         Write 0 for the data_offset of scripts.
10963
10964 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10965
10966         * testsuite/Makefile.am: Add the incremental_test.sh test.
10967         * testsuite/incremental_test.sh: New.
10968         * testsuite/incremental_test_1.c: New.
10969         * testsuite/incremental_test_2.c: New.
10970
10971 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10972
10973         * incremental-dump.cc (main): Fix typos.
10974
10975 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10976
10977         PR gold/11025
10978         * incremental-dump.cc (main): Use llu to print 64 bit values.
10979
10980 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10981             H.J. Lu  <hongjiu.lu@intel.com>
10982
10983         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10984         $(LIBDL).
10985         (incremental_dump_LDADD): Likewise.
10986         * Makefile.in: Regenerated.
10987
10988 2009-11-25  Doug Kwan  <dougkwan@google.com>
10989
10990         Revert:
10991
10992         2009-11-25  Doug Kwan  <dougkwan@google.com>
10993
10994                 * arm.cc (Target_arm::Target_arm): Move method definition
10995                 outside of class definition.  Add code to handle
10996                 --target1-rel, --target1-abs and --target2= options.
10997                 (Target_arm::get_reloc_reloc_type): Change method to be
10998                 non-static and const.
10999                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
11000                 New data member declaration.
11001                 (Target_arm::Scan::local, Target_arm::Scan::global,
11002                 Target_arm::Relocate::relocate,
11003                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11004                 Adjust call to Target_arm::get_real_reloc_type.
11005                 (Target_arm::get_real_reloc_type): Use command line options
11006                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11007                 * options.h (--target1-rel, --target1-abs, --target2): New
11008                 ARM-only options.
11009
11010 2009-11-25  Doug Kwan  <dougkwan@google.com>
11011
11012         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11013         class definition.  Add code to handle --target1-rel, --target1-abs
11014         and --target2= options.
11015         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11016         and const.
11017         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11018         member declaration.
11019         (Target_arm::Scan::local, Target_arm::Scan::global,
11020         Target_arm::Relocate::relocate,
11021         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11022         call to Target_arm::get_real_reloc_type.
11023         (Target_arm::get_real_reloc_type): Use command line options to
11024         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11025         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11026         options.
11027
11028 2009-11-25  Doug Kwan  <dougkwan@google.com>
11029
11030         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11031         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11032         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11033         formatting.
11034         (Arm_relocate_functions::thm_call): Replace body with a call to
11035         Arm_relocate_functions::thumb_branch_common.
11036         (Arm_relocate_functions::thm_jump24,
11037         Arm_relocate_functions::thm_xpc22): New method definitions.
11038         (Arm_relocate_functions::thumb_branch_common): New method definition.
11039         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11040         operator.
11041         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11042         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11043
11044 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11045
11046         * Makefile.am: Build incremental-dump
11047         * Makefile.in: Regenerate.
11048         * incremental-dump.cc: New.
11049         * incremental.cc (Incremental_inputs_header_data,
11050         Incremental_inputs_entry_data): Move to incremental.h
11051         * incremental.h: (Incremental_inputs_header_data,
11052         Incremental_inputs_entry_data): Move from incremental.cc
11053
11054 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11055
11056         * incremental.cc (Incremental_inputs_header,
11057         Incremental_inputs_header_write, Incremental_inputs_entry,
11058         Incremental_inputs_entry_write): Add a typedef with the data type.
11059
11060 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11061
11062         * incremental.cc (Incremental_inputs_header,
11063         Incremental_inputs_header_write, Incremental_inputs_entry,
11064         Incremental_inputs_entry_write): Update comment about which
11065         type has the filed descriptions.
11066
11067 2009-11-15  Doug Kwan  <dougkwan@google.com>
11068
11069         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11070         (Arm_relocate_functions::arm_branch_common): Change method defintion
11071         in class definition to a method declaration and update list of formal
11072         parameters.
11073         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11074         Arm_relocation_functions::jump24): Adjust call to
11075         Arm_relocate_functions::arm_branch_common.  Update list of formal
11076         parameters.
11077         (Arm_relocate_functions::xpc25): New method definition.
11078         (Arm_relocate_functions::arm_branch_common): Move method defintion
11079         out from class definition.  Use stubs for mode-switching and extending
11080         branch ranges.
11081         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11082         specially.  Change code to enable use of stubs in ARM branches.
11083
11084 2009-11-10  Doug Kwan  <dougkwan@google.com>
11085
11086         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11087         in method declaration.
11088         (Target_arm::relocate_stub): New method declaration.
11089         (Target_arm::default_target): Change to return a pointer instead of
11090         a const reference.
11091         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11092         Target_arm::default_target.
11093         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11094         method definition.
11095         (Target_arm::relocate_section): Adjust view.
11096         (Target_arm::relocate_stub): New method definition.
11097
11098 2009-11-10  Doug Kwan  <dougkwan@google.com>
11099
11100         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11101         a format warning.
11102         * incremental.cc (open_incremental_binary): Initialized local
11103         variables to avoid warnings.
11104         * object.cc (make_elf_object): Ditto.
11105         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11106         a format warning.
11107
11108 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11109
11110         PR gold/10930
11111         * testsuite/plugin_test.c: Include "config.h".
11112
11113 2009-11-09  Doug Kwan  <dougkwan@google.com>
11114
11115         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11116         (arm_symbol_value): Remove.
11117         (Arm_relocate_functions::arm_branch_common,
11118         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11119         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11120         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11121         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11122         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11123         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11124         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11125         Arm_relocate_functions::thm_mobw_abs_nc,
11126         Arm_relocate_functions::thm_mov_abs,
11127         Arm_relocate_functions::movw_prel_nc,
11128         Arm_relocate_functions::thm_movt_abs,
11129         Arm_relocate_functions::movt_prel,
11130         Arm_relocate_functions::thm_movw_prel_nc,
11131         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11132         (Target_arm::Relocate::relocate): Only decompose address into two
11133         parts if relocation type uses the thumb-bit and pass the actual
11134         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11135         calls to methods in Arm_relocate_functions for this change.
11136
11137 2009-11-08  Ian Lance Taylor  <iant@google.com>
11138
11139         PR 10925
11140         * reloc.cc: Instantiate
11141         Sized_relobj::initialize_input_to_output_maps and
11142         Sized_relobj:free_input_to_output_maps.
11143
11144 2009-11-06  Ian Lance Taylor  <iant@google.com>
11145
11146         PR 10876
11147         * defstd.cc (in_segment): Set only_if_ref true for "end".
11148
11149 2009-11-06  Doug Kwan  <dougkwan@google.com>
11150
11151         * arm.cc (class Reloc_stub): Correct a comment.
11152         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11153         (Target_arm::scan_section_for_stubs): New method declaration.
11154         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11155         Change methods from private to protected.
11156         (Target_arm::do_may_relax): New method definition.
11157         (Target_arm::do_relax, Target_arm::group_sections,
11158         Target_arm::scan_reloc_for_stub,
11159         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11160         (Target_arm::arm_input_section_map_): New data member declaration.
11161         (Target_arm::scan_reloc_for_stub,
11162         Target_arm::scan_reloc_section_for_stubs,
11163         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11164         Target_arm::do_relax): New method definitions.
11165
11166 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11167
11168         * configure.ac: Check for (struct stat)::st_mtim
11169         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11170         * config.in: Regenerate.
11171         * configure: Regenerate.
11172
11173 2009-11-05  Ian Lance Taylor  <iant@google.com>
11174
11175         PR 10910
11176         * output.cc (Output_segment::add_output_section): Add missing
11177         return statement.
11178
11179 2009-11-04  Ian Lance Taylor  <iant@google.com>
11180
11181         PR 10880
11182         * object.h (class Object): Add is_needed and set_is_needed
11183         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11184         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11185         defined in a dynamic object and referenced by a regular object,
11186         set is_needed for the dynamic object.
11187         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11188         if the file is marked with as_needed and it is not needed.
11189
11190 2009-11-04  Ian Lance Taylor  <iant@google.com>
11191
11192         PR 10887
11193         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11194         tags if data is discarded by linker script.
11195         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11196         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11197         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11198         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11199
11200 2009-11-04  Ian Lance Taylor  <iant@google.com>
11201
11202         * layout.cc (Layout::get_output_section): Add is_interp and
11203         is_dynamic_linker_section parameters.  Change all callers.
11204         (Layout::choose_output_section): Likewise.
11205         (Layout::make_output_section): Likewise.
11206         (Layout::add_output_section_data): Add is_dynamic_linker_section
11207         parameter.  Change all callers.
11208         * layout.h (class Layout): Update declarations.
11209         * output.h (class Output_section): Add is_interp, set_is_interp,
11210         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11211         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11212         generate_code_fills_at_write_ to a bitfield.
11213         * output.cc (Output_section::Output_sections): Initialize new
11214         fields.
11215         (Output_segment::add_output_section): Add do_sort parameter.
11216         Change all callers.
11217
11218 2009-11-03  Ian Lance Taylor  <iant@google.com>
11219
11220         PR 10860
11221         * options.h (class General_options): Add --warn-common.
11222         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11223         merging two common symbols.
11224         (Symbol_table::should_override): Handle --warn-common when merging
11225         a common symbol with a defined symbol.  Use report_resolve_problem
11226         for multiple definitions.
11227         (Symbol_table::report_resolve_problem): New function.
11228         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11229
11230 2009-11-03  Doug Kwan  <dougkwan@google.com>
11231
11232         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11233         stub_factory_.
11234         (Target_arm::stub_factory): New method definition.
11235         (Target_arm::new_arm_input_section,
11236         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11237         Target_arm::reloc_uses_thumb_bit): New method declarations.
11238         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11239         New type definitions.
11240         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11241         member declarations.
11242         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11243         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11244         New method definitions.
11245
11246 2009-11-03  Ian Lance Taylor  <iant@google.com>
11247
11248         * options.h (class General_options): Add --warn_constructors.
11249
11250 2009-11-03  Ian Lance Taylor  <iant@google.com>
11251
11252         PR 10893
11253         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11254         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11255
11256 2009-11-03  Ian Lance Taylor  <iant@google.com>
11257
11258         PR 10895
11259         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11260         --msgid-bugs-address.
11261         (install-pdf): New target.
11262         (install-data_yes): Look up one directory to find mkinstalldirs.
11263
11264 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11265
11266         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11267         tree.
11268
11269 2009-10-30  Doug Kwan  <dougkwan@google.com>
11270
11271         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11272
11273 2009-10-30  Doug Kwan  <dougkwan@google.com>
11274
11275         * arm.cc (Stub_addend_reader): New struct template definition
11276         and partial specializations.
11277         (Stub_addend_reader::operator()): New method definition for a
11278         partially specialized template.
11279
11280 2009-10-30  Doug Kwan  <dougkwan@google.com>
11281
11282         * arm.cc (Arm_relobj::processor_specific_flags): New method
11283         definition.
11284         (Arm_relobj::do_read_symbols): New method declaration.
11285         (Arm_relobj::processor_specific_flags_): New data member declaration.
11286         (Arm_dynobj): New class definition.
11287         (Target_arm::do_finalize_sections): Add input_objects parameter.
11288         (Target_arm::do_adjust_elf_header): New method declaration.
11289         (Target_arm::are_eabi_versions_compatible,
11290         (Target_arm::merge_processor_specific_flags): New method declaration.
11291         (Target_arm::do_make_elf_object): New overloaded method definitions
11292         and declaration.
11293         (Arm_relobj::do_read_symbols): New method definition.
11294         (Arm_dynobj::do_read_symbols): Ditto.
11295         (Target_arm::do_finalize_sections): Add input_objects parameters.
11296         Merge processor-specific flags from all input objects.
11297         (Target_arm::are_eabi_versions_compatible,
11298         Target_arm::merge_processor_specific_flags,
11299         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11300         New method definitions.
11301         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11302         Input_objects pointer type parameter.
11303         * layout.cc (Layout::finalize): Pass input objects to target's.
11304         finalize_sections function.
11305         * output.cc (Output_file_header::do_sized_write): Set ELF file
11306         header's processor-specific flags.
11307         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11308         Input_objects pointer type parameter.
11309         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11310         * target.h (Input_objects): New forward class declaration.
11311         (Target::processor_specific_flags,
11312         Target::are_processor_specific_flags_sect): New method definitions.
11313         (Target::finalize_sections): Add input_objects parameter.
11314         (Target::Target): Initialize processor_specific_flags_ and
11315         are_processor_specific_flags_set_.
11316         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11317         parameter.
11318         (Target::set_processor_specific_flags): New method definition.
11319         (Target::processor_specific_flags_,
11320         Target::are_processor_specific_flags_set_): New data member
11321         declarations.
11322         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11323         Input_objects pointer type parameter.
11324
11325 2009-10-30  Doug Kwan  <dougkwan@google.com>
11326
11327         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11328
11329 2009-10-28  Ian Lance Taylor  <iant@google.com>
11330
11331         * object.h (class Relobj): Drop options parameter from
11332         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11333         do_scan_relocs, do_relocate.  Change all callers.
11334         (class Sized_relobj): Drop options parameters from
11335         do_gc_process_relocs, do_scan_relocs, do_relocate,
11336         do_relocate_sections, relocate_sections, emit_relocs_scan,
11337         emit_relocs_scan_reltype.  Change all callers.
11338         (struct Relocate_info): Remove options field and all references to
11339         it.
11340         * reloc.h (class Read_relocs): Remove options constructor
11341         parameter and options_ field.  Change all callers.
11342         (class Gc_process_relocs, class Scan_relocs): Likewise.
11343         (class Relocate_task): Likewise.
11344         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11345         all callers.
11346         (scan_relocatable_relocs): Likewise.
11347         * target.h (class Sized_target): Remove options parameter from
11348         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11349         all callers.
11350         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11351         callers.
11352         * arm.cc: Update functions to remove options parameters.
11353         * i386.cc: Likewise.
11354         * powerpc.cc: Likewise.
11355         * sparc.cc: Likewise.
11356         * x86_64.cc: Likewise.
11357         * testsuite/testfile.cc: Likewise.
11358
11359 2009-10-28  Doug Kwan  <dougkwan@google.com>
11360
11361         * arm.cc (Arm_relobj): New class definition.
11362         (Arm_relobj::scan_sections_for_stubs,
11363         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11364         New method definitions.
11365
11366 2009-10-28  Cary Coutant  <ccoutant@google.com>
11367
11368         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11369         (Plugin::cleanup_done_): New member.
11370         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11371         (Plugin_manager::cleanup_done_): Remove.
11372         (Plugin_manager::add_input_file): Edit error message.
11373         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11374         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11375
11376 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11377
11378         * fileread.cc: (File_read::View::~View): Use the new
11379         data_ownership_ filed.
11380         (File_read::~File_read): Dispose the new whole_file_view_.
11381         (File_read::open): Mmap the whole file if needed.
11382         (File_read::open): Use whole_file_view_ instead of contents_.
11383         (File_read::find_view): Use whole_file_view_ if applicable.
11384         (File_read::do_read): Use whole_file_view_ instead of contents_.
11385         (File_read::make_view): Use whole_file_view_ instead of contents_,
11386         update File_read::View::View call.
11387         (File_read::find_or_make_view): Update File_read::View::View
11388         call.
11389         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11390         remove contents_
11391         (File_read::View::Data_ownership): New enum.
11392         (File_read::View::View): Replace bool mapped_ with Data_ownership
11393         argument.
11394         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11395         (File_read::View::data_ownership_): New field.
11396         (File_read::contents_): Remove (replaced by whole_file_view_).
11397         (File_read::whole_file_view_): New field.
11398         * options.h (class General_options): Add --keep-files-mapped.
11399
11400 2009-10-27  Cary Coutant  <ccoutant@google.com>
11401
11402         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11403         * testsuite/Makefile.am (plugin_test_5): New test case.
11404         * testsuite/Makefile.in: Regenerate.
11405
11406 2009-10-25  Doug Kwan  <dougkwan@google.com>
11407
11408         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11409         from private to protected to allow access by child class.
11410         (Sized_relobj::do_relocate_sections): New method declaration.
11411         (Sized_relobj::relocate_sections): Virtualize.
11412         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11413         Sized_relobj::relocate_sections.  Instantiate template explicitly
11414         for different target sizes and endianity.
11415
11416 2009-10-24  Doug Kwan  <dougkwan@google.com>
11417
11418         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11419         (Arm_input_section::as_arm_input_section): New method.
11420         (Arm_output_section): New class definition.
11421         (Arm_output_section::create_stub_group,
11422         Arm_output_section::group_sections): New method definitions.
11423
11424 2009-10-22  Doug Kwan  <dougkwan@google.com>
11425
11426         * arm.cc (Arm_input_section): New class definition.
11427         (Arm_input_section::init, Arm_input_section:do_write,
11428         Arm_input_section::set_final_data_size,
11429         Arm_input_section::do_reset_address_and_file_offset): New method
11430         definitions.
11431
11432 2009-10-21  Doug Kwan  <dougkwan@google.com>
11433
11434         * arm.cc (Stub_table, Arm_input_section): New forward class
11435         declarations.
11436         (Stub_table): New class defintion.
11437         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11438         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11439         New method definition.
11440
11441 2009-10-21  Doug Kwan  <dougkwan@google.com>
11442
11443         * arm.cc: Update copyright comments.
11444         (Target_arm): New forward class template declaration.
11445         (Arm_address): New type.
11446         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11447         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11448         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11449         constants.
11450         (Insn_template): Same.
11451         (DEF_STUBS): New macro.
11452         (Stub_type): New enum type.
11453         (Stub_template): New class definition.
11454         (Stub): Same.
11455         (Reloc_stub): Same.
11456         (Stub_factory): Same.
11457         (Target_arm::Target_arm): Initialize may_use_blx_ and
11458         should_force_pic_veneer_.
11459         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11460         Target_arm::should_force_pic_veneer,
11461         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11462         Target_arm::using_thumb_only, Target_arm:;default_target): New
11463         method defintions.
11464         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11465         New data member declarations.
11466         (Insn_template::size, Insn_template::alignment): New method defintions.
11467         (Stub_template::Stub_template): New method definition.
11468         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11469         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11470         (Stub_factory::Stub_factory): New method definition.
11471         * gold.h (string_hash): New template.
11472         * output.h (Input_section_specifier::hash_value): Use
11473         gold::string_hash.
11474         (Input_section_specifier::string_hash): Remove.
11475         * stringpool.cc (Stringpool_template::string_hash): Use
11476         gold::string_hash.
11477
11478 2009-10-20  Doug Kwan  <dougkwan@google.com>
11479
11480         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11481         symbols of relaxed input sections.
11482         * output.h (Output_section::find_relaxed_input_section): Make
11483         method public.
11484
11485 2009-10-16  Doug Kwan  <dougkwan@google.com>
11486
11487         * dynobj.cc (Versions::Versions): Initialize version_script_.
11488         Only insert base version symbol definition for a shared object
11489         if version script defines any version versions.
11490         (Versions::define_base_version): New method definition.
11491         (Versions::add_def): Check that base version is not needed.
11492         (Versions::add_need): Define base version lazily.
11493         * dynobj.h (Versions::define_base_version): New method declaration.
11494         (Versions::needs_base_version_): New data member declaration.
11495         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11496         (check_DATA): Add no_version_test.stdout.
11497         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11498         New make rules.
11499         * testsuite/Makefile.in: Regenerate.
11500         * testsuite/no_version_test.c: New file.
11501         * testsuite/no_version_test.sh: Ditto.
11502
11503 2009-10-16  Doug Kwan  <dougkwan@google.com>
11504
11505         * expression.cc (class Segment_start_expression): New class definition.
11506         (Segment_start_expression::value): New method definition.
11507         (script_exp_function_segment_start): Return a new
11508         Segment_start_expression.
11509         * gold/script-c.h (script_saw_segment_start_expression): New function
11510         prototype.
11511         * script-sections.cc (Script_sections::Script_sections): Initialize
11512         SAW_SEGMENT_START_EXPRESSION_ to false.
11513         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11514         and -Tbbs options to specify section addresses if given in
11515         command line and no SEGMENT_START expression is seen in a script.
11516         * script-sections.h (Script_sections::saw_segment_start_expression,
11517         Script_sections::set_saw_segment_start_expression): New method
11518         definition.
11519         (Script_sections::saw_segment_start_expression_): New data member
11520         declaration.
11521         * script.cc (script_saw_segment_start_expression): New function.
11522         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11523         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11524         script_test_7.sh and script_test_8.sh.
11525         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11526         script_test_8.stdout.
11527         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11528         (script_test_6, script_test_6.stdout, script_test_7,
11529         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11530         * Makefile.in: Regenerate.
11531         * testsuite/script_test_6.sh: New file.
11532         * testsuite/script_test_6.t: Same.
11533         * testsuite/script_test_7.sh: Same.
11534         * testsuite/script_test_7.t: Same.
11535         * testsuite/script_test_8.sh: Same.
11536
11537 2009-10-16  Doug Kwan  <dougkwan@google.com>
11538
11539         * output.cc (Output_segment::set_section_list_address): Cast
11540         expressions to unsigned long long type to avoid format warnings.
11541
11542 2009-10-15  Ian Lance Taylor  <iant@google.com>
11543
11544         * script.cc (Script_options::add_symbol_assignment): Always add a
11545         dot assignment to script_sections_.
11546         * script-sections.cc (Script_sections::add_dot_assignment):
11547         Initialize if necessary.
11548
11549         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11550         program headers with no load segment if there is a linker script.
11551
11552         * layout.cc (Layout::set_segment_offsets): Align the file offset
11553         to the segment aligment for -N or -n with no load segment.
11554         * output.cc (Output_segment::add_output_section): Don't crash if
11555         the first section is a TLS section.
11556         (Output_segment::set_section_list_addresses): Print an error
11557         message if the address moves backward in a linker script.
11558         * script-sections.cc
11559         (Output_section_element_input::set_section_addresses): Don't
11560         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11561         (Orphan_output_section::set_section_addresses): Likewise.
11562
11563 2009-10-15  Doug Kwan  <dougkwan@google.com>
11564
11565         * layout.cc (Layout::finish_dynamic_section): Generate tags
11566         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11567         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11568         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11569
11570 2009-10-14  Ian Lance Taylor  <iant@google.com>
11571
11572         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11573         fields.
11574         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11575         data_shdr fields of relinfo.
11576         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11577         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11578         R_386_TLS_LDO_32, adjust based on section flags.
11579         (Target_i386::Relocate::fix_up_ldo): Remove.
11580
11581 2009-10-13  Ian Lance Taylor  <iant@google.com>
11582
11583         Add support for -pie.
11584         * options.h (class General_options): Add -pie and
11585         --pic-executable.
11586         (General_options::output_is_position_independent): Test -pie.
11587         (General_options::output_is_executable): Return true if not shared
11588         and not relocatable.
11589         (General_options::output_is_pie): Remove.
11590         * options.cc (General_options::finalize): Reject incompatible uses
11591         of -pie.
11592         * gold.cc (queue_middle_tasks): A -pie link is not static.
11593         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11594         * symtab.cc (Symbol::final_value_is_known): Return false if
11595         output_is_position_independent.
11596         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11597         output_is_position_independent.
11598         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11599         output_is_position_independent.
11600         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11601         output_is_position_independent.
11602         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11603         two_file_pie_test.
11604         (basic_pie_test.o, basic_pie_test): New targets.
11605         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11606         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11607         (two_file_pie_test): New target.
11608         * testsuite/Makefile.in: Rebuild.
11609         * README: Remove note saying that -pie is not supported.
11610
11611 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11612
11613         * options.h (class General_options): Add -init and -fini.
11614         * layout.cc (Layout::finish_dynamic_section): Emit
11615         given init and fini functions.
11616
11617 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11618
11619         * gc.h (gc_process_relocs): Check if icf is enabled using new
11620         function.
11621         * gold.cc (queue_initial_tasks): Likewise.
11622         (queue_middle_tasks): Likewise.
11623         * object.cc (do_layout): Likewise.
11624         * symtab.cc (is_section_folded): Likewise.
11625         * main.cc (main): Likewise.
11626         * reloc.cc (Read_relocs::run): Likewise.
11627         (Sized_relobj::do_scan_relocs): Likewise.
11628         * icf.cc (is_function_ctor_or_dtor): New function.
11629         (Icf::find_identical_sections): Check if function is ctor or dtor when
11630         safe icf is chosen.
11631         * options.h (General_options::icf): Change option to be an enum.
11632         (Icf_status): New enum.
11633         (icf_enabled): New method.
11634         (icf_safe_folding): New method.
11635         (set_icf_status): New method.
11636         (icf_status_): New variable.
11637         * (options.cc) (General_options::finalize): Set icf_status_.
11638         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11639         icf_test and icf_keep_unique_test to use the --icf enum flag.
11640         * testsuite/icf_safe_test.sh: New file.
11641         * testsuite/icf_safe_test.cc: New file.
11642
11643 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11644
11645         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11646         includes to gc.h and icf.h.
11647         * arm.cc: Include gc.h.
11648         * gold.cc: Likewise.
11649         * i386.cc: Likewise.
11650         * powerpc.cc: Likewise.
11651         * sparc.cc: Likewise.
11652         * x86_64.cc: Likewise.
11653         * gc.h: Include icf.h.
11654
11655 2009-10-11  Ian Lance Taylor  <iant@google.com>
11656
11657         * plugin.cc: Include "gold.h" before other header files.
11658
11659 2009-10-10  Chris Demetriou  <cgd@google.com>
11660
11661         * options.h (Input_file_argument::Input_file_type): New enum.
11662         (Input_file_argument::is_lib_): Replace with...
11663         (Input_file_argument::type_): New member.
11664         (Input_file_argument::Input_file_argument): Take Input_file_type
11665         'type' rather than boolean 'is_lib' as second argument.
11666         (Input_file_argument::is_lib): Use type_.
11667         (Input_file_argument::is_searched_file): New function.
11668         (Input_file_argument::may_need_search): Handle is_searched_file.
11669         * options.cc (General_options::parse_library): Support -l:filename.
11670         (General_options::parse_just_symbols): Update for Input_file_argument
11671         changes.
11672         (Command_line::process): Likewise.
11673         * archive.cc (Archive::get_file_and_offset): Likewise.
11674         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11675         * script.cc (read_script_file, script_add_file): Likewise.
11676         * fileread.cc (Input_file::Input_file): Likewise.
11677         (Input_file::will_search_for): Handle is_searched_file.
11678         (Input_file::open): Likewise.
11679         * readsyms.cc (Read_symbols::get_name): Likewise.
11680         * testsuite/Makefile.am (searched_file_test): New test.
11681         * testsuite/Makefile.in: Regenerate.
11682         * testsuite/searched_file_test.cc: New file.
11683         * testsuite/searched_file_test_lib.cc: New file.
11684
11685 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11686             Ian Lance Taylor  <iant@google.com>
11687
11688         * descriptor.cc: Include <cstdio> and "binary-io.h".
11689         (Descriptors::open): Open the files in binary mode always.
11690         * script.cc (Lex::get_token): Treat \r as whitespace.
11691
11692 2009-10-09  Ian Lance Taylor  <iant@google.com>
11693
11694         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11695
11696 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11697             Ian Lance Taylor  <iant@google.com>
11698
11699         * configure.ac: Check for readv function also.
11700         * fileread.cc (readv): Define if not HAVE_READV.
11701         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11702         does not exist.
11703         * config.in: Regenerate.
11704         * configure: Regenerate.
11705
11706 2009-10-09  Doug Kwan  <dougkwan@google.com>
11707
11708         * layout.cc (Layout::make_output_section): Call target hook to make
11709         ordinary output section.
11710         (Layout::finalize): Adjust parameter list of call the
11711         Target::may_relax().
11712         * layout.h (class Layout::section_list): New method.
11713         * merge.h (Output_merge_base::entsize): Change visibility to public.
11714         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11715         New methods.
11716         (Output_merge_string::do_is_string): New method.
11717         * object.cc (Sized_relobj::do_setup): renamed from
11718         Sized_relobj::set_up.
11719         * object.h (Sized_relobj::adjust_shndx,
11720         Sized_relobj::initializ_input_to_output_maps,
11721         Sized_relobj::free_input_to_output_maps): Change visibilities to
11722         protected.
11723         (Sized_relobj::setup): Virtualize.
11724         (Sized_relobj::do_setup): New method declaration.
11725         (Sized_relobj::invalidate_section_offset,
11726         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11727         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11728         * options.cc (parse_int): New function.
11729         * options.h (parse_int): New declaration.
11730         (DEFINE_int): New macro.
11731         (stub_group_size): New option.
11732         * output.cc (Output_section::Output_section): Initialize memebers
11733         merge_section_map_, merge_section_by_properties_map_,
11734         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11735         (Output_section::add_input_section): Handled deferred code-fill
11736         generation and remove an old comment.
11737         (Output_section::add_relaxed_input_section): New method definition.
11738         (Output_section::add_merge_input_section): Use merge section by
11739         properties map to speed to search.  Update merge section maps
11740         as appropriate.
11741         (Output_section::build_relaxation_map): New method definition.
11742         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11743         Same.
11744         (Output_section::relax_input_section): Renamed to
11745         Output_section::convert_input_sections_to_relaxed_sections and change
11746         interface to take a vector of pointers to relaxed sections.
11747         (Output_section::find_merge_section,
11748         Output_section::find_relaxed_input_section): New method definitions.
11749         (Output_section::is_input_address_mapped,
11750         Output_section::output_offset, Output_section::output_address):
11751         Use output section data maps to speed up searching.
11752         (Output_section::find_starting_output_address): Add comments.
11753         (Output_section::do_write,
11754         Output_section::write_to_postprocessing_buffer): Do code-fill
11755         generation as appropriate.
11756         (Output_section::get_input_sections): Invalidate relaxed input section
11757         map.
11758         (Output_section::restore_states): Adjust type of checkpoint .
11759         Invalidate relaxed input section map.
11760         * output.h (Output_merge_base): New class declaration.
11761         (Input_section_specifier): New class defintion.
11762         (class Output_relaxed_input_section) Change base class to
11763         Output_section_data_build.
11764         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11765         base class initializer.
11766         (Output_section::add_relaxed_input_section): New method declaration.
11767         (Output_section::Input_section): Change visibility to protected.
11768         (Output_section::Input_section::relobj,
11769         Output_section::Input_section::shndx): Handle relaxed input sections.
11770         Output_section::input_sections) Change visibility to protected.  Also
11771         define overload to return a non-const pointer.
11772         (Output_section::Merge_section_properties): New class defintion.
11773         (Output_section::Merge_section_by_properties_map,
11774         Output_section::Output_section_data_by_input_section_map,
11775         Output_section::Relaxation_map): New types.
11776         (Output_section::relax_input_section): Rename method to
11777         Output_section::convert_input_sections_to_relaxed_sections and change
11778         interface to take a vector of relaxed section pointers.
11779         (Output_section::find_merge_section,
11780         Output_section::find_relaxed_input_section,
11781         Output_section::build_relaxation_map,
11782         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11783         New method declarations.
11784         (Output_section::merge_section_map_
11785         Output_section::merge_section_by_properties_map_,
11786         Output_section::relaxed_input_section_map_,
11787         Output_section::is_relaxed_input_section_map_valid_,
11788         Output_section::generate_code_fills_at_write_): New data members.
11789         * script-sections.cc
11790         (Output_section_element_input::set_section_addresses): Call
11791         current_data_size and addralign methods of relaxed input sections.
11792         (Orphan_output_section::set_section_addresses): Call current_data_size
11793         and addralign methods of relaxed input sections.
11794         * symtab.cc (Symbol_table::compute_final_value): Extract template
11795         from the body of Symbol_table::sized_finalize_symbol.
11796         (Symbol_table::sized_finalized_symbol): Call
11797         Symbol_table::compute_final_value.
11798         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11799         (Symbol_table::compute_final_value): New templated method declaration.
11800         * target.cc (Target::do_make_output_section): New method defintion.
11801         * target.h (Target::make_output_section): New method declaration.
11802         (Target::relax): Add more parameters for input objects, symbol table
11803         and layout.  Adjust call to do_relax.
11804         (Target::do_make_output_section): New method declaration.
11805         (Target::do_relax): Add parameters for input objects, symbol table
11806         and layout.
11807
11808 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11809
11810         * pread.c: Include stdio.h.
11811
11812 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11813
11814         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11815         defined.
11816
11817 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11818
11819         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11820         Change read_shndx type to unsigned int.
11821         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11822         int.
11823         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11824         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11825         Change read_shndx type to unsigned int.
11826         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11827         int.
11828         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11829         * layout.cc (Layout::create_symtab_sections): Cast the result of
11830         local_symcount * symsize to off_t in the gold_assert.
11831
11832 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11833
11834         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11835         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11836         R_ARM_BASE_ABS.
11837         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11838         (Arm_relocate_functions::thm_abs5): New function.
11839         (Arm_relocate_functions::abs12): New function.
11840         (Arm_relocate_functions::abs16): New function.
11841         (Arm_relocate_functions::base_abs): New function.
11842         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11843         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11844         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11845         R_ARM_BASE_ABS.
11846         (Scan::global): Likewise.
11847         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11848         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11849         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11850         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11851         R_ARM_BASE_ABS.
11852
11853 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11854
11855         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11856         (Arm_relocate_functions::movt_prel): New function.
11857         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11858         (Arm_relocate_functions::thm_movt_prel): New function.
11859         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11860         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11861         (Scan::global, Relocate::relocate): Likewise.
11862         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11863
11864 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11865
11866         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11867         Incremental_checker.
11868         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11869         unsigned int.
11870         (class Incremental_inputs_header): New class.
11871         (Incremental_inputs_header_writer): Edit comment.
11872         (Incremental_inputs_entry): New class.
11873         (Incremental_inputs_entry_writer): Edit comment.
11874         (Sized_incremental_binary::do_find_incremental_inputs_section):
11875         Add *strtab_shndx parameter, fill it.
11876         (Sized_incremental_binary::do_check_inputs): New method.
11877         (Incremental_checker::can_incrementally_link_output_file): Use
11878         Sized_incremental_binary::check_inputs.
11879         (Incremental_inputs::report_command_line): Save command line in
11880         command_line_.
11881         * incremental.h:
11882         (Incremental_binary::find_incremental_inputs_section): New
11883         method.
11884         (Incremental_binary::do_find_incremental_inputs_section): Add
11885         strtab_shndx parameter.
11886         (Incremental_binary::do_check_inputs): New pure virtual method.
11887         (Sized_incremental_binary::do_check_inputs): Declare.
11888         (Incremental_checker::Incremental_checker): Add incremental_inputs
11889         parameter, use it to initialize incremental_inputs_.
11890         (Incremental_checker::incremental_inputs_): New field.
11891         (Incremental_checker::command_line): New method.
11892         (Incremental_checker::inputs): New method.
11893         (Incremental_checker::command_line_): New field.
11894
11895 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11896
11897         * incremental.cc: Include <cstdarg> and "target-select.h".
11898         (vexplain_no_incremental): New function.
11899         (explain_no_incremental): New function.
11900         (Incremental_binary::error): New method.
11901         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11902         method.
11903         (make_sized_incremental_binary): New function.
11904         (open_incremental_binary): New function.
11905         (can_incrementally_link_file): Add checks if output is ELF and has
11906         inputs section.
11907         * incremental.h: Include "elfcpp_file.h" and "output.h".
11908         (Incremental_binary): New class.
11909         (Sized_incremental_binary): New class.
11910         (open_incremental_binary): Declare.
11911         * object.cc (is_elf_object): Use
11912         elfcpp::Elf_recognizer::is_elf_file.
11913         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11914         * output.h (Output_file::filesize): New method.
11915
11916 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11917
11918         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11919         New function.
11920         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11921         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11922         function.
11923         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11924         function.
11925         (Arm_relocate_functions::movw_abs_nc): New function.
11926         (Arm_relocate_functions::movt_abs): New function.
11927         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11928         (Arm_relocate_functions::thm_movt_abs): New function.
11929         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11930         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11931         (Scan::global): Likewise.
11932         (Relocate::relocate): Likewise.
11933         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11934
11935 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11936
11937         * arm.cc (Arm_relocate_functions::got_prel) New function.
11938         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11939         (Relocate::relocate): Likewise.
11940         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11941
11942 2009-10-06  Ian Lance Taylor  <iant@google.com>
11943
11944         * options.h (class General_options): Define
11945         split_stack_adjust_size parameter.
11946         * object.h (class Object): Add uses_split_stack_ and
11947         has_no_split_stack_ fields.  Add uses_split_stack and
11948         has_no_split_stack accessor functions.  Declare
11949         handle_split_stack_section.
11950         (class Reloc_symbol_changes): Define.
11951         (class Sized_relobj): Define Function_offsets.  Declare
11952         split_stack_adjust, split_stack_adjust_reltype, and
11953         find_functions.
11954         * object.cc (Object::handle_split_stack_section): New function.
11955         (Sized_relobj::do_layout): Call handle_split_stack_section.
11956         * dynobj.cc (Sized_dynobj::do_layout): Call
11957         handle_split_stack_section.
11958         * reloc.cc (Sized_relobj::relocate_sections): Call
11959         split_stack_adjust for executable sections in split_stack
11960         objects.  Pass reloc_map to relocate_section.
11961         (Sized_relobj::split_stack_adjust): New function.
11962         (Sized_relobj::split_stack_adjust_reltype): New function.
11963         (Sized_relobj::find_functions): New function.
11964         * target-reloc.h: Include "object.h".
11965         (relocate_section): Add reloc_symbol_changes parameter.  Change
11966         all callers.
11967         * target.h (class Target): Add calls_non_split method.  Declare
11968         do_calls_non_split virtual method.  Declare match_view and
11969         set_view_to_nop.
11970         * target.cc: Include "elfcpp.h".
11971         (Target::do_calls_non_split): New function.
11972         (Target::match_view): New function.
11973         (Target::set_view_to_nop): New function.
11974         * gold.cc (queue_middle_tasks): Give an error if mixing
11975         split-stack and non-split-stack objects with -r.
11976         * i386.cc (Target_i386::relocate_section): Add
11977         reloc_symbol_changes parameter.
11978         (Target_i386::do_calls_non_split): New function.
11979         * x86_64.cc (Target_x86_64::relocate_section): Add
11980         reloc_symbol_changes parameter.
11981         (Target_x86_64::do_calls_non_split): New function.
11982         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11983         parameter.
11984         * powerpc.cc (Target_powerpc::relocate_section): Add
11985         reloc_symbol_changes parameter.
11986         * sparc.cc (Target_sparc::relocate_section): Add
11987         reloc_symbol_changes parameter.
11988         * configure.ac: Call AM_CONDITIONAL for the default target.
11989         * configure: Rebuild.
11990         * testsuite/Makefile.am (TEST_AS): New variable.
11991         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11992         (check_DATA): Add split_i386 and split_x86_64 files.
11993         (SPLIT_DEFSYMS): Define.
11994         (split_i386_[1234n].o): New targets.
11995         (split_i386_[124]): New targets.
11996         (split_i386_[1234r].stdout): New targets.
11997         (split_x86_64_[1234n].o): New targets.
11998         (split_x86_64_[124]): New targets.
11999         (split_x86_64_[1234r].stdout): New targets.
12000         (MOSTLYCLEANFILES): Add new executables.
12001         * testsuite/split_i386.sh: New file.
12002         * testsuite/split_x86_64.sh: New file.
12003         * testsuite/split_i386_1.s: New file.
12004         * testsuite/split_i386_2.s: New file.
12005         * testsuite/split_i386_3.s: New file.
12006         * testsuite/split_i386_4.s: New file.
12007         * testsuite/split_i386_n.s: New file.
12008         * testsuite/split_x86_64_1.s: New file.
12009         * testsuite/split_x86_64_2.s: New file.
12010         * testsuite/split_x86_64_3.s: New file.
12011         * testsuite/split_x86_64_4.s: New file.
12012         * testsuite/split_x86_64_n.s: New file.
12013         * testsuite/testfile.cc (Target_test): Update relocation_section
12014         function.
12015         * testsuite/Makefile.in: Rebuild.
12016
12017 2009-10-06  Ian Lance Taylor  <iant@google.com>
12018
12019         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12020         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12021         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12022         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12023         the address on ldo_addrs_.
12024         (Target_i386::Relocate::fix_up_ldo): New function.
12025
12026 2009-10-06   Rafael Espindola  <espindola@google.com>
12027
12028         * plugin.cc (add_input_library): New.
12029         (Plugin::load): Add add_input_library to tv.
12030         (Plugin_manager::add_input_file): Add the is_lib argument.
12031         (add_input_file): Update call to Plugin_manager::add_input_file.
12032         (add_input_library): New.
12033         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12034
12035 2009-09-30  Doug Kwan  <dougkwan@google.com>
12036
12037         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12038         symbol and call Symbol::may_need_copy_reloc to determine if
12039         a copy reloc is needed.
12040         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12041         nocopyreloc is given in command line.
12042         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12043         given in command line.
12044         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12045         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12046         of the removed Target_i386::may_need_copy_reloc.
12047         * options.h (copyreloc): New option with default value false.
12048         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12049         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12050         instead of the removed Target_powerpc::may_need_copy_reloc.
12051         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12052         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12053         instead of the removed Target_sparc::may_need_copy_reloc.
12054         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12055         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12056         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12057         instead of the removed Target_x86_64::may_need_copy_reloc.
12058
12059 2009-09-30  Ian Lance Taylor  <iant@google.com>
12060
12061         * object.h (class Object): Remove target_ field, and target,
12062         sized_target, and set_target methods.
12063         (Object::sized_target): Remove.
12064         (class Sized_relobj): Update declarations.  Remove sized_target.
12065         * object.cc (Sized_relobj::setup): Remove target parameter.
12066         Change all callers.
12067         (Input_objects::add_object): Don't do anything with the target.
12068         (make_elf_sized_object): Add punconfigured parameter.  Change all
12069         callers.  Set or test parameter target.
12070         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12071         Change all callers.
12072         * parameters.cc (Parameters::set_target): Change parameter type to
12073         be non-const.
12074         (Parameters::default_target): Remove.
12075         (set_parameters_target): Change parameter type to be non-const.
12076         (parameters_force_valid_target): New function.
12077         (parameters_clear_target): New function.
12078         * parameters.h (class Parameters): Update declarations.  Remove
12079         default_target method.  Add sized_target and clear_target
12080         methods.  Change target_ to be non-const.
12081         (set_parameters_target): Update declaration.
12082         (parameters_force_valid_target): Declare.
12083         (parameters_clear_target): Declare.
12084         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12085         as NULL if we aren't searching.
12086         (Add_symbols::run): Don't check for compatible target.
12087         * fileread.cc (Input_file::open_binary): Call
12088         parameters_force_valid_target.
12089         * gold.cc (queue_middle_tasks): Likewise.
12090         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12091         set_target on object.
12092         * dynobj.h (class Sized_dynobj): Update declarations.
12093         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12094         make_elf_object returns NULL.
12095         (Archive::include_member): Don't check whether object target is
12096         compatible.
12097         * output.cc (Output_section::add_input_section): Get target from
12098         parameters.
12099         (Output_section::relax_input_section): Likewise.
12100         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12101         parameters.
12102         (Sized_relobj::do_scan_relocs): Likewise.
12103         (Sized_relobj::relocate_sections): Likewise.
12104         * resolve.cc (Symbol_table::resolve): Likewise.
12105         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12106         parameter.  Change all callers.
12107         (Symbol_table::add_from_object): Get target from parameters.
12108         (Symbol_table::add_from_relobj): Don't check object target.
12109         (Symbol_table::add_from_dynobj): Likewise.
12110         (Symbol_table::define_special_symbol): Get target from
12111         parameters.
12112         * symtab.h (class Symbol_table): Update declaration.
12113         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12114         parameter.  Change all callers.  Clear parameter target.
12115         (Binary_test): Test target here.
12116         * testsuite/object_unittest.cc (gold_testsuite): Remove
12117         target_test_pointer parameter.  Change all callers.
12118         (Object_test): Test target here.
12119
12120 2009-09-26  Ian Lance Taylor  <iant@google.com>
12121
12122         * testsuite/initpri1.c: Don't try to use constructor priorities if
12123         compiling with gcc before 4.3.
12124
12125 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12126
12127         * testsuite/retain_symbols_file_test.sh (check_present): Change
12128         output file name to retain_symbols_file_test.stdout.
12129         (check_absent): Likewise.
12130
12131 2009-09-18  Craig Silverstein  <csilvers@google.com>
12132
12133         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12134         * options.cc: Include <cerrno> and <fstream>.
12135         (General_options::finalize): Parse -retain-symbols-file tag.
12136         * options.h: New flag.
12137         (General_options): New method should_retain_symbol, new
12138         variable symbols_to_retain.
12139         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12140         should_retain_symbol map.
12141         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12142         * testsuite/Makefile.in: Regenerate.
12143         * testsuite/retain_symbols_file_test.sh: New file.
12144
12145 2009-09-18  Nick Clifton  <nickc@redhat.com>
12146
12147         * po/es.po: Updated Spanish translation.
12148
12149 2009-09-17  Doug Kwan  <dougkwan@google.com>
12150
12151         * debug.h (DEBUG_RELAXATION): New constant.
12152         (DEBUG_ALL): Add DEBUG_RELAXATION.
12153         (debug_string_to_enum): Add relaxation debug option.
12154         * layout.cc
12155         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12156         Layout::Relaxation_debug_check::read_sections,
12157         Layout::Relaxation_debug_check::read_sections): New method definitions.
12158         (Layout::Layout): Initialize data members
12159         record_output_section_data_from_scrips_,
12160         script_output_section_data_list_ and relaxation_debug_check_.
12161         (Layout::save_segments, Layout::restore_segments,
12162         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12163         Layout::relaxation_loop_body): New method definitions.
12164         (Layout::finalize): Support relaxation.  Move section layout code to
12165         Layout::relaxation_loop_body.
12166         (Layout::set_asection_address_from_script): Move code for orphan
12167         section placement out.
12168         (Layout::place_orphan_sections_in_script): New method definition.
12169         * layout.h (Output_segment_headers, Output_file_header):
12170         New forward class declarations.
12171         (Layout::~Layout): Define.
12172         (Layout::new_output_section_data_from_script): New method definition.
12173         (Layout::place_orphan_sections_in_script): New method declaration.
12174         (Layout::Segment_states): New type declaration.
12175         (Layout::save_segments, Layout::restore_segments,
12176         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12177         Layout::relaxation_loop_body): New method declarations.
12178         (Layout::Output_section_data_list): New type declaration.
12179         (Layout::Relaxation_debug_check): New class definition.
12180         (Layout::record_output_section_data_from_script_,
12181         Layout::script_output_section_data_list_, Layout::segment_states_,
12182         Layout::relaxation_debug_check_): New data members.
12183         * output.cc: (Output_section_headers::do_size): New method definition.
12184         (Output_section_headers::Output_section_headers): Move size
12185         computation to Output_section_headers::do_size.
12186         (Output_segment_headers::do_size): New method definition.
12187         (Output_file_header::Output_file_header): Move size computation to
12188         Output_file_header::do_size and call it.
12189         (Output_file_header::do_size): New method definition.
12190         (Output_data_group::Output_data_group): Adjust call to
12191         Output_section_data.
12192         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12193         (Output_symtab_xindex::do_write): Add array bound check.
12194         (Output_section::Input_section::print_to_mapfile): Handle
12195         RELAXED_INPUT_SECTION_CODE.
12196         (Output_section::Output_section): Initialize data member checkpoint_.
12197         (Output_section::~Output_section): Delete checkpoint object pointed
12198         by checkpoint_.
12199         (Output_section::add_input_section): Always add an Input_section if
12200         relaxing.
12201         (Output_section::add_merge_input_section): Add assert.
12202         (Output_section::relax_input_section): New method definition.
12203         (Output_section::set_final_data_size): Set load address to zero for
12204         an unallocated section.
12205         (Output_section::do_address_and_file_offset_have_reset_values):
12206         New method definition.
12207         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12208         Handle relaxed input section.
12209         (Output_section::sort_attached_input_sections): Checkpoint input
12210         section list lazily.
12211         (Output_section::get_input_sections): Change type of input_sections to
12212         list of Simple_input_section pointers.  Checkpoint input section list
12213         lazily.  Also handle relaxed input sections.
12214         (Output_section::add_input_section_for_script): Take a reference to
12215         a Simple_input_section object instead of Relobj pointer and section
12216         index as parameter.  Handle relaxed input sections.
12217         (Output_section::save_states, Output_section::restore_states): New
12218         method definitions.
12219         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12220         (Output_data::is_data_size_fixed): New method definition.
12221         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12222         if it is fixed.
12223         (Output_data::address_and_file_offset_have_reset_values): New method
12224         definition.
12225         (Output_data::do_address_and_file_offset_have_reset_values): New method
12226         definition.
12227         (Output_data::set_data_size): Check that data size is not fixed.
12228         (Output_data::fix_data_size): New method definition.
12229         (Output_data::is_data_size_fixed_): New data member.
12230         (Output_section_headers::set_final_data_size): New method definition.
12231         (Output_section_headers::do_size): New method declaration.
12232         (Output_segment_headers::set_final_data_size): New method definition.
12233         (Output_segment_headers::do_size): New method declaration.
12234         (Output_file_header::set_final_data_size)::New method definition.
12235         (Output_file_header::do_size)::New method declaration.
12236         (Output_section_data::Output_section_data): Add new parameter
12237         is_data_size_fixed and use it to fix data size.
12238         (Output_data_const::Output_data_const): Adjust call to base class
12239         constructor and fix data size.
12240         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12241         base class constructor and fix data size.
12242         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12243         base class constructor and fix data size.
12244         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12245         class constructor and fix data size.
12246         (Output_data_group::set_final_data_size): New method definition.
12247         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12248         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12249         class constructor and fix data size.
12250         (Output_relaxed_input_section): New class definition.
12251         (Output_section::Simple_input_section): New class definition.
12252         (Output_section::get_input_sections): Adjust parameter list.
12253         (Output_section::add_input_section_for_script): Same.
12254         (Output_section::save_states, Output_section::restore_states,
12255         Output_section::do_address_and_file_offset_have_reset_values,
12256         (Output_section::Input_section::Input_section): Handle
12257         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12258         Output_relaxed_input_section.
12259         (Output_section::Input_section::is_input_section,
12260         Output_section::Input_section::set_output_section): Handle relaxed
12261         input section.
12262         (Output_section::Input_section::is_relaxed_input_section,
12263         Output_section::Input_section::output_section_data,
12264         Output_section::Input_section::relaxed_input_section): New method
12265         definitions.
12266         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12267         value.
12268         (Output_section::Input_section::u1_): Update comments.
12269         (Output_section::Input_section::u2_): Add new union member poris.
12270         (Output_section::Checkpoint_output_section): New classs definition.
12271         (Output_section::relax_input_section): New method declaration.
12272         (Output_section::checkpoint_): New data member.
12273         (Output_segment): Update comments.
12274         (Output_segment::Output_segment): Un-privatize copy constructor.
12275         (Output_segment::operator=): Un-privatize.
12276         * script-sections.cc (Output_section_element::Input_section_list):
12277         Change element type to Output_section::Simple_input_section.
12278         (Output_section_element_dot_assignment::set_section_addresses):
12279         Register output section data for relaxation clean up.
12280         (Output_data_exression::Output_data_expression): Adjust call to base
12281         constructor to fix data size.
12282         (Output_section_element_data::set_section_addresses): Register
12283         Output_data_expression object for relaxation clean up.
12284         (struct Input_section_info): Replace Relobj pointer and section index
12285         pair with Output_section::Simple_input_section and Convert struct to a
12286         class.
12287         (Input_section_sorter::operator()): Adjust access to
12288         Input_section_info data member to use accessors.
12289         (Output_section_element_input::set_section_addresses): Use layout
12290         parameter.  Adjust code to use Output_section::Simple_input_section
12291         and Input_secction_info classes.  Register filler for relaxation
12292         clean up.
12293         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12294         and section index pair with Output_section::Simple_input_section
12295         class.  Adjust code accordingly.
12296         (Phdrs_element::release_segment): New method definition.
12297         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12298         segment list.
12299         (Script_sections::release_segments): New method definition.
12300         * gold/script-sections.h (Script_sections::release_segments): New
12301         method declaration.
12302         * gold/target.h (Target::may_relax, Target::relax,
12303         Target::do_may_relax, Target::do_relax): New method definitions.
12304
12305 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12306
12307         * arm.cc (has_signed_unsigned_overflow): New function.
12308         (Arm_relocate_functions::abs8): New function.
12309         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12310         (Target_arm::Scan::global): Likewise.
12311         (Target_arm::relocate::relocate): Likewise.
12312         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12313         Likewise.
12314
12315 2009-09-16  Cary Coutant  <ccoutant@google.com>
12316
12317         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12318         * testsuite/Makefile.in: Regenerate.
12319
12320 2009-09-11  Nick Clifton  <nickc@redhat.com>
12321
12322         * po/gold.pot: Updated by the Translation project.
12323
12324 2009-09-08  Cary Coutant  <ccoutant@google.com>
12325
12326         * output.cc (Output_file::open): Add execute permission to empty file.
12327         * testsuite/Makefile.am (permission_test): New test.
12328         * testsuite/Makefile.in: Regenerate.
12329
12330 2009-09-02  Ian Lance Taylor  <iant@google.com>
12331
12332         * output.cc (Output_file::resize): Call map_no_anonymous rather
12333         than map.
12334
12335 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12336
12337         * gold.cc: Include "incremental.h".
12338         (queue_initial_tasks): Call Incremental_checker methods.
12339         * incremental.cc: Include "output.h".
12340         (Incremental_checker::can_incrementally_link_output_file): New
12341         method.
12342         * incremental.h (Incremental_checker): New class.
12343
12344         * output.cc (Output_file::open_for_modification): New method.
12345         (Output_file::map_anonymous): Changed return type to bool.  Record
12346         map in base_ field.
12347         (Output_file::map_no_anonymous): New method, broken out of map.
12348         (Output_file::map): Use map_no_anonymous and map_anonymous.
12349         * output.h (class Output_file): Update declarations.
12350
12351 2009-08-24  Cary Coutant  <ccoutant@google.com>
12352
12353         * options.h (Command_line::Pre_options): New class.
12354         (Command_line::pre_options): New member.
12355         * options.cc (gold::options::ready_to_register): New variable.
12356         (One_option::register_option): Do nothing if not registering options.
12357         Assert if same short option registered twice.
12358         (General_options::General_options): Turn off option registration when
12359         done constructing.
12360         (Command_line::Pre_options::Pre_options): New constructor.
12361
12362 2009-08-24  Cary Coutant  <ccoutant@google.com>
12363
12364         * options.h (General_options::no_keep_memory): Remove incorrect
12365         short option.
12366
12367 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12368
12369         * Makefile.am (am__skiplex, am__skipyacc): New.
12370         * Makefile.in: Regenerate.
12371
12372 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12373
12374         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12375         (INCLUDES): ... this.
12376         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12377         (AM_CPPFLAGS): Renamed from ...
12378         (INCLUDE): ... this.
12379         * Makefile.in, testsuite/Makefile.in: Regenerate.
12380
12381         * Makefile.in: Regenerate.
12382         * aclocal.m4: Likewise.
12383         * config.in: Likewise.
12384         * configure: Likewise.
12385         * testsuite/Makefile.in: Likewise.
12386
12387         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12388         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12389         * Makefile.in: Regenerate.
12390         * testsuite/Makefile.in: Regenerate.
12391
12392 2009-08-19  Cary Coutant  <ccoutant@google.com>
12393
12394         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12395         symbols in shared libraries overridden by hidden or internal symbols
12396         in the main program.
12397
12398 2009-08-19  Chris Demetriou  <cgd@google.com>
12399
12400         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12401         checking source file names in error messages.
12402
12403 2009-08-18  Doug Kwan  <dougkwan@google.com>
12404
12405         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12406         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12407         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12408         an elfcpp::Ehdr as parameter.
12409         * object.cc (Object::set_target): Remove the version that looks up
12410         a target and sets it.
12411         (Sized_relobj::setup): Take a Target object instead of
12412         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12413         (make_elf_sized_object): Find target and ask target to
12414         make an ELF object.
12415         * object.h: (Object::set_target): Remove the version that looks up
12416         a target and sets it.
12417         (Sized_relobj::setup): Take a Target object instead of
12418         an elfcpp:Ehdr as parameter.
12419         * target.cc: Include dynobj.h.
12420         (Target::do_make_elf_object_implementation): New.
12421         (Target::do_make_elf_object): New.
12422         * target.h (Target::make_elf_object): New template declaration.
12423         (Target::do_make_elf_object): New method declarations.
12424         (Target::do_make_elf_object_implementation): New template declaration.
12425
12426 2009-08-14  Ian Lance Taylor  <iant@google.com>
12427
12428         * gold.h (FUNCTION_NAME): Define.
12429         (gold_unreachable): Use FUNCTION_NAME.
12430
12431 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12432
12433         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12434         symbol in the --keep-unique list is not found.
12435
12436 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12437
12438         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12439         been maked as --keep-unique.
12440         (Icf::unfold_section): New function.
12441         * icf.h (Icf::unfold_section): New function.
12442         * options.h (General_options::keep_unique): New option.
12443         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12444         * testsuite/Makefile.in: Regenerate.
12445         * testsuite/icf_keep_unique_test.sh: New file.
12446         * testsuite/icf_keep_unique_test.cc: New file.
12447
12448 2009-08-12  Cary Coutant  <ccoutant@google.com>
12449
12450         PR 10471
12451         * resolve.cc (Symbol_table::resolve): Check for references from
12452         dynamic objects to hidden and internal symbols.
12453         * testsuite/Makefile.am (hidden_test.sh): New test.
12454         * testsuite/Makefile.in: Regenerate.
12455         * testsuite/hidden_test.sh: New script.
12456         * testsuite/hidden_test_1.c: New test source.
12457         * testsuite/hidden_test_main.c: New test source.
12458
12459 2009-08-11  Doug Kwan  <dougkwan@google.com>
12460
12461         * arm.cc: Update comments.
12462         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12463         segment to locate the .ARM.exidx section if present.
12464
12465 2009-08-09  Doug Kwan  <dougkwan@google.com>
12466
12467         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12468         patch.
12469
12470 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12471         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12472         compiler warnings.
12473
12474 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12475
12476         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12477         valid tls_segment only for non-debug-section relocations.
12478         * testsuite/Makefile.am: Add gc_tls_test.
12479         * testsuite/Makefile.in: Regenerate.
12480         * testsuite/gc_tls_test.cc: New file.
12481         * testsuite/gc_tls_test.sh: New file.
12482
12483 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12484
12485         * icf.cc: New file.
12486         * icf.h: New file.
12487         * Makefile.am (CCFILES): Add icf.cc.
12488         (HFILES): Add icf.h
12489         * Makefile.in: Regenerate.
12490         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12491         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12492         section, symbol and addend information for the relocs.
12493         * gold.cc (queue_middle_tasks): Call identical code folding.
12494         * gold.h: Add defines for multimap.
12495         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12496         to the call of finalize_local_symbols.
12497         * main.cc (main): Create object of class Icf.
12498         * object.cc (Sized_relobj::do_layout): Allow this function to be
12499         called twice during icf.
12500         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12501         to sections marked as identical by icf.
12502         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12503         when available.
12504         (Sized_relobj::do_section_entsize): New function.
12505         * object.h (Object::section_entsize): New function.
12506         (Object::do_section_entsize): New pure virtual function.
12507         (Relobj::finalize_local_symbols): Add new parameter.
12508         (Relobj::do_section_entsize): New function.
12509         * options.h (General_options::icf): New option.
12510         (General_options::icf_iterations): New option.
12511         (General_options::print_icf_sections): New option.
12512         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12513         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12514         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12515         icf.
12516         * symtab.cc (Symbol_table::is_section_folded): New function.
12517         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12518         to sections marked as identical by icf.
12519         * symtab.h (Symbol_table::set_icf): New function.
12520         (Symbol_table::icf): New function.
12521         (Symbol_table::is_section_folded): New function.
12522         (Symbol_table::icf_): New data member.
12523         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12524         * testsuite/Makefile.am: Add commands to build icf_test.
12525         * testsuite/Makefile.in: Regenerate.
12526         * testsuite/icf_test.sh: New file.
12527         * testsuite/icf_test.cc: New file.
12528
12529 2009-07-24  Chris Demetriou  <cgd@google.com>
12530
12531         * layout.cc (is_compressible_debug_section): Fix incorrect
12532         comment about compressed section names.
12533
12534 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12535
12536         PR 10419
12537         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12538
12539 2009-07-16  Ian Lance Taylor  <iant@google.com>
12540
12541         PR 10400
12542         * layout.h: #include <map>.
12543         (class Kept_section): Change from struct to class.  Add accessors
12544         and setters.  Add section size to Comdat_group mapping.  Change
12545         Comdat_group to std::map.  Add is_comdat_ field.  Add
12546         linkonce_size field in union.
12547         (class Layout): Update declaration of find_or_add_kept_section.
12548         Don't declare find_kept_object.
12549         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12550         parameter.  Add object, shndx, is_comdat, and is_group_name
12551         parameters.  Change all callers.  Adjust for new Kept_section.
12552         (Layout::find_kept_object): Remove.
12553         * object.cc (Sized_relobj::include_section_group): Update use of
12554         Kept_section.  Rename secnum to shndx.  Only record
12555         Kept_comdat_section if sections are the same size.
12556         (Sized_relobj::include_linkonce_section): Update use of
12557         Kept_section.  Only record Kept_comdat_section if sections are the
12558         same size.  Set size of linkonce section.
12559         (Sized_relobj::map_to_kept_section): Update call to
12560         get_kept_comdat_section.
12561         * object.h (class Sized_relobj): Rename fields in
12562         Kept_comdat_section to drop trailing underscores; change object
12563         field to Relobj*.  Change Kept_comdat_section_table to store
12564         struct rather than pointer.
12565         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12566         Add kept_object and kept_shndx parameters.  Change all callers.
12567         (Sized_relobj::get_kept_comdat_section): Change return type to
12568         bool.  Add kept_object and kept_shndx parameters.  Change all
12569         callers.
12570         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12571         Layout::find_or_add_kept_section.
12572
12573 2009-07-09  Ian Lance Taylor  <iant@google.com>
12574
12575         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12576         Reserve space in the hash table.
12577
12578 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12579
12580         * fileread.cc (File_read::get_mtime): New method.
12581         * fileread.h (Timespec): New structure.
12582         (File_read::get_mtime): New method.
12583         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12584         Renamed from timestamp_nsec.
12585         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12586         Elf_Xword.
12587         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12588         timestamp_nsec.
12589         (Incremental_inputs::report_archive): Save mtime; style fix.
12590         (Incremental_inputs::report_obejct): Save mtime; style fix.
12591         (Incremental_inputs::report_script): Save mtime; style fix.
12592         (Incremental_inputs::finalize_inputs): Style fix.
12593         (Incremental_inputs::finalize): Style fix.
12594         (Incremental_inputs::create_input_section_data): Store inputs
12595         mtime.
12596         * incremental.h (Incremental_inputs::report_script): Add mtime
12597         argument.
12598         (Incremental_inputs::Input_info::Input_info): Intialize only one
12599         union member.
12600         (Incremental_inputs::Input_info::archive): Move to nameless
12601         union.
12602         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12603         (Incremental_inputs::Input_info::script): Move to nameless union.
12604         (Incremental_inputs::mtime): New field.
12605         * script.cc (read_input_script): Pass file mtime to
12606         Incremental_input.
12607         * script.h (Script_info::inputs): Style fix.
12608
12609 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12610
12611         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12612         instead of 32.
12613
12614 2009-06-24  Ian Lance Taylor  <iant@google.com>
12615
12616         PR 10156
12617         * layout.cc (Layout::choose_output_section): If we find an
12618         existing section, update the flags.
12619         (Layout::create_notes): New function, broken out of
12620         Layout::finalize.
12621         (Layout::finalize): Don't create note sections.
12622         (Layout::create_note): Don't crash if linker script discards
12623         section.
12624         (Layout::create_gold_note): Likewise.
12625         (Layout::create_build_id): Likewise.  Don't set
12626         after_input_sections on the section.
12627         (Layout::create_executable_stack_info): Remove target parameter.
12628         Change caller.
12629         * layout.h (class Layout): Declare create_notes.  Update
12630         declaration of create_executable_stack_info.
12631         * gold.cc (queue_middle_tasks): Call create_notes.
12632         * output.cc (Output_section::update_flags_for_input_section): Move
12633         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12634         invalid.
12635         * output.h (Output_data::mark_address_invalid): New function.
12636         (class Output_section): Only declare, not define,
12637         update_flags_for_input_section.  Remove set_flags.
12638
12639 2009-06-24  Ian Lance Taylor  <iant@google.com>
12640
12641         * script-sections.cc (Output_section_definition::
12642         set_section_addresses): Rename shadowing local load_address to
12643         laddr.
12644
12645 2009-06-24  Ian Lance Taylor  <iant@google.com>
12646
12647         PR 10244
12648         * reloc.cc (relocate_sections): Skip empty relocation sections.
12649
12650 2009-06-23  Ian Lance Taylor  <iant@google.com>
12651
12652         PR 10156
12653         * layout.cc (Layout::create_note): Use choose_output_section
12654         rather than make_output_section.
12655
12656 2009-06-23  Ian Lance Taylor  <iant@google.com>
12657
12658         PR 10237
12659         * options.cc (General_options::parse_V): Set printed_version_.
12660         (General_options::General_options): Initialize printed_version_.
12661         * options.h (class General_options): Add printed_version_ field.
12662         * gold.cc (queue_initial_tasks): If there are no input files,
12663         don't give a fatal error if we printed the version information.
12664         (queue_middle_tasks): If using -r with a shared object, give a
12665         fatal error rather than an ordinary error.
12666
12667 2009-06-23  Ian Lance Taylor  <iant@google.com>
12668
12669         PR 10219
12670         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12671         (Layout::make_output_section): Set have_stabstr_section_ if we see
12672         a .stab*str section.
12673         (Layout::finalize): Call link_stabs_sections.
12674         (Layout::link_stabs_sections): New file.
12675         * layout.h (class Layout): Add have_stabstr_section_ field.
12676         Declare link_stabs_sections.
12677
12678 2009-06-23  Doug Kwan  <dougkwan@google.com>
12679
12680         * Makefile.am (libgold_a_LIBADD): New.
12681         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12682         * Makefile.in: Regenerate.
12683         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12684         * configure: Regenerate.
12685         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12686         * fileread.cc: Include sys/state.h
12687         * gold.h: Declare memmem and strndup if found missing.
12688         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12689
12690 2009-06-23  Ian Lance Taylor  <iant@google.com>
12691
12692         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12693         * configure: Rebuild.
12694
12695 2009-06-23  Ian Lance Taylor  <iant@google.com>
12696
12697         PR 10147
12698         * object.cc (Object::section_contents): Don't try to get a view if
12699         the section has length zero.
12700         (Object::handle_gnu_warning_section): If the section is empty, use
12701         the name of the section as the warning.
12702
12703 2009-06-23  Ian Lance Taylor  <iant@google.com>
12704
12705         PR 10133
12706         * stringpool.h (class Stringpool_template): Add optimize_ field.
12707         (Stringpool_template::set_optimize): New function.
12708         * stringpool.cc (Stringpool_template::Stringpool_template):
12709         Initialize optimize_ field.
12710         (Stringpool_template::set_string_offsets): Test local optimize
12711         fild rather than parameter.
12712         * layout.cc (Layout::Layout): Call set_optimize on the section
12713         name stringpool.
12714
12715 2009-06-22  Ian Lance Taylor  <iant@google.com>
12716
12717         PR 10030
12718         * yyscript.y: Parse TARGET.
12719         * script.cc (script_set_target): New function.
12720         * script-c.h (script_set_target): Declare.
12721         * options.cc (General_options::string_to_object_format): Rename
12722         from string_to_object_format in anonymous namespace.  Change
12723         callers.
12724         * options.h (class General_options): Declare
12725         string_to_object_format.
12726
12727 2009-06-22  Ian Lance Taylor  <iant@google.com>
12728
12729         * script-sections.cc (Script_sections::create_segments): Don't put
12730         program headers in a PT_LOAD segment if -n or -N.
12731
12732 2009-06-22  Ian Lance Taylor  <iant@google.com>
12733
12734         PR 10141
12735         * options.h (class General_options): Add -z lazy and -z now.  Sort
12736         -z options into alphabetical order.
12737         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12738
12739 2009-06-21  Ian Lance Taylor  <iant@google.com>
12740
12741         * layout.cc (Layout::make_output_section): Call
12742         Target::new_output_section.
12743         (Layout::attach_allocated_section_to_segment): Put large section
12744         sections in a separate load segment with the large segment flag
12745         set.
12746         (Layout::segment_precedes): Sort large data segments after other
12747         load segments.
12748         (align_file_offset): New static function.
12749         (Layout::set_segment_offsets): Use align_file_offset.
12750         * output.h (class Output_section): Add is_small_section_ and
12751         is_large_section_ fields.
12752         (Output_section::is_small_section): New function.
12753         (Output_section::set_is_small_section):  New function.
12754         (Output_section::is_large_section): New function.
12755         (Output_section::set_is_large_section): New function.
12756         (Output_section::is_large_data_section): New function.
12757         (class Output_segment): Add is_large_data_segment_ field.
12758         (Output_segment::is_large_data_segment): New function.
12759         (Output_segment::set_is_large_data_segment): New function.
12760         * output.cc (Output_section::Output_section): Initialize new
12761         fields.
12762         (Output_segment::Output_segment): Likewise.
12763         (Output_segment::add_output_section): Add assertion that large
12764         data sections always go in large data segments.  Force small data
12765         sections to the end of the list of data sections.  Force small BSS
12766         sections to the start of the list of BSS sections.  For large BSS
12767         sections to the end of the list of BSS sections.
12768         * symtab.h (class Symbol): Declare is_common_shndx.
12769         (Symbol::is_defined): Check Symbol::is_common_shndx.
12770         (Symbol::is_common): Likewise.
12771         (class Symbol_table): Define enum Commons_section_type.  Update
12772         declarations.  Add small_commons_ and large_commons_ fields.
12773         * symtab.cc (Symbol::is_common_shndx): New function.
12774         (Symbol_table::Symbol_table): Initialize new fields.
12775         (Symbol_table::add_from_object): Put small and large common
12776         symbols in the right list.
12777         (Symbol_table::sized_finalized_symbol): Check
12778         Symbol::is_common_shndx.
12779         (Symbol_table::sized_write_globals): Likewise.
12780         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12781         common symbol lists.  Don't call do_allocate_commons_list if the
12782         list is empty.
12783         (Symbol_table::do_allocate_commons_list): Remove is_tls
12784         parameter.  Add comons_section_type parameter.  Change all
12785         callers.  Handle small and large common symbols.
12786         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12787         Symbol::is_common_shndx.
12788         * resolve.cc (symbol_to_bits): Likewise.
12789         * target.h (Target::small_common_shndx): New function.
12790         (Target::small_common_section_flags): New function.
12791         (Target::large_common_shndx): New function.
12792         (Target::large_common_section_flags): New function.
12793         (Target::new_output_section): New function.
12794         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12795         small_common_section_flags, and large_common_section_flags
12796         fields.
12797         (Target::do_new_output_section): New virtual function.
12798         * arm.cc (Target_arm::arm_info): Initialize new fields.
12799         * i386.cc (Target_i386::i386_info): Likewise.
12800         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12801         Likewise.
12802         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12803         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12804         (Target_x86_64::do_new_output_section): New function.
12805         * configure.ac: Define conditional MCMODEL_MEDIUM.
12806         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12807         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12808         (large_LDFLAGS): Define.
12809         * testsuite/large.c: New file.
12810         * testsuite/testfile.cc (Target_test::test_target_info):
12811         Initialize new fields.
12812         * configure, testsuite/Makefile.in: Rebuild.
12813
12814 2009-06-05  Doug Kwan  <dougkwan@google.com>
12815
12816         * Makefile.am (CCFILES): Add target.cc.
12817         * Makefile.in: Regenerate.
12818         * i386.cc (class Target_i386): Define new virtual method to
12819         override do_is_local_label_name in parent.
12820         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12821         local symbols if --discard-locals or -X is given.
12822         * options.h (class General_options): Declare new options
12823         '--discard-locals' and '-X' for discarding locals.
12824         * target.h (class Target): Define new methods is_local_label_name.
12825         Declare new virtual method do_is_local_label_name.
12826         * target.cc: New file.
12827         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12828         (check_SCRIPTS): Add discard_locals_test.sh.
12829         (check_DATA): Add discard_local_tests.syms.
12830         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12831         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12832         * testsuite/Makefile.in: Regenerate.
12833         * testsuite/discard_locals_test.c: New file.
12834         * testsuite/discard_locals_test.sh: Same.
12835
12836 2009-06-05  Doug Kwan  <dougkwan@google.com>
12837
12838         * object.cc (Sized_relobj::Sized_relobj): Initialize
12839         discarded_eh_frame_shndx_ to -1U.
12840         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12841         section.
12842         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12843         a discarded .eh_frame section.
12844         (Sized_relobj::do_finalize_local_symbols): Ditto.
12845         * object.h (class Sized_relobj): Declare new member
12846         discarded_eh_frame_shndx_.
12847         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12848         (local_labels_test.o, local_labels_test): New rules.
12849         * testsuite/Makefile.in: Regenerate.
12850
12851 2009-06-04  Doug Kwan  <dougkwan@google.com>
12852
12853         * layout.cc (Layout::section_name_mapping): Add mapping for
12854         special ARM sections.
12855
12856 2009-06-03  Doug Kwan  <dougkwan@google.com>
12857
12858         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12859         (utils::has_overflow): Same.
12860
12861 2009-06-03  Ian Lance Taylor  <iant@google.com>
12862
12863         * layout.cc (Layout::section_name_mapping): New array, replacing
12864         Layout::linkonce_mapping.
12865         (Layout::section_name_mapping_count): New variable, replacing
12866         Layout::linkonce_mapping_count.
12867         (Layout::linkonce_output_name): Remove.
12868         (Layout::output_section_name): Rewrite.
12869         * layout.h (class Layout): Rename Linkonce_mapping to
12870         Section_name_mapping, linkonce_mapping to section_name_mapping,
12871         linkonce_mapping_count to section_name_mapping_count.  Don't
12872         declare linkonce_output_name.
12873
12874 2009-06-03  Doug Kwan  <dougkwan@google.com>
12875
12876         * gold/arm.cc (namespace utils): New.
12877         (Target_arm::reloc_is_non_pic): Define new method.
12878         (class Arm_relocate_functions): New.
12879         (Target_arm::Relocate::relocate): Handle relocation types used by
12880         Android.
12881
12882 2009-06-03  Ian Lance Taylor  <iant@google.com>
12883
12884         * arm.cc (Target_arm::scan::global): Use || instead of |.
12885
12886 2009-06-02  Doug Kwan  <dougkwan@google.com>
12887
12888         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12889         issued_non_pic_error_.
12890         (class Target_arm::Scan): Declare new method check_non_pic.
12891         Define new method symbol_needs_plt_entry.
12892         Declare new data member issued_non_pic_error_.
12893         (class Target_arm::Relocate): Declare new method
12894         should_apply_static_reloc.
12895         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12896         (Target_arm::Scan::check_non_pic): Define new method.
12897         (Target_arm::Scan::local): Handle a small subset of reloc types used
12898         by Android.
12899         (Target_arm::Scan::local): Same.
12900         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12901
12902 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12903
12904         * incremental.cc (Incremental_inputs::report_command_line): Filter
12905         out --incremental-* options.
12906
12907 2009-05-29  Doug Kwan  <dougkwan@google.com>
12908
12909         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12910         template class.
12911         (class Target_arm): Update comment.
12912         (Target_arm::Target_arm): Initialize new data members GOT_,
12913         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12914         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12915         and Target_arm::rel_dyn_section.
12916         Declare new_enum Target_arm::Got_type.
12917         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12918         and DYNBSS_.
12919         Update commments for member do_dynsym_value.
12920         (Target_arm::got_size, Target_arm::plt_section,
12921         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12922         new methods inside class defintion.
12923         (Target_arm::got_section): Define new method.
12924         (Target_arm::rel_dyn_section): Same.
12925         (Output_data_plt_arm): New template class.
12926         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12927         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12928         (Output_data_plt_arm::add_entry): Same.
12929         (Output_data_plt_arm::first_plt_entry): Define new
12930         static data member for PLT instruction template.
12931         (Output_data_plt_arm::plt_entry): Same.
12932         (Output_data_plt_arm::do_write): Define new method.
12933         (Target_arm::make_plt_entry): Same.
12934         (Target_arm::do_finalize_sections): Same.
12935         (Target_arm::do_dynsym_value): Same.
12936
12937 2009-05-28  Doug Kwan  <dougkwan@google.com>
12938
12939         * Makefile.am (TARGETSOURCES): Add arm.cc.
12940         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12941         * Makefile.in: Regenerate.
12942         * arm.cc: New file.
12943         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12944
12945 2009-05-26  Doug Kwan  <dougkwan@google.com>
12946
12947         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12948         (General_options::check_excluded_libs): Strip off directories in
12949         archive name before matching like GNU ld does.
12950         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12951         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12952         (exclude_libs_test_LDFLAGS): Add linker option
12953         -Wl,--exclude-libs,libexclude_libs_test_3
12954         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12955         an explicit archive without using -l.
12956         (alt/libexclude_libs_test_3.a): New make rule.
12957         * testsuite/Makefile.in: Regenerate.
12958         * testsuite/exclude_libs_test.c : Declare lib3_default().
12959         (main): Call it.
12960         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12961         * exclude_libs_test_3.c: New file.
12962
12963 2009-05-26  Nick Clifton  <nickc@redhat.com>
12964
12965         * po/id.po: New Indonesian translation.
12966         * po/gold.pot: Updated template file.
12967
12968 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12969
12970         * testsuite/Makefile.am: Add -ffunction-sections to compile
12971         gc_comdat_test files.  Add -Wl,--gc-sections to build
12972         gc_comdat_test.
12973         * testsuite/Makefile.in: Regenerate.
12974         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12975
12976 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12977
12978         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12979         kept comdat section was garbage collected.
12980         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12981         * testsuite/Makefile.in: Regenerate.
12982         * testsuite/gc_comdat_test.sh: New file.
12983         * testsuite/gc_comdat_test_1.cc: New file.
12984         * testsuite/gc_comdat_test_2.cc: New file.
12985
12986 2009-05-19  Doug Kwan  <dougkwan@google.com>
12987
12988         * archive.cc (Archive::Archive): Move constructor from archive.h
12989         to here.  Initialize no_export_.
12990         (Archive::get_elf_object_for_member): Set no_export flag of object.
12991         * archive.h (Archive::Archive): Move constructor body to
12992         archive.cc.
12993         (Archive::no_export): New method.
12994         (Archive::no_export_): New field.
12995         * object.h (Object::Object): Initialize no_export_ to false.
12996         (Object::no_export, Object::set_no_export): New methods.
12997         (Object::no_export_): New field.
12998         * options.cc (General_options::parse_exclude_libs): New method.
12999         (General_options::check_excluded_libs) Same.
13000         * options.h (exclude_libs): New option.
13001         (General_options::check_excluded_libs): New method declaration.
13002         (General_options::excluded_libs_): New field.
13003         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
13004         default or protected visibility if an object has no-export flag set.
13005         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
13006         (check_SCRIPTS): Add exclude_libs_test.sh.
13007         (check_DATA): Add exclude_libs_test.syms.
13008         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13009         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13010         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13011         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13012         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13013         libexclude_libs_test_2.a): New rules.
13014         * testsuite/Makefile.in: Regenerate.
13015         * testsuite/exclude_libs_test.c: New file.
13016         * testsuite/exclude_libs_test.sh: Ditto.
13017         * testsuite/exclude_libs_test_1.c: Ditto.
13018         * testsuite/exclude_libs_test_2.c: Ditto.
13019
13020 2009-05-15  Ian Lance Taylor  <iant@google.com>
13021
13022         * configure.ac: Check for declarations for cases where libiberty.h
13023         checks HAVE_DECL_xxx.
13024         * configure, config.in: Rebuild.
13025
13026 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13027
13028         * gold.h (Incremental_argument_list): Remove (invalid) forward
13029         declaration.
13030         * incremental.cc (Incremental_inputs::report_achive): New method.
13031         (Incremental_inputs::report_object): New method.
13032         (Incremental_inputs::report_script): New method.
13033         (Incremental_inputs::finalize_inputs): New method.
13034         (Incremental_inputs::finalize): Call finalize_inputs().
13035         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13036         Create inputs entries.
13037         * incremental.h (Incremental_input_type): New enum.
13038         (Incremental_inputs::Incremental_input): Initialize new fields.
13039         (Incremental_inputs::report_inputs): New method.
13040         (Incremental_inputs::report_achive): New method.
13041         (Incremental_inputs::report_object): New method.
13042         (Incremental_inputs::report_script): New method.
13043         (Incremental_inputs::finalize_inputs): New method.
13044         (Incremental_inputs::Input_info): New struct.
13045         (Incremental_inputs::Input_info_map): New typedef.
13046         (Incremental_inputs::lock_): New field.
13047         (Incremental_inputs::Inputs_): New field.
13048         (Incremental_inputs::Inputs_map): New field.
13049         * main.cc (main): Call Incremental_input::report_inputs.
13050         * options.h (Input_argument_list): Typedef moved from
13051         Input_arguments.
13052         (Input_file_group::Files): Remove, use ::Input_argument_list.
13053         (Input_file_group::Input_argument_list): Remove, use
13054         ::Input_argument_list.
13055         * plugin.cc (Plugin_manager::add_input_file): Add error in
13056         incremental build.
13057         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13058         functions.
13059         * script.cc (read_input_script): Call
13060         Incremental_input::report_script.
13061         * script.h (Script_info): New class.
13062
13063 2009-04-27  Ian Lance Taylor  <iant@google.com>
13064
13065         * x86_64.cc (do_adjust_output_section): Set entsize to
13066         plt_entry_size.
13067
13068 2009-04-23  Elliott Hughes  <enh@google.com>
13069
13070         * output.cc (Output_file::close): After short writes, continue
13071         writing from the correct offset in the buffer being written.
13072
13073 2009-04-23  Chris Demetriou  <cgd@google.com>
13074
13075         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13076         * configure: Regenerate.
13077         * config.in: Regenerate.
13078         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13079         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13080
13081 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13082
13083         * incremental.cc (Incremental_inputs_header_data): Renamed from
13084         Incremental_input_header_data.
13085         (Incremental_inputs_header_data::data_size): New field.
13086         (Incremental_inputs_header_data::put_input_file_count): Renamed
13087         from input_file_count.
13088         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13089         from command_line_offset.
13090         (Incremental_inputs_header_data::put_reserved): Renamed from
13091         put_reserved.
13092         (Incremental_inputs_entry_data): Renamed from
13093         Incremental_input_entry_data.
13094         (Incremental_inputs_entry_data::data_size): New field.
13095         (Incremental_inputs::report_command_line): New method.
13096         (Incremental_inputs::finalize): New method.
13097         (Incremental_inputs::create_incremental_inputs_data): New method.
13098         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13099         * incremental.h: New file.
13100         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13101         (Layout::finalize): Create incremental inputs section in
13102         incremental builds.
13103         (Layout::create_incremental_info_sections): New method.
13104         * layout.h (Layout::incremental_inputs): New method.
13105         (Layout::create_incremental_info_sections): New method.
13106         (Layout::incremental_inputs_): New field.
13107         * main.cc (main): Notify Incremental_input of the command line.
13108
13109 2009-04-01  Ian Lance Taylor  <iant@google.com>
13110             Mikolaj Zalewski  <mikolajz@google.com>
13111
13112         * gold.h (reserve_unordered_map): Define, three versions, one for
13113         each version of Unordered_map.
13114         * layout.cc (Layout::Layout): Remove options parameter.  Add
13115         number_of_input_files parameter.  Don't initialize options_.
13116         Initialize number_of_input_files_ and resized_signatures_.  Move
13117         sections_are_attached_.
13118         (Layout::layout_group): Reserve space for group_signatures_.
13119         (Layout::find_or_add_kept_section): Change name parameter to be a
13120         reference.  Resize signatures_ map when it gets large enough.
13121         (Layout::layout_eh_frame): Use parameters->options() instead of
13122         this->options_.
13123         (Layout::make_output_section): Likewise.
13124         (Layout::attach_allocated_section_to_segment): Likewise.
13125         (Layout::finalize, Layout::create_executable_stack): Likewise.
13126         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13127         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13128         * layout.h (class Layout): Update declarations.  Remove options_
13129         field.  Add number_of_input_files_ and resized_signatures_
13130         fields.  Move sections_are_attached_ field.
13131         * main.cc (main): Pass number of input files to Layout
13132         constructor.  Don't pass options.
13133
13134 2009-03-30  Ian Lance Taylor  <iant@google.com>
13135
13136         * ffsll.c (ffsll): Correct implementation.
13137
13138 2009-03-27  Ian Lance Taylor  <iant@google.com>
13139
13140         * ffsll.c: New file.
13141         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13142         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13143         * ftruncate.c (ftruncate): Declare before definition.
13144         * mremap.c (mremap): Likewise.
13145         * pread.c (pread): Likewise.
13146         * configure, Makefile.in, config.in: Rebuild.
13147
13148         * mremap.c: New file.
13149         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13150         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13151         (mremap): Declare if HAVE_MREMAP is not defined.
13152         * configure, Makefile.in, config.in: Rebuild.
13153
13154 2009-03-27  Cary Coutant  <ccoutant@google.com>
13155
13156         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13157         position independent.
13158         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13159         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13160
13161 2009-03-24  Cary Coutant  <ccoutant@google.com>
13162
13163         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13164         an executable.
13165         (needs_dynamic_reloc): Likewise.
13166
13167 2009-03-24  Ian Lance Taylor  <iant@google.com>
13168
13169         * yyscript.y (file_cmd): Recognize EXTERN.
13170         (extern_name_list, extern_name_list_body): New nonterminals.
13171         * script.cc (script_add_extern): Define.
13172         * script-c.h (script_add_extern): Declare.
13173
13174 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13175
13176         * object.cc (is_elf_object): Define.
13177         * object.h (is_elf_object): Declare.
13178         * archive.cc (Archive::get_elf_object_for_member): Call
13179         is_elf_object.
13180         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13181
13182 2009-03-24  Elliott Hughes  <enh@google.com>
13183
13184         * output.cc (Output_file::map_anonymous): Define.
13185         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13186         try an anonymous one.  Report the size if the mmap fails.
13187         * output.h (class Output_file): Declare map_anonymous.
13188
13189 2009-03-24  Ian Lance Taylor  <iant@google.com>
13190
13191         * target-select.cc (instantiate_target): Don't acquire the lock if
13192         the instantiated_target_ field has already been set.
13193
13194 2009-03-23  Ian Lance Taylor  <iant@google.com>
13195
13196         * gold-threads.h (class Initialize_lock): Define.
13197         * gold-threads.cc (class Initialize_lock_once): Define.
13198         (initialize_lock_control): New static variable.
13199         (initialize_lock_pointer): New static variable.
13200         (initialize_lock_once): New static function.
13201         (Initialize_lock::Initialize_lock): Define.
13202         (Initialize_lock::initialize): Define.
13203         * target-select.h: Include "gold-threads.h".
13204         (class Target_selector): Add lock_ and initialize_lock_ fields.
13205         Don't define instantiate_target, just declare it.
13206         * target-select.cc (Target_selector::Target_selector): Initialize
13207         new fields.
13208         (Target_selector::instantiate_target): Define.
13209         * descriptors.h: Include "gold-threads.h".
13210         (class Descriptors): Add initialize_lock_ field.
13211         * descriptors.cc (Descriptors::Descriptors): Initialize new
13212         field.
13213         (Descriptors::open): Use initialize_lock_ field
13214         * errors.h (class Errors): Add initialize_lock_ field.
13215         * errors.cc (Errors::Errors): Initialize new field.
13216         (Errors::initialize_lock): Use initialize_lock_ field.
13217         * powerpc.cc (class Target_selector_powerpc): Remove
13218         instantiated_target_ field.  In do_recognize call
13219         instantiate_target rather than do_instantiate_target.  In
13220         do_instantiate_target just allocate a new target.
13221         * sparc.cc (class Target_selector_sparc): Likewise.
13222
13223         * freebsd.h: New file.
13224         * i386.cc: Include "freebsd.h".
13225         (Target_i386): Derive from Target_freebsd rather than
13226         Sized_target.
13227         (Target_selector_i386): Derive from Target_selector_freebsd rather
13228         than Target_selector.
13229         * x86_64.cc: Include "freebsd.h".
13230         (Target_x86_64): Derive from Target_freebsd rather than
13231         Sized_target.
13232         (Target_selector_x86_64): Derive from Target_selector_freebsd
13233         rather than Target_selector.
13234         * target.h (class Target): Add adjust_elf_header and
13235         do_adjust_elf_header.
13236         * output.cc (Output_file_header:: do_sized_write): Call target
13237         adjust_elf_header routine.
13238         * configure.tgt: Set targ_osabi.
13239         * configure.ac: Define GOLD_DEFAULT_OSABI.
13240         * parameters.cc (Parameters::default_target): Pass
13241         GOLD_DEFAULT_OSABI to select_target.
13242         * target-select.h (class Target_selector): Make instantiate_target
13243         protected rather than private.
13244         * Makefile.am (HFILES): Add freebsd.h.
13245         * configure, Makefile.in, config.in: Rebuild.
13246
13247         * merge.cc (do_add_input_section): Correct pend value.  Change
13248         message about last entry not being null terminated from error to
13249         warning.
13250
13251 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13252
13253         * incremental.cc: New file.
13254         * Makefile.am (CCFILES): Add incremental.cc.
13255         * Makefile.in: Rebuild.
13256
13257 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13258
13259         * layout.cc (Layout::output_section_name): Preserve names
13260         of '.note.' sections.
13261
13262 2009-03-19  Ian Lance Taylor  <iant@google.com>
13263
13264         * descriptors.cc (Descriptors::open): Check that the options are
13265         valid before using them.
13266
13267 2009-03-18  Ian Lance Taylor  <iant@google.com>
13268
13269         * script-sections.h: Include <list>.
13270         (class Script_sections): Change Sections_elements from std::vector
13271         to std::list.  Typedef public Elements_iterator.  Add
13272         orphan_section_placement_, data_segment_align_start_, and
13273         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13274         field.
13275         * script-sections.cc (class Orphan_section_placement): New class.
13276         (class Sections_element): Add virtual functions is_relro and
13277         orphan_section_init.  Remove virtual function place_orphan_here.
13278         (class Output_section_definition): Add is_relro and
13279         orphan_section_init.  Remove place_orphan_here.
13280         (class Orphan_output_section): Likewise.
13281         (Script_sections::Script_sections): Update for field changes.
13282         (Script_sections::data_segment_align): Set saw_data_segment_align_
13283         and data_segment_align_start_, not data_segment_align_index.
13284         (Script_sections::data_segment_relro_end): Check
13285         saw_data_segment_align_.  Use data_segment_align_start_ rather
13286         than data_segment_align_index_.
13287         (Script_sections::place_orphan): Rewrite to use
13288         Orphan_section_placement.
13289
13290 2009-03-17  Ian Lance Taylor  <iant@google.com>
13291
13292         * archive.cc (Archive::add_symbols): Check for a version attached
13293         to the symbol name in the archive map.
13294         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13295         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13296         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13297         (ver_test_11.a): New target.
13298         * testsuite/Makefile.in: Rebuild.
13299
13300         * configure.ac: Check for chsize and posix_fallocate.  Replace
13301         ftruncate.
13302         * ftruncate.c: New file, from gnulib.
13303         * output.cc (posix_fallocate): Define dummy version if not
13304         HAVE_POSIX_FALLOCATE.
13305         (Output_file::map): Call posix_fallocate rather than lseek and
13306         write.
13307         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13308         * configure, Makefile.in, config.in: Rebuild.
13309
13310 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13311
13312         * layout.h (Layout::create_note): Add section_name parameter.
13313         * layout.cc (Layout::create_note): Likewise.
13314         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13315
13316 2009-03-17  Ian Lance Taylor  <iant@google.com>
13317
13318         * descriptors.cc: Include "options.h".
13319         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13320         (Descriptors::open): Always use O_CLOEXEC when opening a new
13321         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13322         then set FD_CLOEXEC.
13323
13324         * sparc.cc (class Target_sparc): Add has_got_section.
13325         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13326         make sure we have a GOT section.
13327
13328         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13329         (Target_sparc::Scan::local): Likewise.
13330         (Target_sparc::Scan::global): Likewise.
13331         (Target_sparc::Relocate::relocate): Likewise.
13332         (Target_sparc::Relocate::relocate_tls): Likewise.
13333
13334         * symtab.cc (Symbol_table::define_default_version): New function,
13335         broken out of add_from_object.
13336         (Symbol_table::add_from_object): Call define_default_version.
13337         (Symbol_table::define_special_symbol): Add resolve_oldsym
13338         parameter.  Change all callers.  If the version for a symbol comes
13339         from a version script, resolve it with the symbol with the same
13340         name with no version.  Also add the symbol without a version if
13341         appropriate.
13342         (do_define_in_output_data): If resolving with oldsym, don't delete
13343         sym.
13344         (do_define_in_output_segment): Likewise.
13345         (do_define_as_constant): Likewise.
13346         * symtab.h (class Symbol_table): Update declarations.
13347
13348 2009-03-13  Ian Lance Taylor  <iant@google.com>
13349
13350         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13351         (Read_symbols::requeue): New function.
13352         (Read_symbols::do_read_symbols): If make_elf_object fails because
13353         the target type is not configured, and the file was searched for,
13354         issue a warning and retry with the next directory.
13355         (Add_symbols::run): If the file has an incompatible format, and
13356         it was searched for, requeue the Read_symbols task.  On error,
13357         release the object.
13358         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13359         dirindex parameter to constructor.  Change all callers.  Declare
13360         incompatible_warning and requeue.
13361         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13362         input_argument_ and input_group_ fields.  Add them to
13363         constructor.  Change all callers.
13364         (class Read_script): Add dirindex_ field.  Add it to constructor.
13365         Change all callers.
13366         * archive.cc (Archive::setup): Remove input_objects parameter.
13367         Change all callers.
13368         (Archive::get_file_and_offset): Likewise.
13369         (Archive::read_all_symbols): Likewise.
13370         (Archive::read_symbols): Likewise.
13371         (Archive::get_elf_object_for_member): Remove input_objects
13372         parameter.  Add punconfigured parameter.  Change all callers.
13373         (Archive::add_symbols): Change return type to bool.  Check return
13374         value of include_member.
13375         (Archive::include_all_members): Likewise.
13376         (Archive::include_member): Change return type to bool.  Return
13377         false if first included object has incompatible target.  Set
13378         included_member_ field.
13379         (Add_archive_symbols::run): If add_symbols returns false, requeue
13380         Read_symbols task.
13381         * archive.h (class Archive): Add included_member_ field.
13382         Initialize it in constructor.  Add input_file and searched_for
13383         methods.  Update declarations.
13384         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13385         input_argument_ fields.  Add them to constructor.  Change all
13386         callers.
13387         * script.cc: Include "target-select.h".
13388         (class Parser_closure): Add skip_on_incompatible_target_ and
13389         found_incompatible_target_ fields.  Add
13390         skip_on_incompatible_target parameter to constructor.  Change all
13391         callers.  Add methods skip_on_incompatible_target,
13392         clear_skip_on_incompatible_target, found_incompatible_target, and
13393         set_found_incompatible_target.
13394         (read_input_script): Add dirindex parameter.  Change all callers.
13395         If parser finds an incompatible target, requeue Read_symbols
13396         task.
13397         (script_set_symbol): Clear skip_on_incompatible_target in
13398         closure.
13399         (script_add_assertion, script_parse_option): Likewise.
13400         (script_start_sections, script_add_phdr): Likewise.
13401         (script_check_output_format): New function.
13402         * script.h (read_input_script): Update declaration.
13403         * script-c.h (script_check_output_format): Declare.
13404         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13405         (ignore_cmd): Remove OUTPUT_FORMAT.
13406         * fileread.cc (Input_file::Input_file): Add explicit this.
13407         (Input_file::will_search_for): New function.
13408         (Input_file::open): Add pindex parameter.  Change all callers.
13409         * fileread.h (class Input_file): Add input_file_argument method.
13410         Declare will_search_for.  Update declarations.
13411         * object.cc (make_elf_object): Add punconfigured parameter.
13412         Change all callers.
13413         * object.h (class Object): Make input_file public.  Add
13414         searched_for method.
13415         (make_elf_object): Update declaration.
13416         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13417         restart search.
13418         * dirsearch.h (class Dirsearch): Update declaration.
13419         * options.h (class General_options): Add --warn-search-mismatch.
13420         * parameters.cc (Parameters::is_compatible_target): New function.
13421         * parameters.h (class Parameters): Declare is_compatible_target.
13422         * workqueue.cc (Workqueue::add_blocker): New function.
13423         * workqueue.h (class Workqueue): Declare add_blocker.
13424
13425         * fileread.cc (Input_file::open): Remove options parameter.
13426         Change all callers.
13427         (Input_file::open_binary): Likewise.
13428         * script.cc (read_input_script): Likewise.
13429         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13430         options parameter from constructor.  Change all callers.
13431         (class Read_script): Likewise.
13432         * fileread.h (class Input_file): Update declarations.
13433         * script.h (read_input_script): Update declaration.
13434
13435 2009-03-10  Nick Clifton  <nickc@redhat.com>
13436
13437         * po/es.po: New Spanish translation.
13438
13439 2009-03-06  Cary Coutant  <ccoutant@google.com>
13440
13441         * options.cc (parse_short_option): Keep dash_z from registering itself.
13442
13443 2009-03-03  Ian Lance Taylor  <iant@google.com>
13444
13445         PR 9918
13446         * target-reloc.h (relocate_section): Pass output_section to
13447         relocate.
13448         * i386.cc (Target_i386::should_apply_static_reloc): Add
13449         output_section parameter.  Change all callers.
13450         (Target_i386::Relocate::relocate): Add output_section parameter.
13451         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13452         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13453         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13454         * testsuite/two_file_shared.sh: New script.
13455         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13456         (check_DATA): Add two_file_shared.dbg.
13457         (two_file_shared.dbg): New target.
13458         * testsuite/Makefile.in: Rebuild.
13459
13460 2009-03-01  Ian Lance Taylor  <iant@google.com>
13461
13462         * configure.ac: Check for byteswap.h.
13463         * configure: Rebuild.
13464         * config.in: Rebuild.
13465
13466 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13467
13468         * layout.cc (Layout::find_or_add_kept_section): New function.
13469         (Layout::add_comdat): Removed.
13470         * layout.h (struct Kept_section): Move out of class Layout.
13471         Remove trailing underscores from field names.  Add group_sections
13472         field.  Rename group_ field to is_group.  Change all uses.
13473         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13474         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13475         comdat_groups_ field.
13476         (Sized_relobj::include_section_group): Use
13477         find_or_add_kept_section and Kept_section::group_sections.
13478         (Sized_relobj::include_linkonce_section): Likewise.
13479         * object.cc (class Sized_relobj): Don't define Comdat_group or
13480         Comdat_group_table.  Remove find_comdat_group and
13481         add_comdat_group.  Remove comdat_groups_ field.
13482         * plugin.cc (include_comdat_group): Use
13483         Layout::find_or_add_kept_section.
13484
13485 2009-02-28  Ian Lance Taylor  <iant@google.com>
13486
13487         * README: --gc-sections and map files are now supported.  Document
13488         some build requirements.
13489
13490         PR 6992
13491         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13492         relocatable link set the value of the section symbol to zero.
13493         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13494         relocatable link don't include the section address in the local
13495         symbol value.
13496
13497 2009-02-27  Ian Lance Taylor  <iant@google.com>
13498
13499         PR 6811
13500         * options.h (class Search_directory): Add is_system_directory.
13501         (class General_options): Declare is_in_system_directory.
13502         * options.cc (get_relative_sysroot): Make static.
13503         (get_default_sysroot): Make static.
13504         (General_optoins::is_in_system_directory): New function.
13505         * fileread.cc (Input_file::is_in_system_directory): New function.
13506         * fileread.h (class Input_file): Declare is_in_system_directory.
13507         * object.h (class Object): Add is_in_system_directory.
13508         (class Input_objects): Remove system_library_directory_ field.
13509         * object.cc (Input_objects::add_object): Don't set
13510         system_library_directory_.
13511         (input_objects::found_in_system_library_directory): Remove.
13512         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13513         parameter.  Change all callers.
13514         (Symbol_table::sized_write_globals): Likewise.
13515         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13516         Call Object::is_in_system_directory.
13517         * symtab.h (class Symbol_table): Update declarations.
13518
13519         PR 5990
13520         * descriptors.h (Open_descriptor): Add is_on_stack field.
13521         * descriptors.cc (Descriptors::open): If the descriptor is on the
13522         top of the stack, remove it.  Initialize is_on_stack field.
13523         (Descriptors::release): Only add pod to stack if it is not on the
13524         stack already.
13525         (Descriptors::close_some_descriptor): Clear stack_next and
13526         is_on_stack fields.
13527
13528         PR 7091
13529         * output.cc (Output_section::find_starting_output_address): Rename
13530         from starting_output_address; add PADDR parameter; change return
13531         type.
13532         * output.h (class Output_section): Declare
13533         find_starting_output_address instead of starting_output_address.
13534         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13535         section symbol for which we can't find a merge section.
13536
13537         PR 9836
13538         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13539         hidden or internal, force the symbol to be local.
13540         * resolve.cc (Symbol::override_visibility): Define.
13541         (Symbol::override_base): Use override_visibility.
13542         (Symbol_table::resolve): Likewise.
13543         (Symbol::override_base_with_special): Likewise.
13544         (Symbol_table::override_with_special): If the visibility is hidden
13545         or internal, force the symbol to be local.
13546         * symtab.h (class Symbol): Add set_visibility and
13547         override_visibility.
13548         * testsuite/ver_test_1.sh: New file.
13549         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13550         (check_DATA): Add ver_test_1.syms.
13551         (ver_test_1.syms): New target.
13552         * testsuite/Makefile.in: Rebuild.
13553
13554 2009-02-25  Cary Coutant  <ccoutant@google.com>
13555
13556         * layout.cc (Layout::choose_output_section): Don't rename sections
13557         when using a linker script that has a SECTIONS clause.
13558         * Makefile.in: Regenerate.
13559
13560         * testsuite/Makefile.am (script_test_5.sh): New test case.
13561         * testsuite/Makefile.in: Regenerate.
13562         * testsuite/script_test_5.cc: New file.
13563         * testsuite/script_test_5.sh: New file.
13564         * testsuite/script_test_5.t: New file.
13565
13566 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13567
13568         * archive.cc (Archive::include_member): Update calls to add_symbols.
13569         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13570         the Layout argument.
13571         * dynobj.h (do_add_symbols): Add the Layout argument.
13572         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13573         Layout argument.
13574         * object.h (Object::add_symbols): Add the Layout argument.
13575         (Object::do_add_symbols): Add the Layout argument.
13576         (Sized_relobj::do_add_symbols): Add the Layout argument.
13577         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13578         Unify the two versions.
13579         (Add_plugin_symbols): Remove.
13580         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13581         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13582         (Add_plugin_symbols): Remove.
13583         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13584         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13585         (Add_symbols::run): Make it work with Pulginobj.
13586
13587 2009-02-06  Ian Lance Taylor  <iant@google.com>
13588
13589         * object.cc (Sized_relobj::do_layout): Make info message start
13590         with lower case letter.
13591
13592 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13593
13594         * binary.cc: Fix file comment.
13595
13596         * options.h (enum Incremental_disposition): Define.
13597         (class General_options): Add new options: --incremental,
13598         --incremental_changed, --incremental_unchanged,
13599         --incremental_unknown.  Add incremental_disposition_ and
13600         implicit_incremental_ fields.
13601         (General_options::incremental_disposition): New function.
13602         (class Position_dependent_options): Add incremental_disposition
13603         option.
13604         (Position_dependent_options::copy_from_options): Set incremental
13605         dispositions.
13606         * options.cc (General_options::parse_incremental_changed): New
13607         function.
13608         (General_options::parse_incremental_unchanged): New function.
13609         (General_options::parse_incremental_unknown): New function.
13610         (General_options::General_options): Initialize new fields
13611         incremental_disposition_ and implicit_incremental_.
13612         (General_options::finalize): Check for uasge of --incremental-*
13613         without --incremental.
13614
13615 2009-02-06  Chris Demetriou  <cgd@google.com>
13616
13617         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13618         pointer and to report location as the file name associated with
13619         the symbol.
13620         (gold_undefined_symbol_at_location): New function to replace the
13621         old gold_undefined_symbol functionality.
13622         * target-reloc.h (relocate_section): Update to use
13623         gold_undefined_symbol_at_location.
13624         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13625         Call gold_undefined_symbol function rather than gold_error.
13626         * errors.h (Errors::undefined_symbol): Take location as a
13627         string, rather than calculating it from a relocation.
13628         * errors.cc (Errors::fatal): Print "fatal error:" before the
13629         formatted message.
13630         (Errors::error, Errors::error_at_location): Print "error: "
13631         before the formatted message.
13632         (Errors::undefined_symbol): Take location as a string, rather
13633         than calculating it from a relocation.
13634         (gold_undefined_symbol_at_location): New function akin to
13635         old gold_undefined_symbol, calculates location from relocation.
13636         (gold_undefined_symbol): Change to take only a Symbol pointer
13637         and to report location as the file name associated with the symbol.
13638         * testsuite/debug_msg.sh: Update for changed error messages.
13639         * testsuite/undef_symbol.sh: Likewise.
13640
13641 2009-02-04  Duncan Sands  <baldrick@free.fr>
13642
13643         PR 9812
13644         * reduced_debug_output.h
13645         (Output_reduced_debug_abbrev_section::failed): Use format for
13646         gold_warning.
13647         (Output_reduced_debug_info_section::faild): Likewise.
13648
13649 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13650
13651         * script.cc (Lazy_demangler): New class.
13652         (Version_script_info::get_symbol_version_helper): Demangle a
13653         symbol only once.
13654
13655 2009-01-29  Cary Coutant  <ccoutant@google.com>
13656
13657         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13658         to __tls_get_addr.
13659         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13660
13661 2009-01-28  Ian Lance Taylor  <iant@google.com>
13662
13663         * version.cc (version_string): Bump to 1.9.
13664
13665         * gold.h: Include <cstring> and <stdint.h>.
13666         * version.cc: Include <cstdio>.
13667         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13668         warning.
13669         * reduced_debug_output.cc (insert_into_vector): Rename from
13670         Insert_into_vector; change all callers.  Use Swap_unaligned to
13671         avoid aliasing issue; remove union since it is unnecessary.
13672
13673 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13674
13675         * Makefile.am (CCFILES): Add gc.cc.
13676         (HFILES): Add gc.h.
13677         * Makefile.in: Regenerate.
13678         * gold.cc (Gc_runner): New class.
13679         (queue_initial_tasks): Call garbage collection related tasks
13680         when corresponding options are invoked.
13681         (queue_middle_gc_tasks): New function.
13682         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13683         processed early before laying out sections during garbage collection.
13684         * gold.h (queue_middle_gc_tasks): New function.
13685         (is_prefix_of): Move from "layout.cc".
13686         * i386.cc (Target_i386::gc_process_relocs): New function.
13687         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13688         * main.cc (main): Create object of class "Garbage_collection".
13689         * object.cc (Relobj::copy_symbols_data): New function.
13690         (Relobj::is_section_name_included): New function.
13691         (Sized_relobj::do_layout): Allow this function to be called twice
13692         during garbage collection and defer layout of section during the
13693         first call.
13694         * object.h (Relobj::get_symbols_data): New function.
13695         (Relobj::is_section_name_included): New function.
13696         (Relobj::copy_symbols_data): New function.
13697         (Relobj::set_symbols_data): New function.
13698         (Relobj::get_relocs_data): New function.
13699         (Relobj::set_relocs_data): New function.
13700         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13701         (Relobj::gc_process_relocs): New function.
13702         (Relobj::do_gc_process_relocs): New pure virtual function.
13703         (Relobj::sd_): New data member.
13704         (Sized_relobj::is_output_section_offset_invalid): New function.
13705         (Sized_relobj::do_gc_process_relocs): New function.
13706         * options.h (General_options::gc_sections): Modify to not be a no-op.
13707         (General_options::print_gc_sections): New option.
13708         * plugin.cc (Plugin_finish::run): Remove function call to
13709         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13710         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13711         * reloc.cc (Read_relocs::run): Add task to process relocs and
13712         determine unreferenced sections when doing garbage collection.
13713         (Gc_process_relocs): New class.
13714         (Sized_relobj::do_gc_process_relocs): New function.
13715         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13716         sections that are garbage collected.
13717         * reloc.h (Gc_process_relocs): New class.
13718         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13719         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13720         symbols whose corresponding sections are garbage collected.
13721         (Symbol_table::Symbol_table): Add new parameter for the garbage
13722         collection object.
13723         (Symbol_table::gc_mark_undef_symbols): New function.
13724         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13725         (Symbol_table::gc_mark_dyn_syms): New function.
13726         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13727         as garbage.
13728         (Symbol_table::add_from_object): Likewise.
13729         (Symbol_table::add_from_relobj): When building shared objects, do not
13730         treat externally visible symbols as garbage.
13731         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13732         table information for static and relocatable links.
13733         * symtab.h (Symbol_table::set_gc): New function.
13734         (Symbol_table::gc): New function.
13735         (Symbol_table::gc_mark_undef_symbols): New function.
13736         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13737         (Symbol_table::gc_mark_dyn_syms): New function.
13738         (Symbol_table::gc_): New data member.
13739         * target.h (Sized_target::gc_process_relocs): New pure virtual
13740         function.
13741         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13742         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13743
13744 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13745
13746         * options.h (General_options::gc_sections): Define as a no-op for now.
13747         (General_options::no_keep_memory): Ditto.
13748         (General_options::Bshareable): Define.
13749         * options.cc (General_options::finalize): Honor -Bshareable.
13750
13751 2009-01-20  Andreas Schwab  <schwab@suse.de>
13752
13753         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13754         read the value in the contents, since we don't use it.  Use the
13755         template endianness when writing.
13756         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13757
13758 2009-01-19  Andreas Schwab  <schwab@suse.de>
13759
13760         * configure.tgt (powerpc64-*): Fix targ_obj.
13761
13762 2009-01-15  Ian Lance Taylor  <iant@google.com>
13763
13764         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13765         local symbols when stripping all symbols.
13766
13767 2009-01-14  Cary Coutant  <ccoutant@google.com>
13768
13769         * output.cc (Output_reloc): Add explicit instantiations.
13770
13771 2009-01-14  Cary Coutant  <ccoutant@google.com>
13772
13773         * archive.cc (Archive::get_elf_object_for_member): Remove call
13774         to File_read::claim_for_plugin.
13775         * descriptors.cc (Descriptors::open): Remove reference to
13776         is_claimed.
13777         (Descriptors::claim_for_plugin): Remove.
13778         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13779         (Descriptors::is_claimed): Remove.
13780         (claim_descriptor_for_plugin): Remove.
13781         * fileread.cc (File_read::claim_for_plugin): Remove.
13782         * fileread.h (File_read::claim_for_plugin): Remove.
13783         (File_read::descriptor): Reopen descriptor if necessary.
13784         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13785         (Plugin_manager::all_symbols_read): Add task parameter. Change
13786         all callers.
13787         (Plugin_manager::get_input_file): New function.
13788         (Plugin_manager::release_input_file): New function.
13789         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13790         corresponding data member.
13791         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13792         and pass to base constructor. Change all callers.
13793         (get_input_file, release_input_file): New functions.
13794         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13795         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13796         (Plugin_manager::all_symbols_read): Add task parameter.
13797         (Plugin_manager::get_input_file): New function.
13798         (Plugin_manager::release_input_file): New function.
13799         (Plugin_manager::task_): New data member.
13800         (Pluginobj::Pluginobj): Add filesize parameter.
13801         (Pluginobj::filename): New function.
13802         (Pluginobj::descriptor): New function.
13803         (Pluginobj::filesize): New function.
13804         (Pluginobj::filesize_): New data member.
13805         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13806         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13807         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13808
13809         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13810         with archive libraries.
13811         * testsuite/Makefile.in: Regenerate.
13812         * testsuite/plugin_test.c (struct sym_info): New type.
13813         (get_input_file, release_input_file): New static variables.
13814         (onload): Capture new transfer vector entries.
13815         (claim_file_hook): Stop reading at end of file according to filesize.
13816         Factor out parsing of readelf output into separate function.
13817         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13818         APIs and get the source file name from the symbol table.  Convert
13819         source file name to corresponding object file name.  Print info
13820         message when adding new input files.
13821         (parse_readelf_line): New function.
13822         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13823         * testsuite/plugin_test_2.sh: Likewise.
13824         * testsuite/plugin_test_3.sh: Likewise.
13825         * testsuite/plugin_test_4.sh: New test case.
13826
13827 2009-01-07  Ian Lance Taylor  <iant@google.com>
13828
13829         * version.cc (version_string): Bump to 1.8.
13830
13831 2008-12-23  Cary Coutant  <ccoutant@google.com>
13832
13833         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13834         * plugin.cc (Plugin_manager::finish): Rename as
13835         layout_deferred_objects.  Move cleanup to separate function.
13836         (Plugin_manager::cleanup): New function.
13837         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13838         separately.
13839         * plugin.h (Plugin_manager::finish): Rename as
13840         layout_deferred_objects.
13841         (Plugin_manager::cleanup): New function.
13842         (Plugin_manager::cleanup_done): New field.
13843
13844 2008-12-23  Cary Coutant  <ccoutant@google.com>
13845
13846         * plugin.cc (is_visible_from_outside): New function.
13847         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13848         so we don't return "IR only" status for exported symbols or -r links.
13849
13850         * testsuite/Makefile.am (plugin_test_3): New test case.
13851         * testsuite/Makefile.in: Regenerate.
13852         * testsuite/plugin_test_3.sh: New file.
13853
13854 2008-12-22  Cary Coutant  <ccoutant@google.com>
13855
13856         * object.cc (Sized_relobj::layout_section): New function.
13857         (Sized_relobj::do_layout): Defer layout of input sections until after
13858         plugin has provided replacement files.
13859         (Sized_relobj::do_layout_deferred_sections): New function.
13860         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13861         (Relobj::layout_deferred_sections): New function.
13862         (Relobj::do_layout_deferred_sections): New function.
13863         (Sized_relobj::do_layout_deferred_sections): New function.
13864         (Sized_relobj::layout_section): New function.
13865         (Sized_relobj::Deferred_layout): New structure.
13866         (Sized_relobj::deferred_layout_): New field.
13867         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13868         Change all callers.  Layout deferred sections.
13869         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13870         references.
13871         (Plugin_hook::run): Move code from do_plugin_hook inline.
13872         (Plugin_hook::do_plugin_hook): Remove.
13873         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13874         (Plugin_manager::finish): Renamed, was cleanup.
13875         (Plugin_manager::should_defer_layout): New function.
13876         (Plugin_manager::add_deferred_layout_object): New function.
13877         (Plugin_manager::Deferred_layout_list): New type.
13878         (Plugin_manager::deferred_layout_objects_): New field.
13879         (Plugin_hook::do_plugin_hook): Remove.
13880
13881 2008-12-17  Ian Lance Taylor  <iant@google.com>
13882
13883         * options.h (class General_options): Add --no case for
13884         --export-dynamic.
13885
13886 2008-12-16  Cary Coutant  <ccoutant@google.com>
13887
13888         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13889         vector.
13890         (Plugin_manager::claim_file): Create plugin object even if
13891         plugin did not call the add_symbols callback.
13892         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13893         asking for more symbols than were added.
13894         * testsuite/Makefile.am (plugin_test_1): Add test case with
13895         no global symbols.
13896         (empty.syms): New target.
13897         * testsuite/Makefile.in: Regenerate.
13898         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13899         message. Don't call add_symbols if no globals.
13900         (all_symbols_read_hook): Don't provide replacement for empty
13901         claimed file.
13902
13903 2008-12-12  Ian Lance Taylor  <iant@google.com>
13904
13905         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13906         r_type == 0 for a local symbol with r_sym == 0.
13907         (scan_relocatable_relocs): Pass r_sym to
13908         local_non_section_strategy.
13909         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13910         r_sym parameter.
13911
13912         * configure.ac: Update test for TLS descriptors: they are
13913         supported as of glibc 2.9.
13914         * configure: Rebuild.
13915
13916 2008-12-11  Ian Lance Taylor  <iant@google.com>
13917
13918         PR 7091
13919         * target-reloc.h (Default_scan_relocatable_relocs): For each
13920         function, map r_type == 0 to RELOC_DISCARD.
13921
13922 2008-12-10  Cary Coutant  <ccoutant@google.com>
13923
13924         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13925         object to override a kept COMDAT group from a plugin object.
13926
13927 2008-12-09  Ian Lance Taylor  <iant@google.com>
13928
13929         PR 7088
13930         * yyscript.y (file_cmd): Handle INPUT.
13931
13932         * testsuite/initpri1.c: Change all declarations to be full
13933         prototypes by adding void, to avoid compiler warnings.
13934
13935 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13936
13937         * options.cc (General_options::parse_plugin_opt): New.
13938         (General_options::add_plugin): The argument now is just the filename.
13939         (General_options::add_plugin_option): New.
13940         * options.h (plugin_opt): New.
13941         (add_plugin): Change argument name.
13942         (add_plugin_option): New.
13943         * plugin.cc (Plugin::load): Don't parse the plugin option.
13944         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13945         (Plugin::add_option): New.
13946         (Plugin::args_): Change type.
13947         (Plugin::filename_): New.
13948         (Plugin_manager::add_plugin_option): New.
13949         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13950         * testsuite/Makefile.in: Regenerate.
13951
13952 2008-12-05  Cary Coutant  <ccoutant@google.com>
13953
13954         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13955         Handle --strip-lto-sections option.
13956         * options.h (strip_lto_sections): New option.
13957
13958 2008-12-01  Cary Coutant  <ccoutant@google.com>
13959
13960         * plugin.cc (ld_plugin_message): Change format parameter to const.
13961         Fix mismatch between new[] and delete.
13962
13963 2008-11-14  Cary Coutant  <ccoutant@google.com>
13964
13965         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13966         instead of -1U.
13967
13968 2008-11-05  Craig Silverstein  <csilvers@google.com>
13969
13970         * options.cc (General_options::parse_dynamic_list): New function.
13971         * options.h (General_options): New flags dynamic_list,
13972         dynamic_list_data, dynamic_list_cpp_new, and
13973         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13974         (General_options::in_dynamic_list): New function.
13975         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13976         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13977         (Lex::can_continue_name): Likewise.
13978         (yylex): Likewise.
13979         (read_script_file): New parameter script_options.
13980         (read_dynamic_list): New function.
13981         (Script_options::define_dynamic_list): New function.
13982         (dynamic_list_keyword_parsecodes): New variable.
13983         (dynamic_list_keywords): New variable.
13984         * script.h (Script_options::define_dynamic_list): New function
13985         prototype.
13986         (read_dynamic_list): New function prototype.
13987         * symtab.cc (strprefix): New macro.
13988         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13989         dynamic_list_data, dynamic_list_cpp_new, and
13990         dynamic_list_cpp_typeinfo.
13991         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13992         (dynamic_list_expr): New rule.
13993         (dynamic_list_nodes): Likewise.
13994         (dynamic_list_node): Likewise.
13995         * testsuite/Makefile.am (dynamic_list): New test.
13996         * testsuite/Makefile.in: Regenerated.
13997         * testsuite/dynamic_list.t: New file.
13998         * testsuite/dynamic_list.sh: New file.
13999
14000 2008-11-05  Craig Silverstein  <csilvers@google.com>
14001
14002         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
14003         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
14004         (t11_last): Likewise.
14005         * testsuite/ver_test_6.c (main): Likewise.
14006
14007 2008-10-07  Cary Coutant  <ccoutant@google.com>
14008
14009         * options.c (General_options::finalize): Add check for -static and
14010         -shared.
14011         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14012         is not empty.
14013
14014 2008-10-02  Cary Coutant  <ccoutant@google.com>
14015
14016         * plugin.cc (make_sized_plugin_object): Fix conditional
14017         compilation to work when not all targets are enabled.
14018
14019 2008-09-29  Cary Coutant  <ccoutant@google.com>
14020
14021         * archive.cc (Archive::get_file_and_offset): Use filename instead
14022         of name to get library path.
14023         (Archive::include_member): Unlock external member of a thin archive.
14024
14025         * testsuite/Makefile.am (TEST_AR): New variable.
14026         (thin_archive_test_1): New test.
14027         (thin_archive_test_2): New test.
14028         * testsuite/Makefile.in: Regenerate.
14029         * testsuite/thin_archive_main.cc: New file.
14030         * testsuite/thin_archive_test_1.cc: New file.
14031         * testsuite/thin_archive_test_2.cc: New file.
14032         * testsuite/thin_archive_test_3.cc: New file.
14033         * testsuite/thin_archive_test_4.cc: New file.
14034
14035 2008-09-29  Cary Coutant  <ccoutant@google.com>
14036
14037         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14038         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14039         instead of -1U.
14040         (Sized_relobj::do_finalize_local_symbols): Likewise.
14041         (Sized_relobj::map_to_kept_section): Likewise.
14042         * object.h (Sized_relobj::invalid_address): New constant.
14043         (Sized_relobj::do_output_section_offset): Check for invalid_address
14044         and return -1ULL.
14045         * output.cc (Output_reloc::local_section_offset): Use constant
14046         invalid_address instead of -1U.
14047         (Output_reloc::get_address): Likewise.
14048         (Output_section::output_address): Change -1U to -1ULL.
14049         * output.h (Output_reloc::invalid_address): New constant.
14050         * reloc.cc (Sized_relobj::write_sections): Use constant
14051         invalid_address instead of -1U.
14052         (Sized_relobj::relocate_sections): Likewise.
14053         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14054         values for merge sections.
14055         * target-reloc.h (relocate_for_relocatable): Use constant
14056         invalid_address instead of -1U.
14057
14058 2008-09-19  Cary Coutant  <ccoutant@google.com>
14059
14060         Add plugin functionality for link-time optimization (LTO).
14061         * configure.ac (plugins): Add --enable-plugins option.
14062         * configure: Regenerate.
14063         * config.in: Regenerate.
14064         * Makefile.am (LIBDL): New variable.
14065         (CCFILES): Add plugin.cc.
14066         (HFILES): Add plugin.h.
14067         (ldadd_var): Add LIBDL.
14068         * Makefile.in: Regenerate.
14069
14070         * archive.cc: Include "plugin.h".
14071         (Archive::setup): Don't preread archive symbols when using a plugin.
14072         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14073         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14074         files.
14075         (Archive::include_member): Add symbols from plugin objects.
14076         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14077         * descriptors.cc (Descriptors::open): Check for file descriptors
14078         abandoned by plugins.
14079         (Descriptors::claim_for_plugin): New function.
14080         * descriptors.h (Descriptors::claim_for_plugin): New function.
14081         (Open_descriptor::is_claimed): New field.
14082         (claim_descriptor_for_plugin): New function.
14083         * fileread.cc (File_read::claim_for_plugin): New function.
14084         * fileread.h (File_read::claim_for_plugin): New function.
14085         (File_read::descriptor): New function.
14086         * gold.cc: Include "plugin.h".
14087         (queue_initial_tasks): Add task to call plugin hooks for generating
14088         new object files.
14089         * main.cc: Include "plugin.h".
14090         (main): Load plugin libraries.
14091         * object.h (Pluginobj): Declare.
14092         (Object::pluginobj): New function.
14093         (Object::do_pluginobj): New function.
14094         (Object::set_target): New function.
14095         * options.cc: Include "plugin.h".
14096         (General_options::parse_plugin): New function.
14097         (General_options::General_options): Initialize plugins_ field.
14098         (General_options::add_plugin): New function.
14099         * options.h (Plugin_manager): Declare.
14100         (General_options): Add --plugin option.
14101         (General_options::has_plugins): New function.
14102         (General_options::plugins): New function.
14103         (General_options::add_plugin): New function.
14104         (General_options::plugins_): New field.
14105         * plugin.cc: New file.
14106         * plugin.h: New file.
14107         * readsyms.cc: Include "plugin.h".
14108         (Read_symbols::do_read_symbols): Check for archive before checking
14109         for ELF file.  Call plugin hooks to claim files.
14110         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14111         from a real object file; force override when processing replacement
14112         files.
14113         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14114         (Symbol::init_base_object): Likewise.
14115         (Symbol::init_base_output_data): Likewise.
14116         (Symbol::init_base_output_segment): Likewise.
14117         (Symbol::init_base_constant): Likewise.
14118         (Symbol::init_base_undefined): Likewise.
14119         (Symbol::output_section): Assert that object is not a plugin.
14120         (Symbol_table::add_from_pluginobj): New function.
14121         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14122         undefined.
14123         (Symbol_table::sized_write_globals): Likewise.
14124         (Symbol_table::add_from_pluginobj): Instantiate template.
14125         * symtab.h (Sized_pluginobj): Declare.
14126         (Symbol::in_real_elf): New function.
14127         (Symbol::set_in_real_elf): New function.
14128         (Symbol::in_real_elf_): New field.
14129         (Symbol_table::add_from_pluginobj): New function.
14130
14131         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14132         (LIBDL): New variable.
14133         (LDADD): Add LIBDL.
14134         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14135         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14136         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14137         (MOSTLYCLEANFILES): Likewise.
14138         * testsuite/Makefile.in: Regenerate.
14139         * testsuite/plugin_test.c: New file.
14140         * testsuite/plugin_test_1.sh: New file.
14141         * testsuite/plugin_test_2.sh: New file.
14142
14143 2008-09-16  Ian Lance Taylor  <iant@google.com>
14144
14145         * target-reloc.h (relocate_section): Check whether a symbol is
14146         defined by the ABI before reporting an undefined symbol error.
14147         * target.h (Target::is_defined_by_abi): Make parameter const.
14148         (Target::do_is_defined_by_abi): Likewise.
14149         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14150         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14151         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14152         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14153         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14154         * testsuite/Makefile.in: Rebuild.
14155
14156         * fileread.cc (make_view): Add casts to avoid warning.
14157
14158 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14159
14160         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14161         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14162
14163 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14164
14165         * options.h (General_options::output_is_executable): New.
14166         (General_options::output_is_pie): New.
14167         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14168         for shared libraries.
14169         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14170
14171 2008-09-11  Chris Demetriou  <cgd@google.com>
14172
14173         * options.h (origin): New -z option.
14174         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14175         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14176         in DT_FLAGS_1.
14177
14178 2008-09-05  Cary Coutant  <ccoutant@google.com>
14179
14180         * fileread.cc (File_read::make_view): Add check for attempt to map
14181         beyond end of file.
14182
14183 2008-09-05  Cary Coutant  <ccoutant@google.com>
14184
14185         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14186         explicit instantiations.
14187
14188 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14189
14190         PR gold/6858
14191         * options.cc (General_options::finalize): Allow undefined symbols
14192         in shlibs if linking -shared.
14193
14194         PR gold/6859
14195         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14196         symbols as not needing a dynsym entry.
14197
14198 2008-08-20  Craig Silverstein  <csilvers@google.com>
14199
14200         * fileread.cc (File_read::open): Do not lock the file unless it
14201         was successfully opened.
14202
14203 2008-08-14  Cary Coutant  <ccoutant@google.com>
14204
14205         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14206         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14207         * testsuite/tls_test.cc (struct int128): 128-bit struct
14208         for testing TLS relocs with non-zero addend.
14209         (v12): New TLS variable.
14210         (t12): New test.
14211         (t_last): Add check for v12.
14212         * testsuite/tls_test.h (t12): New function.
14213         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14214
14215 2008-08-13  Ian Lance Taylor  <iant@google.com>
14216
14217         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14218         set tls_segment_ or relro_segment_.
14219         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14220         when appropriate.
14221         * output.h (Output_section::clear_is_relro): New function.
14222         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14223         sections specially even when output_data_ is empty.
14224         (Output_segment::maximum_alignment): When first section is relro,
14225         only force alignment for PT_LOAD segments.
14226         * script.cc (script_data_segment_align): New function.
14227         (script_data_segment_relro_end): New function.
14228         * script-c.h (script_data_segment_align): Declare.
14229         (script_data_segment_relro_end): Declare.
14230         * script-sections.h (class Script_sections): Declare
14231         data_segment_align and data_segment_relro_end.  Add fields
14232         segment_align_index_ and saw_relro_end_.
14233         * script-sections.cc (class Sections_element): Add set_is_relro
14234         virtual function.  Add new bool* parameter to place_orphan_here.
14235         Add get_output_section virtual function.
14236         (class Output_section_definition): Add set_is_relro.  Add new
14237         bool* parameter to place_orphan_here.  Add get_output_section.
14238         Add is_relro_ field.
14239         (Output_section_definition::Output_section_definition): Initialize
14240         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14241         and is_relro_ fields.
14242         (Output_section_definition::place_orphan_here): Add is_relro
14243         parameter.
14244         (Output_section_definition::set_section_addresses): Set relro for
14245         output section.
14246         (Output_section_definition::alternate_constraint): Likewise.
14247         (class Orphan_output_section): Add new bool* parameter to
14248         place_orphan_here.  Add get_output_section.
14249         (Orphan_output_section::place_orphan_here): Add is_relro
14250         parameter.
14251         (Script_sections::Script_sections): Initialize
14252         data_segment_align_index_ and saw_relro_end_.
14253         (Script_sections::data_segment_align): New function.
14254         (Script_sections::data_segment_relro_end): New function.
14255         (Script_sections::place_orphan): Set or clear is_relro.
14256         (Script_sections::set_section_addresses): Force alignment of first
14257         TLS section.
14258         * yyscript.y (exp): Call script_data_segment_align and
14259         script_data_segment_relro_end.
14260         * testsuite/relro_script_test.t: New file.
14261         * testsuite/relro_test.cc (using_script): Declare.
14262         (t1, t2): Test using_script.
14263         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14264         (relro_script_test_SOURCES): Define.
14265         (relro_script_test_DEPENDENCIES): Define.
14266         (relro_script_test_LDFLAGS): Define.
14267         (relro_script_test_LDADD): Define.
14268         (relro_script_test.so): New target.
14269         * testsuite/Makefile.in: Rebuild.
14270
14271 2008-08-06  Cary Coutant <ccoutant@google.com>
14272
14273         * archive.cc (Archive::total_archives, Archive::total_members)
14274         (Archive::total_members_loaded): New variables.
14275         (Archive::setup): Add parameter.  Add option to preread
14276         archive symbols.
14277         (Archive::read_armap): Add counter.
14278         (Archive::get_file_and_offset): New function.
14279         (Archive::get_elf_object_for_member): New function.
14280         (Archive::read_all_symbols): New function.
14281         (Archive::read_symbols): New function.
14282         (Archive::add_symbols): Add counters.
14283         (Archive::include_all_members): Use armap to find members if it's
14284         already built.
14285         (Archive::include_member): Skip reading symbols if already read.
14286         Factored code into Archive::get_file_and_offset and
14287         Archive::get_elf_object_for_member.  Changed call to
14288         Mapfile::report_include_archive_member.
14289         (Archive::print_stats): New function.
14290         * archive.h: Declare Object and Read_symbols_data classes.
14291         (Archive::Archive): Add initializers for new members.
14292         (Archive::setup): Add parameter.
14293         (Archive::print_stats): New function.
14294         (Archive::total_archives, Archive::total_members)
14295         (Archive::total_members_loaded): New variables.
14296         (Archive::get_file_and_offset): New function.
14297         (Archive::get_elf_object_for_member): New function.
14298         (Archive::read_all_symbols): New function.
14299         (Archive::read_symbols): New function.
14300         (Archive::Archive_member): New class.
14301         (Archive::members_): New member.
14302         (Archive::num_members_): New member.
14303         * main.cc: Include archive.h.
14304         (main): Call Archive::print_stats.
14305         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14306         archive parameter; member_name is now the fully-decorated name.
14307         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14308         * options.h: (General_options): Add --preread-archive-symbols option.
14309         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14310         Archive::setup.
14311
14312 2008-08-04  Ian Lance Taylor  <iant@google.com>
14313
14314         * symtab.h (Symbol::use_plt_offset): New function.
14315         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14316         * powerpc.cc (Relocate::relocate): Likewise.
14317         * sparc.cc (Relocate::relocate): Likewise.
14318         * x86_64.cc (Relocate::relocate): Likewise.
14319         * testsuite/weak_plt.sh: New test.
14320         * testsuite/weak_plt_main.cc: New test.
14321         * testsuite/weak_plt_shared.cc: New test.
14322         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14323         (check_PROGRAMS): Add weak_plt.
14324         (check_DATA): Add weak_plt_shared.so.
14325         (weak_plt_main_pic.o, weak_plt): New targets.
14326         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14327         * testsuite/Makefile.in: Rebuild.
14328
14329         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14330         gcctestdir/ld.
14331         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14332         * testsuite/Makefile.in: Rebuild.
14333
14334 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14335
14336         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14337         * Makefile.in: Regenerate.
14338         * po/POTFILES.in: Regenerate.
14339
14340 2008-07-29  Ian Lance Taylor  <iant@google.com>
14341
14342         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14343         symbols before other symbols.
14344         * testsuite/script_test_2.cc (test_addr): Declare.
14345         (test_addr_alias): Declare.
14346         (main): Check that test_addr and test_addr_alias have the right
14347         values.
14348         * testsuite/script_test_2.t: Define test_addr_alias and
14349         test_addr.
14350
14351 2008-07-24  Ian Lance Taylor  <iant@google.com>
14352
14353         PR 5990
14354         * descriptors.cc: New file.
14355         * descriptors.h: New file.
14356         * gold-threads.h (class Hold_optional_lock): New class.
14357         * fileread.cc: Include "descriptors.h".
14358         (File_read::~File_read): Release descriptor rather than closing
14359         it.
14360         (File_read::open) [file]: Call open_descriptor rather than open.
14361         Set is_descriptor_opened_.
14362         (File_read::open) [memory]: Assert that descriptor is not open.
14363         (File_read::reopen_descriptor): New function.
14364         (File_read::release): Release descriptor.
14365         (File_read::do_read): Make non-const.  Reopen descriptor.
14366         (File_read::read): Make non-const.
14367         (File_read::make_view): Reopen descriptor.
14368         (File_read::do_readv): Likewise.
14369         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14370         Update declarations.
14371         * layout.cc: Include "descriptors.h".
14372         (Layout::create_build_id): Use open_descriptor rather than open.
14373         * output.cc: Include "descriptors.h".
14374         (Output_file::open): Use open_descriptor rather than open.
14375         * archive.cc (Archive::const_iterator): Change Archive to be
14376         non-const.
14377         (Archive::begin, Archive::end): Make non-const.
14378         (Archive::count_members): Likewise.
14379         * archive.h (class Archive): Update declarations.
14380         * object.h (Object::read): Make non-const.
14381         * Makefile.am (CCFILES): Add descriptors.cc.
14382         (HFILES): Add descriptors.h.
14383         * Makefile.in: Rebuild.
14384
14385         PR 6716
14386         * gold.h: Always include <clocale>.  Add Solaris workarounds
14387         following code in binutils/sysdep.h.
14388
14389         PR 6048
14390         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14391         this->eh_frame_hdr_ is NULL before using it.
14392
14393         * dynobj.cc (Versions::Versions): Update comment.
14394
14395         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14396         the base version name.
14397
14398         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14399         array size plus one.
14400         (Stringpool_template::set_string_offsets): Subtract one from key
14401         before using it as an array index.
14402         (Stringpool_template::get_offset_with_length): Likewise.
14403         (Stringpool_template::write_to_buffer): Likewise.
14404         * stringpool.h (Stringpool_template::get_offset_from_key):
14405         Likewise.
14406
14407 2008-07-23  Ian Lance Taylor  <iant@google.com>
14408
14409         PR 6658
14410         * object.h (Merged_symbol_value::value): Do our best to handle a
14411         negative addend.
14412
14413         PR 6647
14414         * script.cc (Version_script_info::get_versions): Don't add empty
14415         version tag to return value.
14416         (Version_script_info::get_symbol_version_helper): Change return
14417         type to bool.  Add pversion parameter.  Change all callers.
14418         (script_register_vers_node): Don't require a non-NULL tag.
14419         * script.h (class Version_script_info): Update declarations.
14420         (Version_script_info::get_symbol_version): Change return type to
14421         bool.  Add version parameter.  Change all callers.
14422         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14423         handling.  Handle an empty version from a version script.
14424         (Symbol_table::define_special_symbol): Likewise.
14425         * testsuite/ver_test_10.script: New file.
14426         * testsuite/ver_test_10.sh: New file.
14427         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14428         (check_DATA): Add ver_test_10.syms.
14429         (ver_test_10.syms, ver_test_10.so): New target.
14430         * testsuite/Makefile.in: Rebuild.
14431
14432 2008-07-23  Simon Baldwin  <simonb@google.com>
14433
14434         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14435         to zero for undefined symbols from dynamic libraries.
14436
14437 2008-07-23  Ian Lance Taylor  <iant@google.com>
14438
14439         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14440         Change all callers.
14441         * symtab.h (class Symbol_table): Update declaration.
14442         * testsuite/ver_test_9.cc: New file.
14443         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14444         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14445         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14446         (ver_test_9.so, ver_test_9.o): New targets.
14447         * testsuite/Makefile.in: Rebuild.
14448
14449 2008-07-22  Ian Lance Taylor  <iant@google.com>
14450
14451         * options.h (class General_options): Define --check-sections.
14452         * layout.cc (Layout::set_segment_offsets): Handle
14453         --check-sections.
14454
14455         * options.h (class General_options): Define -n/--nmagic and
14456         -N/--omagic.
14457         * options.cc (General_options::finalize): For -n/--nmagic or
14458         -N/--omagic, set -static.
14459         * layout.cc (Layout::attach_allocated_section_to_segment): If
14460         -N/--omagic, don't put read-only and read-write sections in
14461         different segments.
14462         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14463         finding a read-only segment.
14464         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14465         don't set the minimum segment alignment to the common page size,
14466         and don't set the file offset to the address modulo the page size.
14467         * script-sections.cc (Script_sections::create_segments): If
14468         -n/--omagic, don't put read-only and read-write sections in
14469         different segments.
14470
14471         * cref.cc: New file.
14472         * cref.h: New file.
14473         * options.h (class General_options): Add --print-symbol-counts.
14474         * main.cc (main): Issue defined symbol report if requested.
14475         * archive.cc (Archive::interpret_header): Make into a const member
14476         function.
14477         (Archive::add_symbols): Call Input_objects::archive_start and
14478         archive_stop.
14479         (Archive::const_iterator): Define new class.
14480         (Archive::begin, Archive::end): New functions.
14481         (Archive::include_all_members): Rewrite to use iterator.
14482         (Archive::count_members): New function.
14483         * archive.h (class Archive): Update declarations.
14484         (Archive::filename): New function.
14485         * object.cc: Include "cref.h".
14486         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14487         (Sized_relobj::do_get_global_symbol_counts): New function.
14488         (Input_objects::add_object): Add object to cross-referencer.
14489         (Input_objects::archive_start): New function.
14490         (Input_objects::archive_stop): New function.
14491         (Input_objects::print_symbol_counts): New function.
14492         * object.h: Declare Cref and Archive.
14493         (Object::get_global_symbol_counts): New function.
14494         (Object::do_get_global_symbol_counts): New pure virtual function.
14495         (class Sized_relobj): Add defined_count_ field.  Update
14496         declarations.
14497         (class Input_objects): Add cref_ field.  Update constructor.
14498         Update declarations.
14499         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14500         defined_count_.
14501         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14502         symbol counts.
14503         (Sized_dynobj::do_get_global_symbol_counts): New function.
14504         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14505         defined_count_.  Update declarations.  Define Symbols typedef.
14506         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14507         parameter.  Change all callers.
14508         (Symbol_table::add_from_dynobj): Add sympointers and defined
14509         parameters.  Change all callers.
14510         * symtab.h (class Symbol_table): Update declarations.
14511         * Makefile.am (CCFILES): Add cref.cc.
14512         (HFILES): Add cref.h.
14513         * Makefile.in: Rebuild.
14514
14515 2008-07-22  Simon Baldwin  <simonb@google.com>
14516
14517         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14518         to zero when writing undefined symbols.
14519
14520 2008-07-22  Ian Lance Taylor  <iant@google.com>
14521
14522         * output.cc (Output_section::add_input_section): Don't try to
14523         merge empty merge sections.
14524
14525 2008-07-21  Craig Silverstein  <csilvers@google.com>
14526
14527         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14528         Include symbol version in error message.
14529
14530 2008-07-20  Chris Demetriou  <cgd@google.com>
14531
14532         * configure.ac (gold_cv_c_random_seed): New configured variable.
14533         (RANDOM_SEED_CFLAGS): New substituted variable.
14534         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14535         * configure: Rebuild.
14536         * Makefile.in: Likewise.
14537         * testsuite/Makefile.in: Likewise.
14538
14539 2008-07-18  Ian Lance Taylor  <iant@google.com>
14540
14541         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14542         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14543         * testsuite/ver_test_main.cc (main): Call t4.
14544         (t4, t4_2a): Define.
14545         * testsuite/ver_test_2.cc (t4_2): Define.
14546         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14547         * testsuite/ver_test_4.cc (t4_2a): Define.
14548         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14549         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14550
14551 2008-07-17  Ian Lance Taylor  <iant@google.com>
14552
14553         * dynobj.cc (Versions::add_def): If we give an error about a
14554         missing version, go ahead and create the version anyhow.
14555
14556 2008-07-10  Ian Lance Taylor  <iant@google.com>
14557
14558         Handle output sections with more than 0x7fffffff bytes.
14559         * object.h (class Relobj): Change map_to_output_ to
14560         output_sections_, and just keep a section pointer.  Change all
14561         uses.  Move comdat group support to Sized_relobj.
14562         (Relobj::is_section_specially_mapped): Remove.
14563         (Relobj::output_section): Remove poff parameter.  Change all
14564         callers.
14565         (Relobj::output_section_offset): New function.
14566         (Relobj::set_section_offset): Rewrite.
14567         (Relobj::map_to_output): Remove.
14568         (Relobj::output_sections): New function.
14569         (Relobj::do_output_section_offset): New pure virtual function.
14570         (Relobj::do_set_section_offset): Likewise.
14571         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14572         group support from Relobj.  Update declarations.
14573         (Sized_relobj::get_output_section_offset): New function.
14574         (Sized_relobj::do_output_section_offset): New function.
14575         (Sized_relobj::do_set_section_offset): New function.
14576         * object.cc (Relobj::output_section_address): Remove.
14577         (Sized_relobj::Sized_relobj): Initialize new fields.
14578         (Sized_relobj::include_section_group): Cast find_kept_object to
14579         Sized_relobj.
14580         (Sized_relobj::include_linkonce_section): Likewise.
14581         (Sized_relobj::do_layout): Use separate arrays for output section
14582         and output offset.
14583         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14584         output_sections.
14585         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14586         output_sections and section_offsets.
14587         (Sized_relobj::write_local_symbols): Likewise.
14588         (map_to_kept_section): Compute output address directly.
14589         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14590         output_sections and section_offsets.
14591         (Sized_relobj::write_sections): Likewise.
14592         (Sized_relobj::relocate_sections): Likewise.
14593         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14594         * output.h (class Output_reloc): Update declarations.  Change
14595         u2_.relobj to Sized_relobj*.
14596         (class Output_data_reloc): Change add functions to use
14597         Sized_relobj*.
14598         * output.cc (Output_reloc::Output_reloc): Change relobj to
14599         Sized_relobj*.
14600         (Output_reloc::local_section_offset): Change return type to
14601         Elf_Addr.  Use get_output_section_offset.
14602         (Output_reloc::get_address): Likewise.
14603         (Output_section::is_input_address_mapped): Don't call
14604         is_section_specially_mapped.
14605         (Output_section::output_offset): Likewise.
14606         (Output_section::output_address): Likewise.
14607         (Output_section::starting_output_address): Likewise.
14608         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14609         parameter to Sized_relobj*.
14610         (Copy_relocs::need_copy_reloc): Likewise.
14611         (Copy_relocs::save): Likewise.
14612         * copy-relocs.h (class Copy_relocs): Update declarations.
14613         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14614         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14615         * target-reloc.h (relocate_for_relocatable): Change
14616         offset_in_output_section type to Elf_Addr.  Change code that uses
14617         it as well.
14618         * layout.cc (Layout::layout): Always set *off.
14619         * mapfile.cc (Mapfile::print_input_section): Use
14620         output_section_offset.
14621         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14622         Sized_relobj*.
14623         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14624         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14625         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14626
14627 2008-07-03  Ian Lance Taylor  <iant@google.com>
14628
14629         * layout.cc (Layout::include_section): Do not discard unrecognized
14630         SHT_STRTAB sections.
14631
14632 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14633
14634         * script.cc (Lex::can_continue_name): Make '?' allowable in
14635         version-script names.
14636         * testsuite/version_script.map: Change glob pattern to use '?'
14637
14638 2008-06-30  Manish Singh  <yosh@gimp.org>
14639
14640         PR 6585
14641         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14642         Correct typo.
14643
14644 2008-06-30  Ian Lance Taylor  <iant@google.com>
14645
14646         PR 6660
14647         PR 6682
14648         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14649         versions]: Don't try to read the value in the contents, since we
14650         don't use it.  Use the template endianness when writing.
14651
14652 2008-06-25  Cary Coutant  <ccoutant@google.com>
14653
14654         * fileread.cc (File_read::make_view): Assert on zero-length view.
14655         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14656         symbol table when there are no symbols to read.
14657
14658 2008-06-23  Craig Silverstein  <csilvers@google.com>
14659
14660         * version.cc (version_string): Bump to 1.7
14661
14662 2008-06-18  Craig Silverstein  <csilvers@google.com>
14663
14664         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14665         constant 0xFFFF to type Valtype.
14666         (Powerpc_relocate_functions::rel16_ha): Likewise.
14667
14668 2008-06-17  Ian Lance Taylor  <iant@google.com>
14669
14670         * output.h (Output_section::Input_section): Initialize p2align_ to
14671         zero for Output_section_data constructors.
14672         (Output_section::Input_section::addralign): If not an input
14673         section, return the alignment of the Output_section_data.
14674         * testsuite/copy_test.cc: New file.
14675         * testsuite/copy_test_1.cc: New file.
14676         * testsuite/copy_test_2.cc: New file.
14677         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14678         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14679         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14680         (copy_test_1_pic.o, copy_test_1.so): New targets.
14681         (copy_test_2_pic.o, copy_test_2.so): New targets.
14682         * testsuite/Makefile.in: Rebuild.
14683
14684         * script-sections.cc (Script_sections::place_orphan): Initialize
14685         local variable exact.
14686
14687 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14688
14689         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14690
14691 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14692             David S. Miller  <davem@davemloft.net>
14693
14694         * powerpc.cc: New file.
14695         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14696         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14697         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14698         * Makefile.in: Rebuild.
14699
14700 2008-06-09  Ian Lance Taylor  <iant@google.com>
14701
14702         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14703         <exception>.
14704         (throwing, orig_terminate): New static variables.
14705         (terminate_handler): New static function.
14706         (t2): Set terminate handler.
14707
14708 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14709
14710         PR 6584
14711         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14712         alignment.
14713
14714 2008-05-30  Cary Coutant  <ccoutant@google.com>
14715
14716         * archive.cc (Archive::include_all_members) Correct to step
14717         over symbol table and extended name table in thin archives.
14718
14719 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14720
14721         PR 6407
14722         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14723         calculation.
14724
14725 2008-05-28  Caleb Howe  <cshowe@google.com>
14726
14727         * reduced_debug_output.cc: New file.
14728         * reduced_debug_output.h: New file.
14729         * options.h (class General_options): Add --strip-debug-non-line.
14730         * options.cc (General_options::finalize): Add strip_debug_non_line
14731         to the strip heirarchy.
14732         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14733         fields.
14734         * layout.cc: Include "reduced_debug_output.h".
14735         (Layout::Layout): Initialize new fields.
14736         (line_only_debug_sections): New static array.
14737         (is_lines_only_debug_sections): New static inline function.
14738         (Layout::include_section): Handle --strip-debug-non-line.
14739         (Layout::make_output_section): If --strip-debug-non-line, build
14740         new output sections for .debug_abbrev and .debug_info.
14741         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14742         gold.  Warn about possible overflow.
14743         (read_signed_LEB_128): Likewise.
14744         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14745         (read_signed_LEB_128): Declare.
14746         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14747         (HFILES): Add reduced_debug_output.h.
14748         * Makefile.in: Rebuild.
14749
14750 2008-05-21  Ian Lance Taylor  <iant@google.com>
14751
14752         * mapfile.cc: New file.
14753         * mapfile.h: New file.
14754         * options.h (class General_options): Add -M/--print-map and -Map.
14755         * options.cc (General_options::finalize): Make -M equivalent to
14756         -Map -.
14757         * main.cc: Include <cstdio> and "mapfile.h".
14758         (main): Open mapfile if requested.
14759         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14760         constructor.  Change caller.
14761         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14762         (queue_middle_tasks): Likewise.
14763         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14764         declarations.
14765         * archive.cc: Include "mapfile.h".
14766         (Archive::add_symbols): Add mapfile parameter.  Change all
14767         callers.  Pass mapfile, symbol, and reason to include_member.
14768         (Archive::include_all_members): Add mapfile parameter.  Change all
14769         callers.
14770         (Archive::include_member): Add mapfile, sym, and why parameters.
14771         Change all callers.  Report inclusion to map file.
14772         * archive.h: Include "fileread.h".
14773         (class Archive): Update declarations.
14774         (Archive::file): New const method.
14775         (class Add_archive_symbols): Add mapfile_ field.  Update
14776         constructor.  Change all callers.
14777         * readsyms.h (class Read_symbols): Likewise.
14778         (class Finish_group): Likewise.
14779         (class Read_script): Likewise.
14780         * common.cc: Include "mapfile.h".
14781         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14782         all callers.
14783         (Symbol_table::do_allocate_commons): Likewise.
14784         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14785         symbol allocation to mapfile.
14786         * common.h (class Allocate_commons_task): Add mapfile_ field.
14787         Update constructor.  Change all callers.
14788         * symtab.h (class Symbol_table): Update declarations.
14789         * layout.cc: Include "mapfile.h".
14790         (Layout_task_runner::run): Print information to mapfile.
14791         (Layout::create_gold_note): Change Output_data_fixed_space to
14792         Output_data_zero_fill.
14793         (Layout::create_build_id): Likewise.
14794         (Layout::print_to_mapfile): New function.
14795         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14796         constructor.  Change caller.
14797         (class Layout): Declare print_to_mapfile.
14798         * output.cc (Output_section::Input_section::print_to_mapfile): New
14799         function.
14800         (Output_section::add_input_section): If producing a map, always
14801         add to input_sections_ list.
14802         (Output_section::do_print_to_mapfile): New function.
14803         (Output_segment::print_sections_to_mapfile): New function.
14804         (Output_segment::print_section_list_to_mapfile): New function.
14805         * output.h: Include "mapfile.h".
14806         (Output_data::print_to_mapfile): New function.
14807         (Output_data::do_print_to_mapfile): New virtual function.
14808         (Output_segment_headers::do_print_to_mapfile): New function.
14809         (Output_file_header::do_print_to_mapfile): New function.
14810         (Output_data_const::do_print_to_mapfile): New function.
14811         (class Output_data_const_buffer): Add map_name_ field.  Update
14812         constructor.  Change all callers.  Add do_print_to_mapfile
14813         function.
14814         (class Output_data_fixed_space): Likewise.
14815         (class Output_data_space): Likewise.
14816         (class Output_data_zero_fill): New class.
14817         (Output_data_strtab::do_print_to_mapfile): New function.
14818         (Output_data_reloc_base::do_print_to_mapfile): New function.
14819         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14820         (Output_data_group::do_print_to_mapfile): New function.
14821         (Output_data_got::do_print_to_mapfile): New function.
14822         (Output_data_dynamic::do_print_to_mapfile): New function.
14823         (Output_symtab_xindex::do_print_to_mapfile): New function.
14824         (class Output_section): Declare do_print_to_mapflie.  Declare
14825         print_to_mapfile in Input_section.
14826         (class Output_segment): Declare new functions.
14827         * object.h (Sized_relobj::symbol_count): New function.
14828         * script-sections.cc
14829         (Output_section_element_dot_assignment::set_section_addresses):
14830         Change Output_data_fixed_space to Output_data_zero_fill.
14831         (Output_data_expression::do_print_to_mapfile): New function.
14832         * script.cc (read_input_script): Add mapfile parameter.  Change
14833         all callers.
14834         * script.h (read_input_script): Update declaration.
14835         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14836         (Eh_frame::do_print_to_mapfile): New function.
14837         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14838         (Output_merge_string::do_print_to_mapfile): New function.
14839         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14840         function.
14841         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14842         function.
14843         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14844         function.
14845         * Makefile.am (CCFILES): Add mapfile.cc.
14846         (HFILES): Add mapfile.h.
14847         * Makefile.in: Rebuild.
14848
14849 2008-05-19  Ian Lance Taylor  <iant@google.com>
14850
14851         * options.h (class General_options): Add -z relro.
14852         * layout.cc (Layout::Layout): Initialize relro_segment_.
14853         (Layout::add_output_section_data): Return the output section.
14854         (Layout::make_output_section): Rcognize relro sections and mark
14855         them appropriately.
14856         (Layout::attach_allocated_section_to_segment): Put relro sections
14857         in a PT_GNU_RELRO segment.
14858         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14859         section as relro.
14860         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14861         PT_TLS segments.
14862         (Layout::linkonce_mapping): Map d.rel.ro.local to
14863         .data.rel.ro.local.
14864         (Layout::output_section_name): Us .data.rel.ro.local for any
14865         section which begins with that.
14866         * layout.h (class Layout): Update add_output_section_data
14867         declaration.  Add relro_segment_ field.
14868         * output.cc (Output_section::Output_section): Initialize is_relro_
14869         and is_relro_local_ fields.
14870         (Output_segment::add_output_section): Group relro sections.
14871         (Output_segment::is_first_section_relro): New function.
14872         (Output_segment::maximum_alignment): If there is a relro section,
14873         align the segment to the common page size.
14874         (Output_segment::set_section_addresses): Track whether we are
14875         looking at relro sections.  If the last section is a relro
14876         section, align to the common page size.
14877         (Output_segment::set_section_list_addresses): Add in_relro
14878         parameter.  Change all callers.  Align to the page size when
14879         moving from relro to non-relro section.
14880         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14881         segment.
14882         * output.h (class Output_section): Add is_relro_ and
14883         is_relro_local_ fields.
14884         (Output_section::is_relro): New function.
14885         (Output_section::set_is_relro): New function.
14886         (Output_section::is_relro_local): New function.
14887         (Output_section::set_is_relro_local): New function.
14888         (class Output_segment): Update declarations.
14889         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14890         * sparc.cc (Target_sparc::got_section): Likewise.
14891         * x86_64.cc (Target_x86_64::got_section): Likewise.
14892         * testsuite/relro_test_main.cc: New file.
14893         * testsuite/relro_test.cc: New file.
14894         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14895         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14896         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14897         (relro_test.so, relro_test_pic.o): New targets.
14898         * testsuite/Makefile.in: Rebuild.
14899
14900 2008-05-16  Ian Lance Taylor  <iant@google.com>
14901
14902         * output.cc (Output_segment::add_output_section): Remove front
14903         parameter.
14904         * output.h (class Output_segment): Remove
14905         add_initial_output_section and overloaded add_output_section.
14906         Update declaration of remaining add_output_section.
14907         * layout.cc (Layout::create_interp): Call add_output_section
14908         rather than add_initial_output_section.
14909         (Layout::finish_dynamic_section): Likewise.
14910
14911         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14912         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14913         know the dynamic type.
14914         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14915         field.  Initialize it in constructor.
14916         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14917         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14918         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14919         reloc.
14920
14921         * output.cc (Output_reloc::get_address): Change return type to
14922         Elf_Addr.
14923         * output.h (class Output_reloc): Update get_address declaration.
14924         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14925         for section addresses.
14926
14927 2008-05-09  Ian Lance Taylor  <iant@google.com>
14928
14929         PR 6493
14930         * gold.cc (gold_nomem): Use return value of write.
14931
14932 2008-05-08  Ian Lance Taylor  <iant@google.com>
14933
14934         * symtab.c (Symbol::init_base_output_data): Add version
14935         parameter.  Change all callers.
14936         (Symbol::init_base_output_segment): Likewise.
14937         (Symbol::init_base_constant): Likewise.
14938         (Symbol::init_base_undefined): Likewise.
14939         (Sized_symbol::init_output_data): Likewise.
14940         (Sized_symbol::init_output_segment): Likewise.
14941         (Sized_symbol::init_constant): Likewise.
14942         (Sized_symbol::init_undefined): Likewise.
14943         (Symbol_table::do_define_in_output_data): If the new symbol has a
14944         version, mark it as the default.
14945         (Symbol_table::do_define_in_output_segment): Likewise.
14946         (Symbol_table::do_define_as_constant): Likewise.
14947         * symtab.h (class Symbol): Update declarations.
14948         (class Sized_symbol): Likewise.
14949         * resolve.cc (Symbol::override_version): New function.
14950         (Symbol::override_base): Call override_version.
14951         (Symbol::override_base_with_special): Likewise.
14952         * testsuite/ver_script_8.script: New file.
14953         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14954         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14955         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14956         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14957
14958 2008-05-06  Ian Lance Taylor  <iant@google.com>
14959
14960         PR 6049
14961         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14962         functions.
14963         (class General_options): Remove existing --undefined, and add
14964         --no-undefined instead.  Add new --undefined as synonym for -u.
14965         * archive.cc (Archive::add_symbols): Check whether symbol was
14966         named with -u.
14967         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14968         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14969         all uses.  Add IS_UNDEFINED.  Update declarations to split
14970         different versions of init_base.  Declare init_base_undefined.
14971         (Symbol::is_defined): Handle IS_UNDEFINED.
14972         (Symbol::is_undefined): Likewise.
14973         (Symbol::is_weak_undefined): Call is_undefined.
14974         (Symbol::is_absolute): Handle IS_CONSTANT.
14975         (class Sized_symbol): Update declarations to split different
14976         versions of init.  Declare init_undefined.
14977         (class Symbol_table): Declare new functions.
14978         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14979         Change all callers.
14980         (Symbol::init_base_output_data): Likewise.
14981         (Symbol::init_base_output_segment): Likewise.
14982         (Symbol::init_base_constant): Likewise.
14983         (Symbol::init_base_undefined): New function.
14984         (Sized_symbol::init_object): Rename from init.  Change all
14985         callers.
14986         (Sized_symbol::init_output_data): Likewise.
14987         (Sized_symbol::init_output_segment): Likewise.
14988         (Sized_symbol::init_constant): Likewise.
14989         (Sized_symbol::init_undefined): New function.
14990         (Symbol_table::add_undefined_symbols_from_command_line): New
14991         function.
14992         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14993         function.
14994         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14995         (Symbol::output_section): Likewise.
14996         (Symbol::set_output_section): Likewise.
14997         (Symbol_table::sized_finalize_symbol): Likewise.
14998         (Symbol_table::sized_write_globals): Likewise.
14999         * resolve.cc (Symbol_table::should_override): Likewise.
15000         (Symbol::override_base_with_special): Likewise.
15001
15002         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
15003         symbol, change it to have default visibility.
15004         * testsuite/protected_1.cc: New file.
15005         * testsuite/protected_2.cc: New file.
15006         * testsuite/protected_3.cc: New file.
15007         * testsuite/protected_main_1.cc: New file.
15008         * testsuite/protected_main_2.cc: New file.
15009         * testsuite/protected_main_3.cc: New file.
15010         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15011         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15012         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15013         (protected_1.so): New target.
15014         (protected_1_pic.o, protected_2_pic.o): New targets.
15015         (protected_3_pic.o): New target.
15016         (check_PROGRAMS): Add protected_2.
15017         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15018         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15019         * testsuite/Makefile.in: Rebuild.
15020
15021         * options.h (DEFINE_var): Add set_user_set_##varname__.
15022         (DEFINE_bool_alias): New macro.
15023         (class General_options): Define -Bstatic using DEFINE_bool_alias
15024         rather than DEFINE_special.  Add --undefined as an alias for -z
15025         defs.
15026         * options.cc (General_options::parse_Bstatic): Remove.
15027
15028         * options.h (class General_options): Add --fatal-warnings.
15029         * main.cc (main): Implement --fatal-warnings.
15030         * errors.h (Errors::warning_count): New function.
15031
15032         * options.h (class General_options): Add -Bsymbolic-functions.
15033         * symtab.h (Symbol::is_preemptible): Check for
15034         -Bsymbolic-functions.
15035
15036 2008-05-05  Ian Lance Taylor  <iant@google.com>
15037
15038         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15039         as noVARNAME rather than no-VARNAME.
15040         (class General_options): Add option -z combreloc.
15041         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15042         get_address.
15043         (Output_reloc::sort_before) [SHT_REL]: New function.
15044         (Output_reloc::sort_before) [SHT_RELA]: New function.
15045         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15046         Sort_relocs_comparison.
15047         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15048         parameter.  Change all callers.
15049         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15050         sort_relocs parameter.  Change all callers.
15051         * output.cc (Output_reloc::get_address): New function, broken out
15052         of write_rel.
15053         (Output_reloc::write_rel): Call it.
15054         (Output_reloc::compare): New function.
15055         (Output_data_reloc_base::do_write): Optionally sort relocs.
15056
15057         * configure.ac: If targ_extra_obj is set, link it in.
15058         * configure.tgt: Initialize all variables.
15059         (x86_64*): Set targ_extra_obj and targ_extra_size.
15060         * configure: Rebuild.
15061
15062         * object.cc (Sized_relobj::include_section_group): Adjust section
15063         indexes read from group data.  Build vector to pass to
15064         layout_group.
15065         * layout.cc (Layout::layout_group): Add flags and shndxes
15066         parameters.  Remove contents parameter.  Change caller.  Update
15067         explicit instantiations.
15068         * layout.h (class Layout): Update layout_group declaration.
15069         * output.cc (Output_data_group::Output_data_group): Add flags and
15070         input_shndxes parameters.  Remove contents parameter.  Change
15071         caller.
15072         (Output_data_group::do_write): Change input_sections_ to
15073         input_shndxes_.
15074         * output.h (class Output_data_group): Update constructor
15075         declaration.  Rename input_sections_ to input_shndxes_.
15076         * testsuite/many_sections_test.cc: Add template.
15077
15078 2008-04-30  Cary Coutant  <ccoutant@google.com>
15079
15080         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15081
15082         * layout.cc (Layout::include_section): Refactored check for debug
15083         info section.
15084         (Layout::add_comdat): Add new parameters.  Change type
15085         of signature parameter.  Add object and shndx to signatures table.
15086         (Layout::find_kept_object): New function.
15087         * layout.h: Include <cstring>.
15088         (Layout::is_debug_info_section): New function.
15089         (Layout::add_comdat): Add new parameters.
15090         (Layout::find_kept_object): New function.
15091         (Layout::Kept_section): New struct.
15092         (Layout::Signatures): Change type of map range.
15093         * object.cc (Relobj::output_section_address): New function.
15094         (Sized_relobj::include_section_group): Add new parameters.  Change
15095         calls to Layout::add_comdat.  Change to build table of kept comdat
15096         groups and table mapping discarded sections to kept sections.
15097         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15098         (Sized_relobj::do_layout): Change calls to include_section_group and
15099         include_linkonce_section.
15100         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15101         value to zero when section is discarded.
15102         (Sized_relobj::map_to_kept_section): New function.
15103         * object.h (Relobj::output_section_address): New function.
15104         (Relobj::Comdat_group): New type.
15105         (Relobj::find_comdat_group): New function.
15106         (Relobj::Comdat_group_table): New type.
15107         (Relobj::Kept_comdat_section): New type.
15108         (Relobj::Kept_comdat_section_table): New type.
15109         (Relobj::add_comdat_group): New function.
15110         (Relobj::set_kept_comdat_section): New function.
15111         (Relobj::get_kept_comdat_section): New function.
15112         (Relobj::comdat_groups_): New field.
15113         (Relobj::kept_comdat_sections_): New field.
15114         (Symbol_value::input_value): Update comment.
15115         (Sized_relobj::map_to_kept_section) New function.
15116         (Sized_relobj::include_linkonce_section): Add new parameter.
15117         * target-reloc.h (Comdat_behavior): New type.
15118         (get_comdat_behavior): New function.
15119         (relocate_section): Add code to map a discarded section to the
15120         corresponding kept section when applying a relocation.
15121
15122 2008-04-30  Craig Silverstein  <csilvers@google.com>
15123
15124         * dwarf_reader.cc (next_generation_count): New static var.
15125         (Addr2line_cache_entry): New struct.
15126         (addr2line_cache): New static var.
15127         (Dwarf_line_info::one_addr2line): Added caching.
15128         (Dwarf_line_info::clear_addr2line_cache): New function.
15129         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15130         cache-size parameter.
15131         (Dwarf_line_info::one_addr2line_cache): New function.
15132         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15133         new cache-size argument to one_addr2line(), and clear cache.
15134
15135 2008-04-28  Cary Coutant  <ccoutant@google.com>
15136
15137         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15138         R_386_PC8 relocations.
15139
15140 2008-04-23  Ian Lance Taylor  <iant@google.com>
15141
15142         * object.cc (Sized_relobj::include_section_group): Check for
15143         invalid section group.
15144
15145         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15146         header size.
15147
15148         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15149         than read for file header.
15150         * archive.cc (Archive::include_member): Likewise.
15151
15152 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15153
15154         * aclocal.m4: Regenerate.
15155         * configure: Regenerate.
15156
15157 2008-04-19  Ian Lance Taylor  <iant@google.com>
15158
15159         * version.cc (version_string): Bump to 1.6.
15160
15161         * testsuite/Makefile.am (many_sections_r_test): New target.
15162         (many_sections_r_test_SOURCES): Remove.
15163         (many_sections_r_test_DEPENDENCIES): Remove.
15164         (many_sections_r_test_LDFLAGS): Remove.
15165         (many_sections_r_test_LDADD): Remove.
15166
15167         * object.cc (Sized_relobj::do_add_symbols): Always pass
15168         local_symbol_count_ to add_from_relobj.
15169
15170         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15171         every thousand variables.
15172         * testsuite/Makefile.in: Rebuild.
15173
15174         * object.cc (Xindex::initialize_symtab_xindex): New function.
15175         (Xindex::read_symtab_xindex): New function.
15176         (Xindex::sym_xindex_to_shndx): New function.
15177         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15178         available.
15179         (Sized_relobj::do_initialize_xindex): New function.
15180         (Sized_relobj::do_read_symbols): Adjust section links.
15181         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15182         parameter.  Change all callers.
15183         (Sized_relobj::include_section_group): Adjust section links and
15184         symbol section indexes.
15185         (Sized_relobj::do_layout): Adjust section links.
15186         (Sized_relobj::do_count_local_symbols): Adjust section links and
15187         symbol section indexes.
15188         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15189         ordinary and special symbols.
15190         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15191         dynsym_xindex parameters.  Change all callers.  Adjust section
15192         links.  Use SHN_XINDEX when needed.
15193         (Sized_relobj::get_symbol_location_info): Adjust section links.
15194         Don't get fooled by special symbols.
15195         * object.h (class Xindex): Define.
15196         (class Object): Add xindex_ parameter.  Declare virtual functoin
15197         do_initialize_xindex.
15198         (Object::adjust_sym_shndx): New function.
15199         (Object::set_xindex): New protected function.
15200         (class Symbol_value): Add is_ordinary_shndx_ field.
15201         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15202         (Symbol_value::value): Assert ordinary section.
15203         (Symbol_value::initialize_input_to_output_map): Likewise.
15204         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15205         Change all callers.
15206         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15207         all callers.
15208         (class Sized_relobj): Update declarations.
15209         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15210         parameter.  Change all callers.
15211         (Sized_relobj::adjust_shndx): New function.
15212         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15213         field.
15214         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15215         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15216         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15217         (Sized_dynobj::read_dynsym_section): Adjust section links.
15218         (Sized_dynobj::read_dynamic): Likewise.
15219         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15220         section links.
15221         (Sized_dynobj::do_initialize_xindex): New function.
15222         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15223         do_initialize_xindex.
15224         (Sized_dynobj::adjust_shndx): New function.
15225         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15226         dynsym_xindex_ fields.
15227         (Layout::finalize): Add a call to set_section_indexes before
15228         creating the symtab sections.
15229         (Layout::set_section_indexes): Don't do anything if the section
15230         already has a section index.
15231         (Layout::create_symtab_sections): Add shnum parameter.  Change
15232         caller.  Create .symtab_shndx section if needed.
15233         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15234         caller.
15235         (Layout::allocated_output_section_count): New function.
15236         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15237         needed.
15238         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15239         fields.  Update declarations.
15240         (Layout::symtab_xindex): New function.
15241         (Layout::dynsym_xindex): New function.
15242         (class Write_symbols_task): Add layout_ field.
15243         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15244         Change caller.
15245         * output.cc (Output_section_headers::Output_section_headers): Add
15246         shstrtab_section parameter.  Change all callers.
15247         (Output_section_headers::do_sized_write): Store overflow values
15248         for section count and section string table section index in
15249         section header zero.
15250         (Output_file_header::do_sized_write): Check for overflow of
15251         section count and section string table section index.
15252         (Output_symtab_xindex::do_write): New function.
15253         (Output_symtab_xindex::endian_do_write): New function.
15254         * output.h (class Output_section_headers): Add shstrtab_section_.
15255         Update declarations.
15256         (class Output_symtab_xindex): Define.
15257         (Output_section::has_out_shndx): New function.
15258         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15259         field.
15260         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15261         Change all callers.
15262         (Sized_symbol::init): Likewise.
15263         (Symbol::output_section): Check for ordinary symbol.
15264         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15265         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15266         callers.
15267         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15268         Change all callers.  Simplify handling of symbols from sections
15269         not included in the link.
15270         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15271         distinction.
15272         (Weak_alias_sorter::operator()): Assert that symbols are
15273         ordinary.
15274         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15275         distinction.
15276         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15277         parameters.  Change all callers.
15278         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15279         symbol distinction.  Use SHN_XINDEX when needed.
15280         (Symbol_table::write_section_symbol): Add symtab_xindex
15281         parameter.  Change all callers.
15282         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15283         SHN_XINDEX when needed.
15284         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15285         declarations.
15286         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15287         (Symbol::is_defined): Check is_ordinary.
15288         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15289         (Symbol::is_absolute, Symbol::is_common): Likewise.
15290         (class Sized_symbol): Update declarations.
15291         (class Symbol_table): Update declarations.
15292         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15293         parameters.  Change all callers.
15294         (Sized_symbol::override): Likewise.
15295         (Symbol_table::override): Likewise.
15296         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15297         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15298         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15299         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15300         to be in an ordinary section.
15301         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15302         object and is_ordinary parameters.  Change all callers.
15303         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15304         Change all callers.  Don't add undefined or non-ordinary symbols
15305         to reloc_map_.
15306         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15307         Change all callers.
15308         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15309         declarations.
15310         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15311         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15312         (Sized_relobj::relocate_sections): Likewise.
15313         * target-reloc.h (scan_relocs): Adjust section symbol index.
15314         (scan_relocatable_relocs): Likewise.
15315         * i386.cc (Scan::local): Check for ordinary symbols.
15316         * sparc.cc (Scan::local): Likewise.
15317         * x86_64.cc (Scan::local): Likewise.
15318         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15319         to symbol_section_and_value.
15320         * testsuite/many_sections_test.cc: New file.
15321         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15322         (check_PROGRAMS): Add many_sections_test.
15323         (many_sections_test_SOURCES): Define.
15324         (many_sections_test_DEPENDENCIES): Define.
15325         (many_sections_test_LDFLAGS): Define.
15326         (BUILT_SOURCES): Add many_sections_define.h.
15327         (many_sections_define.h): New target.
15328         (BUILT_SOURCES): Add many_sections_check.h.
15329         (many_sections_check.h): New target.
15330         (check_PROGRAMS): Add many_sections_r_test.
15331         (many_sections_r_test_SOURCES): Define.
15332         (many_sections_r_test_DEPENDENCIES): Define.
15333         (many_sections_r_test_LDFLAGS): Define.
15334         (many_sections_r_test_LDADD): Define.
15335         (many_sections_r_test.o): New target.
15336         * testsuite/Makefile.in: Rebuild.
15337
15338 2008-04-17  Cary Coutant  <ccoutant@google.com>
15339
15340         * errors.cc (Errors::info): New function.
15341         (gold_info): New function.
15342         * errors.h (Errors::info): New function.
15343         * gold.h (gold_info): New function.
15344         * object.cc (Input_objects::add_object): Print trace output.
15345         * options.cc (options::parse_set): New function.
15346         (General_options::parse_wrap): Deleted.
15347         (General_options::General_options): Deleted initializer.
15348         * options.h (options::String_set): New typedef.
15349         (options::parse_set): New function.
15350         (DEFINE_set): New macro.
15351         (General_options::wrap): Changed to use DEFINE_set. Changed
15352         callers of any_wrap_symbols and is_wrap_symbol.
15353         (General_options::trace, General_options::trace_symbol):
15354         New options.
15355         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15356         (General_options::wrap_symbols_): Deleted.
15357         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15358
15359 2008-04-17  David S. Miller  <davem@davemloft.net>
15360
15361         * options.cc (General_options::parse_V): New function.
15362         * options.h: Add entries for -V and -Qy.
15363
15364 2008-04-17  Ian Lance Taylor  <iant@google.com>
15365
15366         * common.cc (Symbol_table::allocate_commons): Remove options
15367         parameter.  Change caller.
15368         (Symbol_table::do_allocate_commons): Remove options parameter.
15369         Change caller.  Just call do_allocate_commons_list twice.
15370         (Symbol_table::do_allocate_commons_list): New function, broken out
15371         of do_allocate_commons.
15372         * common.h (class Allocate_commons_task): Remove options_ field.
15373         Update constructor.
15374         * symtab.cc (Symbol_table::Symbol_table): Initialize
15375         tls_commons_.
15376         (Symbol_table::add_from_object): Put TLS common symbols on
15377         tls_commons_ list.
15378         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15379         which are IN_OUTPUT_DATA.
15380         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15381         allocate_commons and do_allocate_commons declarations.  Declare
15382         do_allocate_commons_list.
15383         * gold.cc (queue_middle_tasks): Update creation of
15384         Allocate_commons_task to not pass options.
15385         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15386         (TLS_TEST_C_FLAGS): New variable.
15387         (tls_test_c_pic.o): New target.
15388         (tls_test_shared.so): Link in tls_test_c_pic.o.
15389         (tls_test_c_pic_ie.o): New target.
15390         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15391         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15392         (tls_test_c.o): New target.
15393         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15394         (tls_pic_test_LDADD): Likewise.
15395         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15396         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15397         (tls_test_c_gnu2.o): New target.
15398         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15399         tls_test_c_gnu2.o.
15400         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15401         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15402         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15403         * testsuite/tls_test.cc: Include "config.h".
15404         (t_last): Call t11_last.
15405         * testsuite/tls_test.h (t11, t11_last): Declare.
15406         * testsuite/tls_test_c.c: New file.
15407         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15408         * configure.ac: Check for OpenMP support.
15409         * configure, config.in, Makefile.in: Rebuild.
15410         * testsuite/Makefile.in: Rebuild.
15411
15412 2008-04-16  Cary Coutant  <ccoutant@google.com>
15413
15414         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15415         (Target_i386::tls_base_symbol_defined_): New field.
15416         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15417         (Target_i386::Scan::global): Likewise.
15418         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15419         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15420         (Target_x86_64::tls_base_symbol_defined_): New field.
15421         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15422         (Target_x86_64::Scan::global): Likewise.
15423
15424 2008-04-16  Cary Coutant  <ccoutant@google.com>
15425
15426         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15427         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15428         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15429         building shared libraries.
15430         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15431         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15432         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15433         * testsuite/Makefile.in: Rebuild.
15434         * testsuite/weak_undef.h: New file.
15435         * testsuite/weak_undef_file1.cc: Add extra test cases.
15436         * testsuite/weak_undef_file2.cc: Likewise.
15437         * testsuite/weak_undef_test.cc: Likewise.
15438
15439 2008-04-16  David S. Miller  <davem@davemloft.net>
15440
15441         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15442         Add issued_non_pic_error_ field.  Declare check_non_pic.
15443         (Target_sparc::Scan::check_non_pic): New function.
15444         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15445         (Target_sparc::Scan::global): Likewise.
15446
15447         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15448         * configure: Rebuild.
15449
15450         * options.h (DEFINE_enable): New macro.
15451         (new_dtags): New enable option.
15452         (initfirst, interpose, loadfltr, nodefaultlib,
15453         nodelete, nodlopen, nodump): New -z options.
15454         * layout.cc (Layout:finish_dynamic_section): If new
15455         dtags enabled, emit DT_RUNPATH.  Also, emit a
15456         DT_FLAGS_1 containing any specified -z flags.
15457
15458 2008-04-16  Ian Lance Taylor  <iant@google.com>
15459
15460         * copy-relocs.cc: New file.
15461         * copy-relocs.h: New file.
15462         * reloc.cc: Remove Copy_relocs code.
15463         * reloc.h: Likewise.
15464         * reloc-types.h (struct Reloc_types) [both versions]: Add
15465         get_reloc_addend_noerror.
15466         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15467         variants of add_global which take an addend which must be zero.
15468         * i386.cc: Include "copy-relocs.h".
15469         (class Target_i386): Change type of copy_relocs_ to variable,
15470         update initializer.
15471         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15472         Change all callers.
15473         (Target_i386::do_finalize_sections): Change handling of
15474         copy_relocs_.
15475         * sparc.cc: Include "copy-relocs.h".
15476         (class Target_sparc): Change type of copy_relocs_ to variable,
15477         update initializer.
15478         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15479         Change all callers.
15480         (Target_sparc::do_finalize_sections): Change handling of
15481         copy_relocs_.
15482         * x86_64.cc: Include "copy-relocs.h".
15483         (class Target_x86_64): Change type of copy_relocs_ to variable,
15484         update initializer.
15485         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15486         class.  Change all callers.
15487         (Target_x86_64::do_finalize_sections): Change handling of
15488         copy_relocs_.
15489         * Makefile.am (CCFILES): Add copy-relocs.cc.
15490         (HFILES): Add copy-relocs.h.
15491
15492         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15493
15494         * testsuite/script_test_4.sh: Permit leading zeroes.
15495
15496 2008-04-15  Ian Lance Taylor  <iant@google.com>
15497
15498         * script-sections.cc (Script_sections::create_segments): Use
15499         header_size_adjustment even when there is enough room for the
15500         headers.
15501         * testsuite/script_test_4.sh: New file.
15502         * testsuite/script_test_4.t: New file.
15503         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15504         (check_DATA): Add script_test_4.stdout.
15505         (MOSTLYCLEANFILES): Likewise.
15506         (script_test_4): New target.
15507         (script_test_4.stdout): New target.
15508         * testsuite/Makefile.in: Rebuild.
15509
15510         * sparc.cc: Add definitions for Output_data_plt_sparc class
15511         constants.
15512
15513 2008-04-14  David S. Miller  <davem@davemloft.net>
15514
15515         * sparc.cc: New file.
15516         * Makefile.am (TARGETSOURCES): Add sparc.cc
15517         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15518         * configure.tgt: Document targ_extra_size and
15519         targ_extra_big_endian.  Add entries for sparc-* and
15520         sparc64-*.
15521         * configure.ac: Handle targ_extra_size and
15522         targ_extra_big_endian.
15523         * Makefile.in: Rebuild.
15524         * configure: Likewise.
15525         * po/POTFILES.in: Likewise.
15526         * po/gold.pot: Likewise.
15527
15528 2008-04-14  Ian Lance Taylor  <iant@google.com>
15529
15530         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15531         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15532         in the name/type/flags to section mapping.  Don't call
15533         allocate_output_section.
15534         (Layout::choose_output_section): Change parameter from adjust_name
15535         to is_input_section.  Don't permit input sections after sections
15536         are attached to segments.  Don't call allocate_output_section.
15537         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15538         not write_enable_output_section.
15539         (Layout::make_output_section): Don't push to
15540         unattached_section_list_ nor call attach_to_segment.  Call
15541         attach_section_to_segment if sections are attached.
15542         (Layout::attach_sections_to_segments): New function.
15543         (Layout::attach_section_to_segment): New function.
15544         (Layout::attach_allocated_section_to_segment): Rename from
15545         attach_to_segment.  Remove flags parameter.
15546         (Layout::allocate_output_section): Remove function.
15547         (Layout::write_enable_output_section): Remove function.
15548         * layout.h (class Layout): Update for above changes.  Add new
15549         field sections_are_attached_.
15550         * output.h (Output_section::update_flags_for_input_section): New
15551         function.
15552         * output.cc (Output_section::add_input_section): Call
15553         update_flags_for_input_section.
15554         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15555
15556 2008-04-11  Cary Coutant  <ccoutant@google.com>
15557
15558         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15559         thought unnecessary.
15560         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15561
15562 2008-04-11  Ian Lance Taylor  <iant@google.com>
15563
15564         * output.h (class Output_section_data): Remove inline definition
15565         of set_addralign.
15566         * output.cc (Output_section_data::set_addralign): New function.
15567
15568 2008-04-11  Cary Coutant  <ccoutant@google.com>
15569
15570         Add support for TLS descriptors for i386 and x86_64.
15571         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15572         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15573         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15574         GOT_TYPE_TLS_DESC.
15575         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15576         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15577         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15578         relocations.
15579         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15580         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15581         Fix problem with initial-exec relocations.
15582         (Target_i386::Relocate::relocate_tls): Likewise.
15583         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15584         relaxation.
15585         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15586         support for section-plus-offset dynamic table entries.
15587         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15588         (Output_data_dynamic::Dynamic_entry): Add support for
15589         section-plus-offset dynamic table entries.
15590         (Output_data_dynamic::Classification): Likewise.
15591         (Output_data_dynamic::classification_): Renamed offset_.
15592         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15593         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15594         (Target_x86_64::make_plt_section): New function.
15595         (Target_x86_64::reserve_tlsdesc_entries): New function.
15596         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15597         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15598         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15599         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15600         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15601         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15602         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15603         add extra PLT entry for TLS descriptors.
15604         (Output_data_plt_x86_64::got_): New field.
15605         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15606         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15607         fields.
15608         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15609         descriptors.
15610         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15611         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15612         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15613         R_386_TLS_DESC_CALL relocations.
15614         (Target_x86_64::Scan::global): Likewise.
15615         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15616         for TLS descriptors.
15617         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15618         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15619         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15620         GD-to-IE relaxation.
15621         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15622         and TLS_DESCRIPTORS.
15623         * Makefile.in: Rebuild.
15624         * configure: Rebuild.
15625         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15626         (tls_test_shared2.so): New target.
15627         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15628         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15629         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15630         (tls_shared_gd_to_ie_test_LDADD): New variable.
15631         (tls_shared_gnu2_gd_to_ie_test): New target.
15632         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15633         New targets.
15634         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15635         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15636         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15637         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15638         (tls_shared_gnu2_test): New target.
15639         (tls_test_gnu2_shared.so): New target.
15640         (tls_shared_gnu2_test_SOURCES): New variable.
15641         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15642         (tls_shared_gnu2_test_LDFLAGS): New variable.
15643         (tls_shared_gnu2_test_LDADD): New variable.
15644         * testsuite/Makefile.in: Rebuild.
15645         * testsuite/Makefile.
15646
15647 2008-04-11  Ian Lance Taylor  <iant@google.com>
15648
15649         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15650         justsyms.t.
15651         * testsuite/Makefile.in: Rebuild.
15652
15653         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15654         long.
15655         * testsuite/script_test_2.cc (main): Adjust test.
15656
15657 2008-04-11  David S. Miller  <davem@davemloft.net>
15658             Ian Lance Taylor  <iant@google.com>
15659
15660         * options.h (General_options): Add entries for '-Y' and
15661         '-relax'.
15662         * options.cc (General_options:finalize): If -Y was used, add those
15663         entries to the library path instead of the default "/lib" and
15664         "/usr/lib".
15665
15666 2008-04-11  David S. Miller  <davem@davemloft.net>
15667
15668         * testsuite/justsyms.t: Start at 0x100.
15669         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15670         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15671         long.
15672         * testsuite/script_test_2.cc: Adjust string and section length
15673         checks.
15674
15675 2008-04-09  Ian Lance Taylor  <iant@google.com>
15676
15677         PR gold/5996
15678         * script-sections.cc (Sections_element::allocate_to_segment): Add
15679         orphan parameter.
15680         (Output_section_definition::allocate_to_segment): Likewise.
15681         (Orphan_output_section::allocate_to_segment): Likewise.
15682         (Script_sections::attach_sections_using_phdrs_clause): Don't
15683         propagate non-PT_LOAD segments to orphan sections.
15684         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15685         readelf rather than objdump.
15686         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15687         .interp section and PT_INTERP segment are the same size.
15688         * testsuite/Makefile.in: Rebuild.
15689
15690         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15691         aliases for symbols defined in the same object.
15692         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15693         (weak_alias_test_SOURCES): New variable.
15694         (weak_alias_test_DEPENDENCIES): New variable.
15695         (weak_alias_test_LDFLAGS): New variable.
15696         (weak_alias_test_LDADD): New variable.
15697         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15698         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15699         (weak_alias_test_3.o): New target.
15700         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15701         * testsuite/weak_alias_test_main.cc: New file.
15702         * testsuite/weak_alias_test_1.cc: New file.
15703         * testsuite/weak_alias_test_2.cc: New file.
15704         * testsuite/weak_alias_test_3.cc: New file.
15705
15706 2008-04-08  Ian Lance Taylor  <iant@google.com>
15707
15708         * options.h (class General_options): Add --noinhibit-exec option.
15709         * main.cc (main): Check --noinhibit-exec.
15710
15711         * options.h (class General_options): Define --wrap as a special
15712         option.  Add wrap_symbols_ field.
15713         (General_options::any_wrap_symbols): New function.
15714         (General_options::is_wrap_symbol): New function.
15715         * options.cc (General_options::parse_wrap): New function.
15716         (General_options::General_options): Initialize wrap_symbols_.
15717         * symtab.cc (Symbol_table::wrap_symbol): New function.
15718         (Symbol_table::add_from_object): Handle --wrap.
15719         * symtab.h (class Symbol_table): Declare wrap_symbol.
15720         * target.h (Target::wrap_char): New function.
15721         (Target::Target_info): Add wrap_char field.
15722         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15723         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15724         * testsuite/testfile.cc (Target_test::test_target_info):
15725         Likewise.
15726
15727         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15728         there is one.
15729
15730         * layout.h (class Layout): Add added_eh_frame_data_ field.
15731         * layout.cc (Layout::Layout): Initialize new field.
15732         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15733         output section until we find a section we merged successfully.
15734         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15735         that the size be non-zero.
15736
15737         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15738         qualifier.
15739
15740 2008-04-08  Craig Silverstein  <csilvers@google.com>
15741
15742         * configure.ac: Export new conditional variable HAVE_ZLIB.
15743         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15744         on HAVE_ZLIB.
15745         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15746         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15747
15748 2008-04-07  Ian Lance Taylor  <iant@google.com>
15749
15750         * version.cc (version_string): Set to "1.5".
15751
15752         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15753         Add issued_non_pic_error_ field.  Declare check_non_pic.
15754         (Target_x86_64::Scan::check_non_pic): New function.
15755         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15756         (Target_x86_64::Scan::global): Likewise.
15757
15758         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15759         addend parameter.  Change caller.  Handle merge sections.
15760         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15761         Address to Addend.  Don't add in the result of
15762         local_section_offset, pass down the addend and use the returned
15763         value.
15764         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15765         Update declarations of local_section_offset and symbol_value.
15766         * testsuite/two_file_test_1.cc (t18): New function.
15767         * testsuite/two_file_test_2.cc (f18): New function.
15768         * testsuite/two_file_test_main.cc (main): Call t18.
15769         * testsuite/two_file_test.h (t18, f18): Declare.
15770
15771         * configure.ac: Don't test for objdump, c++filt, or readelf.
15772         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15773         conditionals.
15774         (TEST_READELF): New variable.
15775         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15776         (check_PROGRAMS): Add two_file_strip_test.
15777         (two_file_strip_test): New target.
15778         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15779         (two_file_same_shared_strip_test_SOURCES): New variable.
15780         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15781         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15782         (two_file_same_shared_strip_test_LDADD): New variable.
15783         (two_file_shared_strip.so): New target.
15784         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15785         (ver_test_5.syms, ver_test_7.syms): Likewise.
15786         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15787         (strip_test_3.stdout): Use TEST_OBJDUMP.
15788         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15789
15790 2008-04-04  Cary Coutant  <ccoutant@google.com>
15791
15792         * symtab.h (Symbol::is_weak_undefined): New function.
15793         (Symbol::is_strong_undefined): New function.
15794         (Symbol::is_absolute): New function.
15795         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15796         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15797         absolute symbols.
15798         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15799         (weak_undef_test): New target.
15800         * testsuite/Makefile.in: Rebuild.
15801         * testsuite/weak_undef_file1.cc: New file.
15802         * testsuite/weak_undef_file2.cc: New file.
15803         * testsuite/weak_undef_test.cc: New file.
15804
15805 2008-04-03  Craig Silverstein  <csilvers@google.com>
15806
15807         * compressed_output.h (class Output_compressed_section): Use
15808         unsigned buffer.
15809         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15810         add zlib header.
15811         (zlib_compressed_suffix): Removed.
15812         (Output_compressed_section::set_final_data_size): Use unsigned
15813         buffers.
15814         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15815         Fix linker invocation.
15816         (flagstest_o_specialfile_and_compress_debug_sections):
15817         Likewise.
15818         * testsuite/Makefile.in: Regenerated.
15819
15820 2008-04-02  David S. Miller  <davem@davemloft.net>
15821
15822         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15823         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15824
15825 2008-04-02  Craig Silverstein  <csilvers@google.com>
15826
15827         * TODO: New file.
15828
15829 2008-04-02  Ian Lance Taylor  <iant@google.com>
15830
15831         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15832         parameters.  Update for new key type to views_.  Change all
15833         callers.
15834         (File_read::read): Adjust for byteshift in returned view.
15835         (File_read::add_view): New function, broken out of
15836         find_and_make_view.
15837         (File_read::make_view): New function, broken out of
15838         find_and_make_view.
15839         (File_read::find_or_make_view): Add offset and aligned
15840         parameters.  Rewrite accordingly.  Change all callers.
15841         (File_read::get_view): Add offset and aligned parameters.  Adjust
15842         for byteshift in return value.
15843         (File_read::get_lasting_view): Likewise.
15844         * fileread.h (class File_read): Update declarations.
15845         (class File_read::View): Add byteshift_ field.  Add byteshift to
15846         constructor.  Add byteshift method.
15847         * archive.h (Archive::clear_uncached_views): New function.
15848         (Archive::get_view): Add aligned parameter.  Change all callers.
15849         * object.h (Object::get_view): Add aligned parameter.  Change all
15850         callers.
15851         (Object::get_lasting_view): Likewise.
15852
15853         * fileread.cc (File_read::release): Don't call clear_views if
15854         there are multiple objects.
15855         * fileread.h (File_read::clear_uncached_views): New function.
15856         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15857         on the archive.
15858
15859 2008-03-31  Cary Coutant  <ccoutant@google.com>
15860
15861         Add thin archive support.
15862         * archive.cc (Archive::armagt): New const.
15863         (Archive::setup): Remove task parameter and calls to unlock.
15864         (Archive::unlock_nested_archives): New function.
15865         (Archive::read_header): Add nested_off parameter. Change
15866         all callers.
15867         (Archive::interpret_header): Likewise.
15868         (Archive::include_all_members): Change to handle thin
15869         archives.
15870         (Archive::include_member): Likewise.
15871         * archive.h (Archive::Archive): Add new parameters and
15872         initializers.
15873         (Archive::armagt): New const.
15874         (Archive::setup): Remove task parameter.
15875         (Archive::unlock_nested_archives): New function.
15876         (Archive::read_header): Add nested_off parameter.
15877         (Archive::interpret_header): Likewise.
15878         (Archive::Nested_archive_table): New typedef.
15879         (Archive::is_thin_archive_): New field.
15880         (Archive::nested_archives_): New field.
15881         (Archive::options_): New field.
15882         (Archive::dirpath_): New field.
15883         (Archive::task_): New field.
15884         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15885         for thin archives.  Pass additional parameters to
15886         Archive::Archive.  Unlock the archive file after calling
15887         Archive::setup.
15888
15889 2008-03-29  Ian Lance Taylor  <iant@google.com>
15890
15891         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15892         version symbol to be local.
15893         * testsuite/ver_test_4.sh: New file.
15894         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15895         (check_DATA): Add ver_test_4.syms.
15896         (ver_test_4.syms): New target.
15897         * testsuite/Makefile.in: Rebuild.
15898
15899         * output.cc
15900         (Output_section::Input_section_sort_entry::has_priority): New
15901         function.
15902         (Output_section::Input_section_sort_entry::match_file_name): New
15903         function.
15904         (Output_section::Input_section_sort_entry::match_section_name):
15905         Remove.
15906         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15907         Remove.
15908         (Output_section::Input_section_sort_entry::match_section_file):
15909         Remove.
15910         (Output_section::Input_section_sort_compare::operator()): Rewrite
15911         using new Input_section_sort_entry functions.  Sort crtbegin and
15912         crtend first.  Sort sections with no priority before sections with
15913         a priority.
15914         * testsuite/initpri1.c (d3): Check j != 4.
15915         (cd5): New constructor/destructor function.
15916         (main): Check j != 2.
15917
15918         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15919         new symbol when resolving, don't call set_is_default.
15920         * testsuite/ver_test_7.cc: New file.
15921         * testsuite/ver_test_7.sh: New file.
15922         * testsuite/Makefile.am (ver_test_7.so): New target.
15923         (ver_test_7.o): New target.
15924         (check_SCRIPTS): Add ver_test_7.sh.
15925         (check_DATA): Add ver_test_7.syms.
15926         (ver_test_7.syms): New target.
15927
15928 2008-03-28  Ian Lance Taylor  <iant@google.com>
15929
15930         * layout.cc (Layout::layout): If we see an input section with a
15931         name that needs sorting, set the must_sort flag for the output
15932         section.
15933         (Layout::make_output_section): If the name of the output section
15934         indicates that it might require sorting, set the may_sort flag.
15935         * output.h (Output_section::may_sort_attached_input_sections): New
15936         function.
15937         (Output_section::set_may_sort_attached_input_sections): New
15938         function.
15939         (Output_section::must_sort_attached_input_sections): New
15940         function.
15941         (Output_section::set_must_sort_attached_input_sections): New
15942         function.
15943         (class Output_section): Declare Input_section_sort_entry.  Define
15944         Input_section_sort_compare.  Declare
15945         sort_attached_input_sections.  Add new fields:
15946         may_sort_attached_input_sections_,
15947         must_sort_attached_input_sections_,
15948         attached_input_sections_are_sorted_.
15949         * output.cc (Output_section::Output_section): Initialize new
15950         fields.
15951         (Output_section::add_input_section): Add an entry to
15952         input_sections_ if may_sort or must_sort are true.
15953         (Output_section::set_final_data_size): Call
15954         sort_attached_input_sections if necessary.
15955         (Output_section::Input_section_sort_entry): Define new class.
15956         (Output_section::Input_section_sort_compare::operator()): New
15957         function.
15958         (Output_section::sort_attached_input_sections): New function.
15959         * configure.ac: Check whether the compiler supports constructor
15960         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15961         * testsuite/initpri1.c: New file.
15962         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15963         CONSTRUCTOR_PRIORITY.
15964         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15965         (initpri1_LDFLAGS): New variable.
15966         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15967
15968 2008-03-27  Ian Lance Taylor  <iant@google.com>
15969
15970         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15971         * testsuite/common_test_1.c: New file.
15972         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15973         (common_test_1_SOURCES): New variable.
15974         (common_test_1_DEPENDENCIES): New variable.
15975         (common_test_1_LDFLAGS): New variable.
15976
15977         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15978         and commons_ correctly when NAME/VERSION does not override
15979         NAME/NULL.
15980         * testsuite/ver_test_6.c: New file.
15981         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15982         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15983         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15984
15985 2008-03-26  Ian Lance Taylor  <iant@google.com>
15986
15987         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15988         of an undefined symbol from a version script.
15989         * testsuite/Makefile.am (ver_test_5.so): New target.
15990         (ver_test_5.o): New target.
15991         (check_SCRIPTS): Add ver_test_5.sh.
15992         (check_DATA): Add ver_test_5.syms.
15993         (ver_test_5.syms): New target.
15994         * testsuite/ver_test_5.cc: New file.
15995         * testsuite/ver_test_5.script: New file.
15996         * testsuite/ver_test_5.sh: New file.
15997         * Makefile.in, testsuite/Makefile.in: Rebuild.
15998
15999         PR gold/5986
16000         Fix problems building gold with gcc 4.3.0.
16001         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
16002         (gold_error_at_location, gold_warning_at_location): Use it.
16003         * configure.ac: Check whether we can compile and use a template
16004         function with a printf attribute.
16005         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
16006         when jumping over bytes.
16007         * object.cc: Instantiate Object::read_section_data.
16008         * debug.h: Include <cstring>
16009         * dwarf_reader.cc: Include <algorithm>
16010         * main.cc: Include <cstring>.
16011         * options.cc: Include <cstring>.
16012         * output.cc: Include <cstring>.
16013         * script.cc: Include <cstring>.
16014         * script.h: Include <string>.
16015         * symtab.cc: Include <cstring> and <algorithm>.
16016         * target-select.cc: Include <cstring>.
16017         * version.cc: Include <string>.
16018         * testsuite/testmain.cc: Include <cstdlib>.
16019         * configure, config.in: Rebuild.
16020
16021 2008-03-25  Ian Lance Taylor  <iant@google.com>
16022
16023         * options.cc: Include "../bfd/bfdver.h".
16024         (options::help): Print bug reporting address.
16025
16026         * version.cc (print_version): Adjust output for current value of
16027         BFD_VERSION_STRING.
16028
16029         * NEWS: New file.
16030
16031         * options.cc (options::help): Print list of supported targets.
16032         * target-select.h: Include <vector>.
16033         (class Target_selector): Make machine_, size_, and is_big_endian_
16034         fields const.  Add bfd_name_ and instantiated_target_ fields.
16035         (Target_selector::Target_selector): Add bfd_name parameter.
16036         (Target_selector::recognize): Make non-virtual, call
16037         do_recognize.
16038         (Target_selector::recognize_by_name): Make non-virtual, call
16039         do_recognize_by_name.
16040         (Target_selector::supported_names): New function.
16041         (Target_selector::bfd_name): New function.
16042         (Target_selector::do_instantiate_target): New pure virtual
16043         function.
16044         (Target_selector::do_recognize): New virtual function.
16045         (Target_selector::do_recognize_by_name): New virtual function.
16046         (Target_selector::instantiate_target): New private function.
16047         (supported_target_names): Declare.
16048         * target-select.cc (Target_selector::Target_selector): Update for
16049         new parameter and fields.
16050         (select_target_by_name): Check that the name matches before
16051         calling recognize_by_name.
16052         (supported_target_names): New function.
16053         * i386.cc (class Target_selector_i386): Update Target_selector
16054         constructor call.  Remove recognize and recognize_by_name.  Add
16055         do_instantiate_target.
16056         * x86_64.cc (class Target_selector_x86_64): Likewise.
16057         * testsuite/testfile.cc (class Target_selector_test): Update for
16058         changes to Target_selector.
16059
16060         * README: Rewrite, with some notes on unsupported features.
16061
16062 2008-03-24  Cary Coutant  <ccoutant@google.com>
16063
16064         * i386.cc (Target_i386::Got_type): New enum declaration.
16065         (Target_i386::Scan::local): Updated callers of Output_data_got
16066         member functions.
16067         (Target_i386::Scan::global): Likewise.
16068         (Target_i386::Relocate::relocate): Likewise.
16069         (Target_i386::Relocate::relocate_tls): Likewise.
16070         * object.h (Got_offset_list): New class.
16071         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16072         (Sized_relobj::local_got_offset): Likewise.
16073         (Sized_relobj::set_local_got_offset): Likewise.
16074         (Sized_relobj::local_has_tls_got_offset): Removed.
16075         (Sized_relobj::local_tls_got_offset): Removed.
16076         (Sized_relobj::set_local_tls_got_offset): Removed.
16077         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16078         * output.cc (Output_data_got::add_global): Added got_type parameter.
16079         (Output_data_got::add_global_with_rel): Likewise.
16080         (Output_data_got::add_global_with_rela): Likewise.
16081         (Output_data_got::add_global_pair_with_rel): New function.
16082         (Output_data_got::add_global_pair_with_rela): New function.
16083         (Output_data_got::add_local): Added got_type parameter.
16084         (Output_data_got::add_local_with_rel): Likewise.
16085         (Output_data_got::add_local_with_rela): Likewise.
16086         (Output_data_got::add_local_pair_with_rel): New function.
16087         (Output_data_got::add_local_pair_with_rela): New function.
16088         (Output_data_got::add_global_tls): Removed.
16089         (Output_data_got::add_global_tls_with_rel): Removed.
16090         (Output_data_got::add_global_tls_with_rela): Removed.
16091         (Output_data_got::add_local_tls): Removed.
16092         (Output_data_got::add_local_tls_with_rel): Removed.
16093         (Output_data_got::add_local_tls_with_rela): Removed.
16094         * output.h (Output_data_got::add_global): Added got_type parameter.
16095         (Output_data_got::add_global_with_rel): Likewise.
16096         (Output_data_got::add_global_with_rela): Likewise.
16097         (Output_data_got::add_global_pair_with_rel): New function.
16098         (Output_data_got::add_global_pair_with_rela): New function.
16099         (Output_data_got::add_local): Added got_type parameter.
16100         (Output_data_got::add_local_with_rel): Likewise.
16101         (Output_data_got::add_local_with_rela): Likewise.
16102         (Output_data_got::add_local_pair_with_rel): New function.
16103         (Output_data_got::add_local_pair_with_rela): New function.
16104         (Output_data_got::add_global_tls): Removed.
16105         (Output_data_got::add_global_tls_with_rel): Removed.
16106         (Output_data_got::add_global_tls_with_rela): Removed.
16107         (Output_data_got::add_local_tls): Removed.
16108         (Output_data_got::add_local_tls_with_rel): Removed.
16109         (Output_data_got::add_local_tls_with_rela): Removed.
16110         * resolve.cc (Symbol::override_base_with_special): Removed
16111         reference to has_got_offset_ field.
16112         * symtab.cc (Symbol::init_fields): Replaced initialization
16113         of got_offset_ with got_offsets_.  Removed initialization
16114         of has_got_offset_
16115         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16116         (Symbol::got_offset): Likewise.
16117         (Symbol::set_got_offset): Likewise.
16118         (Symbol::has_tls_got_offset): Removed.
16119         (Symbol::tls_got_offset): Removed.
16120         (Symbol::set_tls_got_offset): Removed.
16121         (Symbol::got_offset_): Removed.
16122         (Symbol::tls_mod_got_offset_): Removed.
16123         (Symbol::tls_pair_got_offset_): Removed.
16124         (Symbol::got_offsets_): New field.
16125         (Symbol::has_got_offset): Removed.
16126         (Symbol::has_tls_mod_got_offset): Removed.
16127         (Symbol::has_tls_pair_got_offset): Removed.
16128         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16129         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16130         member functions.
16131         (Target_x86_64::Scan::global): Likewise.
16132         (Target_x86_64::Relocate::relocate): Likewise.
16133         (Target_x86_64::Relocate::relocate_tls): Likewise.
16134
16135 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16136
16137         * yyscript.y: Fix spelling error in comment.
16138
16139 2008-03-24  Ian Lance Taylor  <iant@google.com>
16140
16141         * options.h (class General_options): Define build_id option.
16142         * layout.h (class Layout): Declare write_build_id, create_note,
16143         create_build_id.  Add build_id_note_ member.
16144         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16145         "libiberty.h", "md5.h", "sha1.h".
16146         (Layout::Layout): Initialize eh_frame_data_,
16147         eh_frame_hdr_section_, and build_id_note_.
16148         (Layout::finalize): Call create_build_id.
16149         (Layout::create_note): New function, broken out of
16150         Layout::create_gold_note.
16151         (Layout::create_gold_note): Call create_note.
16152         (Layout::create_build_id): New function.
16153         (Layout::write_build_id): New function.
16154         (Close_task_runner::run): Call write_build_id.
16155
16156         * x86_64.cc: Correct license to GPLv3.
16157
16158 2008-03-23  Ian Lance Taylor  <iant@google.com>
16159
16160         * options.cc: Include "demangle.h".
16161         (parse_optional_string): New function.
16162         (parse_long_option): Handle takes_optional_argument.
16163         (parse_short_option): Update dash_z initializer.  Handle
16164         takes_optional_argument.
16165         (General_options::General_options): Initialize do_demangle_.
16166         (General_options::finalize): Set do_demangle_.  Handle demangling
16167         style.
16168         * options.h (parse_optional_string): Declare.
16169         (struct One_option): Add optional_arg field.  Update constructor.
16170         Update call constructor calls.  Add takes_optional_argument
16171         function.
16172         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16173         (DEFINE_optional_string): Define.
16174         (General_options::demangle): Change from DEFINE_bool to
16175         DEFINE_optional_string.
16176         (General_options::no_demangle): New function.
16177         (General_options::do_demangle): New function.
16178         (General_options::set_do_demangle): New function.
16179         (General_options::execstack_status_): Move definition to end of
16180         class definition.
16181         (General_options::static_): Likewise.
16182         (General_options::do_demangle_): New field.
16183         * object.cc (big_endian>::get_symbol_location_info): Call
16184         Options::do_demangle, not Options::demangle.
16185         * symtab.cc (demangle): Likewise.
16186
16187 2008-03-22  Ian Lance Taylor  <iant@google.com>
16188
16189         * gold.h: Include <cstddef> and <sys/types.h>
16190         * options.h: Include <cstring>.
16191
16192 2008-03-21  Ian Lance Taylor  <iant@google.com>
16193
16194         * Added source code to GNU binutils.
16195 \f
16196 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16197
16198 Copying and distribution of this file, with or without modification,
16199 are permitted in any medium without royalty provided the copyright
16200 notice and this notice are preserved.
16201
16202 Local Variables:
16203 mode: change-log
16204 left-margin: 8
16205 fill-column: 74
16206 version-control: never
16207 End: