PPC gold doesn't check for overflow properly
[platform/upstream/binutils.git] / gold / ChangeLog
1 2014-11-21  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
4         for undefined weaks.
5
6 2014-11-20  Alan Modra  <amodra@gmail.com>
7
8         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
9         from --stub-group-size parameter divided by 1024.
10         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
11         template parameter.  Update all uses.
12         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
13         has_stub_value.  Set for long branches.  Don't report overflow for
14         branch to undefined weak symbols.  Print info message on
15         overflowing branch to stub.
16
17 2014-11-20  Alan Modra  <amodra@gmail.com>
18
19         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
20
21 2014-10-28  Alan Modra  <amodra@gmail.com>
22
23         Apply trunk patches
24         2014-10-22  Alan Modra  <amodra@gmail.com>
25         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
26         thread_starter.
27
28 2014-09-30  Cary Coutant  <ccoutant@google.com>
29
30         PR gold/17432
31         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
32
33 2014-09-30  Kito Cheng  <kito@0xlab.org>
34
35         PR gold/13597
36         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
37         hash table before sysv-style hash table.
38
39 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
40
41         * options.h (--pic-executable): Add negative to alias to -no-pie.
42
43 2014-09-26  Cary Coutant  <ccoutant@google.com>
44
45         PR gold/16773
46         * object.cc (Sized_relobj_file): Compute value of section symbols
47         for TLS sections the same as TLS symbols.
48
49 2014-09-25  Cary Coutant  <ccoutant@google.com>
50
51         PR gold/17432
52         * resolve.cc (Symbol_table::resolve): Override common placeholder
53         symbols, but adjust sizes.
54         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
55         symbols to common lists.
56
57 2014-09-24  Alan Modra  <amodra@gmail.com>
58
59         * po/POTFILES.in: Regenerate.
60
61 2014-09-23  Taiju Tsuiki  <tzik@google.com>
62             Cary Coutant  <ccoutant@google.com>
63
64         PR gold/14860
65         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
66         on input_sections_blocker.
67         * layout.cc (Write_sections_task::locks): Unblock
68         input_sections_blocker_.
69         * layout.h (Write_sections_task::Write_sections_task): Add
70         input_sections_blocker.
71         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
72         to DEPENDENCIES.
73         * testsuite/Makefile.in: Regenerate.
74
75 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
76
77         * testsuite/Makefile.am (plugin_test_10): New test.
78         * testsuite/Makefile.in: Regenerate
79         * testsuite/plugin_common_test_2.c (c1): Align to 8.
80         * testsuite/plugin_test_10.sh: New file.
81
82 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
83
84         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
85         * resolve.cc (Symbol_table::resolve): Don't override common symbols
86         during the replacement phase.
87
88 2014-09-17  Han Shen  <shenhan@google.com>
89             Jing Yu  <jingyu@google.com>
90
91         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
92         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
93         * aarch64.cc (Target_aarch64): Add data members
94         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
95         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
96         constructor.
97         (Target_aarch64::do_reloc_symbol_index): New method.
98         (Target_aarch64::do_reloc_addend): New method.
99         (Target_aarch64::add_tlsdesc_info): New method.
100         (Target_aarch64::do_dynsym_value): New method.
101         (Target_aarch64::do_make_data_plt): Add new parameters: got,
102         got_irelative. Pass them to Output_data_plt_aarch64_standard.
103         (Target_aarch64::make_data_plt): Add new parameters: got,
104         got_irelative. Pass them to do_make_data_plt.
105         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
106         (Target_aarch64::Relocate:tls_gd_to_le): New method.
107         (Target_aarch64::Relocate:tls_ie_to_le): New method.
108         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
109         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
110         (Target_aarch64::got_tlsdesc_section): New method.
111         (Target_aarch64::make_local_ifunc_plt_entry): New method.
112         (Target_aarch64::define_tls_base_symbol): New method.
113         (Target_aarch64::reserve_tlsdesc_entries): New method.
114         (Target_aarch64::got_mod_index_entry): New method.
115         (Target_aarch64::rela_tlsdesc_section): New method.
116         (Target_aarch64::rela_irelative_section): New method.
117         (Target_aarch64::Tlsdesc_info): New struct.
118         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
119         relocations and tlsdesc relocations.
120         (Target_aarch64::optimize_tls_reloc): Implement method.
121         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
122         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
123         in constructor.
124         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
125         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
126         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
127         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
128         (Output_data_plt_aarch64::rela_tlsdesc): New method.
129         (Output_data_plt_aarch64::rela_irelative): New method.
130         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
131         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
132         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
133         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
134         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
135         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
136         (Output_data_plt_aarch64_standard): New member variables:
137         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
138         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
139         New parameter: got, got_irelative.
140         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
141         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
142         (Output_data_plt_aarch64::do_write): Replace got_address with
143         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
144         (AArch64_relocate_functions::update_movnz): New method.
145         (AArch64_relocate_functions): Correct format.
146         (AArch64_relocate_functions::movnz): New method.
147         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
148         before the switch. Add new cases to switch.
149         Check ie_to_le relaxation on tlsie relocations. Add code handling
150         tlsgd tlsdesc cases.
151         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
152         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
153         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
154         Call reloc_name_in_error_message to print unsupported reloc.
155         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
156         make_data_plt.
157         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
158         relocs. Fill in some more dynamic tags.
159         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
160         Skip call tls_get_addr when tlsgd is relaxed.
161         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
162         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
163         tlsdesc->ie relaxation.
164
165 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
166
167         * mips.cc (Target_mips_nacl): New class.
168         (Target_selector_mips_nacl): New class.
169         (target_selector_mips32): Rename from target_selector_mips32be and use
170         Target_selector_mips_nacl instead of Target_selector_mips.
171         (target_selector_mips32el): Rename from target_selector_mips32 and use
172         Target_selector_mips_nacl instead of Target_selector_mips.
173         (target_selector_mips64): Rename from target_selector_mips64be and use
174         Target_selector_mips_nacl instead of Target_selector_mips.
175         (target_selector_mips64el): Rename from target_selector_mips64 and use
176         Target_selector_mips_nacl instead of Target_selector_mips.
177         (Target_mips::mips_info): Add const attribute.
178
179 2014-09-02  Cary Coutant  <ccoutant@google.com>
180
181         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
182         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
183         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
184         (Sized_incr_dynobj::do_section_name): Likewise.
185         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
186         (Sized_incr_dynobj::do_section_name): Likewise.
187         * object.h (Object::section_name): Likewise.
188         (Object::do_section_name): Likewise.
189         (Sized_relobj_file::do_section_name): Likewise.
190         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
191         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
192
193 2014-09-02  Cary Coutant  <ccoutant@google.com>
194
195         PR gold/17005
196         * ehframe.cc (Fde::write): Add output_offset parameter.
197         (Cie::write): Likewise.
198         (Eh_frame::set_final_data_size): Account for offset within output
199         section.
200         (Eh_frame::do_sized_write): Likewise.
201         * ehframe.h (Fde::write): Add output_offset parameter.
202         (Cie::write): Likewise.
203         * output.cc (Output_section::Input_section_sort_entry): Remove
204         section_has_name_; add output_section_name parameter. Use
205         output section name for non-input sections.
206         (Output_section::Input_section_sort_entry::section_has_name): Remove.
207         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
208         (Output_section::Input_section_sort_compare): Remove logic for
209         sections without names.
210         (Output_section::Input_section_sort_init_fini_compare): Likewise.
211         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
212         Likewise.
213         (Output_section::Input_section_sort_section_name_compare): Likewise.
214
215 2014-08-29 Han Shen <shenhan@google.com>
216            Jing Yu <jingyu@google.com>
217
218         * aarch64-reloc-property.cc
219         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
220         reference reloc property in the table.
221         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
222         3 other entries.
223         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
224         2 new overloaded methods.
225         (Output_data_got_aarch64::do_write): Add code to write out
226         static relocs.
227         (class Output_data_got_aarch64::Static_reloc): New class to wrap
228         static relocs.
229         (Output_data_got_aarch64::static_relocs): New vector to
230         hold static relocs.
231         (Target_aarch64::TCB_SIZE): New const static memeber.
232         (Target_aarch64::tcb_size): New method.
233         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
234         (Target_aarch64::Relocate::relocate_tls): New method.
235         (Target_aarch64::Scan::local): Add code handling new reloc types.
236         (Target_aarch64::Scan::global): Add code handling new reloc types.
237
238 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
239
240         * options.h (-no-pie): Add option.
241
242 2014-08-08  Jing Yu  <jingyu@google.com>
243             Han Shen  <shenhan@google.com>
244
245         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
246         (DEFFILES): add aarch64-reloc.def.
247         (TARGETSOURCES): Add aarch64-reloc-property.cc.
248         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
249         * Makefile.in: Regenerate.
250         * aarch64-reloc-property.cc: New file.
251         * aarch64-reloc-property.h: New file.
252         * aarch64-reloc.def: New file.
253         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
254         with tab to make the format consistent.
255         (Output_data_got_aarch64::symbol_table_): New method.
256         (Target_aarch64::do_plt_address_for_global): New method.
257         (Target_aarch64::do_plt_address_for_local): New method.
258         (Target_aarch64::do_select_as_default_target): New method.
259         (Target_aarch64::do_make_data_plt): New method.
260         (Target_aarch64::make_data_plt): New method.
261         (Output_data_plt_aarch64::has_irelative_section): New method.
262         (Output_data_plt_aarch64::address_for_global): New method.
263         (Output_data_plt_aarch64::address_for_local): New method.
264         (Output_data_plt_aarch64::irelative_rel_): New parameter.
265         (Output_data_plt_aarch64::add_entry): Implement contents.
266         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
267         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
268         the got_pov entry to plt0.
269         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
270         Implement contents.
271         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
272         (AArch64_howto): New struct.
273         (aarch64_howto[]): New static const array.
274         (AArch64_relocate_functions): New class.
275         (Target_aarch64::Scan::get_reference_flags): Remove method.
276         (Target_aarch64::Scan::local): Implement to support a few relocations.
277         (Target_aarch64::Scan::global): Implement to support a few relocations.
278         (Target_aarch64::make_plt_section): Implement contents.
279         (Target_aarch64::make_plt_entry): Implement contents.
280         (Target_aarch64::do_finalize_sections): Implement contents.
281         (Target_aarch64::Relocate::relocate): Implement a few relocations.
282         (Target_aarch64::relocate_section): Implement contents.
283
284 2014-08-06  Alan Modra  <amodra@gmail.com>
285
286         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
287
288 2014-08-06  Alan Modra  <amodra@gmail.com>
289
290         PR 13227
291         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
292
293 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
294
295         * object.cc (Relobj::is_section_name_included): Add
296         ".rodata.nptl_version" to not garbage collect this section.
297
298 2014-07-08  Cary Coutant  <ccoutant@google.com>
299
300         * expression.cc (struct Expression::Expression_eval_info): Add
301         new fields type_pointer, vis_pointer, and nonvis_pointer.
302         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
303         nonvis_pointer parameters. Adjust all calls.
304         (Symbol_expression::value): Update type, visibility, and nonvis bits
305         in caller.
306         * script.cc (Symbol_assignment::sized_finalize): Update type,
307         visibility, and remaining st_other bits for new symbol.
308         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
309         vis_pointer, and nonvis_pointer parameters.
310         * symtab.h (Symbol::set_type): New method.
311
312         * testsuite/Makefile.am (defsym_test): New test.
313         * testsuite/Makefile.in: Regenerate.
314         * testsuite/defsym_test.c: New file.
315         * testsuite/defsym_test.sh: New file.
316
317 2014-07-08  Cary Coutant  <ccoutant@google.com>
318
319         PR gold/15639
320         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
321         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
322         (Sized_dynobj::base_read_symbols): ...new method.
323         * object.h (Sized_relobj_file::base_read_symbols): New method.
324         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
325         (Sized_relobj_file::base_read_symbols): ...new method.
326         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
327         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
328         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
329
330 2014-07-04  Alan Modra  <amodra@gmail.com>
331
332         * po/POTFILES.in: Regenerate.
333
334 2014-07-02  Jing Yu  <jingyu@google.com>
335
336         * aarch64.cc: New file
337         * Makefile.am (TARGETSOURCES): Add aarch64.cc
338         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
339         * Makefile.in: Regenerate.
340         * configure.tgt: Add entries for aarch64*.
341         * configure.ac:  Likewise.
342         * configure: Likewise.
343
344 2014-06-27  Alan Modra  <amodra@gmail.com>
345
346         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
347
348 2014-06-24  Cary Coutant  <ccoutant@google.com>
349
350         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
351         sections.
352         (Dwo_file::sized_read_unit_index): Likewise.
353
354 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
355
356         * mips.cc: New file.
357         * Makefile.am (TARGETSOURCES): Add mips.cc
358         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
359         * configure.tgt: Add entries for mips*.
360         * configure.ac: Likewise.
361         * Makefile.in: Regenerate.
362         * configure: Likewise.
363
364 2014-06-09  Cary Coutant  <ccoutant@google.com>
365
366         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
367         unit_length is within section bounds.
368
369 2014-06-09  Cary Coutant  <ccoutant@google.com>
370
371         PR gold/16980
372         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
373         map.
374
375 2014-06-07  Alan Modra  <amodra@gmail.com>
376
377         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
378
379 2014-06-06  Cary Coutant  <ccoutant@google.com>
380
381         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
382         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
383         (Dwarf_pubnames_table::read_header): Likewise.
384         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
385         .debug_gnu_pubtypes.
386
387 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
388
389         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
390         * Makefile.in, configure: Regenerate.
391
392 2014-06-03  Alan Modra  <amodra@gmail.com>
393
394         * powerpc.cc (addis_12_2): Define.
395         (Stub_table::do_write): Support fusion on ELFv2 stubs.
396
397 2014-06-03  Alan Modra  <amodra@gmail.com>
398
399         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
400         st_other output.
401
402 2014-06-02  Alan Modra  <amodra@gmail.com>
403
404         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
405         Only ignore relocs on ELFv1.
406         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
407
408 2014-05-30  Cary Coutant  <ccoutant@google.com>
409
410         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
411         * testsuite/Makefile.in: Regenerate.
412         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
413
414 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
415
416         PR gold/16945
417         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
418         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
419
420 2014-05-15  Alan Modra  <amodra@gmail.com>
421
422         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
423         Compare FDE contents with DW_CFA_nop rather than 0.
424
425 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
426
427         * symtab.h (may_need_copy_reloc): Remove check for position independent
428         code.
429         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
430         position independence before pc absolute may_need_copy_reloc call.
431         Add check for executable output befor pc relative may_need_copy_reloc
432         call.
433         * i386.cc: Ditto.
434         * arm.cc: Ditto.
435         * sparc.cc: Ditto.
436         * tilegx.cc: Ditto.
437         * powerpc.cc: Add check for no position independence before
438         may_need_copy_reloc calls.
439         * testsuite/pie_copyrelocs_test.cc: New file.
440         * testsuite/pie_copyrelocs_shared_test.cc: New file.
441         * Makefile.am (pie_copyrelocs_test): New test.
442         * Makefile.in: Regenerate.
443
444 2014-05-08  Martin Liška  <mliska@suse.cz>
445
446         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
447
448 2014-05-06  Cary Coutant  <ccoutant@google.com>
449
450         PR gold/16900
451         * i386.cc (Output_data_got_plt_i386): New class.
452         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
453         parameter. Change all callers.
454         (Output_data_plt_i386::layout_): Remove.
455         (Output_data_plt_i386::got_plt_): Change type.
456         (Target_i386::got_plt_): Change type. Change all references.
457         (Target_i386::got_section): Create instance of new class.
458         (Output_data_got_plt_i386::do_write): New function.
459         * x86_64.cc (Output_data_got_plt_x86_64): New class.
460         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
461         parameter. Change all callers.
462         (Output_data_plt_x86_64::layout_): Remove.
463         (Output_data_plt_x86_64::got_plt_): Change type.
464         (Target_x86_64::got_plt_): Change type. Change all references.
465         (Target_x86_64::got_section): Create instance of new class.
466         (Output_data_got_plt_x86_64::do_write): New function.
467         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
468         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
469         class.
470
471 2014-05-05  Cary Coutant  <ccoutant@google.com>
472
473         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
474         if we have pubnames/pubtypes.
475
476 2014-05-02  Cary Coutant  <ccoutant@google.com>
477
478         * defstd.cc (in_segment): Define __ehdr_start here...
479         * layout.cc (Layout::finalize): ...Instead of here.  Set the
480         output segment when known.
481         * resolve.cc (Symbol::override_base_with_special): Remember
482         the original binding.
483         * symtab.cc (Symbol::set_output_segment): New function.
484         (Symbol::set_undefined): New function.
485         * symtab.h (Symbol::is_weak_undefined): Check original undef
486         binding.
487         (Symbol::is_strong_undefined): New function.
488         (Symbol::set_output_segment): New function.
489         (Symbol::set_undefined): New function.
490         * target-reloc.h (is_strong_undefined): Remove.
491         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
492         Check for hidden undefs.
493         (relocate_section): Call Symbol::is_strong_undefined.
494
495         * testsuite/Makefile.am (ehdr_start_test_1)
496         (ehdr_start_test_2, ehdr_start_test_3)
497         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
498         * testsuite/Makefile.in: Regenerate.
499         * testsuite/ehdr_start_def.cc: New source file.
500         * testsuite/ehdr_start_test.cc: New source file.
501         * testsuite/ehdr_start_test.t: New linker script.
502         * testsuite/ehdr_start_test_4.sh: New shell script.
503
504 2014-04-23  Cary Coutant  <ccoutant@google.com>
505
506         PR gold/16870
507         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
508
509 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
510
511         * layout.cc (Layout::include_section): Allow a target to decide
512         whether to include a section.
513         * target.h (Target::should_include_section): New function.
514         (Target::do_should_include_section): New function.
515
516 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
517
518         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
519         inline into ...
520         (Copy_relocs::emit): ... here.
521         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
522         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
523         (Copy_reloc_entry::entries_): Change from private to protected.
524
525 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
526
527         * icf.cc (get_section_contents): Replace copies of reloc
528         vectors with const references.
529
530 2014-04-02  Cary Coutant  <ccoutant@google.com>
531
532         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
533         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
534         * configure: Regenerate.
535         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
536         -fno-use-linker-plugin.
537         (LINK1, CXXLINK1): Add it to the link command.
538         * testsuite/Makefile.in: Regenerate.
539
540 2014-03-12  Alan Modra  <amodra@gmail.com>
541
542         * Makefile.in: Regenerate.
543
544 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
545
546         * symtab.h (Symbol::set_nonvis): New function.
547
548 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
549
550         * symtab.cc (Sized_symbol<32>::init_output_data):
551         Instantiate the template.
552         (Sized_symbol<64>::init_output_data): Likewise.
553
554 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
555
556         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
557         adjust dynamic symbol value.
558         * target.h (Target::adjust_dyn_symbol): New function.
559         (Target::do_adjust_dyn_symbol): New function.
560
561 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
562
563         * output.cc (Output_data_dynamic::Dynamic_entry::write):
564         Get the value of DYNAMIC_CUSTOM dynamic entry.
565         * output.h (Output_data_dynamic::add_custom): New function.
566         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
567         dynamic entry.
568         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
569         * target.h (Target::dynamic_tag_custom_value): New function.
570         (Target::do_dynamic_tag_custom_value): New function.
571
572 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
573
574         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
575         dynsym indexes.
576         * target.h (Target::has_custom_set_dynsym_indexes): New function.
577         (Target::do_has_custom_set_dynsym_indexes): New function.
578         (Target::set_dynsym_indexes): New function.
579         (Target::do_set_dynsym_indexes): New function.
580
581 2014-03-07  Alan Modra  <amodra@gmail.com>
582
583         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
584         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
585         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
586         (Powerpc_relocate_functions::has_overflow_bitfield,
587         overflowed): Use the above.
588         (Target_powerpc::Relocate::relocate): Correct overflow checking
589         for a number of relocations.  Modify overflow test for 16-bit
590         fields in instructions to signed/unsigned according to whether
591         the field takes a signed or unsigned value.
592
593 2014-03-05  Alan Modra  <amodra@gmail.com>
594
595         Update copyright years.
596
597 2014-03-05  Alan Modra  <amodra@gmail.com>
598
599         * powerpc.cc (Target_powerpc::Scan::local, global): Support
600         R_PPC64_ADDR64_LOCAL.
601         (Target_powerpc::Relocate::relocate): Likewise.
602
603 2014-03-03  Alan Modra  <amodra@gmail.com>
604
605         * dwp.cc (print_version): Update copyright year to current.
606
607 2014-02-10  Alan Modra  <amodra@gmail.com>
608
609         * po/gold.pot: Regenerate.
610
611 2014-02-06  Cary Coutant  <ccoutant@google.com>
612
613         Fix problem where -u is ignored when a weak undef is seen.
614
615         * archive.cc (Library_base::should_include_member): Reorder
616         code to check for -u option if a weak undef has already been seen.
617         * testsuite/Makefile.am (weak_undef_test_2): New test case.
618         * testsuite/Makefile.in: Regenerate.
619         * testsuite/weak_undef_file3.cc: New file.
620         * testsuite/weak_undef_file4.cc: New file.
621         * testsuite/weak_undef_test_2.cc: New file.
622
623 2014-02-05  Cary Coutant  <ccoutant@google.com>
624
625         Fix issues with gold undefined symbol diagnostics.
626
627         PR binutils/15435
628         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
629         check to here.
630         * target-reloc.h (is_strong_undefined): New function.
631         (relocate_section): Move undef vtable symbol check from here.
632         Check for is_strong_undefined.
633
634 2014-02-05  Cary Coutant  <ccoutant@google.com>
635
636         Fix problems with the --dynamic-list option.
637
638         PR gold/13577
639         * options.cc (General_options::parse_dynamic_list):
640         Set have_dynamic_list_.
641         (General_options::General_options): Initialize have_dynamic_list_.
642         (General_options::finalize): Turn off -Bsymbolic and
643         -Bsymbolic-functions if --dynamic-list provided.
644         * options.h (General_options::have_dynamic_list): New function.
645         (General_options::have_dynamic_list_): New data member.
646         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
647         correctly.
648
649         PR gold/16530
650         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
651         in --dynamic-list, mark it.
652
653         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
654         (dynamic_list_2): New test case.
655         * testsuite/Makefile.in: Regenerate.
656         * testsuite/dynamic_list_2.cc: New file.
657         * testsuite/dynamic_list_2.t: New file.
658         * testsuite/dynamic_list_lib1.cc: New file.
659         * testsuite/dynamic_list_lib2.cc: New file.
660         * testsuite/gc_dynamic_list_test.c: New file.
661         * testsuite/gc_dynamic_list_test.sh: New file.
662         * testsuite/gc_dynamic_list_test.t: New file.
663
664 2014-01-28  Cary Coutant  <ccoutant@google.com>
665
666         Add .gdb_index version 7 support.
667
668         * gold/dwarf_reader.cc: include <utility> (for make_pair).
669         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
670         debug sections.
671         (Dwarf_ranges_table::read_ranges_table): Likewise.
672         (Dwarf_pubnames_table::read_section): Check for GNU-style
673         sections, and for compressed debug sections.
674         (Dwarf_pubnames_table::read_header): Compute end address of table.
675         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
676         for end of list by offset, not by offset == 0.
677         (Dwarf_info_reader::do_read_string_table): Check for compressed
678         debug sections.
679         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
680         Initialize new data members.
681         (Dwarf_pubnames_table::next_name): return flag_byte.
682         (Dwarf_pubnames_table::end_of_table_): New data member.
683         (Dwarf_pubnames_table::is_gnu_style_): New data member.
684         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
685         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
686         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
687         read skeleton type unit DIEs.
688         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
689         (Gdb_index::do_write): Write flag_byte.
690         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
691         (Gdb_index::Cu_vector): Store flags along with cu indexes.
692         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
693         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
694
695 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
696
697         * version.cc (print_version): Update copyright year to 2014.
698
699 2013-12-19  Dimitry Andric  <dimitry@andric.com>
700
701         * stringpool.cc (Stringpool_template::reserve): Add
702         HAVE_UNORDERED_MAP case.
703         * stringpool.cc (Stringpool_template::print_stats): Likewise.
704
705 2013-12-18  Cary Coutant  <ccoutant@google.com>
706
707         * configure.ac: Check for <unordered_set> and <unordered_map>.
708         * config.in: Regenerate.
709         * configure: Regenerate.
710         * system.h: Use <unordered_set> and <unordered_map> if available.
711
712 2013-12-10  Roland McGrath  <mcgrathr@google.com>
713
714         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
715         with $(INSTALL_PROGRAM_ENV).
716         * Makefile.in: Regenerate.
717
718 2013-11-22  Cary Coutant  <ccoutant@google.com>
719
720         * configure.ac: Add check for which library is needed for
721         dlopen.
722         * configure: Regenerate.
723
724 2013-11-22  Cary Coutant  <ccoutant@google.com>
725
726         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
727         assembler.
728         * testsuite/Makefile.in: Regenerate.
729
730 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
731
732         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
733         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
734         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
735         (Target_x86_64<size>::Scan::local): Likewise.
736         (Target_x86_64<size>::Scan::global): Likewise.
737         (Target_x86_64<size>::Relocate::relocate): Likewise.
738         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
739         Likewise.
740         (Target_x86_64<size>::Scan::check_non_pic(): Handle
741         R_X86_64_PC32_BND.
742
743         * testsuite/Makefile.am (check_PROGRAMS): Add
744         exception_x86_64_bnd_test.
745         (exception_x86_64_bnd_test_SOURCES): New macro.
746         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
747         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
748         (exception_x86_64_bnd_test_LDADD): Likewise.
749         (exception_x86_64_bnd_1.o): New rule.
750         (exception_x86_64_bnd_2.o): Likewise.
751         * testsuite/Makefile.in: Regenerated.
752
753 2013-11-15  Alan Modra  <amodra@gmail.com>
754
755         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
756         accessor.
757         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
758         Only call ppc64_local_entry_offset for 64-bit.  Restrict
759         symval_for_branch lookup to ELFv1.
760         (Stub_table::add_plt_call_entry): Use unsigned int off.
761         (Output_data_glink::Address, invalid_address): New.
762         (Output_data_glink::add_eh_frame): Move out of line.  Add
763         support for ELFv2.
764         (Output_data_glink::add_global_entry, find_global_entry,
765         global_entry_address): New functions.
766         (Output_data_glink::global_entry_stubs_, end_branch_table_,
767         ge_size): New variables.
768         (Output_data_glink::set_final_data_size): Add global entry
769         stub sizing.
770         (Output_data_glink::do_write): Write global entry stubs.
771         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
772         parameter.  Return true for ELFv2.  Adjust callers.
773         (Target_powerpc::Scan::local, global): Restrict opd lookup to
774         ELFv1.  Similarly for ifunc and dynamic relocation processing
775         specific to ELFv1.  Recognize that symbols are defined on
776         their plt entries for ELFv2.
777         (Target_powerpc::symval_for_branch): Assert if called for
778         ELFv2 or ppc32.
779         (Target_powerpc::Relocate::relocate): Use global entry plt
780         stub for symbol value if such exists on ELFv2.
781         (Target_powerpc::Relocate::relocate): Don't call
782         symval_for_branch when ELFv2.  Do adjust for local entry
783         offset when ELFv2.
784         (Target_powerpc::do_dynsym_value): Set symbols to global entry
785         plt stub for ELFv2.
786         (Target_powerpc::do_plt_address_for_global): Similarly.
787
788 2013-11-14  Cary Coutant  <ccoutant@google.com>
789
790         Revert patch -- this did not fix the problem, and there is
791         no race there.
792
793         2013-11-14  Cary Coutant  <ccoutant@google.com>
794
795             PR gold/14860
796             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
797             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
798             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
799             updating fde_offsets_.
800             (Eh_frame_hdr::lock_): New data member.
801
802 2013-11-14  Cary Coutant  <ccoutant@google.com>
803
804         * dwp.cc (Dwo_file_entry): New type.
805         (File_list): Use Dwo_file_entry.
806         (Dwo_file::verify): New function.
807         (Dwo_file::verify_dwo_list): New function.
808         (Dwo_file::sized_verify_dwo_list): New function.
809         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
810         list.
811         (Dwp_options): New enum type.
812         (dwp_options): Add --verify-only.
813         (usage): Likewise.
814         (main): Likewise.
815         * dwp.h (gold_info): Add declaration.
816
817 2013-11-14  Cary Coutant  <ccoutant@google.com>
818
819         PR gold/14860
820         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
821         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
822         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
823         updating fde_offsets_.
824         (Eh_frame_hdr::lock_): New data member.
825
826 2013-11-06  Cary Coutant  <ccoutant@google.com>
827
828         PR gold/15758
829         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
830         before reloc sections.
831
832 2013-11-04  Alan Modra  <amodra@gmail.com>
833
834         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
835         (Symbol::needs_dynamic_reloc): Test new flag.
836         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
837         (Target_powerpc::Scan::get_reference_flags): Add target param.
838         Return FUNC_DESC_ABI for 64-bit ELFv1.
839         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
840         call.
841         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
842         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
843
844 2013-10-31  Cary Coutant  <ccoutant@google.com>
845
846         Restore support for dwp v2 DWARF package file format.
847
848         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
849         tu_length parameter.  Adjust all callers.
850         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
851         * dwp.cc: Include dwarf.h.
852         (Section_bounds): New struct type.
853         (Unit_set): New struct type.
854         (Dwo_file::Dwo_file): Initialize new data member.
855         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
856         Combine and rename to...
857         (Dwo_file::read_unit_index): ...this.
858         (Dwo_file::sized_read_compunit_index)
859         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
860         (Dwo_file::sized_read_unit_index): ...this.
861         (Dwo_file::copy_section): Remove section_name, is_str_offsets
862         parameters; add section_id parameter.
863         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
864         (Dwo_file::add_unit_set): ...this.
865         (Dwo_file::shndx_map_): Remove.
866         (Dwo_file::sect_offsets_): New data member.
867         (Dwp_output_file::Dwp_output_file): Initialize new data members.
868         (Dwp_output_file::add_section): Rename to...
869         (Dwp_output_file::add_contribution): ...this.
870         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
871         (Dwp_output_file::add_tu_set): Likewise.
872         (Dwp_output_file::Contribution): New type.
873         (Dwp_output_file::Section::contributions): New data member.
874         (Dwp_output_file::Cu_or_tu_set): Remove.
875         (Dwp_output_file::Section::Section): New ctor.
876         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
877         (Dwp_output_file::Dwp_index::Section_table): New type.
878         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
879         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
880         parameter.
881         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
882         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
883         (Dwp_output_file::Dwp_index::section_table): New member function.
884         (Dwp_output_file::Dwp_index::section_table_end): New member function.
885         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
886         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
887         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
888         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
889         (Dwp_output_file::Dwp_index::section_table_): New data member.
890         (Dwp_output_file::Dwp_index::section_mask_): New data member.
891         (Dwp_output_file::add_output_section): New member function.
892         (Dwp_output_file::write_new_section): New member function.
893         (Dwp_output_file::write_contributions): New member function.
894         (Dwp_output_file::section_id_map_): New data member.
895         (class Dwo_id_info_reader): Remove.
896         (class Unit_reader): New class.
897         (get_dwarf_section_name): New function.
898         (Dwo_file::read_executable): Adjust initializations of class data.
899         (Dwo_file::read): Add support for v2 package file format.
900         (Dwo_file::read_unit_index): Likewise.
901         (Dwo_file::sized_read_unit_index): Likewise.
902         (Dwo_file::copy_section): Likewise.
903         (Dwo_file::add_unit_set): Likewise.
904         (Dwp_output_file::add_output_section): Likewise.
905         (Dwp_output_file::add_contribution): Likewise.
906         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
907         for empty slot.
908         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
909         file format.
910         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
911         slot.
912         (Dwp_output_file::initialize): Remove unused function.
913         (Dwp_output_file::finalize): Add support for v2 package file format.
914         (Dwp_output_file::write_index): Likewise.
915         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
916         function prototype.
917
918 2013-10-31  Cary Coutant  <ccoutant@google.com>
919
920         * configure.ac: Fix check for -fmerge-constants.
921         * configure.ac: Regenerate.
922
923 2013-10-30  Roland McGrath  <mcgrathr@google.com>
924
925         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
926         Correct 9-byte nop sequence to match what the assembler generates.
927
928 2013-10-30  Alan Modra  <amodra@gmail.com>
929
930         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
931         ppc64_local_entry_offset, ppc64_local_entry_offset,
932         do_read_symbols): New functions.
933         (Powerpc_relobj::e_flags_, st_other_): New vars.
934         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
935         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
936         (Powerpc_relobj::e_flags_): New var.
937         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
938         and adjust for ELFv2.
939         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
940         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
941         (Powerpc_dynobj::do_find_special_sections): Likewise.
942         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
943         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
944         to ELFv2 local entry.
945         (Target_powerpc::do_relax): No thread safe barriers needed for
946         ELFv2.
947         (Output_data_plt_powerpc::initial_plt_entry_size_,
948         plt_entry_size): Delete.  Replace all uses with
949         first_plt_entry_offset() and plt_entry_size().
950         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
951         reserved_size parm.  Update callers.
952         (Output_data_plt_powerpc::entry_count): Update.
953         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
954         and use Target_powerpc::first_plt_entry_offset().
955         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
956         rename to plt_entry_size.
957         (Output_data_plt_powerpc::add_ifunc_entry,
958         add_local_ifunc_entry): Adjust reloc for ELFv2.
959         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
960         (glink_eh_frame_fde_64v2): New.
961         (Stub_table::plt_call_size): Support ELFv2 sizing.
962         (Output_data_glink::add_eh_frame): Use the new FDE.
963         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
964         (Stub_table::do_write): Write ELFv2 stubs and glink.
965         (Target_powerpc::Relocate::relocate): Replaces nop after call
966         with ld 2,24(1) and adjust local offset destination for ELFv2.
967
968 2013-10-30  Alan Modra  <amodra@gmail.com>
969
970         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
971         (Target_powerpc::Scan::global, local): Likewise.
972         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
973         on all ppc64 @h and @ha relocs.
974
975 2013-10-14  Alan Modra  <amodra@gmail.com>
976
977         * output.h (Output_data_got::add_constant): Tidy.
978         (Output_data_got::add_constant_pair): New function.
979         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
980         methods used so as to first call reserve_ent().
981
982 2013-10-11  Roland McGrath  <mcgrathr@google.com>
983
984         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
985         add_got_entry and add_got_entry_pair.
986
987         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
988         (HAVE_PUBNAMES): Likewise.
989         * configure: Regenerate.
990
991         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
992         * testsuite/Makefile.in: Regenerate.
993
994         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
995         Remove const from declaration.
996         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
997         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
998         * output.h (Output_file_header): Remove const from member target_
999         and corresponding constructor argument.
1000         * output.cc (Output_file_header::Output_file_header): Update prototype.
1001         (Output_file_header::do_sized_write): Use this->target_ in place
1002         of parameters()->target().
1003
1004         * testsuite/undef_symbol.cc (Foo::get_a): New method.
1005
1006         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
1007         * configure: Regenerate.
1008         * Makefile.in: Regenerate.
1009         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
1010         * testsuite/merge_string_literals_2.c: Likewise.
1011         * testsuite/Makefile.am
1012         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
1013         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
1014         literal -fmerge-constants.
1015         * testsuite/Makefile.in: Regenerate.
1016
1017         * i386.cc (Target_i386): Remove unused member dynbss_.
1018         * arm.cc (Target_arm): Likewise.
1019         * powerpc.cc (Target_powerpc): Likewise.
1020         * sparc.cc (Target_sparc): Likewise.
1021         * tilegx.cc (Target_tilegx): Likewise.
1022         * x86_64.cc (Target_x86_64): Likewise.
1023         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
1024         type_signature_, type_offset_.
1025         * plugin.h (Plugin_hook): Remove unused member layout_.
1026         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
1027         mapfile_.
1028         (Read_member): Remove unused members input_objects_, symtab_,
1029         mapfile_, layout_.
1030         (Check_library): Remove unused member symtab_.
1031         * archive.h (Lib_group): Remove unused member lib_.
1032         * archive.cc (Lib_group::Lib_group): Update initializer.
1033         * incremental.h (Incremental_binary): Remove unused member target_.
1034         (Incremental_script_entry): Removed unused member script_.
1035         * layout.h (Write_symbols_task): Remove unused member input_objects_.
1036         * icf.h (Icf): Remove unused member num_tracked_relocs.
1037
1038         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
1039         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
1040         its only use.
1041         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
1042
1043         * archive.h: Use struct rather than class for forward declaration
1044         of Read_symbols_data.
1045
1046 2013-10-07  Cary Coutant  <ccoutant@google.com>
1047
1048         PR gold/16010
1049         * testsuite/Makefile.am (icf_test): Fix dependencies.
1050         (icf_safe_test): Likewise.
1051         (icf_safe_so_test): Likewise.
1052         (large_symbol_alignment): Add empty _LDADD rule.
1053         * testsuite/Makefile.in: Regenerate.
1054
1055 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
1056
1057         PR gold/15927
1058         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
1059         relocation for R_X86_64_32 on x32.
1060
1061 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1062
1063         * output.cc (Output_segment::set_section_addresses): Take new
1064         Target* argument.  If target->isolate_execinstr() and the segment
1065         is executable and starts at a target->abi_pagesize() boundary,
1066         pad its end out to a target->abi_pagesize() boundary with code fill.
1067         * output.h (Output_segment::set_section_addresses): Update decl.
1068         * layout.h (Layout::check_output_data_for_reset_values): Take new
1069         argument RELAX_OUTPUTS.
1070         (Layout): New member relax_output_list_.
1071         (Layout::add_relax_output): New method.
1072         * layout.cc (Layout::Layout): Update constructor.
1073         (Layout::reset_relax_output): New method.
1074         (Layout::clean_up_after_relaxation): Call it.
1075         (Layout::prepare_for_relaxation): Update caller.
1076         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1077         Call reset_relax_output before re-processing segments for
1078         isolate_execinstr case.
1079         (Layout::write_data): Handle relax_output_list_.
1080         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1081         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1082
1083 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1084
1085         PR binutils/15834
1086         * object.h: Fix typos.
1087
1088 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1089
1090         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1091         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1092
1093 2013-08-07  Cary Coutant  <ccoutant@google.com>
1094
1095         Revert support for v2 DWP files:
1096
1097         2013-03-01  Cary Coutant  <ccoutant@google.com>
1098
1099             Add dwp support for v2 DWARF package file format.
1100             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1101             tu_length parameter.  Adjust all callers.
1102             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1103             * dwp.cc: Include dwarf.h.
1104             (Section_bounds): New struct type.
1105             (Unit_set): New struct type.
1106             (Dwo_file::Dwo_file): Initialize new data member.
1107             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1108             Combine and rename to...
1109             (Dwo_file::read_unit_index): ...this.
1110             (Dwo_file::sized_read_compunit_index)
1111             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1112             (Dwo_file::sized_read_unit_index): ...this.
1113             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1114             parameters; add section_id parameter.
1115             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1116             (Dwo_file::add_unit_set): ...this.
1117             (Dwo_file::shndx_map_): Remove.
1118             (Dwo_file::sect_offsets_): New data member.
1119             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1120             (Dwp_output_file::add_section): Rename to...
1121             (Dwp_output_file::add_contribution): ...this.
1122             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1123             (Dwp_output_file::add_tu_set): Likewise.
1124             (Dwp_output_file::Contribution): New type.
1125             (Dwp_output_file::Section::contributions): New data member.
1126             (Dwp_output_file::Cu_or_tu_set): Remove.
1127             (Dwp_output_file::Section::Section): New ctor.
1128             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1129             (Dwp_output_file::Dwp_index::Section_table): New type.
1130             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1131             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1132             parameter.
1133             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1134             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1135             (Dwp_output_file::Dwp_index::section_table): New member function.
1136             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1137             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1138             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1139             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1140             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1141             (Dwp_output_file::Dwp_index::section_table_): New data member.
1142             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1143             (Dwp_output_file::add_output_section): New member function.
1144             (Dwp_output_file::write_new_section): New member function.
1145             (Dwp_output_file::write_contributions): New member function.
1146             (Dwp_output_file::section_id_map_): New data member.
1147             (class Dwo_id_info_reader): Remove.
1148             (class Unit_reader): New class.
1149             (get_dwarf_section_name): New function.
1150             (Dwo_file::read_executable): Adjust initializations of class data.
1151             (Dwo_file::read): Add support for v2 package file format.
1152             (Dwo_file::read_unit_index): Likewise.
1153             (Dwo_file::sized_read_unit_index): Likewise.
1154             (Dwo_file::copy_section): Likewise.
1155             (Dwo_file::add_unit_set): Likewise.
1156             (Dwp_output_file::add_output_section): Likewise.
1157             (Dwp_output_file::add_contribution): Likewise.
1158             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1159             for empty slot.
1160             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1161             file format.
1162             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1163             slot.
1164             (Dwp_output_file::initialize): Remove unused function.
1165             (Dwp_output_file::finalize): Add support for v2 package file format.
1166             (Dwp_output_file::write_index): Likewise.
1167             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1168             function prototype.
1169
1170 2013-07-31  Cary Coutant  <ccoutant@google.com>
1171
1172         * object.cc (Sized_relobj::do_output_section_address): New function.
1173         (Sized_relobj): Instantiate explicitly.
1174         * object.h (Object::output_section_address): New function.
1175         (Object::do_output_section_address): New function.
1176         (Sized_relobj::do_output_section_address): New function.
1177         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1178
1179 2013-07-30  Cary Coutant  <ccoutant@google.com>
1180             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1181
1182         * parameters.cc (Parameters::entry): Return target-specific entry
1183         symbol name.
1184         * target.h (Target::entry_symbol_name): New function.
1185         (Target_info::entry_symbol_name): New data member.
1186
1187         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1188         * i386.cc (Target_i386::i386_info): Likewise.
1189         (Target_i386_nacl::i386_nacl_info): Likewise.
1190         * sparc.cc (Target_sparc::sparc_info): Likewise.
1191         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1192         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1193         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1194         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1195
1196 2013-07-22  Sterling Augustine  <saugustine@google.com>
1197
1198         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1199         Convert parameter shndx to local variable. Add parameters symtab
1200         and symtab_size.  Scan over section names.  Find relocation
1201         section corresponding to current section.  Create and initialize
1202         reloc_mapper_ and reloc_type_.
1203         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1204         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1205         cu_offset_.
1206         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1207         Initialize new fields unit_length_ and cu_offset_.
1208         (Dwarf_pubnames_table::read_section): Update prototype.
1209         (Dwarf_pubnames_table::cu_offset): New member function.
1210         (Dwarf_pubnames_table::subsection_size): Likewise.
1211         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1212         New fields.
1213         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1214         member functions public.
1215         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1216         Update comment.  Rework logic.  Move repeated parts to...
1217         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1218         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1219         pubtypes_table_, and stmt_list_offset.
1220         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1221         Gdb_index::find_pubtype_offset,
1222         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1223         (Gdb_index::pubnames_read): Update prototype and rework logic.
1224         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1225         Forward declare.
1226         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1227         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1228         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1229         Gdb_index::map_pubtable_to_dies):
1230         Declare functions.
1231         (Gdb_index::pubnames_read): Update declaration.
1232         (Gdb_index::Pubname_offset_map): New type.
1233         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1234         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1235         Gdb_index::stmt_list_offset): Declare.
1236         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1237         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1238         Gdb_index::pubtypes_offset_): Remove.
1239
1240 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1241
1242         * options.h (General_options): Add -Trodata-segment option.
1243         * parameters.cc (Parameters::check_rodata_segment): New function.
1244         (Parameters::set_target_once): Call it.
1245         * parameters.h (Parameters): Declare it (private member function).
1246         * layout.cc (load_seg_unusable_for_headers): New function, broken
1247         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1248         then validate rodata segment rather than text segment.
1249         (relaxation_loop_body): Call that.
1250         (is_text_segment): New function.  Don't admit a non-executable
1251         segment if TARGET->isolate_execinstr().
1252         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1253
1254 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1255
1256         PR gold/15070
1257         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1258         * nacl.h (Sniff_file::View::View): Request aligned view.
1259
1260 2013-07-11  Cary Coutant  <ccoutant@google.com>
1261
1262         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1263         correct BRLT entry size.
1264
1265 2013-07-03  Alan Modra  <amodra@gmail.com>
1266
1267         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1268         comment.
1269
1270 2013-07-01  Cary Coutant  <ccoutant@google.com>
1271
1272         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1273         reloc_type_.
1274         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1275         (Dwarf_ranges_table::lookup_reloc): New function.
1276         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1277         reloc_type_.
1278         (Dwarf_ranges_table::lookup_reloc): New function.
1279         (Dwarf_ranges_table::reloc_type_): New data member.
1280
1281 2013-06-27  Jing Yu  <jingyu@google.com>
1282
1283         PR gold/15662
1284         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1285         function.
1286         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1287         (Target_powerpc::do_relax): Call the above.
1288
1289 2013-06-27  Cary Coutant  <ccoutant@google.com>
1290
1291         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1292         on garbage collected .opd section.
1293
1294 2013-06-27  Alan Modra  <amodra@gmail.com>
1295
1296         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1297         is non-zero.
1298         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1299         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1300
1301 2013-06-14  Cary Coutant  <ccoutant@google.com>
1302
1303         * resolve.cc (Symbol::override_base): Don't override st_type
1304         from plugin placeholder symbols.
1305         (Symbol_table::resolve): Likewise.
1306         (Symbol_table::should_override): Don't complain about TLS mismatch
1307         if the TO symbol is a plugin placeholder.
1308         * testsuite/Makefile.am (plugin_test_tls): New test.
1309         * testsuite/Makefile.in: Regenerate.
1310         * testsuite/plugin_test_tls.sh: New test script.
1311         * testsuite/two_file_test_2_tls.cc: New test source.
1312         * testsuite/two_file_test_tls.cc: New test source.
1313
1314 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1315
1316         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1317         the maximum segment alignment is larger than the page size.
1318         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1319         correctly aligns the symbols with large alignemnt.
1320         * testsuite/Makefile.in: Regenerate.
1321         * testsuite/large_symbol_alignment.cc: New file.
1322
1323 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1324             Sriraman Tallam  <tmsriram@google.com>
1325
1326         * options.h (sort_section): New option.
1327         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1328         Rename from Input_section_sort_section_name_special_ordering_compare.
1329         (Input_section_sort_section_name_compare): New struct.
1330         * output.cc (Output_section::Input_section_sort_section_name_compare::
1331         operator()): New function.
1332         (Output_section::sort_attached_input_sections): Use new sort function
1333         for .text if --sort-section=name is specified.
1334         * layout.cc (Layout::make_output_section):
1335         Add sorting by name when --sort-section=name is specified.
1336         * testsuite/Makefile.am (text_section_grouping): Test option
1337         --sort-section=name.
1338         * testsuite/Makefile.in: Regenerate.
1339         * testsuite/section_sorting_name.cc: New file.
1340         * testsuite/section_sorting_name.sh: New file.
1341
1342 2013-05-21  Cary Coutant  <ccoutant@google.com>
1343
1344         * symtab.h (Symbol::is_cxx_vtable): New function.
1345         * target-reloc.h (relocate_section): Check for vtable symbol.
1346         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1347         * testsuite/Makefile.in: Regenerate.
1348         * testsuite/missing_key_func.cc: New test source.
1349         * testsuite/missing_key_func.sh: New test script.
1350
1351 2013-05-21  Cary Coutant  <ccoutant@google.com>
1352
1353         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1354         type of enclosing symbol.
1355         (Relocate_info::location): Check symbol type when describing symbol.
1356         * object.h (Symbol_location_info): Remove unused line_number;
1357         add enclosing_symbol_type.
1358         * testsuite/debug_msg.sh: Adjust expected output.
1359
1360 2013-05-13  Cary Coutant  <ccoutant@google.com>
1361
1362         * configure.ac: Export DEFAULT_TARGET.
1363         * configure: Regenerate.
1364         * Makefile.in: Regenerate.
1365         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1366         * testsuite/Makefile.in: Regenerate.
1367         * testsuite/debug_msg.sh: Delete duplicate tests.
1368         Don't check undef_int error message match for powerpc where the
1369         source file and line number aren't available.
1370
1371 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1372
1373         * options.h (General_options): Add --rosegment-gap option.
1374         * options.cc (finalize): --rosegment-gap implies --rosegment.
1375         * layout.cc (set_segment_offsets): Let user option override
1376         target->rosegment_gap().
1377
1378 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1379
1380         * options.h (General_options): Remove leading space from help
1381         messages for -nostdlib and --rosegment.
1382
1383 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1384
1385         PR ld/15365
1386         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1387
1388 2013-05-03  Alan Modra  <amodra@gmail.com>
1389
1390         * merge.cc (Output_merge_string::do_add_input_section): Correct
1391         scan for number of strings.  Rename vars to avoid shadowing.
1392         Include missing terminator in input_size_.
1393
1394 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1395
1396         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1397         Restore empty string handling.
1398
1399 2013-05-01  Cary Coutant  <ccoutant@google.com>
1400
1401         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1402         uninitialized warning.
1403
1404 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1405
1406         * output.cc (Output_section::add_merge_input_section): Allow
1407         to merge sections if the alignment is more than character size.
1408         * merge.h (Output_merge_string::Output_merge_string): Remove
1409         assert.
1410         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1411         only not-null strings. Check the alignment of strings.
1412         * stringpool.h
1413         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1414         alignment as the argument.
1415         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1416         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1417         Align non-zero length strings according to the addralign_.
1418         (Stringpool_template<Stringpool_char>::set_string_offsets):
1419         Updating offsets according to the given alignment.
1420         * testsuite/Makefile.am (text_section_grouping): Test if string
1421         literals are getting merged.
1422         * testsuite/Makefile.in: Regenerate.
1423         * testsuite/merge_string_literals_1.c: New file.
1424         * testsuite/merge_string_literals_2.c: Ditto.
1425         * testsuite/merge_string_literals.sh: Ditto.
1426
1427 2013-04-26  Ian Lance Taylor  <iant@google.com>
1428
1429         * target-reloc.h (relocate_section): If the reloc offset is out of
1430         range, pass VIEW as NULL to relocate.relocate.
1431         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1432         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1433         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1434         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1435         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1436         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1437
1438 2013-04-26  Geoff Pike  <gpike@chromium.org>
1439
1440         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1441         * layout.cc (Hash_task): New class.
1442         (Layout::queue_build_id_tasks): New function.
1443         (Layout::write_build_id): Handle single-thread portion of build ID
1444         computation.  (In some cases, all of it is single-threaded.)  Replace
1445         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1446         functionality in fewer lines of code.
1447         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1448         * options.h (General_options): make "--build-id" default to tree
1449         rather than sha1.  Add two new options related to --build-id=tree:
1450         --build-id-chunk-size-for-treehash and
1451         --build-id-min-file-size-for-treehash.
1452         * Makefile.am: add testing of --build-id=tree and related new options
1453         (these tests will be invoked by "make check").
1454         * Makefile.in: Regenerate.
1455
1456 2013-04-25  Alan Modra  <amodra@gmail.com>
1457
1458         * configure.tgt: Add powerpcle and powerpc64le.
1459
1460 2013-04-22  Alan Modra  <amodra@gmail.com>
1461
1462         PR gold/15355
1463         * layout.cc (Layout::segment_precedes): Allow more than one
1464         segment with the same type and flags.
1465
1466 2013-04-15  Cary Coutant  <ccoutant@google.com>
1467
1468         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1469         allocate space in file for BSS sections.
1470
1471 2013-04-15  Cary Coutant  <ccoutant@google.com>
1472
1473         * script-sections.cc (Orphan_output_section): Reset address
1474         to zero after each orphaned section for relocatable links.
1475
1476 2013-04-15  Cary Coutant  <ccoutant@google.com>
1477
1478         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1479         section starting address for relocatable link.
1480         * testsuite/Makefile.am (script_test_11): New test.
1481         * testsuite/Makefile.in: Regenerate.
1482         * testsuite/script_test_11.c: New source file.
1483         * testsuite/script_test_11.t: New linker script.
1484
1485 2013-04-13  Alan Modra  <amodra@gmail.com>
1486
1487         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1488         owner when sections are not adjacent and exceed group size.
1489         (Target_powerpc::group_sections): Handle corner case.
1490         (Target_powerpc::Branch_info::make_stub): Handle case where
1491         stub table doesn't exist due to branches in non-exec sections.
1492         (Target_powerpc::Relocate::relocate): Likewise.
1493
1494 2013-04-11  Alan Modra  <amodra@gmail.com>
1495
1496         PR gold/15354
1497         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1498         .branch_lt to match bfd ld.  Adjust comments throughout file.
1499
1500 2013-04-04  Ian Lance Taylor  <iant@google.com>
1501
1502         GCC PR c++/56840
1503         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1504         sections before checking whether they are included in the link.
1505
1506 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1507
1508         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1509         object before calling the plugin claim_file handler.  Pass the elf
1510         object of the archive to the plugin. Delete the elf object if the
1511         plugin claims the file.
1512
1513 2013-03-21  Alan Modra  <amodra@gmail.com>
1514
1515         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1516         segment when omagic.
1517
1518 2013-03-21  Alan Modra  <amodra@gmail.com>
1519
1520         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1521         comparison warning.
1522         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1523         uninitialized" warning.
1524
1525 2013-03-20  Alan Modra  <amodra@gmail.com>
1526
1527         * symtab.h (Symbol::clear_version): New function.
1528         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1529         is_needed by weak references.  Clear version for symbols defined
1530         in as-needed objects that are not needed.
1531
1532 2013-03-15  Alan Modra  <amodra@gmail.com>
1533
1534         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1535         static and public.  Add report_err param.  Return false for data refs.
1536         (Target_powerpc::rela_dyn_section): New overloaded function.
1537         (Target_powerpc::plt_, iplt_): Elucidate.
1538         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1539         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1540         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1541         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1542         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1543         push_branch and make_plt_entry for ifunc syms when
1544         reloc_needs_plt_for_ifunc.
1545         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1546         for ifunc unless reloc_needs_plt_for_ifunc.
1547
1548 2013-03-15  Alan Modra  <amodra@gmail.com>
1549
1550         * gc.h (gc_process_relocs): Don't look through function descriptors.
1551         * icf.cc (get_section_contents): Do so here instead.
1552
1553 2013-03-13  Alan Modra  <amodra@gmail.com>
1554
1555         * powerpc.cc (is_branch_reloc): Forward declare.
1556         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1557         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1558         false for 64-bit, true for 32-bit non-branch relocs.
1559         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1560         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1561         nm output.
1562         (icf_safe_test): Generate linker map file as well as nm output.
1563         (icf_safe_so_test): Likewise.
1564         * testsuite/Makefile.in: Regenerate.
1565         * testsuite/icf_test.sh: Parse linker map file to determine
1566         section folding.
1567         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1568         * testsuite/icf_safe_so_test.sh: Likewise.
1569         (X86_32_or_ARM_specific_safe_fold): Merge into..
1570         (arch_specific_safe_fold): ..this.
1571         (X86_64_specific_safe_fold): Delete unused function.
1572
1573 2013-03-12  Alan Modra  <amodra@gmail.com>
1574
1575         * gc.h (gc_process_relocs): Look through function descriptors
1576         to determine shndx, symvalue and addend used by ICF.  Tidy
1577         variable duplication.
1578
1579 2013-03-11  Alan Modra  <amodra@gmail.com>
1580
1581         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1582         * layout.cc (Layout_task_runner::run): ..to here.
1583         * symtab.h (struct Symbol_location): Extract from..
1584         (class Symbol_table): ..here.
1585         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1586         * target.h (class Target): Add function_location and
1587         do_function_location functions.
1588         (class Sized_target): Add do_function_location.
1589         * object.h (class Sized_relobj_file): Move find_shdr..
1590         (class Object): ..to here.
1591         * object.cc: Likewise.  Update to suit.  Instantiate.
1592         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1593         * powerpc.cc (class Powerpc_dynobj): New.
1594         (Target_powerpc::do_function_location): New function.
1595         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1596         (Powerpc_dynobj::do_read_symbols): New function.
1597         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1598
1599 2013-03-08  Ian Lance Taylor  <iant@google.com>
1600
1601         * options.cc (General_options::string_to_object_format): Accept
1602         "default".
1603
1604 2013-03-08  Alan Modra  <amodra@gmail.com>
1605
1606         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1607         pointer to Post_fde.
1608         (struct Post_fde): Move definition to here..
1609         * ehframe.cc (struct Post_fde): ..from here.
1610         (Cie::write): Don't alloc Post_fde.
1611         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1612
1613 2013-03-07  Alan Modra  <amodra@gmail.com>
1614
1615         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1616         relocation referencing .LC0.
1617         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1618
1619 2013-03-07  Alan Modra  <amodra@gmail.com>
1620
1621         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1622         always_inline.  Add assembly for powerpc to avoid GOT.
1623
1624 2013-03-07  Alan Modra  <amodra@gmail.com>
1625
1626         * testsuite/script_test_10.sh: Don't test .bss section
1627         header number.
1628
1629 2013-03-06  Alan Modra  <amodra@gmail.com>
1630
1631         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1632         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1633         all callers.  Handle folded sections.
1634         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1635         to Powerpc_relobj.
1636         (Global_symbol_visitor_opd::operator()): Likewise.
1637
1638 2013-03-04  Alan Modra  <amodra@gmail.com>
1639
1640         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1641         * testsuite/Makefile.in: Regenerate.
1642
1643 2013-03-01  Cary Coutant  <ccoutant@google.com>
1644
1645         Add dwp support for v2 DWARF package file format.
1646         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1647         tu_length parameter.  Adjust all callers.
1648         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1649         * dwp.cc: Include dwarf.h.
1650         (Section_bounds): New struct type.
1651         (Unit_set): New struct type.
1652         (Dwo_file::Dwo_file): Initialize new data member.
1653         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1654         Combine and rename to...
1655         (Dwo_file::read_unit_index): ...this.
1656         (Dwo_file::sized_read_compunit_index)
1657         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1658         (Dwo_file::sized_read_unit_index): ...this.
1659         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1660         parameters; add section_id parameter.
1661         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1662         (Dwo_file::add_unit_set): ...this.
1663         (Dwo_file::shndx_map_): Remove.
1664         (Dwo_file::sect_offsets_): New data member.
1665         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1666         (Dwp_output_file::add_section): Rename to...
1667         (Dwp_output_file::add_contribution): ...this.
1668         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1669         (Dwp_output_file::add_tu_set): Likewise.
1670         (Dwp_output_file::Contribution): New type.
1671         (Dwp_output_file::Section::contributions): New data member.
1672         (Dwp_output_file::Cu_or_tu_set): Remove.
1673         (Dwp_output_file::Section::Section): New ctor.
1674         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1675         (Dwp_output_file::Dwp_index::Section_table): New type.
1676         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1677         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1678         parameter.
1679         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1680         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1681         (Dwp_output_file::Dwp_index::section_table): New member function.
1682         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1683         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1684         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1685         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1686         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1687         (Dwp_output_file::Dwp_index::section_table_): New data member.
1688         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1689         (Dwp_output_file::add_output_section): New member function.
1690         (Dwp_output_file::write_new_section): New member function.
1691         (Dwp_output_file::write_contributions): New member function.
1692         (Dwp_output_file::section_id_map_): New data member.
1693         (class Dwo_id_info_reader): Remove.
1694         (class Unit_reader): New class.
1695         (get_dwarf_section_name): New function.
1696         (Dwo_file::read_executable): Adjust initializations of class data.
1697         (Dwo_file::read): Add support for v2 package file format.
1698         (Dwo_file::read_unit_index): Likewise.
1699         (Dwo_file::sized_read_unit_index): Likewise.
1700         (Dwo_file::copy_section): Likewise.
1701         (Dwo_file::add_unit_set): Likewise.
1702         (Dwp_output_file::add_output_section): Likewise.
1703         (Dwp_output_file::add_contribution): Likewise.
1704         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1705         for empty slot.
1706         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1707         file format.
1708         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1709         slot.
1710         (Dwp_output_file::initialize): Remove unused function.
1711         (Dwp_output_file::finalize): Add support for v2 package file format.
1712         (Dwp_output_file::write_index): Likewise.
1713         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1714         function prototype.
1715
1716 2013-03-01  Cary Coutant  <ccoutant@google.com>
1717
1718         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1719         function into class definition in header file.
1720         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1721         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1722         New function.
1723         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1724
1725 2013-02-28  Alan Modra  <amodra@gmail.com>
1726
1727         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1728         * target.cc (Target::do_plt_fde_location): New function.
1729         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1730         accessor function, and constructor param.
1731         (struct Post_fde, Post_fdes): Declare.
1732         (Cie::write): Add post_fdes param.
1733         * ehframe.cc (Fde::write): Use plt_fde_location.
1734         (struct Post_fde): Define.
1735         (Cie::write): Stash FDEs added post merge mapping.
1736         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1737         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1738         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1739         other FDEs.
1740         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1741         (Target_powerpc::has_glink): New function.
1742         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1743         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1744         glink_eh_frame_fde_32, default_fde): New data.
1745         (Stub_table::eh_frame_added_): New var.
1746         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1747         Make const.
1748         (Stub_table::add_eh_frame): New function.
1749         (Output_data_glink::add_eh_frame): New function.
1750         (Target_powerpc::make_glink_section): Call add_eh_frame.
1751
1752 2013-02-15  Ian Lance Taylor  <iant@google.com>
1753
1754         * options.h (DEFINE_uint64_alias): Define.
1755         (class General_options): Add -Ttext-segment as an alias for
1756         -Ttext.
1757
1758 2013-02-15  Alan Modra  <amodra@gmail.com>
1759
1760         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1761         (Stub_table::do_write): ..here, two places.
1762         (Stub_table::plt_call_size): Use it here too.
1763
1764 2013-02-11  Ian Lance Taylor  <iant@google.com>
1765
1766         * descriptors.cc (Descriptors::close_all): New function.
1767         * descriptors.h (class Descriptors): Declare close_all.
1768         (close_all_descriptors): New inline function.
1769         * plugin.cc: Include "descriptors.h".
1770         (Plugin_manager::cleanup): Call close_all_descriptors.
1771
1772 2013-02-06  Alan Modra  <amodra@gmail.com>
1773
1774         * README: Update coding style link.
1775
1776 2013-01-28  Cary Coutant  <ccoutant@google.com>
1777
1778         * dwp.cc (File_list): New typedef.
1779         (Dwo_name_info_reader): New class.
1780         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1781         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1782         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1783         (Dwo_file::read_executable): New function.
1784         (Dwo_file::read): Move common setup code to ...
1785         (Dwo_file::make_object): ... here.
1786         (dwp_options): Add --exec/-e.
1787         (usage): Likewise.
1788         (main): Likewise.
1789
1790 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1791
1792         * layout.cc (Layout::layout): Check for option text_reorder.
1793         (Layout::make_output_section): Ditto.
1794         * options.h (text_reorder): New option.
1795         * output.cc (Input_section_sort_compare): Remove special ordering
1796         of section names.
1797         (Output_section::
1798          Input_section_sort_section_name_special_ordering_compare::
1799          operator()): New function.
1800         (Output_section::sort_attached_input_sections): Use new sort function
1801         for .text.
1802         * output.h (Input_section_sort_section_name_special_ordering_compare):
1803         New struct.
1804         * testsuite/Makefile.am (text_section_grouping): Test option
1805         --no-text-reorder
1806         * testsuite/Makefile.in: Regenerate.
1807         * testsuite/text_section_grouping.sh: Check order of functions without
1808         default text reordering.
1809
1810 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1811
1812         * options.h (General_options): Change default to true for new_dtags.
1813
1814 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1815
1816         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1817         when enable_new_dtags is false.  Only add DT_RUNPATH when
1818         enable_new_dtags is true.
1819
1820 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1821
1822         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1823         used in declaration and definition consistent.
1824         (Target_powerpc::symval_for_branch): Ditto.
1825
1826 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1827
1828         * testsuite/plugin_final_layout.cc: Fix comment.
1829
1830 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1831
1832         * layout.cc (Layout::layout): Do not do default sorting for
1833         text sections when section ordering is specified.
1834         (make_output_section): Ditto.
1835         * testsuite/plugin_final_layout.cc: Name the function sections
1836         to catch reordering issues.
1837
1838 2013-01-15  Alan Modra  <amodra@gmail.com>
1839
1840         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1841         plt-thread-safe.
1842
1843 2013-01-15  Alan Modra  <amodra@gmail.com>
1844
1845         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1846         * testsuite/Makefile.in: Regenerate.
1847
1848 2013-01-14  Alan Modra  <amodra@gmail.com>
1849
1850         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1851         * testsuite/Makefile.in: Regenerate.
1852
1853 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1854
1855         PR bfd/14430
1856         Fix mingw gold build with plugins enabled
1857         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1858         * configure.ac: Export DLOPEN_LIBS and add headers check.
1859         * plugin.cc: Handle non-dlfcn case.
1860         * Makefile.in: Regenerate.
1861         * config.in: Regenerate.
1862         * configure: Regenerate.
1863         * testsuite/Makefile.in: Regenerate.
1864
1865 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1866
1867         * output.h (sort_attached_input_sections): Change to be public.
1868         * script-sections.cc
1869         (Output_section_definition::set_section_addresses): Sort
1870         attached input sections according to section order before linker
1871         script assigns section addresses.
1872         (Orphan_output_section::set_section_addresses): Sort
1873         attached input sections according to section order before linker
1874         script assigns section addresses.
1875         * Makefile.am (final_layout.sh): Use a simple linker script to
1876         check if section ordering still works.
1877         * Makefile.in: Regenerate.
1878
1879 2013-01-09  Ben Cheng  <bccheng@google.com>
1880
1881         * arm.cc (Target_arm::attributes_accept_div): New function.
1882         (Target_arm::attributes_forbid_div): New function.
1883         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1884         attribute using the same new functions as what bfd/elf32_arm.c
1885         does.
1886
1887 2013-01-07  Cary Coutant  <ccoutant@google.com>
1888
1889         PR gold/14993
1890         * output.cc (Output_section::add_input_section): For incremental
1891         updates, don't track input sections that are allocated from patch
1892         space.
1893
1894 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1895             Ian Lance Taylor  <iant@google.com>
1896
1897         PR gold/14897
1898         * configure.ac (--enable-ld): Removed.
1899         (install_as_default): Set to yes only for --enable-gold=default
1900         or --disable-ld.
1901         * configure: Regenerated.
1902
1903 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1904
1905         * options.h (General_options): Add -fuse-ld= for GCC linker
1906         option compatibility.
1907
1908 2013-01-04  Cary Coutant  <ccoutant@google.com>
1909
1910         * configure.ac: Fix typo restoring CXXFLAGS.
1911         * configure: Regenerate.
1912
1913 2013-01-04  Cary Coutant  <ccoutant@google.com>
1914
1915         * testsuite/Makefile.am (CXXLINK_S): New macro.
1916         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1917         * testsuite/Makefile.in: Regenerate.
1918
1919 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1920
1921         * version.cc (print_version): Update copyright year to 2013.
1922
1923 2012-12-20  Ian Lance Taylor  <iant@google.com>
1924
1925         * layout.cc (Layout::special_ordering_of_input_section): New
1926         function.
1927         (Layout::layout): If input section requires special ordering, must
1928         sort input sections.
1929         (Layout::make_output_section): May sort .text input sections.
1930         (Layout::is_section_name_prefix_grouped): Remove.
1931         * layout.h (class Layout): Declare
1932         special_ordering_of_input_section.  Don't declare
1933         is_section_name_prefix_grouped.
1934         * output.cc (Output_section::add_input_section): Revert last
1935         change.
1936         (Output_section::Input_section_sort::match_file_name): Don't crash
1937         if called on output section data.
1938         (Output_section::Input_section_sort_compare): Sort based on
1939         special ordering.
1940         (Output_section::Input_section_sort_section_order_index_compare):
1941         Revert last patch.
1942         (Output_section::sort_attached_input_sections): Likewise.
1943
1944 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1945
1946         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1947         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1948         * output.cc (Output_section::add_input_section): Check if section
1949         name contains special prefix.  Keep input sections to sort such
1950         sections.
1951         (Output_section::Input_section_sort_section_order_index_compare
1952          ::operator()): Group sections according to prefixes.
1953         (Output_section::sort_attached_input_sections): Add condition to
1954         Input_section_entry constructor call.
1955         * testsuite/Makefile.am (text_section_grouping): New test.
1956         * testsuite/Makefile.in: Regenerate.
1957         * testsuite/text_section_grouping.cc: New file.
1958         * testsuite/text_section_grouping.sh: New file.
1959
1960 2012-12-17  Nick Clifton  <nickc@redhat.com>
1961
1962         * Makefile.am: Add copyright notice.
1963         * NEWS: Likewise.
1964         * README: Likewise.
1965         * configure.ac: Likewise.
1966         * ftruncate.c: Likewise.
1967         * Makefile.in: Regenerate.
1968
1969 2012-12-14  Cary Coutant  <ccoutant@google.com>
1970
1971         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1972         --no-as-needed flag.
1973         (exception_separate_shared_12_test): Likewise.
1974         (incremental_copy_test): Likewise.
1975         * testsuite/Makefile.in: Regenerate.
1976
1977 2012-12-14  Cary Coutant  <ccoutant@google.com>
1978
1979         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1980         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1981
1982 2012-12-12  Alan Modra  <amodra@gmail.com>
1983
1984         * powerpc.cc (class Track_tls): New.
1985         (class Relocate, class Scan): Inherit Track_tls.
1986         (Target_powerpc::Scan::local, global): Track tls optimization
1987         and avoid creating plt entry for __tls_get_addr if all uses
1988         are optimized away.
1989         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1990
1991 2012-12-12  Alan Modra  <amodra@gmail.com>
1992
1993         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1994         Replace no_toc_optimize with toc_optimize.
1995         * output.h (Output_section::input_sections): Provide non-const variant.
1996         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1997         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1998         accessors.
1999         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
2000         (class Sort_toc_sections): New.
2001         (Target_powerpc::do_finalize_sections): Sort toc sections.
2002         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
2003
2004 2012-12-10  Roland McGrath  <mcgrathr@google.com>
2005
2006         * testsuite/binary_unittest.cc (read_all): New function.
2007         (Sized_binary_test): Use it instead of ::read.
2008         * fileread.cc (do_read): Don't assume pread always reads the whole
2009         amount in a single call.
2010
2011 2012-12-10  Alan Modra  <amodra@gmail.com>
2012
2013         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
2014         Set EM_PPC64 or EM_PPC here.
2015         (Target_selector_powerpc::do_recognize): Delete.
2016
2017 2012-12-10  Alan Modra  <amodra@gmail.com>
2018
2019         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
2020         stub_table_.
2021         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
2022
2023 2012-12-07  Roland McGrath  <mcgrathr@google.com>
2024
2025         * testsuite/binary_unittest.cc (Sized_binary_test):
2026         Use open_descriptor rather than ::open.
2027
2028 2012-12-07  Alan Modra  <amodra@gmail.com>
2029
2030         * powerpc.cc (Stub_table::do_write): Delete redundant Address
2031         typedef and invalid_address constant.
2032         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
2033         instantiate constants.
2034
2035 2012-12-06  Roland McGrath  <mcgrathr@google.com>
2036
2037         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
2038         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
2039         * aclocal.m4: Regenerate.
2040         * configure: Regenerate.
2041         * Makefile.in: Regenerate.
2042         * testsuite/Makefile.in: Regenerate.
2043
2044 2012-12-07  Alan Modra  <amodra@gmail.com>
2045
2046         * options.h (General_options): Add no_toc_optimize.
2047         * powerpc.cc (ok_lo_toc_insn): New function.
2048         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
2049
2050 2012-12-06  Alan Modra  <amodra@gmail.com>
2051
2052         * options.h (General_options): Add plt_align, plt_static_chain,
2053         plt_thread_safe.  Update stub_group_size help text.
2054         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
2055         for new plt_thread_safe_ var.
2056         (use_plt_offset): Correct comments.
2057         (Target_powerpc::do_relax): Look for thread creation symbols to
2058         determine default plt_thread_safe value.  Clear plt call stubs
2059         as well as branch stubs each iteration.
2060         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2061         insn constants.
2062         (l, hi, ha, write_insn): Move earlier.
2063         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2064         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2065         plt stubs too.
2066         (Stub_table::update_size): Adjust.
2067         (Stub_table::prev_size, set_prev_size): Delete.
2068         (Stub_table::stub_align): Let --plt-align affect result.
2069         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2070         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2071         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2072         (Stub_table::do_write): Support more stub variants.
2073
2074 2012-12-04  Alan Modra  <amodra@gmail.com>
2075
2076         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2077         (Target_powerpc::do_define_standard_symbols): New function.
2078
2079 2012-12-03  Alan Modra  <amodra@gmail.com>
2080
2081         * output.h: Formatting, whitespace.
2082
2083 2012-12-03  Alan Modra  <amodra@gmail.com>
2084
2085         * layout.h (Layout::get_executable_sections): Declare.
2086         * layout.cc (Layout::get_executable_sections): New function.
2087         * arm.cc (Target_arm::group_sections): Use it.
2088         (Arm_output_section::group_sections): Delete now redundant test.
2089         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2090         param to handle relative relocs.
2091         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2092         (Output_data_reloc::add_absolute): Adjust.
2093         (Output_data_reloc::add_relative): New function.
2094         (Output_data::reset_data_size): New function.
2095         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2096         (Output_section::set_addralign): New function.
2097         (Output_section::checkpoint_set_addralign): New function.
2098         (Output_section::clear_section_offsets_need_adjustment): New function.
2099         (Output_section::input_sections): Make public.
2100         * powerpc.cc (class Output_data_brlt_powerpc): New.
2101         (class Stub_table, class Stub_control): New.
2102         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2103         stub_table_, set_stub_table, stub_table): New vectors and accessor
2104         functions.
2105         (Target_powerpc::do_may_relax, do_relax, push_branch,
2106         new_stub_table, stub_tables, brlt_section, group_sections,
2107         add_branch_lookup_table, find_branch_lookup_table,
2108         write_branch_lookup_table, make_brlt_section): New functions.
2109         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2110         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2111         branch_info_): New vars.
2112         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2113         make call stubs here.
2114         (Output_data_glink): Remove all call stub handling from this class.
2115         (Target_powerpc::Scan::local, global): Save interesting branch
2116         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2117         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2118         functions on final link.
2119         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2120         Handle long branch destinations too.
2121         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2122         do_plt_address_for_local): Adjust lookup of plt call stubs.
2123
2124 2012-11-30  Alan Modra  <amodra@gmail.com>
2125
2126         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2127         relocs against protected symbols when building 32-bit shared libs.
2128
2129 2012-11-30  Alan Modra  <amodra@gmail.com>
2130
2131         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2132         param.  Call got_section() to make .got.  Update all callers
2133         and their callers and so on.
2134
2135 2012-11-30  Alan Modra  <amodra@gmail.com>
2136
2137         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2138         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2139         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2140         value if it already exists.
2141
2142 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2143
2144         PR gold/14858
2145         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2146
2147 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2148
2149         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2150         than bfc instruction for data sandboxing.
2151
2152 2012-11-08  Alan Modra  <amodra@gmail.com>
2153
2154         * po/POTFILES.in: Regenerate.
2155
2156 2012-11-05  Alan Modra  <amodra@gmail.com>
2157
2158         * configure.ac: Apply 2012-09-10 change to config.in here.
2159         * configure: Regenerate.
2160
2161 2012-11-05  Alan Modra  <amodra@gmail.com>
2162
2163         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2164         (struct Opd_ent): Use "Address" rather than "Offset".
2165         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2166         (Target_powerpc::got_section): Make public.
2167         (Target_powerpc::scan_relocs): Move code setting symbols..
2168         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2169         Create _SDA_BASE_ only when referenced.
2170
2171 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2172
2173         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2174         from last change.
2175
2176 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2177
2178         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2179         for offset_in_output_section parameter.
2180         (Sized_target::relocate_special_relocatable): Likewise.
2181         * arm.cc (Target_arm::relocate_relocs): Likewise.
2182         (Target_arm::relocate_special_relocatable): Likewise.
2183         * i386.cc (Target_i386::relocate_relocs): Likewise.
2184         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2185         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2186         * target-reloc.h (relocate_relocs): Likewise.
2187         * testsuite/testfile.cc (Target_test): Likewise.
2188         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2189         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2190
2191         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2192         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2193
2194         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2195         parameter, which is unused in the [!F_SETFD] case.
2196
2197         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2198         SYMNDX to off_t before comparing it to this->data_size().
2199         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2200         * incremental.cc (Output_section_incremental_inputs::do_write):
2201         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2202
2203         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2204
2205 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2206
2207         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2208         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2209         in EABI_VER5.
2210
2211 2012-10-29  Cary Coutant  <ccoutant@google.com>
2212
2213         * dwp.cc (usage): Add file and exit status parameters;
2214         add --help and --version options.
2215         (print_version): New function.
2216         (main): Add --help and --version options.
2217
2218 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2219
2220         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2221         final_layout_sequence.txt.
2222         * testsuite/Makefile.in: Regenerated.
2223
2224 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2225
2226         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2227         COMPILE generated by automake.
2228         (LINK1): Likewise.
2229         (CXXCOMPILE1): Likewise.
2230         (CXXLINK1): Likewise.
2231         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2232         (LINK): Likewise.
2233         (CXXCOMPILE): Likewise.
2234         (CXXLINK): Likewise.
2235         * testsuite/Makefile.in: Regenerated.
2236
2237 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2238
2239         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2240         on bad fwrite return.
2241
2242 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2243
2244         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2245         on val.
2246
2247 2012-10-23  Cary Coutant  <ccoutant@google.com>
2248
2249         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2250         * testsuite/Makefile.in: Regenerate.
2251         * testsuite/dwp_test.h: New source file.
2252         * testsuite/dwp_test_1.cc: New source file.
2253         * testsuite/dwp_test_1.s: New source file.
2254         * testsuite/dwp_test_1.sh: New source file.
2255         * testsuite/dwp_test_1b.cc: New source file.
2256         * testsuite/dwp_test_1b.s: New source file.
2257         * testsuite/dwp_test_2.cc: New source file.
2258         * testsuite/dwp_test_2.s: New source file.
2259         * testsuite/dwp_test_2.sh: New source file.
2260         * testsuite/dwp_test_main.cc: New source file.
2261         * testsuite/dwp_test_main.s: New source file.
2262
2263 2012-10-23  Cary Coutant  <ccoutant@google.com>
2264
2265         * dwp.h: New header file.
2266         * dwp.cc: New source file.
2267         * gold.h: Move shared declarations to system.h.
2268         * system.h: New header file.
2269         * Makefile.am: Add dwp.
2270         * Makefile.in: Regenerate.
2271
2272 2012-10-23  Cary Coutant  <ccoutant@google.com>
2273
2274         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2275         Dwarf_info_reader::read_from_pointer.
2276         (Dwarf_pubnames_table::read_header): Likewise.
2277         (Dwarf_pubnames_table::next_name): Likewise.
2278         (Dwarf_die::read_attributes): Likewise.
2279         (Dwarf_die::skip_attributes): Likewise.
2280         (Dwarf_info_reader::read_from_pointer): New function template.
2281         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2282         (Dwarf_pubnames_table): Likewise.
2283         (Dwarf_info_reader::read_from_pointer): New function template.
2284         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2285         Dwarf_pubnames_table ctor.
2286
2287 2012-10-23  Cary Coutant  <ccoutant@google.com>
2288
2289         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2290         abbrev_shndx.
2291         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2292         abbrev_shndx_.
2293         (Dwarf_info_reader::set_abbrev_shndx): New method.
2294         (Dwarf_info_reader::abbrev_shndx_): New data member.
2295
2296 2012-10-23  Cary Coutant  <ccoutant@google.com>
2297
2298         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2299         from object, not parameters.
2300         (Dwarf_info_reader::parse): Likewise.
2301         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2302         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2303         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2304         methods.
2305
2306 2012-10-23  Cary Coutant  <ccoutant@google.com>
2307
2308         * fileread.cc (Input_file::Input_file): New constructor.
2309         * fileread.h (class Input_file): Add new constructor.
2310
2311 2012-10-18  Alan Modra  <amodra@gmail.com>
2312
2313         PR gold/14727
2314         * object.cc (Relobj::is_section_name_included): Also match
2315         .sdata personality section.
2316
2317 2012-10-18  Alan Modra  <amodra@gmail.com>
2318
2319         * target-reloc.h (class Default_comdat_behavior): New, package up..
2320         (get_comdat_behaviour): ..this.
2321         (relocate_section): Add Relocate_comdat_behavior template arg,
2322         adjust code to suit.
2323         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2324         (Target_arm::scan_reloc_section): Likewise.
2325         * i386.cc (Target_i386::relocate_section): Likewise.
2326         * sparc.cc (Target_sparc::relocate_section): Likewise.
2327         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2328         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2329         * powerpc.cc (class Relocate_comdat_behavior): New.
2330         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2331         gold::relocate_section with new template arg.
2332
2333 2012-10-18  Alan Modra  <amodra@gmail.com>
2334
2335         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2336         dynamic relocs for GOT_TPREL got entries, without symbol if
2337         resolving locally.
2338         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2339         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2340         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2341
2342 2012-10-17  Alan Modra  <amodra@gmail.com>
2343
2344         PR gold/14726
2345         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2346
2347 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2348
2349         * layout.cc (Layout::include_section): Keep sections marked
2350         SHF_EXCLUDE when doing relocatable links.
2351
2352 2012-10-16  Alan Modra  <amodra@gmail.com>
2353
2354         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2355         (Target_powerpc::do_finalize_sections): Call it.
2356         (Output_data_save_res): New class and supporting functions.
2357         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2358         normal symbols defined in object files.
2359
2360 2012-10-12  Alan Modra  <amodra@gmail.com>
2361
2362         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2363         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2364         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2365         section if scan_opd_relocs not yet called.
2366         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2367
2368 2012-10-12  Alan Modra  <amodra@gmail.com>
2369
2370         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2371         add_local_ifunc_entry): Revert last change.
2372         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2373
2374 2012-10-05  Alan Modra  <amodra@gmail.com>
2375
2376         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2377         do_plt_address_for_global): New functions.
2378         (Output_data_got_powerpc::do_write): Don't segfault when linking
2379         statically.
2380         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2381         add_local_ifunc_entry): Return true on adding entry..
2382         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2383         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2384         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2385         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2386         set up symbols here.
2387         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2388         syms here.  Do so even when no .iplt.  Don't segfault when linking
2389         statically.
2390         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2391         new variants without reloc param.
2392         (Glink_sym_ent::Glink_sym_ent): Likewise.
2393         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2394         reloc when refs will resolve to plt call stub.
2395         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2396         R_PPC_PLTREL24 to resolve locally.
2397         (Target_powerpc::Scan::global): Correct ifunc handling.
2398         (Target_powerpc::Relocate::relocate): Correct local sym glink
2399         lookup.  Don't destroy "value" when we have a plt call stub,
2400         and when checking plt call validity.
2401         (Target_powerpc::do_dynsym_value): Simplify.
2402
2403 2012-10-05  Alan Modra  <amodra@gmail.com>
2404
2405         * i386.cc (Output_data_plt_i386::address_for_global,
2406         address_for_local): Add plt offset to returned value.  Adjust uses.
2407         * sparc.cc (Output_data_plt_sparc::address_for_global,
2408         address_for_local): Likewise.
2409         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2410         address_for_local): Likewise.
2411         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2412         address_for_local): Likewise.
2413         * target.h (Target::plt_address_for_global, plt_address_for_local):
2414         Update comment.
2415         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2416         (Output_data_got::Got_entry::write): Nor here.
2417         * output.h: Comment fix.
2418
2419 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2420
2421         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2422         global_offset_table_ value for larget got.
2423         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2424
2425 2012-09-29  Alan Modra  <amodra@gmail.com>
2426
2427         * powerpc.cc (Target_powerpc::iplt_): New output section.
2428         (Target_powerpc::iplt_section, make_iplt_section,
2429         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2430         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2431         Target_powerpc::plt_entry_count): Count iplt entries too.
2432         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2433         reloc section in constructor.  New params.
2434         (Target_powerpc::make_plt_section): Create reloc section here instead.
2435         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2436         functions.
2437         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2438         (Output_data_glink::add_entry, find_entry): New functions to
2439         deal with local syms.
2440         (Glink_sym_ent): Add support for local syms.
2441         (Output_data_glink::do_write): Handle ifunc plt entries.
2442         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2443         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2444         (Target_powerpc::Relocate::relocate): Likewise.
2445         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2446
2447 2012-09-25  Alan Modra  <amodra@gmail.com>
2448
2449         * object.h (Sized_relobj_file::adjust_local_symbol,
2450         do_adjust_local_symbol): New functions.
2451         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2452         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2453         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2454         and irregular opd entry spacing.
2455         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2456         (Global_symbol_visitor_opd): New functor.
2457         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2458         on deleted opd entries.
2459
2460 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2461
2462         * tilegx.cc: New file.
2463         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2464         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2465         * configure.tgt: Add entries for tilegx*.
2466         * configure.ac: Likewise.
2467         * Makefile.in: Rebuild.
2468         * configure: Likewise.
2469         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2470         tilegx.
2471
2472 2012-09-13  Alan Modra  <amodra@gmail.com>
2473
2474         * target-reloc.h (scan_relocs): Call scan.local for relocs
2475         against symbols in discarded sections.  Pass is_discarded
2476         param.
2477         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2478         Add is_discarded param.
2479         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2480         is_discarded to flag opd entry as discarded.  Don't emit dyn
2481         relocs on such entries.
2482         (Target_powerpc::Scan::global): Similarly detect and handle
2483         such opd entries.
2484         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2485         opd_ent_.  Update all uses.
2486         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2487         (Target_powerpc::relocate_section): Zero out discarded opd
2488         entry relocs.
2489
2490 2012-09-12  Ian Lance Taylor  <iant@google.com>
2491
2492         PR gold/14570
2493         * output.cc: Rename Output_data_got template parameter from size
2494         to got_size for all functions.  Compile all variants of
2495         Output_data_got.
2496         (Output_data_got::Got_entry::write): Correct use of size for
2497         symbol value.  Use local_is_tls rather than casting to
2498         Sized_relobj_file.
2499         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2500         (class Sized_relobj_file): Add do_local_is_tls.
2501         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2502
2503 2012-09-11  Alan Modra  <amodra@gmail.com>
2504
2505         PR gold/14566
2506         * layout.cc (Layout::set_segment_offsets): When using
2507         common-page-size alignment, ensure we are on a new max-page-size
2508         page.
2509         * output.cc (Output_segment::set_section_addresses): Use
2510         abi_pagesize, not common_pagesize for relro boundary.
2511         (Output_segment::set_offset): Likewise.
2512
2513 2012-09-11  Alan Modra  <amodra@gmail.com>
2514
2515         * output.h (Output_data_got::add_global_tls, add_local_tls,
2516         add_local_tls_pair): New functions.
2517         (Output_data_got::add_local_pair_with_rel): Remove second
2518         reloc param.  Expand comment.
2519         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2520         use_plt_or_tls_offset_, similarly for constructor param.
2521         (Output_data_got::Got_entry::write): Add got_index param.
2522         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2523         add_local_tls_pair): New functions.
2524         (Output_data_got::Got_entry::write): Handle tls symbols
2525         with use_plt_or_tls_offset_ set specially.
2526         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2527         (Output_data_got::do_write): Replace iterator with index, pass
2528         index to entry write function.
2529         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2530         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2531         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2532         call.
2533         * i386.cc (Target_i386::Scan::local): Likewise.
2534         * sparc.cc (Target_sparc::Scan::local): Likewise.
2535         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2536         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2537         do_tls_offset_for_global): New functions.
2538         (Target_powerpc::Scan::local): Correct TLS relocations and got
2539         entry values.
2540         (Target_powerpc::Scan::global): Don't emit unnecessary
2541         dynamic relocations on TLS GOT entries.
2542
2543 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2544
2545         * config.in: Disable sanity check for kfreebsd.
2546
2547 2012-09-10  Sterling Augustine  <saugustine@google.com>
2548
2549         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2550         (Gdb_index::pubtypes_read): New parameter.
2551         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2552         to calls.
2553         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2554         pubtypes_object_.
2555
2556 2012-09-09  Alan Modra  <amodra@gmail.com>
2557
2558         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2559         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2560         * gc.h (gc_process_relocs): Call target gc_add_reference.
2561         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2562         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2563         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2564         unnecessary cast.
2565         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2566         to cater for when we don't need code offset.  Update use.
2567         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2568         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2569         set_opd_valid): New functions.
2570         (Target_powerpc::do_gc_add_reference): New function.
2571         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2572         stashed refs.
2573         (Target_powerpc::do_gc_mark_symbol): New function.
2574
2575 2012-09-06  Cary Coutant  <ccoutant@google.com>
2576
2577         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2578         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2579         (Dwarf_die::skip_attributes): Likewise.
2580         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2581         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2582         (main): Call it.
2583         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2584
2585 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2586
2587         * testsuite/script_test_3.t: Add .got.plt output section
2588         statement.
2589         * testsuite/script_test_4.t: Likewise.
2590
2591 2012-09-05  Alan Modra  <amodra@gmail.com>
2592
2593         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2594         update all uses and lose "enum" when using type.
2595
2596 2012-09-05  Alan Modra  <amodra@gmail.com>
2597
2598         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2599         * configure: Regenerate.
2600         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2601         (plugin_final_layout.stdout): Likewise.
2602         (memory_test): Set page sizes to 0x1000.
2603         * testsuite/Makefile.in: Regenerate.
2604         * testsuite/discard_locals_test.sh: Add FIXME comment.
2605         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2606         * testsuite/pr14265.t: Add .got output section statement.
2607         * testsuite/script_test_2.t: Likewise.
2608         * testsuite/script_test_3.t: Likewise.
2609         * testsuite/script_test_4.t: Likewise.
2610         * testsuite/script_test_5.t: Likewise.
2611         * testsuite/script_test_6.t: Likewise.
2612         * testsuite/script_test_7.t: Likewise.
2613         * testsuite/script_test_9.t: Likewise.
2614
2615 2012-09-05  Alan Modra  <amodra@gmail.com>
2616
2617         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2618         (Powerpc_relocate_functions::Status): New typedef.
2619         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2620         (Target_powerpc::Scan::local): Handle REL64.
2621         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2622         for REL32 and REL64.
2623         (Target_powerpc::symval_for_branch): New function, extracted from..
2624         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2625         checks.  Report overflow errors.
2626
2627 2012-09-05  Alan Modra  <amodra@gmail.com>
2628
2629         * object.h (Sized_relobj_file::emit_relocs): Delete.
2630         (Sized_relobj_file::emit_relocs_reltype): Delete.
2631         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2632         relocate_relocs for --emit-relocs.
2633         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2634         * output.h: Update comment.
2635         (Output_segment::first_section): New function.
2636         (Output_segment::first_section_load_address): Use first_section.
2637         * output.cc (Output_segment::first_section): New function extracted..
2638         (Output_segment::first_section_load_address): ..from here.  Delete.
2639         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2640         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2641         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2642         adjust call to target.h function.
2643         * i386.cc (Target_i386): Likewise.
2644         * sparc.cc (Target_sparc): Likewise.
2645         * x86_64.cc (Target_x86_64): Likewise.
2646         * powerpc.cc (Target_powerpc): Likewise.
2647         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2648         first tls section has section symbol for optimised local dynamic
2649         output relocs.
2650         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2651         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2652         optimised tls code.
2653         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2654         Rename to relocate_relocs.  Update error message.
2655
2656 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2657
2658         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2659         --just-symbols.
2660
2661 2012-08-31  Alan Modra  <amodra@gmail.com>
2662
2663         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2664         (Powerpc_relobj::toc_base_offset): New stub function.
2665         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2666         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2667         (Target_powerpc::Relocate::enum skip_tls): New.
2668         (Target_powerpc::call_tls_get_addr_): New var.
2669         (Target_powerpc::is_branch_reloc): Move to file scope.
2670         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2671         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2672         New functions.
2673         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2674         (powerpc_info): Correct common_pagesize for ppc64.
2675         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2676         (Powerpc_relocate_functions): Add overflow check enums and functions.
2677         Add non-shift version of rela, rela_ua.  Delete all rel public
2678         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2679         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2680         addr16_ha3, addr14 functions.
2681         (Output_data_got_powerpc::add_constant_pair): New function.
2682         (Output_data_got_powerpc::got_base_offset): Likewise.
2683         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2684         (instruction constants): Sort, add some more.
2685         (Output_data_glink::do_write): Add and use Address typedef.  Use
2686         object->toc_base_offset() stub for 64-bit.
2687         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2688         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2689         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2690         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2691         Always treat .opd relocs as against locally defined symbol.
2692         Correct condition for RELATIVE relocs.
2693         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2694         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2695         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2696         calculations.  Handle TLS relocs, and more.  Add overflow
2697         checking and adjust for Powerpc_relocate_functions changes.
2698         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2699         Reinstate --emit-relocs code with FIXME.
2700
2701 2012-08-30  Alan Modra  <amodra@gmail.com>
2702
2703         * layout.cc (Layout::set_segment_offsets): Set p_align to
2704         abi_pagesize, not common_pagesize.
2705         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2706         to determine whether file header can go in segment.
2707
2708 2012-08-30  Alan Modra  <amodra@gmail.com>
2709
2710         * output.h (Output_reloc::Output_reloc <output section>): Add
2711         is_relative param.  Adjust calls.
2712         (Output_reloc::add_output_section_relative): New functions.
2713         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2714         is_relative.
2715         (Output_reloc::symbol_value): Handle SECTION_CODE.
2716
2717 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2718
2719         * gold.cc (queue_middle_tasks): Call layout again when unique
2720         segments for sections is desired.
2721         * layout.cc (Layout::Layout): Initialize new members.
2722         (Layout::get_output_section_flags): New function.
2723         (Layout::choose_output_section): Call get_output_section_flags.
2724         (Layout::layout): Make output section for mapping to a unique segment.
2725         (Layout::insert_section_segment_map): New function.
2726         (Layout::attach_allocated_section_to_segment): Make unique segment for
2727         output sections marked so.
2728         (Layout::segment_precedes): Check for unique segments when sorting.
2729         * layout.h (Layout::Unique_segment_info): New struct.
2730         (Layout::Section_segment_map): New typedef.
2731         (Layout::insert_section_segment_map): New function.
2732         (Layout::get_output_section_flags): New function.
2733         (Layout::is_unique_segment_for_sections_specified): New function.
2734         (Layout::set_unique_segment_for_sections_specified): New function.
2735         (Layout::unique_segment_for_sections_specified_): New member.
2736         (Layout::section_segment_map_): New member.
2737         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2738         Rename is_gc_pass_one to is_pass_one.
2739         Rename is_gc_pass_two to is_pass_two.
2740         Rename is_gc_or_icf to is_two_pass.
2741         Check for which pass based on whether symbols data is present.
2742         Make it two pass when unique segments for sections is desired.
2743         * output.cc (Output_section::Output_section): Initialize new
2744         members.
2745         * output.h (Output_section::is_unique_segment): New function.
2746         (Output_section::set_is_unique_segment): New function.
2747         (Output_section::is_unique_segment_): New member.
2748         (Output_section::extra_segment_flags): New function.
2749         (Output_section::set_extra_segment_flags): New function.
2750         (Output_section::extra_segment_flags_): New member.
2751         (Output_section::segment_alignment): New function.
2752         (Output_section::set_segment_alignment): New function.
2753         (Output_section::segment_alignment_): New member.
2754         (Output_segment::Output_segment): Initialize is_unique_segment_.
2755         (Output_segment::is_unique_segment): New function.
2756         (Output_segment::set_is_unique_segment): New function.
2757         (Output_segment::is_unique_segment_): New member.
2758         * plugin.cc (allow_unique_segment_for_sections): New function.
2759         (unique_segment_for_sections): New function.
2760         (Plugin::load): Add new functions to transfer vector.
2761         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2762         * Makefile.in: Regenerate.
2763         * testsuite/plugin_final_layout.sh: Check if unique segment
2764         functionality works.
2765         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2766         are available.
2767         (allow_unique_segment_for_sections): New global.
2768         (unique_segment_for_sections): New global.
2769         (claim_file_hook): Call allow_unique_segment_for_sections.
2770         (all_symbols_read_hook): Call unique_segment_for_sections.
2771
2772 2012-08-22  Cary Coutant  <ccoutant@google.com>
2773
2774         * layout.cc (Layout::include_section): Don't assert on GROUP
2775         sections with --emit-relocs.
2776
2777 2012-08-21  Cary Coutant  <ccoutant@google.com>
2778
2779         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2780         if --export-dynamic-symbol names an undef symbol.
2781
2782 2012-08-18  Alan Modra  <amodra@gmail.com>
2783
2784         * powerpc.cc: Formatting and white space.
2785         (Powerpc_relobj): Rename got2_section_ to special_.
2786         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2787         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2788         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2789         (Target_powerpc): Add Address typedef and invalid_address.  Use
2790         throughout.
2791         (Target_powerpc::is_branch_reloc): New function.
2792         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2793         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2794         for dst_mask, value and addend.
2795         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2796         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2797         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2798         uint16_t for 24-bit offset.  Use get_output_section_offset and
2799         check return.
2800         (Target_powerpc::Scan::local): Handle more relocs.
2801         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2802         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2803         Plug in toc restoring insn after plt calls.  Translate branches
2804         to function descriptor symbols to corresponding entry point.
2805         (Target_powerpc::relocate_for_relocatable): Check return from
2806         get_output_section_offset.
2807         * symtab.h: Comment typo.
2808
2809 2012-08-14  Ian Lance Taylor  <iant@google.com>
2810
2811         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2812         unsupported_relocal_local to call unsupported_reloc_global.
2813
2814 2012-08-14  Nick Clifton  <nickc@redhat.com>
2815
2816         PR ld/14265
2817         * script-sections.cc (Sections_element::output_section_name): Add
2818         keep return parameter.
2819         (Output_section_element::match_name): Add keep return parameter.
2820         Return the value of the keep_ member.
2821         * script-sections.h (class Output_section): Update
2822         output_section_name prototype.
2823         * layout.cc (Layout::keep_input_section): New public member
2824         function.
2825         (Layout::choose_output_section): Pass keep parameter to
2826         output_section_name.
2827         * layout.h (class Layout): Add keep_input_section.
2828         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2829         sections.
2830         * testsuite/Makefile.am: Add a test.
2831         * testsuite/Makefile.in: Regenerate.
2832         * testsuite/pr14265.c: Source file for the test.
2833         * testsuite/pr14265.t: Linker script for the test.
2834         * testsuite/pr14265.sh: Shell script for the test.
2835
2836 2012-08-14  Alan Modra  <amodra@gmail.com>
2837
2838         * target.h (Target::output_section_name): New function.
2839         (Target::do_output_section_name): New function.
2840         * layout.cc (Layout::choose_output_section): Call the above.
2841         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2842
2843 2012-08-14  Alan Modra  <amodra@gmail.com>
2844
2845         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2846         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2847         for replace_constant call.
2848         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2849         (Output_data_glink::do_print_to_mapfile): New function.
2850         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2851         (Target_powerpc::Relocate::relocate): Likewise.
2852
2853 2012-08-14  Alan Modra  <amodra@gmail.com>
2854
2855         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2856         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2857         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2858         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2859         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2860         here.
2861         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2862         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2863         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2864         here.
2865         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2866         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2867
2868 2012-08-12  Alan Modra  <amodra@gmail.com>
2869
2870         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2871         (glink insn constants): Use uint32_t.
2872         (Output_data_glink::add_entry): Use insert, not [] operator.
2873
2874 2012-08-11  Alan Modra  <amodra@gmail.com>
2875
2876         * object.h (Sized_relobj_file::find_shdr): New function.
2877         (Sized_relobj_file::find_special_sections): New function.
2878         * object.cc (Sized_relobj_file::find_shdr): New function.
2879         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2880         (Sized_relobj_file::find_special_sections): New function, split out..
2881         (Sized_relobj_file::do_read_symbols): ..from here.
2882         * output.h (Output_data_got::replace_constant): New function.
2883         (Output_data_got::num_entries): New function.
2884         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2885         (Output_data_got::got_offset): Protected rather than private.
2886         (Output_data_got::replace_got_entry): New function.
2887         * output.cc (Output_data_got::replace_got_entry): New function.
2888         * powerpc.cc (class Powerpc_relobj): New.
2889         (class Powerpc_relocate_functions): Delete all psymval variants or
2890         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2891         Implement _ha functions using corresponding _hi function.
2892         (Powerpc_relobj::find_special_sections): New function.
2893         (Target_powerpc::do_make_elf_object): New function.
2894         (class Output_data_got_powerpc): New.
2895         (class Output_data_glink): New.
2896         (class Powerpc_scan_relocatable_reloc): New.
2897         Many more changes througout file.
2898
2899 2012-08-09  Nick Clifton  <nickc@redhat.com>
2900
2901         * po/vi.po: Updated Vietnamese translation.
2902
2903 2012-08-07  Ian Lance Taylor  <iant@google.com>
2904
2905         * layout.cc (Layout::add_target_dynamic_tags): If
2906         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2907         plt_rel.
2908
2909 2012-07-30  Nick Clifton  <nickc@redhat.com>
2910
2911         * po/gold.pot: Updated template.
2912         * po/es.po: Updated Spanish translation.
2913
2914 2012-07-18  Cary Coutant  <ccoutant@google.com>
2915
2916         PR gold/14344
2917         * configure.ac: Add check for -gpubnames support.
2918         * configure: Regenerate.
2919         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2920         support; force -gno-pubnames.
2921         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2922         support.
2923         (gdb_index_test_4): New test.
2924         * testsuite/Makefile.in: Regenerate.
2925         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2926         * testsuite/gdb_index_test_2.sh: Likewise.
2927         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2928         * testsuite/gdb_index_test_4.sh: New script.
2929         * testsuite/gdb_index_test_comm.sh: New script with common code;
2930         don't look for space after colon.
2931
2932 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2933
2934         * gold.cc (queue_middle_tasks): Update function order only after
2935         deferred objects due to plugins are processed.
2936
2937 2012-07-11  Ian Lance Taylor  <iant@google.com>
2938
2939         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2940         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2941         (Target_arm::scan_reloc_for_stub): Likewise.
2942         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2943         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2944         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2945         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2946         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2947
2948 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2949             Ian Lance Taylor  <iant@google.com>
2950
2951         PR gold/14309
2952         * configure.ac: Test whether std::tr1::hash<off_t> works.
2953         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2954         needed.
2955         * output.h (class Output_fill): Add virtual destructor.
2956         * configure, config.in: Rebuild.
2957
2958 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2959
2960         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2961
2962 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2963
2964         * plugin.cc (Plugin::load): Handle position independent executables.
2965
2966 2012-06-06  Cary Coutant  <ccoutant@google.com>
2967
2968         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2969         add .debug_macro.
2970         (lines_only_debug_sections): Likewise.
2971         (gdb_fast_lookup_sections): New static array.
2972         (is_gdb_debug_section): Rename formal parameter.
2973         (is_lines_only_debug_section): Likewise.
2974         (is_gdb_fast_lookup_section): New function.
2975         (Layout::include_section): Check for ".zdebug_" prefix; pass
2976         section name suffix to is_gdb_debug_section, et al.; check for
2977         fast-lookup sections when building .gdb_index.
2978         * options.h (--strip-debug-gdb): Update GDB version number.
2979
2980 2012-06-06  Cary Coutant  <ccoutant@google.com>
2981
2982         * configure.ac: Add check for fallocate.
2983         * configure: Regenerate.
2984         * config.in: Regenerate.
2985
2986         * options.h (class General_options): Add --mmap-output-file and
2987         --posix-fallocate options.
2988         * output.cc: (posix_fallocate): Remove; replace with...
2989         (gold_fallocate): New function.
2990         (Output_file::map_no_anonymous): Call gold_fallocate.
2991         (Output_file::map): Check --mmap-output-file option.
2992
2993 2012-06-05  Jing Yu  <jingyu@google.com>
2994
2995         * gold.h (textdomain): Add do {} to empty while(0).
2996         (bindtextdomain): Likewise.
2997
2998 2012-06-04  Cary Coutant  <ccoutant@google.com>
2999
3000         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
3001         has_dynsym_index.
3002
3003 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
3004
3005         * symtab.cc (Symbol_table::define_special_symbol):
3006         Initialize *poldsym to prevent uninitialized variable errors.
3007
3008 2012-05-23  Cary Coutant  <ccoutant@google.com>
3009
3010         * layout.cc (Layout::section_name_mapping): Add rules to handle
3011         exact match on .data.rel.ro.local or .data.rel.ro.
3012         (Layout::output_section_name): Check for exact matches.
3013
3014 2012-05-23  Cary Coutant  <ccoutant@google.com>
3015
3016         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
3017         more carefully.
3018
3019 2012-05-22  Cary Coutant  <ccoutant@google.com>
3020
3021         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
3022         object before exporting symbol.
3023
3024 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
3025
3026         * testsuite/tls_test.cc: Include "config.h" first.
3027         * testsuite/tls_test_c.c: Likewise.
3028
3029 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
3030             Nick Clifton  <nickc@redhat.com>
3031
3032         PR 14072
3033         * configure.in: Add check that sysdep.h has been included before
3034         any system header files.
3035         * configure: Regenerate.
3036         * config.in: Regenerate.
3037
3038 2012-05-14  Cary Coutant  <ccoutant@google.com>
3039
3040         * layout.cc (Layout::make_output_section): Mark .tdata section
3041         as RELRO.
3042         * testsuite/relro_test.cc: Add a TLS variable.
3043
3044 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
3045
3046         PR gold/14091
3047         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
3048         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
3049         R_X86_64_64.
3050
3051 2012-05-08  Cary Coutant  <ccoutant@google.com>
3052
3053         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
3054         (lines_only_debug_sections): Likewise.
3055
3056 2012-05-02  Roland McGrath  <mcgrathr@google.com>
3057
3058         * nacl.cc: New file.
3059         * nacl.h: New file.
3060         * Makefile.am (CCFILES, HFILES): Add them.
3061         * Makefile.in: Regenerate.
3062         * i386.cc (Output_data_plt_i386_nacl): New class.
3063         (Output_data_plt_i386_nacl_exec): New class.
3064         (Output_data_plt_i386_nacl_dyn): New class.
3065         (Target_i386_nacl): New class.
3066         (Target_selector_i386_nacl): New class.
3067         (target_selector_i386): Use it instead of Target_selector_i386.
3068         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3069         (Target_x86_64_nacl): New class.
3070         (Target_selector_x86_64_nacl): New class.
3071         (target_selector_x86_64, target_selector_x32): Use it instead of
3072         Target_selector_x86_64.
3073         * arm.cc (Output_data_plt_arm_nacl): New class.
3074         (Target_arm_nacl): New class.
3075         (Target_selector_arm_nacl): New class.
3076         (target_selector_arm, target_selector_armbe): Use it instead of
3077         Target_selector_arm.
3078
3079         * target-select.cc (select_target): Take new Input_file* and off_t
3080         arguments, pass them on to recognize method of selector.
3081         * object.cc (make_elf_sized_object): Update caller.
3082         * parameters.cc (parameters_force_valid_target): Likewise.
3083         * incremental.cc (make_sized_incremental_binary): Likewise.
3084         * target-select.h: Update decl.
3085         (Target_selector::recognize): Take new Input_file* argument,
3086         pass it on to do_recognize.
3087         (Target_selector::do_recognize): Take new Input_file* argument.
3088         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3089         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3090         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3091         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3092
3093         * target.h (Target::Target_info): New members isolate_execinstr
3094         and rosegment_gap.
3095         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3096         * arm.cc (Target_arm::arm_info): Update initializer.
3097         * i386.cc (Target_i386::i386_info): Likewise.
3098         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3099         * sparc.cc (Target_sparc::sparc_info): Likewise.
3100         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3101         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3102         * layout.cc (Layout::attach_allocated_section_to_segment):
3103         Take new const Target* argument.  If target->isolate_execinstr(), act
3104         like --rosegment.
3105         (Layout::find_first_load_seg): Take new const Target* argument;
3106         if target->isolate_execinstr(), reject PF_X segments.
3107         (Layout::relaxation_loop_body): Update caller.
3108         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3109         reset file offset to zero when we hit LOAD_SEG, and then do a second
3110         loop over the segments before LOAD_SEG to reassign offsets after
3111         addresses have been determined.  Handle target->rosegment_gap().
3112         (Layout::attach_section_to_segment): Take new const Target* argument;
3113         pass it to attach_allocated_section_to_segment.
3114         (Layout::make_output_section): Update caller.
3115         (Layout::attach_sections_to_segments): Take new const Target* argument;
3116         pass it to attach_section_to_segment.
3117         * gold.cc (queue_middle_tasks): Update caller.
3118         * layout.h (Layout): Update method decls with new arguments.
3119
3120         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3121         Target_info pointer to use.
3122         (Target_arm::do_make_data_plt): New virtual method.
3123         (Target_arm::make_data_plt): New method that calls it.
3124         (Target_arm::make_plt_entry): Use it.
3125         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3126         for the section alignment.
3127         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3128         method.
3129         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3130         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3131         method.
3132         (Output_data_plt_arm::get_plt_entry_size): Call it.
3133         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3134         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3135         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3136         method.
3137         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3138         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3139         method instead of sizeof(plt_entry).
3140         (Output_data_plt_arm::add_entry): Likewise.
3141         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3142         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3143         than static method.
3144         (Target_arm::plt_entry_size): Likewise.
3145         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3146         Move to ...
3147         (Output_data_plt_arm_standard): ... here, new class.
3148         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3149         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3150         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3151
3152         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3153         Take additional argument for the PLT entry size.
3154         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3155         Use get_plt_entry_size method rather than plt_entry_size variable.
3156         (Output_data_plt_x86_64::reserve_slot): Likewise.
3157         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3158         (Output_data_plt_x86_64::add_entry): Likewise.
3159         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3160         (Output_data_plt_x86_64::address_for_global): Likewise.
3161         (Output_data_plt_x86_64::address_for_local): Likewise.
3162         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3163         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3164         Make method non-static.
3165         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3166         method.
3167         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3168         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3169         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3170         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3171         virtual method.
3172         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3173         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3174         virtual method.
3175         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3176         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3177         virtual method.
3178         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3179         (Output_data_plt_x86_64::plt_entry_size)
3180         (Output_data_plt_x86_64::first_plt_entry)
3181         (Output_data_plt_x86_64::plt_entry)
3182         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3183         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3184         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3185         (Output_data_plt_x86_64_standard): ... here, new class.
3186         (Target_x86_64::Target_x86_64): Take optional argument for the
3187         Target_info pointer to use.
3188         (Target_x86_64::do_make_data_plt): New virtual method.
3189         (Target_x86_64::make_data_plt): New method to call it.
3190         (Target_x86_64::init_got_plt_for_update): Use that.
3191         Call this->plt_->add_eh_frame method here.
3192         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3193         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3194         rather than static method.
3195         (Target_x86_64::plt_entry_size): Likewise.
3196         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3197         rather than plt_entry_size variable.  Move guts of PLT filling to...
3198         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3199         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3200         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3201
3202         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3203         additional argument for the section alignment.
3204         Don't do add_eh_frame_for_plt here.
3205         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3206         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3207         variable.
3208         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3209         method.
3210         (Output_data_plt_i386::get_plt_entry_size): Call it.
3211         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3212         (Output_data_plt_i386::add_eh_frame): New method to call it.
3213         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3214         method.
3215         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3216         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3217         method.
3218         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3219         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3220         method instead of plt_entry_size.
3221         (Output_data_plt_i386::plt_entry_size)
3222         (Output_data_plt_i386::plt_eh_frame_fde_size)
3223         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3224         (Output_data_plt_i386_standard): ... here, new class.
3225         (Output_data_plt_i386_exec): New class.
3226         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3227         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3228         (Output_data_plt_i386::exec_plt_entry): Move to ...
3229         (Output_data_plt_i386_exec::plt_entry): ... here.
3230         (Output_data_plt_i386_dyn): New class.
3231         (Output_data_plt_i386::first_plt_entry): Move to ...
3232         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3233         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3234         (Output_data_plt_i386_dyn::plt_entry): ... here.
3235         (Target_i386::Target_i386): Take optional argument for the Target_info
3236         pointer to use.
3237         (Target_i386::do_make_data_plt): New virtual method.
3238         (Target_i386::make_data_plt): New method to call it.
3239         (Target_i386::make_plt_section): Use that.
3240         Call this->plt_->add_eh_frame method here.
3241         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3242         rather than plt_entry_size variable.
3243         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3244         (Output_data_plt_i386::address_for_local): Likewise.
3245         (Output_data_plt_i386::do_write): Likewise.
3246         Move guts of PLT filling to...
3247         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3248         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3249         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3250         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3251
3252 2012-05-01  Cary Coutant  <ccoutant@google.com>
3253
3254         * dwarf_reader.cc (Dwarf_die::read_attributes)
3255         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3256         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3257         * reduced_debug_output.cc
3258         (Output_reduced_debug_info_section::get_die_end): Remove
3259         DW_FORM_GNU_ref_index.  Add default case.
3260
3261 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3262
3263         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3264         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3265         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3266         DW_AT_high_pc as offset from DW_AT_low_pc.
3267
3268         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3269         * testsuite/Makefile.in: Regenerate.
3270         * testsuite/gdb_index_test_3.c: New test source file.
3271         * testsuite/gdb_index_test_3.sh: New test source file.
3272
3273 2012-04-25  Ian Lance Taylor  <iant@google.com>
3274
3275         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3276         pointer.
3277         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3278         as a class, not a struct.
3279         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3280         (Target_arm::apply_cortex_a8_workaround): Likewise.
3281         * gc.h: Declare Reloc_types as a struct, not a class.
3282         * object.h: Declare Symbols_data as a struct.
3283         * reloc.h: Declare Read_relocs_data as a struct.
3284         * target.h: Declare Relocate_info as a struct.
3285
3286 2012-04-24  David S. Miller  <davem@davemloft.net>
3287
3288         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3289         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3290         and R_SPARC_WPLT30.
3291
3292 2012-04-24  Cary Coutant  <ccoutant@google.com>
3293
3294         * incremental-dump.cc (find_input_containing_global): Replace
3295         magic number with symbolic constant.
3296         (dump_incremental_inputs): Update version number.
3297         * incremental.cc (Output_section_incremental_inputs): Update version
3298         number; import symbolic constants from Incremental_inputs_reader.
3299         (Incremental_inputs::create_data_sections): Align relocations
3300         section correctly for 64-bit targets.
3301         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3302         constants; add padding.
3303         (Output_section_incremental_inputs::write_header): Add assert for
3304         header_size.
3305         (Output_section_incremental_inputs::write_input_files): Add assert
3306         for input_entry_size.
3307         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3308         add assert for object_info_size, input_section_entry_size,
3309         global_sym_entry_size.
3310         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3311         for data structure sizes; use them.
3312         (Incremental_input_entry_reader): Import symbolic constants from
3313         Incremental_inputs_reader; use them.
3314
3315 2012-04-23  David S. Miller  <davem@davemloft.net>
3316
3317         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3318         and elf_flags_set_.
3319         (Target_sparc::Target_sparc): Initialize new fields.
3320         (Target_sparc::do_make_elf_object): New function.
3321         (Target_sparc::do_adjust_elf_header): New function.
3322
3323 2012-04-23  Cary Coutant  <ccoutant@google.com>
3324
3325         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3326         CU range table of gdb index.
3327
3328 2012-04-20  David S. Miller  <davem@davemloft.net>
3329
3330         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3331         instead of false.
3332
3333 2012-04-16  David S. Miller  <davem@davemloft.net>
3334
3335         * sparc.cc (Target_sparc::got_address): New function.
3336         (Sparc_relocate_functions::gdop_hix22): New function.
3337         (Sparc_relocate_functions::gdop_lox10): New function.
3338         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3339         relocs.
3340         (Target_sparc::Scan::local): Likewise if the global symbol is not
3341         preemptible and is not IFUNC.
3342         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3343         transformations for local and non-preemptible non-IFUNC global
3344         symbols.
3345
3346         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3347         writing out 64-bit part of ranges.
3348
3349         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3350         -fpic and -fpie respectively.
3351         * Makefile.in: Regenerate.
3352
3353         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3354         (Target_sparc::Target_sparc): Initialize new field.
3355         (Target_sparc::do_plt_section_for_global): New function.
3356         (Target_sparc::do_plt_section_for_local): New function.
3357         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3358         (Target_sparc::make_plt_section): New function, broken out of
3359         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3360         (Target_sparc::make_plt_entry): Call make_plt_section.
3361         (Target_sparc::make_local_ifunc_plt_entry): New function.
3362         (Target_sparc::rela_ifunc_section): New function.
3363         (Target_sparc::plt_section): Remove const.
3364         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3365         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3366         and ifunc_count_ fields.
3367         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3368         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3369         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3370         (Output_data_plt_sparc::rela_ifunc): New function.
3371         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3372         (Output_data_plt_sparc::has_ifunc_section): New function.
3373         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3374         (Output_data_plt_sparc::address_for_global): New function.
3375         (Output_data_plt_sparc::address_for_local): New function.
3376         (Output_data_plt_sparc::plt_index_to_offset): New function.
3377         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3378         and entry_count.
3379         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3380         entry_count.
3381         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3382         R_SPARC_JMP_IREL to switch.
3383         (Target_sparc::Scan::check_non_pic): Likewise.
3384         (Target_sparc::Scan::local): Handle IFUNC symbols.
3385         (Target_sparc::Scan::local): Likewise.
3386         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3387         and plt_address_for_local.
3388         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3389         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3390
3391         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3392         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3393         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3394         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3395         global relocs too.
3396         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3397         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3398         calls.
3399         * sparc.cc (Target_sparc::Scan::global): Likewise.
3400         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3401
3402 2012-04-16  Cary Coutant  <ccoutant@google.com>
3403
3404         * archive.cc (Library_base::should_include_member): Check for
3405         --export-dynamic-symbol.
3406         * options.h (class General_options): Add --export-dynamic-symbol.
3407         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3408         --export-dynamic-symbol.
3409         (Symbol_table::gc_mark_undef_symbols): Likewise.
3410         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3411
3412 2012-04-12  David S. Miller  <davem@davemloft.net>
3413
3414         * sparc.cc (Reloc::wdisp10): New relocation method.
3415         (Reloc::h34): Likewise.
3416         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3417         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3418         R_SPARC_WDISP10.
3419         (Target_sparc::Scan::local): Likewise.
3420         (Target_sparc::Scan::global): Likewise.
3421         (Target_sparc::Relocate::relocate): Likewise.
3422
3423 2012-04-09  Cary Coutant  <ccoutant@google.com>
3424
3425         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3426         low_pc == 0.
3427
3428 2012-04-06  Ian Lance Taylor  <iant@google.com>
3429
3430         * timer.cc: #include <unistd.h>.
3431
3432 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3433
3434         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3435         * config.in: Regenerate.
3436         * configure: Regenerate.
3437
3438 2012-04-05  Nick Clifton  <nickc@redhat.com>
3439
3440         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3441         (AM_LC_MESSAGES): Add.
3442         * aclocal.m4: Regenerate.
3443         * config.in: Regenerate.
3444         * configure: Regenerate.
3445
3446 2012-03-21  Cary Coutant  <ccoutant@google.com>
3447
3448         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3449         * Makefile.in: Regenerate.
3450         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3451         (Sized_elf_reloc_mapper::symbol_section): New function.
3452         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3453         (make_elf_reloc_mapper): New function.
3454         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3455         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3456         (Dwarf_abbrev_table::do_get_abbrev): New function.
3457         (Dwarf_ranges_table::read_ranges_table): New function.
3458         (Dwarf_ranges_table::read_range_list): New function.
3459         (Dwarf_pubnames_table::read_section): New function.
3460         (Dwarf_pubnames_table::read_header): New function.
3461         (Dwarf_pubnames_table::next_name): New function.
3462         (Dwarf_die::Dwarf_die): New function.
3463         (Dwarf_die::read_attributes): New function.
3464         (Dwarf_die::skip_attributes): New function.
3465         (Dwarf_die::set_name): New function.
3466         (Dwarf_die::set_linkage_name): New function.
3467         (Dwarf_die::attribute): New function.
3468         (Dwarf_die::string_attribute): New function.
3469         (Dwarf_die::int_attribute): New function.
3470         (Dwarf_die::uint_attribute): New function.
3471         (Dwarf_die::ref_attribute): New function.
3472         (Dwarf_die::child_offset): New function.
3473         (Dwarf_die::sibling_offset): New function.
3474         (Dwarf_info_reader::check_buffer): New function.
3475         (Dwarf_info_reader::parse): New function.
3476         (Dwarf_info_reader::do_parse): New function.
3477         (Dwarf_info_reader::do_read_string_table): New function.
3478         (Dwarf_info_reader::lookup_reloc): New function.
3479         (Dwarf_info_reader::get_string): New function.
3480         (Dwarf_info_reader::visit_compilation_unit): New function.
3481         (Dwarf_info_reader::visit_type_unit): New function.
3482         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3483         Sized_elf_reloc_mapper.
3484         (Sized_dwarf_line_info::symbol_section): Remove function.
3485         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3486         (Sized_dwarf_line_info::read_line_mappings): Remove object
3487         parameter, adjust callers.
3488         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3489         * dwarf_reader.h: Include <sys/types.h>.
3490         (class Track_relocs): Remove forward declaration.
3491         (class Elf_reloc_mapper): New class.
3492         (class Sized_elf_reloc_mapper): New class.
3493         (class Dwarf_abbrev_table): New class.
3494         (class Dwarf_range_list): New class.
3495         (class Dwarf_ranges_table): New class.
3496         (class Dwarf_pubnames_table): New class.
3497         (class Dwarf_die): New class.
3498         (class Dwarf_info_reader): New class.
3499         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3500         (Sized_dwarf_line_info::symbol_section): Remove member function.
3501         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3502         base class.
3503         * gdb-index.cc: New source file.
3504         * gdb-index.h: New source file.
3505         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3506         and .debug_types sections, call Layout::add_to_gdb_index.
3507         (Sized_relobj_incr::do_section_name): Implement.
3508         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3509         return type; Implement.
3510         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3511         return type.
3512         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3513         parameter list and return type.
3514         (Sized_incr_dynobj::do_section_contents): Likewise.
3515         * layout.cc: Include gdb-index.h.
3516         (Layout::Layout): Initialize gdb_index_data_.
3517         (Layout::init_fixed_output_section): Check for .gdb_index section.
3518         (Layout::add_to_gdb_index): New function. Instantiate.
3519         * layout.h: Add forward declaration for class Gdb_index.
3520         (Layout::add_to_gdb_index): New member function.
3521         (Layout::gdb_index_data_): New data member.
3522         * main.cc: Include gdb-index.h.
3523         (main): Print statistics for gdb index.
3524         * object.cc (Object::section_contents): Move code into
3525         do_section_contents.
3526         (need_decompressed_section): Check for sections needed when building
3527         gdb index.
3528         (build_compressed_section_map): Likewise.
3529         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3530         gdb index.
3531         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3532         sections; call Layout::add_to_gdb_index.
3533         (Sized_relobj_file::do_decompressed_section_contents): Call
3534         do_section_contents directly.
3535         * object.h (Object::do_section_contents): Adjust parameter list and
3536         return type.
3537         (Object::do_decompressed_section_contents): Call do_section_contents
3538         directly.
3539         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3540         return type.
3541         * options.h (class General_options): Add --gdb-index option.
3542         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3543         list and return type.
3544         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3545         * reloc.h (Track_relocs::checkpoint): New function.
3546         (Track_relocs::reset): New function.
3547
3548         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3549         New test cases.
3550         * testsuite/Makefile.in: Regenerate.
3551         * testsuite/gdb_index_test.cc: New test source file.
3552         * testsuite/gdb_index_test_1.sh: New test source file.
3553         * testsuite/gdb_index_test_2.sh: New test source file.
3554
3555 2012-03-19  Doug Kwan  <dougkwan@google.com>
3556
3557         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3558         (Target_arm::do_finalize_sections): Remove code which defines
3559         __exidx_start and __exidx_end.  Make symbol table parameter
3560         anonymous as it is not used.
3561         * gold.cc (queue_middle_tasks): Call target hook to define any
3562         target-specific symbols.
3563         * target.h (Target::define_standard_symbols): New method.
3564         (Target::do_define_standard_symbols): Same.
3565         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3566         * testsuite/Makefile.in: Regenerate.
3567         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3568         and __exidx_end.
3569         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3570         relocations are generated for __exidx_start and __exidx_end.
3571
3572 2012-03-16  Doug Kwan  <dougkwan@google.com>
3573
3574         * testsuite/Makefile.am: Disable test initpri3b.
3575         * testsuite/Makefile.in: Regenerate.
3576
3577 2012-03-15  Doug Kwan  <dougkwan@google.com>
3578
3579         * arm.cc (Target_arm::got_section): Make .got section read-only
3580         if -z now is given.
3581
3582 2012-03-15  Ian Lance Taylor  <iant@google.com>
3583
3584         PR gold/13850
3585         * layout.cc (Layout::make_output_section): Correctly mark
3586         SHT_INIT_ARRAY, et. al., as relro.
3587
3588 2012-03-14  Doug Kwan  <dougkwan@google.com>
3589
3590         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3591         dynamic relocations for protected symbols in shared objects.
3592
3593 2012-03-13  Ian Lance Taylor  <iant@google.com>
3594
3595         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3596         keep the larger alignment.
3597
3598 2012-03-12  Cary Coutant  <ccoutant@google.com>
3599
3600         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3601         handling of DW_LNE_define_file.
3602
3603 2012-03-12  Cary Coutant  <ccoutant@google.com>
3604
3605         * reduced_debug_output.cc
3606         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3607         codes to switch.
3608
3609 2012-02-29  Cary Coutant  <ccoutant@google.com>
3610
3611         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3612
3613 2012-02-29  Cary Coutant  <ccoutant@google.com>
3614
3615         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3616         Call Object::decompressed_section_contents.
3617         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3618         New dtor.
3619         (Sized_dwarf_line_info::buffer_start_): New data member.
3620         * merge.cc (Output_merge_data::do_add_input_section): Call
3621         Object::decompressed_section_contents.
3622         (Output_merge_string::do_add_input_section): Likewise.
3623         * object.cc (need_decompressed_section): New function.
3624         (build_compressed_section_map): Decompress sections needed later.
3625         (Sized_relobj_file::do_decompressed_section_contents): New function.
3626         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3627         * object.h (Object::decompressed_section_contents): New function.
3628         (Object::discard_decompressed_sections): New function.
3629         (Object::do_decompressed_section_contents): New function.
3630         (Object::do_discard_decompressed_sections): New function.
3631         (Compressed_section_info): New type.
3632         (Compressed_section_map): Include decompressed section contents.
3633         (Sized_relobj_file::do_decompressed_section_contents): New function.
3634         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3635
3636 2012-02-16  Cary Coutant  <ccoutant@google.com>
3637
3638         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3639         * testsuite/Makefile.in: Regenerate.
3640
3641 2012-02-14  Cary Coutant  <ccoutant@google.com>
3642
3643         * options.cc (General_options::finalize): Disallow -pie and -static.
3644
3645 2012-02-03  Doug Kwan  <dougkwan@google.com>
3646
3647         * arm.cc (Arm_relocate_functions::abs8,
3648         Arm_relocate_functions::abs16): Use
3649         Bits::has_signed_unsigned_overflow32.
3650         (Arm_relocate_functions::thm_abs8): Correct range of
3651         overflow check.
3652         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3653         in assertions.
3654
3655 2012-02-02  Doug Kwan  <dougkwan@google.com>
3656
3657         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3658         position independent outputs, not just shared objects.
3659
3660 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3661
3662         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3663         * configure: Regenerated.
3664
3665 2012-01-27  Ian Lance Taylor  <iant@google.com>
3666
3667         * reloc.h (Bits): New class with static functions, copied from
3668         namespace utils in arm.cc.
3669         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3670         instead.
3671
3672 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3673
3674         * incremental.cc (write_info_blocks): Correct relocation offset.
3675
3676 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3677
3678         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3679         (Relocate::tls_gd_to_le): Likewise.
3680
3681 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3682
3683         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3684
3685 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3686
3687         * configure.ac: Check if -mcmodel=medium works.
3688         * configure: Regenerated.
3689
3690 2012-01-24  Cary Coutant  <ccoutant@google.com>
3691
3692         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3693         definition and ...
3694         (read_unsigned_LEB_128_x): ... this new function.
3695         (read_signed_LEB_128): Replaced with inline definition and ...
3696         (read_signed_LEB_128_x): ... this new function.
3697         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3698         (read_unsigned_LEB_128): Add inline definition.
3699         (read_signed_LEB_128_x): New function.
3700         (read_signed_LEB_128): Add inline definition.
3701         * testsuite/Makefile.am (leb128_unittest): New unit test.
3702         * testsuite/Makefile.in: Regenerate.
3703         * testsuite/leb128_unittest.cc: New unit test.
3704
3705 2012-01-23  Ian Lance Taylor  <iant@google.com>
3706
3707         PR gold/13617
3708         * i386.cc (Target_i386::do_code_fill): When using a jmp
3709         instruction, pad with nop instructions.
3710         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3711
3712 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3713
3714         * x86_64.cc (gc_process_relocs): Add typename on types used in
3715         template.
3716         (scan_relocs): Likewise.
3717         (relocate_section): Likewise.
3718         (apply_relocation): Likewise.
3719
3720 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3721
3722         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3723         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3724         under x32.
3725
3726 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3727
3728         * x86_64.cc: Initial support for x32.
3729
3730 2012-01-03  Cary Coutant  <ccoutant@google.com>
3731
3732         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3733         Use abstract base class for GOT.
3734         * gold/output.h (class Output_data_got_base): New abstract base class.
3735         (class Output_data_got): Derive from new base class, adjust ctors.
3736         (Output_data_got::reserve_slot): Make virtual; rename to
3737         do_reserve_slot; Adjust callers.
3738         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3739         pointer to abstract base class.
3740         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3741
3742 2011-12-18  Ian Lance Taylor  <iant@google.com>
3743
3744         * object.h (Relobj::local_symbol_value): New function.
3745         (Relobj::local_plt_offset): New function.
3746         (Relobj::local_has_got_offset): New function.
3747         (Relobj::local_got_offset): New function.
3748         (Relobj::set_local_got_offset): New function.
3749         (Relobj::do_local_symbol_value): New pure virtual function.
3750         (Relobj::do_local_plt_offset): Likewise.
3751         (Relobj::do_local_has_got_offset): Likewise.
3752         (Relobj::do_local_got_offset): Likewise.
3753         (Relobj::do_set_local_got_offset): Likewise.
3754         (Sized_relobj::do_local_has_got_offset): Rename from
3755         local_has_got_offset.
3756         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3757         (Sized_relobj::do_set_local_got_offset): Rename from
3758         set_local_got_offset.
3759         (Sized_relobj_file::do_local_plt_offset): Rename from
3760         local_plt_offset.
3761         (Sized_relobj_file::do_local_symbol_value): New function.
3762         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3763         local_plt_offset.
3764         * output.cc (Output_data_got::Got_entry::write): Change object to
3765         Relobj.  Use local_symbol_value.
3766         (Output_data_got::add_global_with_rel): Change rel_dyn to
3767         Output_data_reloc_generic*.  Use add_global_generic.
3768         (Output_data_got::add_global_with_rela): Remove.  Change all
3769         callers to use add_global_with_rel.
3770         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3771         Output_data_reloc_generic*.  Use add_global_generic.
3772         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3773         callers to use add_global_pair_with_rel.
3774         (Output_data_got::add_local): Change object to Relobj*.
3775         (Output_data_got::add_local_plt): Likewise.
3776         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3777         change rel_dyn to Output_data_reloc_generic*.  Use
3778         add_local_generic.
3779         (Output_data_got::add_local_with_rela): Remove.  Change all
3780         callers to use all_local_with_rel.
3781         (Output_data_got::add_local_pair_with_rel): Change object to
3782         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3783         add_output_section_generic.
3784         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3785         callers to use add_local_pair_with_rel.
3786         (Output_data_got::reserve_local): Change object to Relobj*.
3787         * output.h: (class Output_data_reloc_generic): Add pure virtual
3788         declarations for add_global_generic, add_local_generic,
3789         add_output_section_generic.
3790         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3791         functions for Output_data_reloc_generic.  Update declarations for
3792         changes listed in output.cc.
3793         (class Output_data_got): Change template parameter to got_size.
3794         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3795         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3796         function.
3797         (Sized_relobj_incr::do_local_plt_offset): New function.
3798         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3799         add_global_generic.
3800
3801 2011-12-17  Cary Coutant  <ccoutant@google.com>
3802
3803         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3804         * resolve.cc (Symbol_table::resolve): Likewise.
3805         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3806         arrays.
3807         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3808
3809 2011-12-16  Ian Lance Taylor  <iant@google.com>
3810
3811         * output.h (Output_data_reloc_generic::add): Only call
3812         add_dynamic_reloc if this is a dynamic reloc section.
3813
3814 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3815
3816         PR gold/13505
3817         * target-reloc.h (apply_relocation): Replace <64, false> with
3818         <size, big_endian>.
3819
3820 2011-11-25  Nick Clifton  <nickc@redhat.com>
3821
3822         * po/it.po: New Italian translation.
3823
3824 2011-11-17  Sterling Augustine  <saugustine@google.com>
3825
3826         * script.cc (script_include_directive): Implement.
3827         (read_script_file): New local variables name and search_path. Update
3828         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3829         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3830         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3831
3832 2011-11-11  Sterling Augustine  <saugustine@google.com>
3833
3834         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3835         (file_or_sections_cmd): Likewise.
3836
3837 2011-11-11  Doug Kwan  <dougkwan@google.com>
3838
3839         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3840         if --just-symbols is given.
3841
3842 2011-11-10  Doug Kwan  <dougkwan@google.com>
3843
3844         PR gold/13362
3845         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3846         when processing data relocs.
3847         * reloc.h (Relocate_functions::rel_unaligned): New method.
3848         (Relocate_functions::pcrel_unaligned): Ditto.
3849         (Relocate_functions::rel32_unaligned): Ditto.
3850         (Relocate_functions::pcrel32_unaligned): Ditto.
3851
3852 2011-11-09  Doug Kwan  <dougkwan@google.com>
3853
3854         PR gold/13362
3855         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3856         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3857         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3858         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3859         (Relocate_functions::rel_unaligned): New.
3860         (Relocate_functions::rel32_unaligned): New.
3861         * target-reloc.h (relocate_for_relocatable): Add code to handle
3862         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3863         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3864         arm_unaligned_reloc_r): New targets.
3865         * testsuite/Makefile.in: Regenerate.
3866         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3867         linking.
3868
3869 2011-11-02  Ian Lance Taylor  <iant@google.com>
3870
3871         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3872         NATIVE_LINKER.
3873         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3874         * options.cc (General_options::finalize): Use library search path
3875         from configure script if specified.  If not native and no sysroot,
3876         only search TOOLLIBDIR.
3877         * options.h (Search_directory::Search_directory): Change name to
3878         const std::string&.
3879         (General_options::add_to_library_path_with_sysroot): Change arg to
3880         const std::string&.
3881         * configure, Makefile.in, config.in: Rebuild.
3882
3883 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3884
3885         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3886         we are working around the ARM1176 Erratum.
3887         * options.h (General_options::fix_arm1176): Add option.
3888         * testsuite/Makefile.am: Add testcases, and keep current ones
3889         working.
3890         * testsuite/Makefile.in: Regenerate.
3891         * testsuite/arm_fix_1176.s: New file.
3892         * testsuite/arm_fix_1176.sh: Likewise.
3893
3894 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3895
3896         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3897         may_use_blx_.
3898         (Target_arm::may_use_blx): Remove method.
3899         (Target_arm::set_may_use_blx): Likewise.
3900         (Target_arm::may_use_v4t_interworking): New method.
3901         (Target_arm::may_use_v5t_interworking): Likewise.
3902         (Target_arm::may_use_blx_): Remove member variable.
3903         (Arm_relocate_functions::arm_branch_common): Check for v5T
3904         interworking.
3905         (Arm_relocate_functions::thumb_branch_common): Likewise.
3906         (Reloc_stub::stub_type_for_reloc): Likewise.
3907         (Target_arm::do_finalize_sections): Correct interworking checks.
3908         * testsuite/Makefile.am: Add new tests.
3909         * testsuite/Makefile.in: Regenerate.
3910         * testsuite/arm_farcall_arm_arm.s: New test.
3911         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3912         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3913         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3914         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3915         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3916         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3917         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3918
3919 2011-10-31  Cary Coutant  <ccoutant@google.com>
3920
3921         PR gold/13023
3922         * expression.cc (Expression::eval_with_dot): Add
3923         is_section_dot_assignment parameter.
3924         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3925         absolute and assigning to dot within a section.
3926         * script-sections.cc
3927         (Output_section_element_assignment::set_section_addresses): Pass
3928         dot_section to set_if_absolute.
3929         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3930         as is_section_dot_assignment flag to eval_with_dot.
3931         (Output_section_element_dot_assignment::set_section_addresses):
3932         Likewise.
3933         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3934         parameter.  Also set value if relative to dot_section; set the
3935         symbol's output_section.
3936         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3937         parameter.  Adjust all callers.
3938         (Expression::eval_maybe_dot): Likewise.
3939         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3940         Adjust all callers.
3941         * testsuite/script_test_2.t: Test assignment of an absolute value
3942         to dot within an output section element.
3943
3944 2011-10-31  Cary Coutant  <ccoutant@google.com>
3945
3946         * options.h (class General_options): Add --[no-]gnu-unique options.
3947         * symtab.cc (Symbol_table::sized_write_globals): Convert
3948         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3949
3950 2011-10-31  Cary Coutant  <ccoutant@google.com>
3951
3952         PR gold/13359
3953         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3954         unnecessary assertion.
3955         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3956
3957 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3958
3959         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3960         gc_mark_symbol.
3961         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3962         gc_mark_symbol.
3963         Change to just keep the section associated with symbol.
3964         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3965         they are externally visible and --export-dynamic is turned on.
3966         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3967
3968 2011-10-19  Ian Lance Taylor  <iant@google.com>
3969
3970         PR gold/13163
3971         * script-sections.cc
3972         (Output_section_element_dot_assignment::needs_output_section): New
3973         function.
3974
3975 2011-10-19  Ian Lance Taylor  <iant@google.com>
3976
3977         PR gold/13204
3978         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3979         --section-start option was seen.
3980         * options.h (General_options::any_section_start): New function.
3981
3982 2011-10-18  David S. Miller  <davem@davemloft.net>
3983
3984         PR binutils/13301
3985         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3986         member to track relocation locations that have moved during TLS
3987         reloc optimizations.
3988         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3989         (Target_sparc::Relocate::relocate): Adjust view down by 4
3990         bytes if it matches reloc_adjust_addr_.
3991         (Target_sparc::Relocate::relocate_tls): Always move the
3992         __tls_get_addr call delay slot instruction forward 4 bytes when
3993         performing relaxation.
3994
3995 2011-10-18  Cary Coutant  <ccoutant@google.com>
3996
3997         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3998         (Output_file::map_no_anonymous): Check for non-zero
3999         return code from posix_fallocate.
4000
4001 2011-10-17  Cary Coutant  <ccoutant@google.com>
4002
4003         PR gold/13245
4004         * plugin.cc (is_visible_from_outside): Check for symbols
4005         referenced from dynamic objects.
4006         * resolve.cc (Symbol_table::resolve): Don't count references
4007         from dynamic objects as references from real ELF files.
4008         * testsuite/plugin_test_2.sh: Adjust expected result.
4009
4010 2011-10-17  Cary Coutant  <ccoutant@google.com>
4011
4012         * gold.cc: Include timer.h.
4013         (queue_middle_tasks): Stamp time.
4014         (queue_final_tasks): Likewise.
4015         * main.cc (main): Store timer in parameters.  Print timers
4016         for each pass.
4017         * parameters.cc (Parameters::Parameters): Initialize timer_.
4018         (Parameters::set_timer): New function.
4019         (set_parameters_timer): New function.
4020         * parameters.h (Parameters::set_timer): New function.
4021         (Parameters::timer): New function.
4022         (Parameters::timer_): New data member.
4023         (set_parameters_timer): New function.
4024         * timer.cc (Timer::stamp): New function.
4025         (Timer::get_pass_time): New function.
4026         * timer.h (Timer::stamp): New function.
4027         (Timer::get_pass_time): New function.
4028         (Timer::pass_times_): New data member.
4029
4030 2011-10-17  Cary Coutant  <ccoutant@google.com>
4031
4032         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
4033         task for members of lib groups.
4034
4035 2011-10-17  Cary Coutant  <ccoutant@google.com>
4036
4037         PR gold/13288
4038         * fileread.cc (File_read::find_view): Add assert.
4039         (File_read::make_view): Move bounds check (replace with assert)...
4040         (File_read::find_or_make_view): ... to here.
4041
4042 2011-10-12  Cary Coutant  <ccoutant@google.com>
4043
4044         * output.cc (Output_file::open_base_file): Handle case where
4045         ::read returns less than requested size.
4046
4047 2011-10-10  Cary Coutant  <ccoutant@google.com>
4048
4049         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
4050         Initialize defined_count_.
4051         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
4052         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
4053         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
4054         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
4055         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
4056         * incremental.h (Sized_relobj_incr::defined_count_): New data
4057         member.
4058         (Sized_incr_dynobj::defined_count_): New data member.
4059         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
4060         Return zeroes instead of internal error.
4061
4062 2011-10-10  Cary Coutant  <ccoutant@google.com>
4063
4064         PR gold/13249
4065         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4066         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4067         * output.h (class Output_reloc): Add use_plt_offset flag.
4068         (Output_reloc::type_): Adjust size of bit field.
4069         (Output_reloc::use_plt_offset_): New bit field.
4070         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4071         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4072         flag.  Adjust all callers.
4073         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4074         creating RELATIVE relocations.
4075
4076 2011-10-10  Nick Clifton  <nickc@redhat.com>
4077
4078         * po/es.po: Updated Spanish translation.
4079         * po/fi.po: Updated Finnish translation.
4080
4081 2011-10-03   Diego Novillo  <dnovillo@google.com>
4082
4083         * options.cc (parse_uint): Fix dereference of RETVAL.
4084
4085 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4086
4087         * layout.h (section_order_map_): New member.
4088         (get_section_order_map): New member function.
4089         * output.cc (Output_section::add_input_section): Check for patterns
4090         only when --section-ordering-file is specified.
4091         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4092         output_sections have been formed.
4093         * layout.cc (Layout_Layout): Initialize section_order_map_.
4094         * plugin.cc (update_section_order): Store order in order_map. Do not
4095         update the order.
4096         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4097         * testsuite/Makefile.in: Regenerate.
4098         * testsuite/plugin_section_order.c: New file.
4099         * testsuite/plugin_final_layout.cc: New file.
4100         * testsuite/plugin_final_layout.sh: New file.
4101
4102 2011-09-29  Cary Coutant  <ccoutant@google.com>
4103
4104         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4105         Check for NULL.
4106         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4107         symbols during incremental update.
4108         (Symbol_table::add_from_dynobj): Likewise.
4109
4110 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4111             Ian Lance Taylor  <iant@google.com>
4112
4113         * symtab.cc (Symbol_table::define_special_symbol): Always
4114         canonicalize version string.
4115
4116 2011-09-26  Cary Coutant  <ccoutant@google.com>
4117
4118         * gold.cc (queue_initial_tasks): Move option checks ...
4119         * options.cc (General_options::finalize): ... to here. Disable
4120         some options; make others fatal.
4121
4122 2011-09-26  Cary Coutant  <ccoutant@google.com>
4123
4124         gcc PR lto/47247
4125         * plugin.cc (get_symbols_v2): New function.
4126         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4127         (is_referenced_from_outside): New function.
4128         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4129         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4130         (get_symbols): Pass version parameter.
4131         (get_symbols_v2): New function.
4132         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4133         parameter.
4134         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4135         (onload): Add LDPT_GET_SYMBOLS_V2.
4136         (all_symbols_read_hook): Use get_symbols_v2; check for
4137         LDPR_PREVAILING_DEF_IRONLY_EXP.
4138         * testsuite/plugin_test_3.sh: Update expected results.
4139
4140 2011-09-23  Simon Baldwin  <simonb@google.com>
4141
4142         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4143         configuration options.
4144         * configure: Regenerate.
4145         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4146         * Makefile.in: Regenerate.
4147         * testsuite/Makefile.in: Regenerate.
4148
4149 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4150
4151         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4152
4153 2011-09-19  Cary Coutant  <ccoutant@google.com>
4154
4155         * incremental.cc (can_incremental_update): Fix typo in comment.
4156         * incremental.h (can_incremental_update): Likewise.
4157
4158 2011-09-18  Cary Coutant  <ccoutant@google.com>
4159
4160         * incremental.cc (can_incremental_update): New function.
4161         * incremental.h (can_incremental_update): New function.
4162         * layout.cc (Layout::init_fixed_output_section): Call it.
4163         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4164         * object.cc (Sized_relobj_file::do_layout): Call
4165         can_incremental_update.
4166
4167 2011-09-13  Cary Coutant  <ccoutant@google.com>
4168
4169         * configure.ac: Check for glibc support for gnu_indirect_function
4170         support with static linking, setting automake conditional
4171         IFUNC_STATIC.
4172         * Makefile.in: Regenerate.
4173         * configure: Regenerate.
4174
4175         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4176         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4177         for IFUNC_STATIC.
4178         * testsuite/Makefile.in: Regenerate.
4179
4180 2011-09-13  Cary Coutant  <ccoutant@google.com>
4181
4182         * incremental.cc (Sized_relobj_incr::do_layout): Call
4183         report_comdat_group for kept comdat sections.
4184         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4185         * testsuite/Makefile.in: Regenerate.
4186         * testsuite/incr_comdat_test_1.cc: New source file.
4187         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4188         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4189         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4190
4191 2011-09-13  Ian Lance Taylor  <iant@google.com>
4192
4193         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4194         variable external_symbols_offset.
4195
4196 2011-09-12  Ian Lance Taylor  <iant@google.com>
4197
4198         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4199         triggered if object has no symbols.
4200
4201 2011-09-09  David S. Miller  <davem@davemloft.net>
4202
4203         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4204         (Output_fill_debug_line::do_write): Likewise.
4205
4206 2011-08-29  Cary Coutant  <ccoutant@google.com>
4207
4208         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4209         casts to match formatting specs.
4210         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4211
4212 2011-08-26  Cary Coutant  <ccoutant@google.com>
4213
4214         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4215         remaining hole size when allocating.
4216         (Layout::make_output_section): Set fill methods for debug sections.
4217         * layout.h (Free_list::Free_list_node): Move from private to
4218         public.
4219         (Free_list::set_min_hole_size): New function.
4220         (Free_list::begin, Free_list::end): New functions.
4221         (Free_list::min_hole_): New data member.
4222         * output.cc: Include dwarf.h.
4223         (Output_fill_debug_info::do_minimum_hole_size): New function.
4224         (Output_fill_debug_info::do_write): New function.
4225         (Output_fill_debug_line::do_minimum_hole_size): New function.
4226         (Output_fill_debug_line::do_write): New function.
4227         (Output_section::Output_section): Initialize new data member.
4228         (Output_section::set_final_data_size): Ensure patch space is larger
4229         than minimum hole size.
4230         (Output_section::do_write): Fill holes in debug sections.
4231         * output.h (Output_fill): New class.
4232         (Output_fill_debug_info): New class.
4233         (Output_fill_debug_line): New class.
4234         (Output_section::set_free_space_fill): New function.
4235         (Output_section::free_space_fill_): New data member.
4236         * testsuite/Makefile.am (incremental_test_3): Add
4237         --incremental-patch option.
4238         (incremental_test_4): Likewise.
4239         (incremental_test_5): Likewise.
4240         (incremental_test_6): Likewise.
4241         (incremental_copy_test): Likewise.
4242         (incremental_common_test_1): Likewise.
4243         * testsuite/Makefile.in: Regenerate.
4244
4245 2011-08-26  Nick Clifton  <nickc@redhat.com>
4246
4247         * po/es.po: Updated Spanish translation.
4248
4249 2011-08-01  Cary Coutant  <ccoutant@google.com>
4250
4251         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4252         * gold/testsuite/Makefile.in: Regenerate.
4253         * gold/testsuite/justsyms_exec.c: New source file.
4254         * gold/testsuite/justsyms_lib.c: New source file.
4255
4256 2011-08-01  Cary Coutant  <ccoutant@google.com>
4257
4258         * layout.cc (Layout::set_segment_offsets): Don't realign text
4259         segment if -Ttext was specified.
4260         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4261         file type.
4262         * object.h (Sized_relobj_file::e_type): New function.
4263         (Sized_relobj_file::e_type_): New data member.
4264         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4265         base address for ET_EXEC files.
4266         * target.cc (Target::do_make_elf_object_implementation): Allow
4267         ET_EXEC files with --just-symbols option.
4268
4269 2011-07-28  Cary Coutant  <ccoutant@google.com>
4270
4271         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4272         Add thread_number parameter.
4273         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4274         * workqueue-threads.cc
4275         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4276         current thread if its thread number is greater than desired thread
4277         count.
4278         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4279         Add thread_number parameter.
4280         (Workqueue::should_cancel_thread): Likewise.
4281         (Workqueue::find_runnable_or_wait): Pass thread_number to
4282         should_cancel_thread.
4283         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4284         parameter.
4285
4286 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4287
4288         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4289         only after checking if it cannot be forced local.
4290         * symtab.h (is_externally_visible): Check if the symbol is not forced
4291         local.
4292
4293 2011-07-15  Ian Lance Taylor  <iant@google.com>
4294
4295         * options.h (class General_options): Add --print-output-format.
4296         Move -EL next to -EB, for  better --help output.
4297         * target-select.cc: Include <cstdio>, "options.h", and
4298         "parameters.h".
4299         (Target_selector::do_target_bfd_name): New function.
4300         (print_output_format): New function.
4301         * target-select.h (class Target_selector): Update declarations.
4302         (Target_selector::target_bfd_name): New function.
4303         (print_output_format): Declare.
4304         * main.cc: Include "target-select.h".
4305         (main): Handle --print-output-format.
4306         * gold.cc: Include "target-select.h".
4307         (queue_initial_tasks): Handle --print-output-format when there are
4308         no input files.
4309         * parameters.cc (parameters_force_valid_target): Give a better
4310         error message if -EB/-EL does not match target.
4311         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4312         function.
4313
4314 2011-07-15  Ian Lance Taylor  <iant@google.com>
4315
4316         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4317         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4318         (Output_data_plt_i386::do_write): Write address of .dynamic
4319         section to first entry in .got.plt section.
4320         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4321         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4322         Initialize layout_.
4323         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4324         section to first entry in .got.plt section.
4325         * layout.h (Layout::dynamic_section): New function.
4326
4327 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4328
4329         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4330         to claim_file call.
4331         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4332         input_section_position_, and input_section_glob_.
4333         (read_layout_from_file): Call function section_ordering_specified.
4334         * layout.h (is_section_ordering_specified): New function.
4335         (section_ordering_specified): New function.
4336         (section_ordering_specified_): New boolean member.
4337         * main.cc(main): Call load_plugins after layout object is defined.
4338         * output.cc (Output_section::add_input_section): Use
4339         function section_ordering_specified to check if section ordering is
4340         needed.
4341         * output.cc (Output_section::add_relaxed_input_section): Use
4342         function section_ordering_specified to check if section ordering is
4343         needed.
4344         (Output_section::update_section_layout): New function.
4345         (Output_section::sort_attached_input_sections): Check if input section
4346         must be reordered.
4347         * output.h (Output_section::update_section_layout): New function.
4348         * plugin.cc (get_section_count): New function.
4349         (get_section_type): New function.
4350         (get_section_name): New function.
4351         (get_section_contents): New function.
4352         (update_section_order): New function.
4353         (allow_section_ordering): New function.
4354         (Plugin::load): Add the new interfaces to the transfer vector.
4355         (Plugin_manager::load_plugins): New parameter.
4356         (Plugin_manager::all_symbols_read): New parameter.
4357         (Plugin_manager::claim_file): New parameter. Save the elf object for
4358         unclaimed objects.
4359         (Plugin_manager::get_elf_object): New function.
4360         (Plugin_manager::get_view): Change to directly use the bool to check
4361         if get_view is called from claim_file_hook.
4362         * plugin.h (input_objects): New function
4363         (Plugin__manager::load_plugins): New parameter.
4364         (Plugin_manager::claim_file): New parameter.
4365         (Plugin_manager::get_elf_object): New function.
4366         (Plugin_manager::in_claim_file_handler): New function.
4367         (Plugin_manager::in_claim_file_handler_): New member.
4368         (layout): New function.
4369         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4370         handler with an extra parameter. Make the elf object before calling
4371         claim_file handler.
4372         * testsuite/plugin_test.c (get_section_count): New function pointer.
4373         (get_section_type): New function pointer.
4374         (get_section_name): New function pointer.
4375         (get_section_contents): New function pointer.
4376         (update_section_order): New function pointer.
4377         (allow_section_ordering): New function pointer.
4378         (onload): Check if the new interfaces exist.
4379
4380 2011-07-13  Ian Lance Taylor  <iant@google.com>
4381
4382         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4383         relro section.
4384         * x86_64.cc (Target_x86_64::got_section): Likewise.
4385         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4386         (relro_now_test_SOURCES): New variable.
4387         (relro_now_test_DEPENDENCIES): New variable.
4388         (relro_now_test_LDFLAGS): New variable.
4389         (relro_now_test_LDADD): New variable.
4390         (relro_now_test.so): New target.
4391         * testsuite/Makefile.in: Rebuild.
4392
4393 2011-07-12  Ian Lance Taylor  <iant@google.com>
4394
4395         PR gold/12980
4396         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4397         GLOB_DAT relocation rather than a RELATIVE relocation for a
4398         protected symbol when creating a shared library.
4399         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4400         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4401         * testsuite/protected_main_1.cc (main): Test that protected
4402         function has same address.
4403
4404 2011-07-11  Ian Lance Taylor  <iant@google.com>
4405
4406         PR gold/12979
4407         * options.h (class General_options): Add -Bgroup.
4408         * options.cc (General_options::finalize): If -Bgroup is set,
4409         default to --unresolved-symbols=report-all.
4410         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4411         * target-reloc.h (issue_undefined_symbol_error): Handle
4412         --unresolved-symbols=report-all.
4413
4414 2011-07-08  Ian Lance Taylor  <iant@google.com>
4415
4416         PR gold/11985
4417         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4418         if linker script discards key sections.
4419         (Layout::create_dynamic_symtab): Likewise.
4420         (Layout::assign_local_dynsym_offsets): Likewise.
4421         (Layout::sized_create_version_sections): Likewise.
4422         (Layout::create_interp): Likewise.
4423         (Layout::finish_dynamic_section): Likewise.
4424         (Layout::set_dynamic_symbol_size): Likewise.
4425
4426 2011-07-08  Ian Lance Taylor  <iant@google.com>
4427
4428         PR gold/12386
4429         * options.h (class General_options): Add --unresolved-symbols.
4430         * target-reloc.h (issue_undefined_symbol_error): Check
4431         --unresolved-symbols.  Add comments.
4432
4433 2011-07-08  Ian Lance Taylor  <iant@google.com>
4434
4435         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4436         expression more complex.
4437
4438 2011-07-08  Ian Lance Taylor  <iant@google.com>
4439
4440         PR gold/11317
4441         * target-reloc.h (issue_undefined_symbol_error): New inline
4442         function, broken out of relocate_section.
4443         (relocate_section): Call issue_undefined_symbol_error.
4444         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4445         there is no TLS segment if we are about to issue an undefined
4446         symbol error.
4447         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4448
4449 2011-07-08  Ian Lance Taylor  <iant@google.com>
4450
4451         PR gold/12279
4452         * resolve.cc (Symbol_table::should_override): Add fromtype
4453         parameter.  Change all callers.  Give error when linking together
4454         TLS and non-TLS symbol.
4455         (Symbol_table::should_override_with_special): Add fromtype
4456         parameter.  Change all callers.
4457         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4458         there is no TLS segment if we have reported some errors.
4459         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4460
4461 2011-07-08  Ian Lance Taylor  <iant@google.com>
4462
4463         PR gold/12372
4464         * target.h (Target::plt_address_for_global): New function.
4465         (Target::plt_address_for_local): New function.
4466         (Target::plt_section_for_global): Remove.
4467         (Target::plt_section_for_local): Remove.
4468         (Target::do_plt_address_for_global): New virtual function.
4469         (Target::do_plt_address_for_local): New virtual function.
4470         (Target::do_plt_section_for_global): Remove.
4471         (Target::do_plt_section_for_local): Remove.
4472         (Target::register_global_plt_entry): Add Symbol_table and Layout
4473         parameters.
4474         * output.cc (Output_data_got::Got_entry::write): Use
4475         plt_address_for_global and plt_address_for_local.
4476         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4477         address of output section.
4478         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4479         got_irelative_, and irelative_count_ fields.  Update
4480         declarations.
4481         (Output_data_plt_i386::has_irelative_section): New function.
4482         (Output_data_plt_i386::entry_count): Add irelative_count_.
4483         (Output_data_plt_i386::set_final_data_size): Likewise.
4484         (class Target_i386): Add got_irelative_ and rel_irelative_
4485         fields.  Update declarations.
4486         (Target_i386::Target_i386): Initialize new fields.
4487         (Target_i386::do_plt_address_for_global): New function replacing
4488         do_plt_section_for_global.
4489         (Target_i386::do_plt_address_for_local): New function replacing
4490         do_plt_section_for_local.
4491         (Target_i386::got_section): Create got_irelative_.
4492         (Target_i386::rel_irelative_section): New function.
4493         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4494         fields.  Don't define __rel_iplt_{start,end}.
4495         (Output_data_plt_i386::add_entry): Add symtab and layout
4496         parameters.  Change all callers.  Use different PLT and GOT for
4497         IFUNC symbols.
4498         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4499         layout parameters.  Change all callers.  Use different PLT and
4500         GOT.
4501         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4502         (Output_data_plt_i386::rel_irelative): New function.
4503         (Output_data_plt_i386::address_for_global): New function.
4504         (Output_data_plt_i386::address_for_local): New function.
4505         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4506         IRELATIVE GOT when changing IFUNC GOT entries.
4507         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4508         reloc.
4509         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4510         if we didn't create an IRELATIVE GOT.
4511         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4512         plt_address_for_local.
4513         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4514         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4515         got_irelative_, and irelative_count_ fields.  Update
4516         declarations.
4517         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4518         Initialize new fields.  Remove symtab parameter.  Change all
4519         callers.
4520         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4521         irelative_count_.
4522         (Output_data_plt_x86_64::has_irelative_section): New function.
4523         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4524         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4525         fields.  Update declarations.
4526         (Target_x86_64::Target_x86_64): Initialize new fields.
4527         (Target_x86_64::do_plt_address_for_global): New function replacing
4528         do_plt_section_for_global.
4529         (Target_x86_64::do_plt_address_for_local): New function replacing
4530         do_plt_section_for_local.
4531         (Target_x86_64::got_section): Create got_irelative_.
4532         (Target_x86_64::rela_irelative_section): New function.
4533         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4534         all callers.  Don't create __rel_iplt_{start,end}.
4535         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4536         parameters.  Change all callers.  Use different PLT and GOT for
4537         IFUNC symbols.
4538         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4539         layout parameters.  Change all callers.  Use different PLT and
4540         GOT.
4541         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4542         parameters.  Change all callers.  Use different PLT and GOT for
4543         IFUNC symbols.
4544         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4545         (Output_data_plt_x86_64::rela_irelative): New function.
4546         (Output_data_plt_x86_64::address_for_global): New function.
4547         (Output_data_plt_x86_64::address_for_local): New function.
4548         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4549         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4550         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4551         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4552         parameters.
4553         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4554         reloc.
4555         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4556         symbols if we didn't create an IRELATIVE GOT.
4557         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4558         plt_address_for_local.
4559         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4560         * testsuite/ifuncvar1.c: New test file.
4561         * testsuite/ifuncvar2.c: New test file.
4562         * testsuite/ifuncvar3.c: New test file.
4563         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4564         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4565         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4566         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4567         * testsuite/Makefile.in: Rebuild.
4568
4569 2011-07-07  Cary Coutant  <ccoutant@google.com>
4570
4571         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4572         (two_file_test_1_ndebug.o): Likewise.
4573         (two_file_test_1b_ndebug.o): Likewise.
4574         (two_file_test_2_ndebug.o): Likewise.
4575         (two_file_test_main_ndebug.o): Likewise.
4576         (incremental_test_2): Link with no-debug versions.
4577
4578 2011-07-06  Cary Coutant  <ccoutant@google.com>
4579
4580         * gold/incremental.cc
4581         (Output_section_incremental_inputs::write_info_blocks): Check for
4582         hidden and internal symbols.
4583
4584 2011-07-06  Cary Coutant  <ccoutant@google.com>
4585
4586         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4587         Check disposition for startup file.
4588         (Incremental_inputs::report_command_line): Ignore
4589         --incremental-startup-unchanged option.
4590         * options.cc (General_options::parse_incremental_startup_unchanged):
4591         New function.
4592         (General_options::General_options): Initialize new data member.
4593         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4594         (General_options): Add --incremental-startup-unchanged option.
4595         (General_options::incremental_startup_disposition): New function.
4596         (General_options::incremental_startup_disposition_): New data member.
4597
4598 2011-07-06  Cary Coutant  <ccoutant@google.com>
4599
4600         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4601         input file index to Script_info ctor.
4602         (Sized_incremental_binary::do_file_has_changed): Find the
4603         command-line argument for files named in scripts.
4604         * incremental.h (Script_info::Script_info): New ctor
4605         with input file index.
4606         (Script_info::input_file_index): New function.
4607         (Script_info::input_file_index_): New data member.
4608         (Incremental_binary::get_library): Add const.
4609         (Incremental_binary::get_script_info): Add const.
4610         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4611         * testsuite/Makefile.am (incremental_test_5): New test case.
4612         (incremental_test_6): New test case.
4613         * testsuite/Makefile.in: Regenerate.
4614
4615 2011-07-06  Cary Coutant  <ccoutant@google.com>
4616
4617         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4618         debug output when command lines differ.
4619
4620 2011-07-06  Cary Coutant  <ccoutant@google.com>
4621
4622         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4623         --incremental-patch option.
4624         * layout.cc (Free_list::allocate): Extend allocation beyond original
4625         end if enabled.
4626         (Layout::make_output_section): Mark sections that should get
4627         patch space.
4628         * options.cc (parse_percent): New function.
4629         * options.h (parse_percent): New function.
4630         (DEFINE_percent): New macro.
4631         (General_options): Add --incremental-patch option.
4632         * output.cc (Output_section::Output_section): Initialize new data
4633         members.
4634         (Output_section::add_input_section): Print section name when out
4635         of patch space.
4636         (Output_section::add_output_section_data): Likewise.
4637         (Output_section::set_final_data_size): Add patch space when
4638         doing --incremental-full.
4639         (Output_section::do_reset_address_and_file_offset): Remove patch
4640         space.
4641         (Output_segment::set_section_list_addresses): Print debug output
4642         only if --incremental-update.
4643         * output.h (Output_section::set_is_patch_space_allowed): New function.
4644         (Output_section::is_patch_space_allowed_): New data member.
4645         (Output_section::patch_space_): New data member.
4646         * parameters.cc (Parameters::incremental_full): New function.
4647         * parameters.h (Parameters::incremental_full): New function
4648         * testsuite/Makefile.am (incremental_test_2): Add test for
4649         --incremental-patch option.
4650         * testsuite/Makefile.in: Regenerate.
4651         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4652         (t18): Remove function body.
4653
4654 2011-07-05  Doug Kwan  <dougkwan@google.com>
4655
4656         PR gold/12771
4657         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4658         Arm_Address type for relocation result.
4659         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4660         overflow check.
4661         (Arm_relocate_functions::abs32): Use unaligned access.
4662         (Arm_relocate_functions::rel32): Ditto.
4663         (Arm_relocate_functions::prel31): Ditto.
4664         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4665         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4666         static data relocations.
4667         * testsuite/Makefile.in: Regnerate.
4668         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4669
4670 2011-07-05  Ian Lance Taylor  <iant@google.com>
4671
4672         PR gold/12392
4673         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4674         symbols if necessary.
4675         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4676
4677 2011-07-05  Ian Lance Taylor  <iant@google.com>
4678
4679         PR gold/12952
4680         * resolve.cc (Symbol::override_base_with_special): Simply override
4681         version with special symbol version, ignoring previous version.
4682
4683 2011-07-05  Ian Lance Taylor  <iant@google.com>
4684
4685         * object.cc (Sized_relobj_file::include_section_group): Add
4686         information to comment about signature location.
4687
4688 2011-07-02  Ian Lance Taylor  <iant@google.com>
4689
4690         PR gold/12957
4691         * options.h (class General_options): Add -f and -F.
4692         * options.cc (General_options::finalize): Fatal error if -f/-F
4693         are used without -shared.
4694         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4695
4696 2011-07-02  Ian Lance Taylor  <iant@google.com>
4697
4698         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4699
4700 2011-07-01  Ian Lance Taylor  <iant@google.com>
4701
4702         PR gold/12525
4703         PR gold/12952
4704         * resolve.cc (Symbol::override_base_with_special): Don't override
4705         the version if the overriding symbol has a different name.
4706         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4707         all callers.  If we give an error about an undefined version,
4708         define the base version if necessary.
4709         * dynobj.h (class Versions): Update declaration.
4710         * testsuite/weak_alias_test_5.cc: New file.
4711         * testsuite/weak_alias_test.script: New file.
4712         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4713         and versioned_alias have the right value, and call t2.
4714         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4715         weak_alias_test_5.so.
4716         (weak_alias_test_LDADD): Likewise.
4717         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4718         * testsuite/Makefile.in: Rebuild.
4719
4720 2011-07-01  Ian Lance Taylor  <iant@google.com>
4721
4722         PR gold/12525
4723         * options.h (class General_options): Support -z notext.
4724         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4725         -Wl,-z,notext.
4726         (two_file_shared_nonpic.so): Likewise.
4727         (two_file_shared_mixed.so): Likewise.
4728         (two_file_shared_mixed_1.so): Likewise.
4729         (weak_undef_lib_nonpic.so): Likewise.
4730         (alt/weak_undef_lib_nonpic.so): Likewise.
4731         (tls_test_shared_nonpic.so): Likewise.
4732         * testsuite/Makefile.in: Rebuild.
4733
4734 2011-07-01  Ian Lance Taylor  <iant@google.com>
4735
4736         PR gold/12525
4737         * configure.ac: Test whether static linking works, setting
4738         the automake conditional HAVE_STATIC.
4739         * testsuite/Makefile.am: Disable tests using -static if
4740         HAVE_STATIC is not true.
4741         * configure, testsuite/Makefile.in: Rebuild.
4742
4743 2011-07-01  Ian Lance Taylor  <iant@google.com>
4744
4745         PR gold/12525
4746         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4747         Assert if we see DW_EH_PE_indirect.
4748         * target.h (Target::ehframe_datarel_base): New function.
4749         (Target::do_ehframe_datarel_base): New target function.
4750         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4751         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4752         function.
4753
4754 2011-07-01  Ian Lance Taylor  <iant@google.com>
4755
4756         PR gold/12571
4757         * options.h (class General_options): Add
4758         --ld-generated-unwind-info.
4759         * ehframe.cc (Fde::write): Add address parameter.  Change all
4760         callers.  If associated with PLT, fill in address and size.
4761         (Cie::set_output_offset): Only add merge mapping if there is an
4762         object.
4763         (Cie::write): Add address parameter.  Change all callers.
4764         (Eh_frame::add_ehframe_for_plt): New function.
4765         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4766         input_offset_ fields into union u_, with new plt field.
4767         (Fde::Fde): Adjust for new union field.
4768         (Fde::Fde) [Output_data version]: New constructor.
4769         (Fde::add_mapping): Only add merge mapping if there is an object.
4770         (class Cie): Update declarations.
4771         (class Eh_frame): Declare add_ehframe_for_plt.
4772         * layout.cc (Layout::layout_eh_frame): Break out code into
4773         make_eh_frame_section, and call it.
4774         (Layout::make_eh_frame_section): New function.
4775         (Layout::add_eh_frame_for_plt): New function.
4776         * layout.h (class Layout): Update declarations.
4777         * merge.cc (Merge_map::add_mapping): Add assertion.
4778         * i386.cc: Include "dwarf.h".
4779         (class Output_data_plt_i386): Make first_plt_entry,
4780         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4781         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4782         and plt_eh_frame_fde.
4783         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4784         boundary.  Call add_eh_frame_for_plt if appropriate.
4785         * x86_64.cc: Include "dwarf.h".
4786         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4787         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4788         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4789         and plt_eh_frame_fde.
4790         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4791         appropriate.
4792
4793 2011-06-29  Ian Lance Taylor  <iant@google.com>
4794
4795         PR gold/12629
4796         * object.cc (Sized_relobj_file::layout_section): Change shdr
4797         parameter to be const.
4798         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4799         out of do_layout.
4800         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4801         appropriate.  Call layout_eh_frame_section.
4802         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4803         sections.
4804         * object.h (class Sized_relobj_file): Update declarations.
4805
4806 2011-06-29  Ian Lance Taylor  <iant@google.com>
4807
4808         PR gold/12652
4809         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4810         modifier.
4811         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4812
4813 2011-06-29  Ian Lance Taylor  <iant@google.com>
4814
4815         PR gold/12675
4816         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4817         SHT_X86_64_UNWIND.
4818         * layout.cc (Layout::layout_eh_frame): Likewise.
4819
4820 2011-06-29  Ian Lance Taylor  <iant@google.com>
4821
4822         PR gold/12695
4823         * layout.cc (Layout::symtab_section_shndx): New function.
4824         * layout.h (class Layout): Declare symtab_section_shndx.
4825         * output.cc (Output_section::write_header): Call it.
4826
4827 2011-06-29  Ian Lance Taylor  <iant@google.com>
4828
4829         PR gold/12818
4830         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4831         symbols which are not used in a relocation.
4832
4833 2011-06-28  Ian Lance Taylor  <iant@google.com>
4834
4835         PR gold/12898
4836         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4837         script create indistinguishable segments.
4838         (Layout::set_segment_offsets): Use stable_sort when sorting
4839         segments.  Pass this to Compare_segments constructor.
4840         * layout.h (class Layout): Make segment_precedes non-static.
4841         (class Compare_segments): Change from struct to class.  Add
4842         layout_ field.  Add constructor.
4843         * script-sections.cc
4844         (Script_sections::attach_sections_using_phdrs_clause): Rename
4845         local orphan to is_orphan.  Don't report failure to put empty
4846         section in segment.  On attachment failure, report name of
4847         section, and attach to first PT_LOAD segment.
4848
4849 2011-06-28  Ian Lance Taylor  <iant@google.com>
4850
4851         PR gold/12934
4852         * target-select.cc (Target_selector::Target_selector): Add
4853         emulation parameter.  Change all callers.
4854         (select_target_by_bfd_name): Rename from select_target_by_name.
4855         Change all callers.
4856         (select_target_by_emulation): New function.
4857         (supported_emulation_names): New function.
4858         * target-select.h (class Target_selector): Add emulation_ field.
4859         Update declarations.
4860         (Target_selector::recognize_by_bfd_name): Rename from
4861         recognize_by_name.  Change all callers.
4862         (Target_selector::supported_bfd_names): Rename from
4863         supported_names.  Change all callers.
4864         (Target_selector::recognize_by_emulation): New function.
4865         (Target_selector::supported_emulations): New function.
4866         (Target_selector::emulation): New function.
4867         (Target_selector::do_recognize_by_bfd_name): Rename from
4868         do_recognize_by_name.  Change all callers.
4869         (Target_selector::do_supported_bfd_names): Rename from
4870         do_supported_names.  Change all callers.
4871         (Target_selector::do_recognize_by_emulation): New function.
4872         (Target_selector::do_supported_emulations): New function.
4873         (select_target_by_bfd_name): Change name in declaration.
4874         (select_target_by_emulation): Declare.
4875         (supported_emulation_names): Declare.
4876         * parameters.cc (parameters_force_valid_target): Try to find
4877         target based on emulation from -m option.
4878         * options.h (class General_options): Change doc string for -m.
4879         * options.cc (help): Print emulations.
4880         (General_options::parse_V): Likewise.
4881         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4882         Add emulation parameter.  Change all callers.
4883
4884 2011-06-28  Ian Lance Taylor  <iant@google.com>
4885
4886         * target.h (class Target): Add osabi_ field.
4887         (Target::osabi): New function.
4888         (Target::set_osabi): New function.
4889         (Target::Target): Initialize osabi_.
4890         (Target::do_adjust_elf_header): Make pure virtual.
4891         (Sized_target::do_adjust_elf_header): Declare.
4892         * target.cc (Sized_target::do_adjust_elf_header): New function.
4893         (class Sized_target): Instantiate all versions.
4894         * freebsd.h (class Target_freebsd): Remove.
4895         (Target_selector_freebsd::do_recognize): Call set_osabi on
4896         Target.
4897         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4898         (Target_selector_freebsd::set_osabi): Remove.
4899         * i386.cc (class Target_i386): Inherit from Sized_target rather
4900         than Target_freebsd.
4901         * x86_64.cc (class Target_x86_64): Likewise.
4902
4903 2011-06-28  Ian Lance Taylor  <iant@google.com>
4904
4905         * target.h (Target::can_check_for_function_pointers): Rewrite.
4906         Make non-virtual.
4907         (Target::can_icf_inline_merge_sections): Likewise.
4908         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4909         (Target::Target_info): Add can_icf_inline_merge_sections field.
4910         (Target::do_can_check_for_function_pointers): New virtual
4911         function.
4912         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4913         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4914         from can_check_for_function_pointers, move in file.
4915         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4916         section_may_have_icf_unsafe_poineters, move in file.
4917         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4918         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4919         Rename from can_check_for_function_pointers, move in file.
4920         (Target_i386::can_icf_inline_merge_sections): Remove.
4921         (Target_i386::i386_info): Initialize
4922         can_icf_inline_merge_sections.
4923         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4924         Initialize can_icf_inline_merge_sections.
4925         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4926         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4927         Rename from can_check_for_function_pointers, move in file.
4928         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4929         (Target_x86_64::x86_64_info): Initialize
4930         can_icf_inline_merge_sections.
4931         * testsuite/testfile.cc (Target_test::test_target_info):
4932         Likewise.
4933         * icf.cc (get_section_contents): Correct formatting.
4934
4935 2011-06-27  Ian Lance Taylor  <iant@google.com>
4936
4937         * symtab.cc (Symbol::versioned_name): New function.
4938         (Symbol_table::add_to_final_symtab): Use versioned_name when
4939         appropriate.
4940         (Symbol_table::sized_write_symbol): Likewise.
4941         * symtab.h (class Symbol): Declare versioned_name.
4942         * stringpool.h (class Stringpool_template): Add variant of add
4943         which takes a std::basic_string.
4944         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4945         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4946         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4947         (ver_test_12.o): New target.
4948         * testsuite/Makefile.in: Rebuild.
4949
4950 2011-06-27  Doug Kwan  <dougkwan@google.com>
4951
4952         * arm.cc (Arm_relocate_functions::thm_jump8,
4953         Arm_relocate_functions::thm_jump11): Use a wider signed
4954         type to compute offset.
4955         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4956         arm_thm_jump8.
4957         * testsuite/Makefile.in: Regenerate.
4958         * testsuite/arm_branch_in_range.sh: Check test results of
4959         arm_thm_jump11 and arm_thm_jump8.
4960         * testsuite/arm_thm_jump11.s: New test source file.
4961         * testsuite/arm_thm_jump11.t: New linker script.
4962         * testsuite/arm_thm_jump8.s: New test source file.
4963         * testsuite/arm_thm_jump8.t: New linker script.
4964
4965 2011-06-24  Ian Lance Taylor  <iant@google.com>
4966
4967         * layout.cc: Include "object.h".
4968         (ctors_sections_in_init_array): New static variable.
4969         (Layout::is_ctors_in_init_array): New function.
4970         (Layout::layout): Add entry to ctors_sections_in_init_array if
4971         appropriate.
4972         * layout.h (class Layout): Declare is_ctors_in_init_array.
4973         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4974         is_ctors_reverse_view is set.
4975         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4976         all callers.  Set is_ctors_reverse_view field of View_size.
4977         (Sized_relobj_file::reverse_words): New function.
4978         * object.h (Sized_relobj_file::View_size): Add
4979         is_ctors_reverse_view field.
4980         (class Sized_relobj_file): Update declarations.
4981         * testsuite/initpri3.c: New test.
4982         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4983         initpri3b.
4984         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4985         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4986         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4987         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4988         * testsuite/Makefile.in: Rebuild.
4989
4990 2011-06-24  Cary Coutant  <ccoutant@google.com>
4991
4992         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4993         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4994         (debug_msg_cdebug.err): New targets.
4995         * testsuite/Makefile.in: Regenerate.
4996         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4997         Fix checks for link with shared library.
4998
4999 2011-06-24  Doug Kwan  <dougkwan@google.com>
5000
5001         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
5002         skip empty text sections.
5003         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
5004
5005 2011-06-22  Ian Lance Taylor  <iant@google.com>
5006
5007         PR gold/12910
5008         * options.h (class General_options): Add --ctors-in-init-array.
5009         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
5010         friends as SHT_PROGBITS for merging sections.
5011         (Layout::layout): Remove special handling of .init_array and
5012         friends.  Don't sort if doing relocatable link.  Sort for .ctors
5013         and .dtors if ctors_in_init_array.
5014         (Layout::make_output_section): Force correct section types for
5015         .init_array and friends.  Don't sort if doing relocatable link,
5016         Don't sort .ctors and .dtors if ctors_in_init_array.
5017         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
5018         (Layout::output_section_name): Add relobj parameter.  Change all
5019         callers.  Handle .ctors. and .dtors. in code rather than table.
5020         Handle .ctors and .dtors if ctors_in_init_array.
5021         (Layout::match_file_name): New function, moved from output.cc.
5022         * layout.h (class Layout): Update declarations.
5023         * output.cc: Include "layout.h".
5024         (Input_section_sort_entry::get_priority): New function.
5025         (Input_section_sort_entry::match_file_name): Just call
5026         Layout::match_file_name.
5027         (Output_section::Input_section_sort_init_fini_compare::operator()):
5028         Handle .ctors and .dtors.  Sort by explicit priority rather than
5029         by name.
5030         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
5031         * testsuite/initpri2.c: New test.
5032         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
5033         (check_PROGRAMS): Add initpri2.
5034         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
5035         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
5036         * configure, testsuite/Makefile.in: Rebuild.
5037
5038 2011-06-19  Ian Lance Taylor  <iant@google.com>
5039
5040         PR gold/12880
5041         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
5042         .interp section to a PT_INTERP segment even if we have seen a
5043         --dynamic-linker option.  Don't do it if we have seen a PHDRS
5044         clause in a linker script.
5045         (Layout::finalize): Don't create a .interp section if we've
5046         already create a PT_INTERP segment.
5047         (Layout::create_interp): Always call choose_output_section (revert
5048         patch of 2011-06-17).  Don't create PT_INTERP segment.
5049         * script-sections.cc
5050         (Script_sections::create_note_and_tls_segments): Add a .interp
5051         section to a PT_INTERP segment even if we have seen a
5052         --dynamic-linker option.
5053
5054 2011-06-18  Ian Lance Taylor  <iant@google.com>
5055
5056         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
5057         merely because a non-PT_LOAD segment has a dynamic reloc.
5058
5059 2011-06-18  Ian Lance Taylor  <iant@google.com>
5060
5061         * layout.cc (Layout::finish_dynamic_section): Don't create
5062         DT_FLAGS entry if not needed.
5063
5064 2011-06-18  Ian Lance Taylor  <iant@google.com>
5065
5066         PR gold/12745
5067         * layout.cc (Layout::layout_eh_frame): Correct handling of
5068         writable .eh_frame section.
5069
5070 2011-06-17  Ian Lance Taylor  <iant@google.com>
5071
5072         PR gold/12893
5073         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5074         symbol is redefined with the exact same object and value.
5075
5076 2011-06-17  Ian Lance Taylor  <iant@google.com>
5077
5078         PR gold/12880
5079         * layout.h (class Layout): Add interp_segment_ field.
5080         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5081         (Layout::attach_allocated_section_to_segment): If making shared
5082         library, put .interp section in PT_INTERP segment.
5083         (Layout::finalize): Also call create_interp if -dynamic-linker
5084         option was used.
5085         (Layout::create_interp): Assert that there is no PT_INTERP
5086         segment.  If not using a SECTIONS clause, use make_output_section.
5087         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5088         * script-sections.cc
5089         (Script_sections::create_note_and_tls_segments): If making shared
5090         library, put .interp section in PT_INTERP segment.
5091
5092 2011-06-17  Ian Lance Taylor  <iant@google.com>
5093
5094         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5095         when making a shared library.
5096
5097 2011-06-17  Ian Lance Taylor  <iant@google.com>
5098
5099         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5100         parameter.  Change all callers.  Don't issue warning about PC32
5101         against locally defined symbol.
5102
5103 2011-06-16  Ian Lance Taylor  <iant@google.com>
5104
5105         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5106         occurs in same object.
5107
5108 2011-06-14  Alan Modra  <amodra@gmail.com>
5109
5110         * po/POTFILES.in: Regenerate.
5111
5112 2011-06-09  Ian Lance Taylor  <iant@google.com>
5113
5114         * script-sections.cc
5115         (Orphan_output_section::set_section_addresses): For a relocatable
5116         link set address to 0.
5117
5118 2011-06-09  Cary Coutant  <ccoutant@google.com>
5119
5120         PR gold/12804
5121         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5122         used with --compress-debug-sections.
5123         * gold/object.cc (Sized_relobj_file::do_layout): Report
5124         uncompressed size of compressed input sections.
5125
5126 2011-06-08  Cary Coutant  <ccoutant@google.com>
5127
5128         PR gold/12804
5129         * testsuite/two_file_test_2_v1.cc: Change initialization of
5130         v2 to keep it in .data.
5131
5132 2011-06-07  Cary Coutant  <ccoutant@google.com>
5133
5134         * common.cc (Symbol_table::do_allocate_commons_list): Call
5135         gold_fallback.
5136         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5137         (Errors::fallback): New function.
5138         (gold_fallback): New function.
5139         * errors.h (Errors::fallback): New function.
5140         * gold.cc (gold_exit): Change status parameter to enum; adjust
5141         all callers.
5142         (queue_initial_tasks): Call gold_fallback.
5143         * gold.h: Include cstdlib.
5144         (Exit_status): New enum type.
5145         (gold_exit): Change status parameter to enum.
5146         (gold_fallback): New function.
5147         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5148         (Layout::create_symtab_sections): Likewise.
5149         (Layout::create_shdrs): Likewise.
5150         * main.cc (main): Adjust call to gold_exit.
5151         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5152         (Output_data_got::add_got_entry_pair): Likewise.
5153         (Output_section::add_input_section): Likewise.
5154         (Output_section::add_output_section_data): Likewise.
5155         (Output_segment::set_section_list_addresses): Likewise.
5156         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5157
5158 2011-06-07  Cary Coutant  <ccoutant@google.com>
5159
5160         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5161         for incremental links.
5162         * output.cc (Output_segment::set_section_list_addresses): Remove
5163         FIXME and test for TLS or BSS.
5164
5165 2011-06-07  Cary Coutant  <ccoutant@google.com>
5166
5167         * testsuite/Makefile.am: Add incremental_copy_test,
5168         incremental_common_test_1.
5169         * testsuite/Makefile.in: Regenerate.
5170         * testsuite/common_test_1_v1.c: New source file.
5171         * testsuite/common_test_1_v2.c: New source file.
5172         * testsuite/copy_test_v1.cc: New source file.
5173
5174 2011-06-07  Cary Coutant  <ccoutant@google.com>
5175
5176         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5177         update, allocate common from bss section's free list.
5178         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5179         linker-defined symbols.
5180         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5181         Skip GOT and PLT entries that are no longer referenced.
5182         (Output_section_incremental_inputs::write_info_blocks): Mark
5183         linker-defined symbols.
5184         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5185         * output.cc (Output_section::allocate): New function.
5186         * output.h (Output_section::allocate): New function.
5187         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5188         linker-defined symbols.
5189         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5190         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5191         (Symbol::init_base_output_data): Likewise.
5192         (Symbol::init_base_output_segment): Likewise.
5193         (Symbol::init_base_constant): Likewise.
5194         (Sized_symbol::init_output_data): Likewise.
5195         (Sized_symbol::init_output_segment): Likewise.
5196         (Sized_symbol::init_constant): Likewise.
5197         (Symbol_table::do_define_in_output_data): Likewise.
5198         (Symbol_table::do_define_in_output_segment): Likewise.
5199         (Symbol_table::do_define_as_constant): Likewise.
5200         * symtab.h (Symbol::is_predefined): New function.
5201         (Symbol::init_base_output_data): Add is_predefined parameter.
5202         (Symbol::init_base_output_segment): Likewise.
5203         (Symbol::init_base_constant): Likewise.
5204         (Symbol::is_predefined_): New data member.
5205         (Sized_symbol::init_output_data): Add is_predefined parameter.
5206         (Sized_symbol::init_output_segment): Likewise.
5207         (Sized_symbol::init_constant): Likewise.
5208         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5209
5210 2011-06-07  Cary Coutant  <ccoutant@google.com>
5211
5212         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5213         instead of emit_copy_reloc.
5214         (Copy_relocs::emit_copy_reloc): Refactor.
5215         (Copy_relocs::make_copy_reloc): New function.
5216         (Copy_relocs::add_copy_reloc): Remove.
5217         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5218         section.
5219         (Copy_relocs::make_copy_reloc): New function.
5220         (Copy_relocs::add_copy_reloc): Remove.
5221         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5222         unchanged input files.
5223         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5224         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5225         Reserve BSS space for COPY relocations.
5226         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5227         (Output_section_incremental_inputs::write_info_blocks): Record
5228         whether a symbol is copied from a shared object.
5229         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5230         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5231         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5232         (Incremental_input_entry_reader::get_output_symbol_index): Add
5233         is_copy parameter.
5234         (Incremental_binary::emit_copy_relocs): New function.
5235         (Incremental_binary::do_emit_copy_relocs): New function.
5236         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5237         new data member.
5238         (Sized_incremental_binary::add_copy_reloc): New function.
5239         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5240         (Sized_incremental_binary::Copy_reloc): New struct.
5241         (Sized_incremental_binary::Copy_relocs): New typedef.
5242         (Sized_incremental_binary::copy_relocs_): New data member.
5243         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5244         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5245         * target.h (Sized_target::emit_copy_reloc): New function.
5246         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5247
5248 2011-06-02  Cary Coutant  <ccoutant@google.com>
5249
5250         PR gold/12163
5251         * gold/archive.cc (Archive::Archive): Initialize new data member.
5252         (Archive::include_all_members): Return if archive has already been
5253         included.
5254         * gold/archive.h (Archive::include_all_members_): New data member.
5255
5256 2011-06-02  Nick Clifton  <nickc@redhat.com>
5257
5258         * dynobj.h: Fix spelling mistake in comment.
5259         * output.cc: Likewise.
5260
5261 2011-05-31  Doug Kwan  <dougkwan@google.com>
5262             Asier Llano
5263
5264         PR gold/12826
5265         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5266         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5267         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5268         redundant arm_exidx_test.so.
5269         * testsuite/Makefile.in: Regenerate.
5270         (check_SCRIPTS): Add pr12826.sh
5271         (check_DATA): Add pr12826.stdout
5272         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5273         * testsuite/pr12826.sh: New file.
5274         * testsuite/pr12826_1.s: Ditto.
5275         * testsuite/pr12826_1.s: Ditto.
5276
5277 2011-05-30  Ian Lance Taylor  <iant@google.com>
5278
5279         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5280         sections.
5281
5282 2011-05-29  Ian Lance Taylor  <iant@google.com>
5283
5284         PR gold/12804
5285         * testsuite/Makefile.am: Use different file name for two_file_test
5286         temporary file for each incremental test.
5287         * testsuite/Makefile.in: Rebuild.
5288
5289 2011-05-29  Ian Lance Taylor  <iant@google.com>
5290
5291         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5292         binary input file is empty.
5293
5294 2011-05-27  Ian Lance Taylor  <iant@google.com>
5295
5296         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5297         (ver_test_9.so): Likewise.
5298         * testsuite/Makefile.in: Rebuild.
5299
5300 2011-05-26 Cary Coutant  <ccoutant@google.com>
5301
5302         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5303         * incremental.cc (Incremental_inputs::report_input_section): Fix
5304         comment, indentation.
5305         (Incremental_inputs::report_comdat_group): New function.
5306         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5307         of data for incremental input file entry.
5308         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5309         group count, COMDAT group signatures.
5310         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5311         an unchanged input file.
5312         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5313         Initialize new data member.
5314         (Incremental_object_entry::add_comdat_group): New function.
5315         (Incremental_object_entry::get_comdat_group_count): New function.
5316         (Incremental_object_entry::get_comdat_signature_key): New function.
5317         (Incremental_object_entry::groups_): New data member.
5318         (Incremental_inputs::report_comdat_group): New function.
5319         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5320         data for incremental input file entry.
5321         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5322         (Incremental_input_entry_reader::get_input_section): Adjust size of
5323         data for incremental input file entry.
5324         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5325         (Incremental_input_entry_reader::get_comdat_group_signature): New
5326         function.
5327         * object.cc (Sized_relobj::include_section_group): Report kept
5328         COMDAT groups for incremental links.
5329
5330 2011-05-24  David Meyer  <pdox@google.com>
5331
5332         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5333         with name parameter.  Add found_name parameter.
5334         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5335         * dirsearch.h (class Dirsearch): Update declaration.
5336
5337 2011-05-24  Ian Lance Taylor  <iant@google.com>
5338
5339         * archive.cc (Library_base::should_include_member): Pull in object
5340         from archive if it defines the entry symbol.
5341         * parameters.cc (Parameters::entry): New function.
5342         * parameters.h (class Parameters): Declare entry.
5343         * output.h (class Output_file_header): Remove entry_ field.
5344         * output.cc (Output_file_header::Output_file_header): Remove entry
5345         parameter.  Change all callers.
5346         (Output_file_header::entry): Use parameters->entry.
5347         * gold.cc (queue_middle_tasks): Likewise.
5348         * plugin.cc (Plugin_hook::run): Likewise.
5349
5350 2011-05-24 Cary Coutant  <ccoutant@google.com>
5351
5352         * gold.cc (queue_initial_tasks): Pass incremental base filename
5353         to Output_file::open_base_file; don't print error message.
5354         * incremental-dump.cc (main): Adjust call to
5355         Output_file::open_for_modification.
5356         * incremental-dump.cc (main): Likewise.
5357         * incremental.cc (Incremental_inputs::report_command_line):
5358         Ignore --incremental-base option when comparing command lines.
5359         Ignore parameter when given as separate argument.
5360         * options.h (class General_options): Add --incremental-base.
5361         * output.cc (Output_file::Output_file):
5362         (Output_file::open_base_file): Add base_name and writable parameters;
5363         read base file into new file; print error message here.
5364         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5365         callers.
5366         * output.h (Output_file::open_for_modification): Rename to...
5367         (Output_file::open_base_file): ...this; add base_name and
5368         writable parameters; adjust all callers.
5369         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5370         callers.
5371         * testsuite/Makefile.am (incremental_test_4): Test
5372         --incremental-base.
5373         * testsuite/Makefile.in: Regenerate.
5374
5375 2011-05-24 Cary Coutant  <ccoutant@google.com>
5376
5377         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5378         incremental_test_4.
5379         * testsuite/Makefile.in: Regenerate.
5380         * testsuite/two_file_test_1_v1.cc: New test source file.
5381         * testsuite/two_file_test_1b_v1.cc: New test source file.
5382         * testsuite/two_file_test_2_v1.cc: New test source file.
5383
5384 2011-05-24 Cary Coutant  <ccoutant@google.com>
5385
5386         * dynobj.h (Dynobj::do_dynobj): New function.
5387         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5388         flag and soname for shared objects.
5389         * incremental.cc (Incremental_inputs::report_object): Make
5390         either Incremental_object_entry or Incremental_dynobj_entry; add
5391         soname to string table.
5392         (Incremental_inputs::report_input_section): Add assertion.
5393         (Output_section_incremental_inputs::set_final_data_size): Adjust
5394         type of input file entry for shared libraries; adjust size of
5395         shared library info entry.
5396         (Output_section_incremental_inputs::write_input_files): Write
5397         as_needed flag for shared libraries.
5398         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5399         of input file entry for shared libraries; write soname.
5400         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5401         soname from incremental info.
5402         * incremental.h (enum Incremental_input_flags): Add
5403         INCREMENTAL_INPUT_AS_NEEDED.
5404         (Incremental_input_entry::Incremental_input_entry): Initialize new
5405         data member.
5406         (Incremental_input_entry::set_as_needed): New function.
5407         (Incremental_input_entry::as_needed): New function.
5408         (Incremental_input_entry::do_dynobj_entry): New function.
5409         (Incremental_input_entry::as_needed_): New data member.
5410         (Incremental_object_entry::Incremental_object_entry): Don't check
5411         for shared library.
5412         (Incremental_object_entry::do_type): Likewise.
5413         (class Incremental_dynobj_entry): New class.
5414         (Incremental_input_entry_reader::as_needed): New function.
5415         (Incremental_input_entry_reader::get_soname): New function.
5416         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5417         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5418         size of shared library info entry.
5419         * layout.cc (Layout::finish_dynamic_section): Don't test for
5420         incremental link when adding DT_NEEDED entries.
5421         * object.h (Object::Object): Initialize new data member.
5422         (Object::dynobj): New function.
5423         (Object::set_as_needed): New function.
5424         (Object::as_needed): New function.
5425         (Object::do_dynobj): New function.
5426         (Object::as_needed_): New data member.
5427
5428 2011-05-24 Cary Coutant  <ccoutant@google.com>
5429
5430         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5431         info; adjust display of GOT entries.
5432         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5433         vector of input objects; remove file_status_.
5434         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5435         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5436         got_plt reader; call target hooks to reserve GOT entries.
5437         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5438         of input file info header and GOT info entry.
5439         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5440         relocation info.
5441         (Got_plt_view_info::got_descriptor): Remove.
5442         (Got_plt_view_info::sym_index): New data member.
5443         (Got_plt_view_info::input_index): New data member.
5444         (Local_got_offset_visitor::visit): Write input file index.
5445         (Global_got_offset_visitor::visit): Write 0 for input file index.
5446         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5447         with sym_index and input_index.
5448         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5449         incremental info GOT entry; replace got_descriptor with input_index.
5450         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5451         map from input file index to object.
5452         (Sized_relobj_incr::do_layout): Replace direct data member reference
5453         with accessor function.
5454         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5455         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5456         Adjust size of input file info header.
5457         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5458         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5459         (Incremental_input_entry_reader::get_input_section): Adjust size of
5460         input file info header.
5461         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5462         of incremental info GOT entry.
5463         (Incremental_got_plt_reader::get_got_desc): Remove.
5464         (Incremental_got_plt_reader::get_got_symndx): New function.
5465         (Incremental_got_plt_reader::get_got_input_index): New function.
5466         (Sized_incremental_binary::Sized_incremental_binary): Remove
5467         file_status_; add input_objects_.
5468         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5469         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5470         (Sized_incremental_binary::file_is_unchanged): Remove.
5471         (Sized_incremental_binary::set_input_object): New function.
5472         (Sized_incremental_binary::input_object): New function.
5473         (Sized_incremental_binary::file_status_): Remove.
5474         (Sized_incremental_binary::input_objects_): New data member.
5475         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5476         references.
5477         (Sized_relobj_incr::invalid_address): Move to base class.
5478         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5479         class.
5480         (Sized_relobj_incr::do_output_section_offset): Likewise.
5481         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5482         (Sized_relobj_incr::section_offsets_): Likewise.
5483         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5484         function.
5485         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5486         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5487         with accessor function.
5488         (Sized_relobj_file::do_layout): Likewise.
5489         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5490         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5491         (Sized_relobj_file::compute_final_local_value): Replace refs to
5492         section_offsets_ with accessor function.
5493         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5494         * object.h (Relobj::Relobj): Initialize new data members.
5495         (Relobj::add_dyn_reloc): New function.
5496         (Relobj::first_dyn_reloc): New function.
5497         (Relobj::dyn_reloc_count): New function.
5498         (Relobj::first_dyn_reloc_): New data member.
5499         (Relobj::dyn_reloc_count_): New data member.
5500         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5501         references.
5502         (Sized_relobj::Address): New typedef.
5503         (Sized_relobj::invalid_address): Move here from child class.
5504         (Sized_relobj::Sized_relobj): Initialize new data members.
5505         (Sized_relobj::sized_relobj): New function.
5506         (Sized_relobj::is_output_section_offset_invalid): Move here from
5507         child class.
5508         (Sized_relobj::get_output_section_offset): Likewise.
5509         (Sized_relobj::local_has_got_offset): Likewise.
5510         (Sized_relobj::local_got_offset): Likewise.
5511         (Sized_relobj::set_local_got_offset): Likewise.
5512         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5513         (Sized_relobj::clear_got_offsets): New function.
5514         (Sized_relobj::section_offsets): Move here from child class.
5515         (Sized_relobj::do_output_section_offset): Likewise.
5516         (Sized_relobj::do_set_section_offset): Likewise.
5517         (Sized_relobj::Local_got_offsets): Likewise.
5518         (Sized_relobj::local_got_offsets_): Likewise.
5519         (Sized_relobj::section_offsets_): Likewise.
5520         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5521         references.
5522         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5523         class.
5524         (Sized_relobj_file::sized_relobj): New function
5525         (Sized_relobj_file::local_has_got_offset): Move to base class.
5526         (Sized_relobj_file::local_got_offset): Likewise.
5527         (Sized_relobj_file::set_local_got_offset): Likewise.
5528         (Sized_relobj_file::get_output_section_offset): Likewise.
5529         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5530         (Sized_relobj_file::do_output_section_offset): Likewise.
5531         (Sized_relobj_file::do_set_section_offset): Likewise.
5532         (Sized_relobj_file::Local_got_offsets): Likewise.
5533         (Sized_relobj_file::local_got_offsets_): Likewise.
5534         (Sized_relobj_file::section_offsets_): Likewise.
5535         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5536         (all constructors).
5537         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5538         (Output_reloc::get_symbol_index): Likewise.
5539         (Output_reloc::local_section_offset): Likewise.
5540         (Output_reloc::get_address): Likewise.
5541         (Output_reloc::symbol_value): Likewise.
5542         (Output_data_got::reserve_slot): Move to class definition.
5543         (Output_data_got::reserve_local): New function.
5544         (Output_data_got::reserve_slot_for_global): Remove.
5545         (Output_data_got::reserve_global): New function.
5546         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5547         (all constructors, two instantiations).
5548         (Output_reloc::get_relobj): New function (two instantiations).
5549         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5550         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5551         (Output_data_reloc::add_global): Adjust type of relobj.
5552         (Output_data_reloc::add_global_relative): Likewise.
5553         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5554         (Output_data_reloc::add_local): Likewise.
5555         (Output_data_reloc::add_local_relative): Likewise.
5556         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5557         (Output_data_reloc::add_local_section): Likewise.
5558         (Output_data_reloc::add_output_section): Likewise.
5559         (Output_data_reloc::add_absolute): Likewise.
5560         (Output_data_reloc::add_target_specific): Likewise.
5561         (Output_data_got::reserve_slot): Move definition here.
5562         (Output_data_got::reserve_local): New function.
5563         (Output_data_got::reserve_global): New function.
5564         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5565         section_offsets_ with accessor function.
5566         (Sized_relobj_file::write_sections): Likewise.
5567         (Sized_relobj_file::do_relocate_sections): Likewise.
5568         * target.h (Sized_target::reserve_local_got_entry): New function.
5569         (Sized_target::reserve_global_got_entry): New function.
5570         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5571         (Target_x86_64::reserve_global_got_entry): New function.
5572         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5573
5574 2011-05-23 Cary Coutant  <ccoutant@google.com>
5575
5576         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5577         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5578         bit when checking got_type.
5579         * incremental.cc (Sized_incremental_binary::setup_readers):
5580         Store symbol table and string table locations; initialize bit vector
5581         of file status flags.
5582         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5583         unchanged files.
5584         (Sized_incremental_binary::do_process_got_plt): New function.
5585         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5586         (Output_section_incremental_inputs::set_final_data_size): Record
5587         file index for each input file.
5588         (Output_section_incremental_inputs::write_got_plt): Store file index
5589         instead of input entry offset for each GOT entry.
5590         * incremental.h
5591         (Incremental_input_entry::Incremental_input_entry): Initialize new
5592         data member.
5593         (Incremental_input_entry::set_offset): Store file index.
5594         (Incremental_input_entry::get_file_index): New function.
5595         (Incremental_input_entry::file_index_): New data member.
5596         (Incremental_binary::process_got_plt): New function.
5597         (Incremental_binary::do_process_got_plt): New function.
5598         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5599         data members.
5600         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5601         (Sized_incremental_binary::set_file_is_unchanged): New function.
5602         (Sized_incremental_binary::file_is_unchanged): New function.
5603         (Sized_incremental_binary::do_process_got_plt): New function.
5604         (Sized_incremental_binary::file_status_): New data member.
5605         (Sized_incremental_binary::main_symtab_loc_): New data member.
5606         (Sized_incremental_binary::main_strtab_loc_): New data member.
5607         * output.cc (Output_data_got::Got_entry::write): Add case
5608         RESERVED_CODE.
5609         (Output_data_got::add_global): Call add_got_entry.
5610         (Output_data_got::add_global_plt): Likewise.
5611         (Output_data_got::add_global_with_rel): Likewise.
5612         (Output_data_got::add_global_with_rela): Likewise.
5613         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5614         (Output_data_got::add_global_pair_with_rela): Likewise.
5615         (Output_data_got::add_local): Call add_got_entry.
5616         (Output_data_got::add_local_plt): Likewise.
5617         (Output_data_got::add_local_with_rel): Likewise.
5618         (Output_data_got::add_local_with_rela): Likewise.
5619         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5620         (Output_data_got::add_local_pair_with_rela): Likewise.
5621         (Output_data_got::reserve_slot): New function.
5622         (Output_data_got::reserve_slot_for_global): New function.
5623         (Output_data_got::add_got_entry): New function.
5624         (Output_data_got::add_got_entry_pair): New function.
5625         (Output_section::add_output_section_data): Edit FIXME.
5626         * output.h
5627         (Output_section_data_build::Output_section_data_build): New
5628         constructor with size parameter.
5629         (Output_data_space::Output_data_space): Likewise.
5630         (Output_data_got::Output_data_got): Initialize new data member; new
5631         constructor with size parameter.
5632         (Output_data_got::add_constant): Call add_got_entry.
5633         (Output_data_got::reserve_slot): New function.
5634         (Output_data_got::reserve_slot_for_global): New function.
5635         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5636         (Output_data_got::add_got_entry): New function.
5637         (Output_data_got::add_got_entry_pair): New function.
5638         (Output_data_got::free_list_): New data member.
5639         * target.h (Sized_target::init_got_plt_for_update): New function.
5640         (Sized_target::register_global_plt_entry): New function.
5641         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5642         Initialize new data member; call init; add constructor with PLT count.
5643         (Output_data_plt_x86_64::init): New function.
5644         (Output_data_plt_x86_64::add_relocation): New function.
5645         (Output_data_plt_x86_64::reserve_slot): New function.
5646         (Output_data_plt_x86_64::free_list_): New data member.
5647         (Target_x86_64::init_got_plt_for_update): New function.
5648         (Target_x86_64::register_global_plt_entry): New function.
5649         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5650         incremental updates.
5651         (Output_data_plt_x86_64::add_relocation): New function.
5652         * testsuite/object_unittest.cc (Object_test): Set default options.
5653
5654 2011-05-16  Ian Lance Taylor  <iant@google.com>
5655
5656         * options.h (class General_options): Make -i a synonym for -r.
5657
5658 2011-05-16  Ian Lance Taylor  <iant@google.com>
5659
5660         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5661
5662 2011-05-10 Cary Coutant  <ccoutant@google.com>
5663
5664         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5665         strip_all (-s).
5666
5667 2011-05-06  Ian Lance Taylor  <iant@google.com>
5668
5669         * layout.cc (Layout::layout): If the output section flags change,
5670         update the ordering.
5671
5672 2011-04-25 Cary Coutant  <ccoutant@google.com>
5673
5674         * incremental-dump.cc (dump_incremental_inputs): Print local
5675         symbol info for each input file.
5676         * incremental.cc
5677         (Output_section_incremental_inputs::set_final_data_size): Add local
5678         symbol info to input file entries in incremental info.
5679         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5680         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5681         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5682         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5683         implementation.
5684         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5685         (Sized_incr_relobj::do_relocate): Write the local symbols.
5686         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5687         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5688         Adjust size of input file header.
5689         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5690         (Incremental_inputs_reader::get_local_symbol_count): New function.
5691         (Incremental_inputs_reader::get_input_section): Adjust size of input
5692         file header.
5693         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5694         (Sized_incr_relobj::This): New typedef.
5695         (Sized_incr_relobj::sym_size): New const data member.
5696         (Sized_incr_relobj::Local_symbol): New struct.
5697         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5698         (Sized_incr_relobj::do_local_symbol_offset): New function.
5699         (Sized_incr_relobj::local_symbol_count_): New data member.
5700         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5701         (Sized_incr_relobj::local_symbol_index_): New data member.
5702         (Sized_incr_relobj::local_symbol_offset_): New data member.
5703         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5704         (Sized_incr_relobj::local_symbols_): New data member.
5705         * object.h (Relobj::output_local_symbol_count): New function.
5706         (Relobj::local_symbol_offset): New function.
5707         (Relobj::do_output_local_symbol_count): New function.
5708         (Relobj::do_local_symbol_offset): New function.
5709         (Sized_relobj::do_output_local_symbol_count): New function.
5710         (Sized_relobj::do_local_symbol_offset): New function.
5711
5712 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5713
5714         * descriptors.cc (set_close_on_exec): New function.
5715         (Descriptors::open): Use set_close_on_exec.
5716         * output.cc (S_ISLNK): Define if not defined.
5717
5718 2011-04-22 Cary Coutant  <ccoutant@google.com>
5719
5720         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5721         global symbol map.
5722         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5723         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5724         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5725         relocations.
5726         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5727         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5728         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5729         * incremental.h
5730         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5731         function.
5732         (Incremental_binary::apply_incremental_relocs): New function.
5733         (Incremental_binary::do_apply_incremental_relocs): New function.
5734         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5735         data member.
5736         (Sized_incremental_binary::add_global_symbol): New function.
5737         (Sized_incremental_binary::global_symbol): New function.
5738         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5739         (Sized_incremental_binary::symbol_map_): New data member.
5740         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5741         * target.h (Sized_target::apply_relocation): New function.
5742         * target-reloc.h (apply_relocation): New function.
5743         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5744
5745 2011-04-22  Doug Kwan  <dougkwan@google.com>
5746
5747         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5748         flag of a SHT_ARM_EXIDX section.
5749         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5750         * testsuite/Makefile.in: Regenerate.
5751         * testsuite/arm_exidx_test.s: New file.
5752         * testsuite/arm_exidx_test.sh: Same.
5753
5754 2011-04-20 Cary Coutant  <ccoutant@google.com>
5755
5756         PR gold/12689
5757         * archive.h (Incremental_archive_entry::Archive_member):
5758         Initialize arg_serial_ (second constructor).
5759
5760 2011-04-17  Ian Lance Taylor  <iant@google.com>
5761
5762         * object.cc (Relocate_info::location): Simplify location string.
5763         * errors.cc (Errors::error_at_location): Don't print program
5764         name.
5765         (Errors::warning_at_location): Likewise.
5766         (Errors::undefined_symbol): Likewise.
5767         * testsuite/debug_msg.sh: Update accordingly.
5768
5769 2011-04-14 Cary Coutant  <ccoutant@google.com>
5770
5771         * gold/layout.cc (Layout::symtab_section_offset): New function.
5772         * gold/layout.h (Layout::symtab_section_offset): New function.
5773         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5774
5775 2011-04-12  Ian Lance Taylor  <iant@google.com>
5776
5777         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5778         with MREMAP_MAYMOVE.
5779         * output.h (class Output_file): Add map_is_allocated_ field.
5780         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5781         not available, provide stubs.  If mremap is not available, #define
5782         it to gold_mremap.
5783         (MREMAP_MAYMOVE): Define if not defined.
5784         (Output_file::Output_file): Initialize map_is_allocated_.
5785         (Output_file::resize): Check map_is_allocated_.
5786         (Output_file::map_anonymous): If mmap fails, use malloc.
5787         (Output_file::unmap): Don't do anything for an anonymous map.
5788         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5789         is not available, provide stubs.
5790         (File_read::View::~View): Use free rather than delete[].
5791         (File_read::make_view): Use malloc rather than new[].  If mmap
5792         fails, use malloc.
5793         (File_read::find_or_make_view): Use malloc rather than new[].
5794         * gold.h: Remove HAVE_REMAP code.
5795         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5796         exists.  Rename mremap to gold_mremap.  If mmap is not available
5797         don't do anything.
5798         * configure, config.in: Rebuild.
5799
5800 2011-04-11  Ian Lance Taylor  <iant@google.com>
5801
5802         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5803         initialize local variable v.
5804
5805 2011-04-11  Cary Coutant  <ccoutant@google.com>
5806
5807         * archive.cc (Archive::include_member): Adjust call to
5808         report_object.
5809         (Add_archive_symbols::run): Track argument serial numbers.
5810         (Lib_group::include_member): Likewise.
5811         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5812         * archive.h (Incremental_archive_entry::Archive_member):
5813         Initialize arg_serial_.
5814         (Archive_member::arg_serial_): New data member.
5815         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5816         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5817         incremental link.
5818         (Sized_dynobj::do_for_all_local_got_entries): New function.
5819         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5820         function.
5821         * fileread.cc (get_mtime): New function.
5822         * fileread.h (get_mtime): New function.
5823         * gold.cc (queue_initial_tasks): Check for incremental update.
5824         (process_incremental_input): New function.
5825         (queue_middle_tasks): Don't force valid target for incremental
5826         update.
5827         * incremental-dump.cc (find_input_containing_global): Adjust
5828         size of symbol info entry.
5829         (dump_incremental_inputs): Dump argument serial number and
5830         in_system_directory flag; bias shndx by 1; print symbol names
5831         when dumping per-file symbol lists; use new symbol info readers.
5832         * incremental.cc
5833         (Output_section_incremental_inputs:update_data_size): New function.
5834         (Sized_incremental_binary::setup_readers): Setup input readers
5835         for each input file; build maps for files added from libraries
5836         and scripts.
5837         (Sized_incremental_binary::check_input_args): New function.
5838         (Sized_incremental_binary::do_check_inputs): Build map of argument
5839         serial numbers to input arguments.
5840         (Sized_incremental_binary::do_file_has_changed): Rename
5841         do_file_is_unchanged to this; compare file modification times.
5842         (Sized_incremental_binary::do_init_layout): New function.
5843         (Sized_incremental_binary::do_reserve_layout): New function.
5844         (Sized_incremental_binary::do_get_input_reader): Remove.
5845         (Sized_incremental_binary::get_symtab_view): New function.
5846         (Incremental_checker::can_incrementally_link_output_file): Remove.
5847         (Incremental_inputs::report_command_line): Exclude --debug options.
5848         (Incremental_inputs::report_archive_begin): Add parameter; track
5849         argument serial numbers; don't put input file entry for archive
5850         before archive members.
5851         (Incremental_inputs::report_archive_end): Put input file entry
5852         for archive after archive members.
5853         (Incremental_inputs::report_object): Add parameter; track argument
5854         serial numbers and in_system_directory flag.
5855         (Incremental_inputs::report_script): Add parameter; track argument
5856         serial numbers.
5857         (Output_section_incremental_inputs::set_final_data_size): Adjust
5858         size of symbol info entry; check for forwarding symbols.
5859         (Output_section_incremental_inputs::write_input_files): Write
5860         in_system_directory flag and argument serial number.
5861         (Output_section_incremental_inputs::write_info_blocks): Map section
5862         indices between incremental info and original input file; store
5863         input section index for each symbol.
5864         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5865         change operator() to visit().
5866         (class Global_got_offset_visitor): Likewise.
5867         (class Global_symbol_visitor_got_plt):
5868         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5869         classes.
5870         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5871         (Sized_incr_relobj::do_read_symbols): New function.
5872         (Sized_incr_relobj::do_layout): New function.
5873         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5874         (Sized_incr_relobj::do_add_symbols): New function.
5875         (Sized_incr_relobj::do_should_include_member): New function.
5876         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5877         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5878         (Sized_incr_relobj::do_section_size): New function.
5879         (Sized_incr_relobj::do_section_name): New function.
5880         (Sized_incr_relobj::do_section_contents): New function.
5881         (Sized_incr_relobj::do_section_flags): New function.
5882         (Sized_incr_relobj::do_section_entsize): New function.
5883         (Sized_incr_relobj::do_section_address): New function.
5884         (Sized_incr_relobj::do_section_type): New function.
5885         (Sized_incr_relobj::do_section_link): New function.
5886         (Sized_incr_relobj::do_section_info): New function.
5887         (Sized_incr_relobj::do_section_addralign): New function.
5888         (Sized_incr_relobj::do_initialize_xindex): New function.
5889         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5890         (Sized_incr_relobj::do_read_relocs): New function.
5891         (Sized_incr_relobj::do_gc_process_relocs): New function.
5892         (Sized_incr_relobj::do_scan_relocs): New function.
5893         (Sized_incr_relobj::do_count_local_symbols): New function.
5894         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5895         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5896         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5897         (Sized_incr_relobj::do_relocate): New function.
5898         (Sized_incr_relobj::do_set_section_offset): New function.
5899         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5900         (Sized_incr_dynobj::do_read_symbols): New function.
5901         (Sized_incr_dynobj::do_layout): New function.
5902         (Sized_incr_dynobj::do_add_symbols): New function.
5903         (Sized_incr_dynobj::do_should_include_member): New function.
5904         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5905         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5906         (Sized_incr_dynobj::do_section_size): New function.
5907         (Sized_incr_dynobj::do_section_name): New function.
5908         (Sized_incr_dynobj::do_section_contents): New function.
5909         (Sized_incr_dynobj::do_section_flags): New function.
5910         (Sized_incr_dynobj::do_section_entsize): New function.
5911         (Sized_incr_dynobj::do_section_address): New function.
5912         (Sized_incr_dynobj::do_section_type): New function.
5913         (Sized_incr_dynobj::do_section_link): New function.
5914         (Sized_incr_dynobj::do_section_info): New function.
5915         (Sized_incr_dynobj::do_section_addralign): New function.
5916         (Sized_incr_dynobj::do_initialize_xindex): New function.
5917         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5918         (make_sized_incremental_object): New function.
5919         (Incremental_library::copy_unused_symbols): New function.
5920         (Incremental_library::do_for_all_unused_symbols): New function.
5921         * incremental.h (enum Incremental_input_flags): New type.
5922         (class Incremental_checker): Remove.
5923         (Incremental_input_entry::Incremental_input_entry): Add argument
5924         serial number.
5925         (Incremental_input_entry::arg_serial): New function.
5926         (Incremental_input_entry::set_is_in_system_directory): New function.
5927         (Incremental_input_entry::is_in_system_directory): New function.
5928         (Incremental_input_entry::arg_serial_): New data member.
5929         (Incremental_input_entry::is_in_system_directory_): New data member.
5930         (class Script_info): Move here from script.h.
5931         (Script_info::Script_info): Add filename parameter.
5932         (Script_info::filename): New function.
5933         (Script_info::filename_): New data member.
5934         (Incremental_script_entry::Incremental_script_entry): Add argument
5935         serial number.
5936         (Incremental_object_entry::Incremental_object_entry): Likewise.
5937         (Incremental_object_entry::add_input_section): Build list of input
5938         sections with map to original shndx.
5939         (Incremental_object_entry::get_input_section_index): New function.
5940         (Incremental_object_entry::shndx_): New data member.
5941         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5942         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5943         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5944         serial number.
5945         (Incremental_inputs::report_archive_begin): Likewise.
5946         (Incremental_inputs::report_object): Likewise.
5947         (Incremental_inputs::report_script): Likewise.
5948         (class Incremental_global_symbol_reader): New class.
5949         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5950         and store flags and input file type.
5951         (Incremental_input_entry_reader::arg_serial): New function.
5952         (Incremental_input_entry_reader::type): Extract type from flags.
5953         (Incremental_input_entry_reader::is_in_system_directory): New function.
5954         (Incremental_input_entry_reader::get_input_section_count): Call
5955         accessor function for type.
5956         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5957         function for type; adjust size of global symbol entry.
5958         (Incremental_input_entry_reader::get_global_symbol_count): Call
5959         accessor function for type.
5960         (Incremental_input_entry_reader::get_object_count): Likewise.
5961         (Incremental_input_entry_reader::get_object_offset): Likewise.
5962         (Incremental_input_entry_reader::get_member_count): Likewise.
5963         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5964         (Incremental_input_entry_reader::get_member_offset): Likewise.
5965         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5966         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5967         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5968         (Incremental_input_entry_reader::get_global_symbol_reader): New
5969         function.
5970         (Incremental_input_entry_reader::get_output_symbol_index): New
5971         function.
5972         (Incremental_input_entry_reader::type_): Remove.
5973         (Incremental_input_entry_reader::flags_): New data member.
5974         (Incremental_inputs_reader::input_file_offset): New function.
5975         (Incremental_inputs_reader::input_file_index): New function.
5976         (Incremental_inputs_reader::input_file): Call input_file_offset.
5977         (Incremental_inputs_reader::input_file_at_offset): New function.
5978         (Incremental_relocs_reader::get_r_type): Reformat.
5979         (Incremental_relocs_reader::get_r_shndx): Reformat.
5980         (Incremental_relocs_reader::get_r_offset): Reformat.
5981         (Incremental_relocs_reader::data): New function.
5982         (Incremental_binary::Incremental_binary): Initialize new data members.
5983         (Incremental_binary::check_inputs): Add cmdline parameter.
5984         (Incremental_binary::file_is_unchanged): Remove.
5985         (Input_reader::arg_serial): New function.
5986         (Input_reader::get_unused_symbol_count): New function.
5987         (Input_reader::get_unused_symbol): New function.
5988         (Input_reader::do_arg_serial): New function.
5989         (Input_reader::do_get_unused_symbol_count): New function.
5990         (Input_reader::do_get_unused_symbol): New function.
5991         (Incremental_binary::input_file_count): New function.
5992         (Incremental_binary::get_input_reader): Change signature to use
5993         index instead of filename.
5994         (Incremental_binary::file_has_changed): New function.
5995         (Incremental_binary::get_input_argument): New function.
5996         (Incremental_binary::get_library): New function.
5997         (Incremental_binary::get_script_info): New function.
5998         (Incremental_binary::init_layout): New function.
5999         (Incremental_binary::reserve_layout): New function.
6000         (Incremental_binary::output_file): New function.
6001         (Incremental_binary::do_check_inputs): New function.
6002         (Incremental_binary::do_file_is_unchanged): Remove.
6003         (Incremental_binary::do_file_has_changed): New function.
6004         (Incremental_binary::do_init_layout): New function.
6005         (Incremental_binary::do_reserve_layout): New function.
6006         (Incremental_binary::do_input_file_count): New function.
6007         (Incremental_binary::do_get_input_reader): Change signature.
6008         (Incremental_binary::input_args_map_): New data member.
6009         (Incremental_binary::library_map_): New data member.
6010         (Incremental_binary::script_map_): New data member.
6011         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6012         new data members.
6013         (Sized_incremental_binary::output_section): New function.
6014         (Sized_incremental_binary::inputs_reader): Add const.
6015         (Sized_incremental_binary::symtab_reader): Add const.
6016         (Sized_incremental_binary::relocs_reader): Add const.
6017         (Sized_incremental_binary::got_plt_reader): Add const.
6018         (Sized_incremental_binary::get_symtab_view): New function.
6019         (Sized_incremental_binary::Inputs_reader): New typedef.
6020         (Sized_incremental_binary::Input_entry_reader): New typedef.
6021         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
6022         (Sized_incremental_binary::do_file_is_unchanged): Remove.
6023         (Sized_incremental_binary::do_file_has_changed): New function.
6024         (Sized_incremental_binary::do_init_layout): New function.
6025         (Sized_incremental_binary::do_reserve_layout): New function.
6026         (Sized_input_reader::Inputs_reader): Remove.
6027         (Sized_input_reader::Input_entry_reader): Remove.
6028         (Sized_input_reader::do_arg_serial): New function.
6029         (Sized_input_reader::do_get_unused_symbol_count): New function.
6030         (Sized_input_reader::do_get_unused_symbol): New function.
6031         (Sized_incremental_binary::do_input_file_count): New function.
6032         (Sized_incremental_binary::do_get_input_reader): Change signature;
6033         use index instead of filename.
6034         (Sized_incremental_binary::section_map_): New data member.
6035         (Sized_incremental_binary::input_entry_readers_): New data member.
6036         (class Sized_incr_relobj): New class.
6037         (class Sized_incr_dynobj): New class.
6038         (make_sized_incremental_object): New function.
6039         (class Incremental_library): New class.
6040         * layout.cc (Free_list::num_lists): New static data member.
6041         (Free_list::num_nodes): New static data member.
6042         (Free_list::num_removes): New static data member.
6043         (Free_list::num_remove_visits): New static data member.
6044         (Free_list::num_allocates): New static data member.
6045         (Free_list::num_allocate_visits): New static data member.
6046         (Free_list::init): New function.
6047         (Free_list::remove): New function.
6048         (Free_list::allocate): New function.
6049         (Free_list::dump): New function.
6050         (Free_list::print_stats): New function.
6051         (Layout_task_runner::run): Resize output file for incremental updates.
6052         (Layout::Layout): Initialize new data members.
6053         (Layout::set_incremental_base): New function.
6054         (Layout::init_fixed_output_section): New function.
6055         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
6056         incremental updates.
6057         (Layout::create_gold_note): Do not create gold note section for
6058         incremental updates.
6059         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
6060         for incremental updates.
6061         (Layout::set_section_offsets): For incremental updates, allocate space
6062         from free list.
6063         (Layout::create_symtab_sections): Layout with offsets relative to
6064         start of section; for incremental updates, allocate space from free
6065         list.
6066         (Layout::create_shdrs): For incremental updates, allocate space from
6067         free list.
6068         (Layout::finish_dynamic_section): For incremental updates, do not
6069         check --as-needed (fixed in subsequent patch).
6070         * layout.h (class Free_list): New class.
6071         (Layout::set_incremental_base): New function.
6072         (Layout::incremental_base): New function.
6073         (Layout::init_fixed_output_section): New function.
6074         (Layout::allocate): New function.
6075         (Layout::incremental_base_): New data member.
6076         (Layout::free_list_): New data member.
6077         * main.cc (main): Print Free_list statistics.
6078         * object.cc (Relobj::finalize_incremental_relocs): Add
6079         clear_counts parameter; clear counts only when clear_counts is set.
6080         (Sized_relobj::Sized_relobj): Initialize new base class.
6081         (Sized_relobj::do_layout): Don't report special sections.
6082         (Sized_relobj::do_for_all_local_got_entries): New function.
6083         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6084         symtab_off to all symbol table offsets.
6085         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6086         * object.h (class Got_offset_list): Move to top of file.
6087         (Object::Object): Allow case where input_file == NULL.
6088         (Object::~Object): Likewise.
6089         (Object::input_file): Assert that input_file != NULL.
6090         (Object::lock): Allow case where input_file == NULL.
6091         (Object::unlock): Likewise.
6092         (Object::is_locked): Likewise.
6093         (Object::token): Likewise.
6094         (Object::release): Likewise.
6095         (Object::is_incremental): New function.
6096         (Object::get_mtime): New function.
6097         (Object::for_all_local_got_entries): New function.
6098         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6099         (Object::set_is_in_system_directory): New function.
6100         (Object::is_in_system_directory): New function.
6101         (Object::do_is_incremental): New function.
6102         (Object::do_get_mtime): New function.
6103         (Object::do_for_all_local_got_entries): New function.
6104         (Object::is_in_system_directory_): New data member.
6105         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6106         (class Sized_relobj_base): New class.
6107         (class Sized_relobj): Derive from Sized_relobj_base.
6108         (class Sized_relobj::Symbols): Redeclare from base class.
6109         (class Sized_relobj::local_got_offset_list): Remove.
6110         (class Sized_relobj::Output_sections): Redeclare from base class.
6111         (class Sized_relobj::do_for_all_local_got_entries): New function.
6112         (class Sized_relobj::write_local_symbols): Add offset parameter.
6113         (class Sized_relobj::local_symbol_offset_): Update comment.
6114         (class Sized_relobj::local_dynsym_offset_): Update comment.
6115         * options.cc (Input_arguments::add_file): Remove const.
6116         * options.h (Input_file_argument::Input_file_argument):
6117         Initialize arg_serial_ (all constructors).
6118         (Input_file_argument::set_arg_serial): New function.
6119         (Input_file_argument::arg_serial): New function.
6120         (Input_file_argument::arg_serial_): New data member.
6121         (Input_arguments::Input_arguments): Initialize file_count_.
6122         (Input_arguments::add_file): Remove const.
6123         (Input_arguments::number_of_input_files): New function.
6124         (Input_arguments::file_count_): New data member.
6125         (Command_line::number_of_input_files): Call
6126         Input_arguments::number_of_input_files.
6127         * output.cc (Output_segment_headers::Output_segment_headers):
6128         Set current size.
6129         (Output_section::Input_section::current_data_size): New function.
6130         (Output_section::Output_section): Initialize new data members.
6131         (Output_section::add_input_section): Don't do merge sections for
6132         an incremental link; allocate space from free list for an
6133         incremental update.
6134         (Output_section::add_output_section_data): Allocate space from
6135         free list for an incremental update.
6136         (Output_section::update_data_size): New function.
6137         (Output_section::set_fixed_layout): New function.
6138         (Output_section::reserve): New function.
6139         (Output_segment::set_section_addresses): Remove const.
6140         (Output_segment::set_section_list_addresses): Remove const; allocate
6141         space from free list for an incremental update.
6142         (Output_segment::set_offset): Adjust size of RELRO segment for an
6143         incremental update.
6144         * output.h (Output_data::current_data_size): Move here from
6145         child classes.
6146         (Output_data::pre_finalize_data_size): New function.
6147         (Output_data::update_data_size): New function.
6148         (Output_section_headers::update_data_size): new function.
6149         (Output_section_data_build::current_data_size): Move to Output_data.
6150         (Output_data_strtab::update_data_size): New function.
6151         (Output_section::current_data_size): Move to Output_data.
6152         (Output_section::set_fixed_layout): New function.
6153         (Output_section::has_fixed_layout): New function.
6154         (Output_section::reserve): New function.
6155         (Output_section::update_data_size): New function.
6156         (Output_section::has_fixed_layout_): New data member.
6157         (Output_section::free_list_): New data member.
6158         (Output_segment::set_section_addresses): Remove const.
6159         (Output_segment::set_section_list_addresses): Remove const.
6160         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6161         New function.
6162         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6163         New function.
6164         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6165         parameter when calling Add_symbols constructor; store argument
6166         serial number for members of a lib group.
6167         (Add_symbols::locks): Allow case where token == NULL.
6168         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6169         (Read_member::~Read_member): New function.
6170         (Read_member::is_runnable): New function.
6171         (Read_member::locks): New function.
6172         (Read_member::run): New function.
6173         (Check_script::~Check_script): New function.
6174         (Check_script::is_runnable): New function.
6175         (Check_script::locks): New function.
6176         (Check_script::run): New function.
6177         (Check_library::~Check_library): New function.
6178         (Check_library::is_runnable): New function.
6179         (Check_library::locks): New function.
6180         (Check_library::run): New function.
6181         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6182         (Add_symbols::library_): New data member.
6183         (class Read_member): New class.
6184         (class Check_script): New class.
6185         (class Check_library): New class.
6186         * reloc.cc (Read_relocs::is_runnable): Allow case where
6187         token == NULL.
6188         (Read_relocs::locks): Likewise.
6189         (Scan_relocs::locks): Likewise.
6190         (Relocate_task::locks): Likewise.
6191         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6192         to clear counters.
6193         (Sized_relobj::incremental_relocs_scan): Fix comment.
6194         (Sized_relobj::do_relocate): Pass output file offset to
6195         write_local_symbols.
6196         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6197         from class declaration.
6198         * script.cc (read_input_script): Allocate Script_info; pass
6199         argument serial number to report_script.
6200         * script.h (class Script_info): Move to incremental.h.
6201         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6202         * symtab.h (Symbol_table::add_from_incrobj): New function.
6203         (Symbol_table::set_file_offset): New function.
6204
6205 2011-04-05  Cary Coutant  <ccoutant@google.com>
6206
6207         * incremental-dump.cc (dump_incremental_inputs): Change signature
6208         to take a Sized_incremental_binary; change caller.  Use readers
6209         in Sized_incremental_binary.
6210         * incremental.cc
6211         (Sized_incremental_binary::find_incremental_inputs_sections):
6212         Rename do_find_incremental_inputs_sections to this.
6213         (Sized_incremental_binary::setup_readers): New function.
6214         (Sized_incremental_binary::do_check_inputs): Check
6215         has_incremental_info_ flag; move setup code to setup_readers;
6216         use input readers.
6217         (Sized_incremental_binary::do_file_is_unchanged): New function.
6218         (Sized_incremental_binary::do_get_input_reader): New function.
6219         * incremental.h (class Incremental_binary): Move to end of file.
6220         (Incremental_binary::file_is_unchanged): New function.
6221         (Incremental_binary::do_file_is_unchanged): New function.
6222         (Incremental_binary::Input_reader): New class.
6223         (Incremental_binary::get_input_reader): New function.
6224         (class Sized_incremental_binary): Move to end of file.
6225         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6226         input section reader classes.
6227         (Sized_incremental_binary::has_incremental_info): New function.
6228         (Sized_incremental_binary::inputs_reader): New function.
6229         (Sized_incremental_binary::symtab_reader): New function.
6230         (Sized_incremental_binary::relocs_reader): New function.
6231         (Sized_incremental_binary::got_plt_reader): New function.
6232         (Sized_incremental_binary::do_file_is_unchanged): New function.
6233         (Sized_incremental_binary::Sized_input_reader): New class.
6234         (Sized_incremental_binary::get_input_reader): New function.
6235         (Sized_incremental_binary::find_incremental_inputs_sections):
6236         Rename do_find_incremental_inputs_sections to this.
6237         (Sized_incremental_binary::setup_readers): New function.
6238         (Sized_incremental_binary::has_incremental_info_): New data member.
6239         (Sized_incremental_binary::inputs_reader_): New data member.
6240         (Sized_incremental_binary::symtab_reader_): New data member.
6241         (Sized_incremental_binary::relocs_reader_): New data member.
6242         (Sized_incremental_binary::got_plt_reader_): New data member.
6243         (Sized_incremental_binary::current_input_file_): New data member.
6244
6245 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6246
6247         PR gold/12640
6248         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6249         violation.
6250
6251 2011-03-30  Cary Coutant  <ccoutant@google.com>
6252
6253         * archive.cc (Archive::include_member): Adjust call to report_object.
6254         (Add_archive_symbols::run): Add script_info to call to
6255         report_archive_begin.
6256         (Lib_group::include_member): Adjust call to report_object.
6257         (Add_lib_group_symbols::run): Adjust call to report_object.
6258         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6259         blocks.  Add object count for script input files.
6260         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6261         script_info parameter; change all callers.
6262         (Incremental_inputs::report_object): Add script_info parameter;
6263         change all callers.
6264         (Incremental_inputs::report_script): Store backpointer to
6265         incremental info entry.
6266         (Output_section_incremental_inputs::set_final_data_size): Record
6267         additional information for scripts.
6268         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6269         * incremental.h (Incremental_script_entry::add_object): New function.
6270         (Incremental_script_entry::get_object_count): New function.
6271         (Incremental_script_entry::get_object): New function.
6272         (Incremental_script_entry::objects_): New data member; adjust
6273         constructor.
6274         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6275         (Incremental_inputs::report_object): Add script_info parameter.
6276         (Incremental_inputs_reader::get_object_count): New function.
6277         (Incremental_inputs_reader::get_object_offset): New function.
6278         * options.cc (Input_arguments::add_file): Return reference to
6279         new input argument.
6280         * options.h (Input_argument::set_script_info): New function.
6281         (Input_argument::script_info): New function.
6282         (Input_argument::script_info_): New data member; adjust all
6283         constructors.
6284         (Input_file_group::add_file): Return reference to new input argument.
6285         (Input_file_lib::add_file): Likewise.
6286         (Input_arguments::add_file): Likewise.
6287         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6288         * script.cc (Parser_closure::Parser_closure): Add script_info
6289         parameter; adjust all callers.
6290         (Parser_closure::script_info): New function.
6291         (Parser_closure::script_info_): New data member.
6292         (read_input_script): Report scripts earlier to incremental info.
6293         (script_add_file): Set script_info in Input_argument.
6294         (script_add_library): Likewise.
6295         * script.h (Script_options::Script_info): Rewrite class.
6296
6297 2011-03-29  Cary Coutant  <ccoutant@google.com>
6298
6299         * archive.cc (Library_base::should_include_member): Move
6300         method here from class Archive.
6301         (Archive::Archive): Initialize base class.
6302         (Archive::should_include_member): Move to base class.
6303         (Archive::do_for_all_unused_symbols): New function.
6304         (Add_archive_symbols::run): Remove redundant access to
6305         incremental_inputs.
6306         (Lib_group::Lib_group): Initialize base class.
6307         (Lib_group::do_filename): New function.
6308         (Lib_group::include_member): Pass pointer to Lib_group to
6309         report_object.
6310         (Lib_group::do_for_all_unused_symbols): New function.
6311         (Add_lib_group_symbols::run): Report archive information for
6312         incremental links.
6313         * archive.h (class Library_base): New base class.
6314         (class Archive): Derive from Library_base.
6315         (Archive::filename): Move to base class.
6316         (Archive::set_incremental_info): Likewise.
6317         (Archive::incremental_info): Likewise.
6318         (Archive::Should_include): Likewise.
6319         (Archive::should_include_member): Likewise.
6320         (Archive::Armap_entry): Remove.
6321         (Archive::Unused_symbol_iterator): Remove.
6322         (Archive::unused_symbols_begin): Remove.
6323         (Archive::unused_symbols_end): Remove.
6324         (Archive::do_filename): New function.
6325         (Archive::do_get_mtime): New function.
6326         (Archive::do_for_all_unused_symbols): New function.
6327         (Archive::task_): Move to base class.
6328         (Archive::incremental_info_): Likewise.
6329         (class Lib_group): Derive from Library_base.
6330         (Lib_group::do_filename): New function.
6331         (Lib_group::do_get_mtime): New function.
6332         (Lib_group::do_for_all_unused_symbols): New function.
6333         (Lib_group::task_): Move to base class.
6334         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6335         function.
6336         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6337         function.
6338         * incremental.cc (Incremental_inputs::report_archive_begin):
6339         Use Library_base; call library's get_mtime; add incremental inputs
6340         entry before members.
6341         (class Unused_symbol_visitor): New class.
6342         (Incremental_inputs::report_archive_end): Use Library_base; use
6343         visitor class to record unused symbols; don't add incremental inputs
6344         entry after members.
6345         (Incremental_inputs::report_object): Use Library_base.
6346         * incremental.h
6347         (Incremental_archive_entry::Incremental_archive_entry): Remove
6348         unused Archive parameter.
6349         (Incremental_inputs::report_archive_begin): Use Library_base.
6350         (Incremental_inputs::report_archive_end): Likewise.
6351         (Incremental_inputs::report_object): Likewise.
6352         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6353         function.
6354         * object.h (Object::for_all_global_symbols): New function.
6355         (Object::do_for_all_global_symbols): New function.
6356         (Sized_relobj::do_for_all_global_symbols): New function.
6357         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6358         function.
6359         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6360         function.
6361
6362 2011-03-27  Ian Lance Taylor  <iant@google.com>
6363
6364         * archive.cc (Archive::interpret_header): Return -1 if something
6365         goes wrong.  Change callers accordingly.
6366
6367 2011-03-25  Cary Coutant  <ccoutant@google.com>
6368
6369         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6370         * testsuite/Makefile.in: Regenerate.
6371
6372 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6373
6374         * plugin.cc (get_view): New.
6375         (Plugin::load): Pass get_view to the plugin.
6376         (Plugin_manager::get_view): New.
6377
6378 2011-03-21  Ian Lance Taylor  <iant@google.com>
6379
6380         * testsuite/final_layout.sh: Rewrite to not use dc.
6381         * testsuite/relro_test.sh: Fail if dc is not present.
6382
6383 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6384
6385         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6386         Change == to -eq.
6387         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6388         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6389         Change == to -eq.
6390         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6391         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6392
6393 2011-03-14  Ian Lance Taylor  <iant@google.com>
6394
6395         * script-sections.cc (Sort_output_sections::script_compare):
6396         Rename from is_before, change return type.
6397         (Sort_output_sections::operator()): Adjust accordingly.
6398
6399 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6400
6401         PR gold/12572
6402         * testsuite/odr_violation2.cc: Add comment to make all error line
6403         numbers double digits.
6404         * testsuite/debug_msg.sh: Adjust expected errors.
6405
6406 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6407
6408         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6409         but mark earlier ones as non-canonical
6410         (offset_to_iterator): Update search target and example
6411         (do_addr2line): Return extra lines in a vector*
6412         (format_file_lineno): Extract from do_addr2line
6413         (one_addr2line): Add vector* out-param
6414         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6415         when a lineno entry appeared last for its instruction
6416         (Dwarf_line_info): Add vector* out-param
6417         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6418         * symtab.cc (Odr_violation_compare): Include the lineno in the
6419         comparison again.
6420         (linenos_from_loc): New. Combine the canonical line for an
6421         address with its other lines.
6422         (True_if_intersect): New. Helper functor to make
6423         std::set_intersection a query.
6424         (detect_odr_violations): Compare sets of lines instead of just
6425         one line for each function. This became less deterministic, but
6426         has fewer false positives.
6427         * symtab.h: Declarations.
6428         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6429         mix an optimized and non-optimized object in the same binary
6430         (odr_violation2.so): Same.
6431         * testsuite/Makefile.in: Regenerate from Makefile.am.
6432         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6433         * testsuite/debug_msg.sh: Update line numbers and add
6434         assertions.
6435         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6436         non-optimized context.
6437         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6438         isn't inlined, and use OdrDerived in an optimized context.
6439         * testsuite/odr_header1.h: Defines OdrDerived, where
6440         optimization will change the
6441         first-instruction-in-the-destructor's file and line number.
6442         * testsuite/odr_header2.h: Defines OdrBase.
6443
6444 2011-03-09  Ian Lance Taylor  <iant@google.com>
6445
6446         * fileread.cc (File_read::clear_views): Don't delete the whole
6447         file view.
6448
6449 2011-03-08  Ian Lance Taylor  <iant@google.com>
6450
6451         PR gold/12525
6452         * fileread.cc: #include <climits>.
6453         (GOLD_IOV_MAX): Define.
6454         (File_read::read_multiple): Limit number of entries by iov_max.
6455         * fileread.h (class File_read): Always set max_readv_entries to
6456         128.
6457
6458 2011-03-07  Ian Lance Taylor  <iant@google.com>
6459
6460         PR gold/12525
6461         * options.h (class General_options): Add -dy and -dn.
6462
6463 2011-03-02  Cary Coutant  <ccoutant@google.com>
6464
6465         * testsuite/script_test_9.t: Add TLS segment.
6466
6467 2011-03-02  Simon Baldwin  <simonb@google.com>
6468
6469         * configure.ac: Add check for gnu_indirect_function support in
6470         the toolchain building binutils.
6471         * configure: Rebuild.
6472
6473 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6474
6475         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6476         plugin only symbols.
6477         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6478         in plugin files as not needed in the symbol table.
6479
6480 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6481
6482         * output.cc (Output_section::add_input_section): Delay fill
6483         generation for section ordering.
6484
6485 2011-02-09  Ian Lance Taylor  <iant@google.com>
6486
6487         PR gold/12316
6488         * object.h (class Sized_relobj): Remove clear_local_symbols.
6489         * reloc.cc (Sized_relobj::do_relocate): Don't call
6490         clear_local_symbols.
6491
6492 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6493
6494         * plugin.cc (is_visible_from_outside): Return true for symbols
6495         in the -u option.
6496
6497 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6498
6499         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6500         filename.
6501
6502 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6503
6504         * icf.h (is_section_foldable_candidate): Change type of parameter
6505         to std::string.
6506         * icf.cc (Icf::find_identical_sections): Change type of local variable
6507         section_name to be std::string.
6508         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6509
6510 2011-01-25  Ian Lance Taylor  <iant@google.com>
6511
6512         * script.cc (script_add_extern): Rewrite to use
6513         add_symbol_reference.
6514
6515 2011-01-25  Doug Kwan  <dougkwan@google.com>
6516
6517         * icf.cc (get_section_contents): Always lock section's object.
6518
6519 2011-01-24  Ian Lance Taylor  <iant@google.com>
6520
6521         * options.h (class General_options): Accept
6522         --no-detect-odr-violations.
6523
6524 2011-01-24  Ian Lance Taylor  <iant@google.com>
6525
6526         * version.cc (version_string): Bump to 1.11.
6527
6528 2011-01-24  Ian Lance Taylor  <iant@google.com>
6529
6530         * plugin.cc (class Plugin_rescan): Define new class.
6531         (Plugin_manager::claim_file): Set any_claimed_.
6532         (Plugin_manager::save_archive): New function.
6533         (Plugin_manager::save_input_group): New function.
6534         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6535         necessary.
6536         (Plugin_manager::new_undefined_symbol): New function.
6537         (Plugin_manager::rescan): New function.
6538         (Plugin_manager::rescannable_defines): New function.
6539         (Plugin_manager::add_input_file): Set any_added_.
6540         * plugin.h (class Plugin_manager): define new fields rescannable_,
6541         undefined_symbols_, any_claimed_, and any_added_.  Declare
6542         Plugin_rescan as friend.  Declare new functions.
6543         (Plugin_manager::Rescannable): Define type.
6544         (Plugin_manager::Rescannable_list): Define type.
6545         (Plugin_manager::Undefined_symbol_list): Define type.
6546         (Plugin_manager::Plugin_manager): Initialize new fields.
6547         * archive.cc (Archive::defines_symbol): New function.
6548         (Add_archive_symbols::run): Pass archive to plugins if any.
6549         * archive.h (class Archive): Declare defines_symbol.
6550         * readsyms.cc (Input_group::~Input_group): New function.
6551         (Finish_group::run): Pass input_group to plugins if any.
6552         * readsyms.h (class Input_group): Declare destructor.
6553         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6554         any.
6555
6556 2011-01-10  Ian Lance Taylor  <iant@google.com>
6557
6558         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6559         section as relro.
6560         (Layout::set_segment_offsets): Reset increase_relro before calling
6561         set_section_addresses a second time.
6562
6563 2011-01-04  Cary Coutant  <ccoutant@google.com>
6564
6565         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6566         sections before NOBITS sections.
6567
6568 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6569
6570         * version.cc (print_version): Update copyright to 2011.
6571
6572 2010-12-23  Cary Coutant  <ccoutant@google.com>
6573
6574         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6575         of OS to this->add.  Add OD parameter to second form of the function.
6576
6577 2010-12-20  Ian Lance Taylor  <iant@google.com>
6578
6579         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6580         second of two consecutive entries with same offset.
6581
6582 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6583
6584         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6585         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6586         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6587         to avoid unneeded links against $(LDADD).
6588         * testsuite/Makefile.in: Regenerate.
6589
6590 2010-12-15  Ian Lance Taylor  <iant@google.com>
6591
6592         PR gold/12324
6593         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6594         for R_X86_64_32 and R_X86_64_PC32.
6595         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6596         ver_matching_def_pic.o.
6597         (ver_matching_def_pic.o): New target.
6598
6599 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6600
6601         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6602         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6603         Move definition before File_read::View member definitions.
6604         (File_read::View::~View): Initialize and hold lock before
6605         updating current_mapped_bytes.
6606
6607 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6608
6609         * dwarf_reader.cc: Remove outdated comment.
6610         * gold-threads.cc: Fix typo in error message.
6611         * archive.cc: Fix typos in comments.
6612         * archive.h: Likewise.
6613         * arm-reloc-property.cc: Likewise.
6614         * arm-reloc-property.h: Likewise.
6615         * arm-reloc.def: Likewise.
6616         * arm.cc: Likewise.
6617         * attributes.h: Likewise.
6618         * cref.cc: Likewise.
6619         * ehframe.cc: Likewise.
6620         * fileread.h: Likewise.
6621         * gold.h: Likewise.
6622         * i386.cc: Likewise.
6623         * icf.cc: Likewise.
6624         * incremental.h: Likewise.
6625         * int_encoding.cc: Likewise.
6626         * layout.h: Likewise.
6627         * main.cc: Likewise.
6628         * merge.h: Likewise.
6629         * object.cc: Likewise.
6630         * object.h: Likewise.
6631         * options.cc: Likewise.
6632         * readsyms.cc: Likewise.
6633         * reduced_debug_output.cc: Likewise.
6634         * reloc.cc: Likewise.
6635         * script-sections.cc: Likewise.
6636         * sparc.cc: Likewise.
6637         * symtab.h: Likewise.
6638         * target-reloc.h: Likewise.
6639         * target.cc: Likewise.
6640         * target.h: Likewise.
6641         * timer.cc: Likewise.
6642         * timer.h: Likewise.
6643         * x86_64.cc: Likewise.
6644
6645 2010-12-09  Cary Coutant  <ccoutant@google.com>
6646
6647         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6648         stack.
6649         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6650         parameter; change all callers.
6651         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6652         * options.h (warn_execstack): New option.
6653
6654 2010-12-07  Doug Kwan  <dougkwan@google.com>
6655
6656         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6657         like function call relocations.
6658
6659 2010-12-07  Ian Lance Taylor  <iant@google.com>
6660
6661         * archive.cc (Archive::get_elf_object_for_member): Permit
6662         punconfigured to be NULL.
6663         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6664         (Archive::include_member): Pass NULL to get_elf_object_for_member
6665         if we searched for the archive and this is the first included
6666         object.
6667
6668 2010-12-01  Ian Lance Taylor  <iant@google.com>
6669
6670         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6671         track_relocs_type_ field.
6672         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6673         Set track_relocs_type_.
6674         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6675         contents when using RELA relocs.
6676         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6677         reloc_map_.
6678         * reloc.cc (Track_relocs::next_addend): New function.
6679         * reloc.h (class Track_relocs): Declare next_addend.
6680
6681 2010-12-01  Ian Lance Taylor  <iant@google.com>
6682
6683         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6684         virtual destructor.
6685
6686 2010-12-01  Ian Lance Taylor  <iant@google.com>
6687
6688         * README: Update compilers known to work and fail.
6689
6690 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6691
6692         * configure.in: For --enable-gold, handle value `default' instead of
6693         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6694         not the default.
6695         * configure: Regenerate.
6696
6697 2010-11-18  Doug Kwan  <dougkwan@google.com>
6698
6699         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6700         and right_alignment to be zero.  Store result alignment only if it is
6701         greater than existing alignment.
6702
6703 2010-11-16  Cary Coutant  <ccoutant@google.com>
6704
6705         PR gold/12220
6706         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6707         Check for ".zdebug_line".
6708
6709 2010-11-16  Doug Kwan  <dougkwan@google.com>
6710             Cary Coutant  <ccoutant@google.com>
6711
6712         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6713         by reference; adjust all callers.
6714         * output.cc (Output_segment::set_section_addresses): Adjust references
6715         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6716         list is empty.
6717         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6718         end at page boundary.
6719
6720 2010-11-16  Cary Coutant  <ccoutant@google.com>
6721
6722         PR gold/12220
6723         * layout.cc (Layout::choose_output_section): Transform names of
6724         compressed sections even when using a script with a SECTIONS clause.
6725         (Layout::output_section_name): Remove code to transform
6726         compressed debug section names.
6727         * output.cc (Output_section::add_input_section): Use uncompressed
6728         section size when tracking input sections.
6729
6730 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6731
6732         * symtab.h (Symbol::NON_PIC_REF): Remove.
6733         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6734         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6735         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6736         (Symbol::use_plt_offset): Take a flags argument and pass it
6737         directly to needs_dynamic_reloc.  Restrict check for undefined
6738         weak symbols to function calls.
6739         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6740         (Target_arm::Scan::global): Use it.
6741         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6742         (Target_arm::Relocate::relocate): Likewise.
6743         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6744         parameter with an r_type parameter.  Use get_reference_flags
6745         to get the flags.
6746         (Target_arm::Relocate::relocate): Update accordingly.
6747         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6748         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6749         (Target_i386::Scan::global): Likewise.
6750         (Target_i386::Relocate::relocate): Likewise.
6751         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6752         parameter with an r_type parameter.  Use get_reference_flags
6753         to get the flags.
6754         (Target_i386::Relocate::relocate): Update accordingly.
6755         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6756         (Target_powerpc::Scan::global): Use it.
6757         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6758         (Target_powerpc::Relocate::relocate): Likewise.
6759         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6760         (Target_sparc::Scan::global): Use it.
6761         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6762         (Target_sparc::Relocate::relocate): Likewise.
6763         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6764         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6765         (Target_x86_64::Scan::global): Likewise.
6766         (Target_x86_64::Relocate::relocate): Likewise.
6767
6768 2010-11-08  Doug Kwan  <dougkwan@google.com>
6769             Cary Coutant  <ccoutant@google.com>
6770
6771         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6772         (Arm_exidx_merge_section::section_contents_): New data member.
6773         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6774         (Arm_input_section::~Arm_input_section): De-allocate memory.
6775         (Arm_input_section::original_contents_): New data member.
6776         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6777         in parameters instead of calling Object::section_contents without
6778         locking.
6779         (Arm_output_section::group_section): New parameter TASK.  Pass it
6780         to callees that need locking objects.
6781         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6782         to lock EXIDX input sections.  Fix a formatting issue.  Call
6783         Arm_exidx_merged_section::build_contents to create merged section
6784         contents.
6785         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6786         to lock object of stub table owner.
6787         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6788         TEXT_SIZE to initialize data member TEXT_SIZE_.
6789         (Arm_exidx_input_section::addralign): Fix typo in comment.
6790         (Arm_exidx_input_section::text_size): New method.
6791         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6792         that require locking objects.  Lock objects before scanning for stubs
6793         and updating local symbols.
6794         (Arm_input_section<big_endian>::init): Copy contents of original
6795         input section.
6796         (Arm_input_section<big_endian>::do_write): Use saved contents of
6797         original input section instead of calling Object::section_contents
6798         without locking.
6799         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6800         size without calling Object::section_size().
6801         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6802         for size.  Allocate a buffer for merged EXIDX entries.
6803         (Arm_exidx_merged_section::build_contents): New method.
6804         (Arm_exidx_merged_section::do_write): Move merge section contents
6805         building code to Arm_exidx_merged_section::build_contetns.  Write
6806         out contetns in buffer instead of building it on the fly.
6807         (Arm_relobj::make_exidx_input_section): Also pass text section size
6808         to Arm_exidx_input_section constructor.
6809         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6810         (Arm_dynobj::do_read_symbols): Fix memory leak.
6811         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6812         * target.h: (class Task): Add forward declaration.
6813         (Target::relax): Add new parameter TASK and pass it to
6814         Target::do_relax().
6815         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6816
6817 2010-11-05  Cary Coutant  <ccoutant@google.com>
6818
6819         PR gold/10708
6820         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6821         object when reading from the file.
6822         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6823         second layout pass.
6824         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6825         when reading section contents.
6826         (get_section_contents): Likewise.
6827         (icf::find_identical_sections): Likewise.
6828         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6829         object when reading from the file.
6830         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6831         the object when doing deferred section layout.
6832
6833 2010-11-03  Nick Clifton  <nickc@redhat.com>
6834
6835         PR gold/12001
6836         * script.h (class Symbol_assignment: name): New member.  Returns
6837         the name of the symbol.
6838         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6839         Returns true if the given symbol name is on the list of
6840         assignments wating to be processed.
6841         * archive.cc (should_incldue_member): If the symbol is undefined,
6842         check to see if it is on the list of symbols pending assignment.
6843
6844 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6845
6846         * script-sections.cc (Script_sections::find_memory_region): Check
6847         for a NULL output section pointer.
6848
6849 2010-10-29  Doug Kwan  <dougkwan@google.com>
6850
6851         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6852         Output_section::add_relaxed_input_section.
6853         * output.cc (Output_section::add_relaxed_input_section): Add new
6854         arguments LAYOUT and NAME.  Set section order index.
6855         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6856         Copy section order index.
6857         * output.h (Output_section::add_relaxed_input_section): Add new
6858         arguments LAYOUT and NAME.
6859
6860 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6861
6862         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6863         NATIVE_OR_CROSS_LINKER.
6864         * testsuite/Makefile.in: Regenerate.
6865
6866 2010-10-20  Doug Kwan  <dougkwan@google.com>
6867
6868         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6869         without SHF_LINK_ORDER flags.
6870         * layout.cc (Layout::choose_output_section): Do not filter
6871         SHF_LINK_ORDER flag in a relocatable link.
6872
6873 2010-10-17  Cary Coutant  <ccoutant@google.com>
6874
6875         * output.h (Output_segment::set_section_addresses): Change function
6876         signature.  Update all callers.
6877         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6878         sections.
6879         (Output_segment::set_section_addresses): Align after last TLS
6880         section.  Add padding before last relro section instead of after.
6881
6882 2010-10-17  Doug Kwan  <dougkwan@google.com>
6883
6884         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6885         GOT output section to be writable.
6886
6887 2010-10-14  Cary Coutant  <ccoutant@google.com>
6888
6889         * debug.h (DEBUG_INCREMENTAL): New flag.
6890         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6891         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6892         mode.
6893         * incremental.cc (report_command_line): Ignore all forms of
6894         --incremental.
6895         * layout.cc (Layout::Layout): Check parameters for incremental link
6896         mode.
6897         * options.cc (General_options::parse_incremental): New function.
6898         (General_options::parse_no_incremental): New function.
6899         (General_options::parse_incremental_full): New function.
6900         (General_options::parse_incremental_update): New function.
6901         (General_options::incremental_mode_): New data member.
6902         (General_options::finalize): Check incremental_mode_.
6903         * options.h (General_options): Update help text for --incremental.
6904         Add --no-incremental, --incremental-full, --incremental-update.
6905         (General_options::Incremental_mode): New enum type.
6906         (General_options::incremental_mode): New function.
6907         (General_options::incremental_mode_): New data member.
6908         * parameters.cc (Parameters::incremental_mode_): New data member.
6909         (Parameters::set_options): Set incremental_mode_.
6910         (Parameters::set_incremental_full): New function.
6911         (Parameters::incremental): New function.
6912         (Parameters::incremental_update): New function.
6913         (set_parameters_incremental_full): New function.
6914         * parameters.h (Parameters::set_incremental_full): New function.
6915         (Parameters::incremental): New function.
6916         (Parameters::incremental_update): New function.
6917         (Parameters::incremental_mode_): New data member.
6918         (set_parameters_incremental_full): New function.
6919         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6920         incremental link mode.
6921         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6922         (Sized_relobj::do_relocate_sections): Likewise.
6923         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6924         option.
6925         * testsuite/Makefile.in: Regenerate.
6926         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6927
6928 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6929
6930         * script-sections.h (class Script_sections): Make
6931         Sections_elements typedef public.
6932         * script-sections.cc (class Sort_output_sections): Add elements_
6933         field.  Add constructor which sets it; change all callers.
6934         (Sort_output_sections::is_before): New function.
6935         (Sort_output_sections::operator()): Call is_before.
6936         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6937         conditional.
6938         * testsuite/script_test_10.sh: New test. Test script section
6939         order.
6940         * testsuite/script_test_10.t: Likewise.
6941         * testsuite/script_test_10.s: Likewise.
6942         * testsuite/Makefile.am: Wrap the cross linker tests and the
6943         common tests into NATIVE_OR_CROSS_LINKER.
6944         (check_SCRIPTS): Add script_test_10.sh.
6945         (check_DATA): Add script_test_10.stdout.
6946         (script_test_10.o, script_test_10): New targets.
6947         (script_test_10.stdout): New target.
6948         * configure, testsuite/Makefile.in: Regenerate.
6949
6950 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6951
6952         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6953         error for the deprecated relocations.
6954         (Target_arm::Scan::global): Likewise.
6955         (Target_arm::Relocate::relocate): Likewise.
6956
6957 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6958
6959         * fileread.cc (Input_file::find_file): Initialize *found_name
6960         and *namep when using the fallback search for case 4.
6961
6962 2010-10-11  Cary Coutant  <ccoutant@google.com>
6963
6964         * options.h (class General_options): Redefine -z lazy as an alias for
6965         the negation of -z now.
6966
6967 2010-10-11  Ian Lance Taylor  <iant@google.com>
6968
6969         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6970         binding.
6971
6972 2010-10-06  Nick Clifton  <nickc@redhat.com>
6973
6974         * script-sections.cc(class Memory_region): Remove
6975         current_lma_offset_ field.  Rename current_vma_offset_ to
6976         current_offset_.  Add last_section_ field.
6977         (Memory_region::get_current_vma_address): Rename to
6978         get_current_address.
6979         (Memory_region::get_current_lma_address): Delete.
6980         (Memory_region::increment_vma_offset): Rename to
6981         increment_offset.
6982         (Memory_region::increment_lma_offset): Delete.
6983         (Memory_region::attributes_compatible): New method.  Returns
6984         true if the provided section is compatible with the region.
6985         (Memory_region::get_last_section): New method.  Returns the last
6986         section to use the region.
6987         (Memory_region::set_last_section): New method.  Stores the last
6988         section to use the region.
6989         (Script_sections::block_in_region): New method.  Returns true if
6990         a block of memory is contained within a region.
6991         (Script_sections::find_memory_region): New method.  Locates a
6992         memory region to be used to set a VMA or LMA address.
6993         (Output_section_definition::set_section_addresses): Add code to
6994         check for addresses set by memory regions.
6995         (Output_segment::set_section_addresses): Remove memory region
6996         walking code.
6997         (Script_sections::create_segment): Add a warning if a header
6998         segment is created outside of any region.
6999         * script-sections.h (class Script_sections): Add prototypes for
7000         find_memory_region and block_in_region methods.
7001         * testsuite/memory_test.s: Use .long instead of .word.
7002         * testsuite/memory_test.t: Add some more output sections.
7003         * testsuite/memory_test.sh: Update expected output.
7004
7005 2010-10-02  Doug Kwan  <dougkwan@google.com>
7006
7007         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
7008         defintion to symtab.h
7009         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
7010         declaration to defintion.
7011
7012 2010-10-01  Nick Clifton  <nickc@redhat.com>
7013
7014         * expression.cc (eval): Replace dummy argument with NULL.
7015         (eval_maybe_dot): Check for a NULL result section pointer.
7016         (Symbol_expression::value): Likewise.
7017         (Dot_expression::value): Likewise.
7018         (BINARY_EXPRESSION): Likewise.
7019         (Max_expression::value): Likewise.
7020         (Min_expression::value): Likewise.
7021         (Absolute_expression::value): Likewise.
7022         (Addr_expression::value_from_output_section): Likewise.
7023         (Loaddddr_expression::value_from_output_section): Likewise.
7024         (Segment_start_expression::value): Likewise.
7025         * script-sections.cc
7026         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
7027         argument with NULL.
7028         (Sections_elememt_dot_assignment::set_section_addresses):
7029         Likewise.
7030         (Output_data_expression::do_write_to_buffer): Likewise.
7031         (Output_section_definition::finalize_symbols): Likewise.
7032         (Output_section_definition::set_section_addresses): Likewise.
7033
7034 2010-09-30  Doug Kwan  <dougkwan@google.com>
7035
7036         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
7037
7038 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
7039
7040         * target.h (Target::can_icf_inline_merge_sections): New virtual
7041         function.
7042         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
7043         virtual function.
7044         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
7045         virtual function.
7046         * icf.cc (get_section_contents): Inline merge sections only when
7047         target allows it.
7048
7049 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7050
7051         * configure: Regenerate.
7052
7053 2010-09-17  Ian Lance Taylor  <iant@google.com>
7054
7055         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
7056         * testsuite/Makefile.am (memory_test.o): New target.
7057         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
7058         memory_test.t.
7059         * testsuite/Makefile.in: Rebuild.
7060
7061 2010-09-17  Doug Kwan  <dougkwan@google.com>
7062
7063         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7064         defintion if relocation uses GOT entries of the symbol.
7065         * testsuite/icf_safe_test.sh: Fix test.
7066         * testsuite/icf_safe_so_test.sh: Fix test.
7067
7068 2010-09-16  Cary Coutant  <ccoutant@google.com>
7069
7070         * script_sections.cc (class Memory_region): Remove "NULL" from
7071         vector initializations.
7072
7073 2010-09-15  Cary Coutant  <ccoutant@google.com>
7074
7075         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7076         Resolve forwarding symbols.
7077
7078 2010-09-15  Doug Kwan  <dougkwan@google.com>
7079
7080         * gold/testsuite/script_test_3.t: Add ARM special sections.
7081         * gold/testsuite/script_test_4.t: Same.
7082         * gold/testsuite/script_test_5.t: Same.
7083         * gold/testsuite/script_test_6.t: Same.
7084         * gold/testsuite/script_test_7.t: Same.
7085         * gold/testsuite/script_test_7.t: Same.
7086         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7087
7088 2010-09-14  Cary Coutant  <ccoutant@google.com>
7089
7090         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7091         (Target_x86_64::Relocate::relocate_tls): Replace check for
7092         saw_tls_block_reloc_ with test for executable section.
7093
7094 2010-09-12  Cary Coutant  <ccoutant@google.com>
7095
7096         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7097         position-independent executables to shared libraries need dynamic
7098         relocations.
7099         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7100         position-independent executables.
7101         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7102         * testsuite/Makefile.in: Regenerate.
7103
7104 2010-09-10  Nick Clifton  <nickc@redhat.com>
7105
7106         PR gold/11997
7107         * testsuite/memory_test.t: Discard any sections that are not
7108         needed.
7109
7110 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7111
7112         PR gold/11996
7113         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7114         "This::" to work around a bug in gcc 4.2.
7115
7116         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7117
7118 2010-09-09  Rafael Espindola  <espindola@google.com>
7119
7120         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7121         sections with different PF_X flags in the same segment.
7122         (Layout::find_first_load_seg): Search all segments to find the first
7123         one.
7124         * options.h (rosegment): New.
7125
7126 2010-09-08  Rafael Espindola  <espindola@google.com>
7127
7128         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7129
7130 2010-09-08  Doug Kwan  <dougkwan@google.com>
7131
7132         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7133         (Arm_relobj::do_relocate_sections): Add new parameter for output
7134         file to match the parent.
7135         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7136         of local symbols instead of input values.  Update code to track
7137         changes in gold::relocate_section.
7138         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7139         (Sized_relobj::compute_final_local_value_internal): New methods.
7140         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7141         body into private version of Sized_relobj::compute_final_local_value.
7142         Call the inline method.
7143         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7144         merged symbol value if there is one.
7145         (Symbol_value::has_output_value): New method defintiion.
7146         (Sized_relobj::Compute_final_local_value_status): New enum type.
7147         (Sized_relobj::compute_final_local_value): New methods.
7148         (Sized_relobj::compute_final_local_value_internal): New methods.
7149         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7150         and arm_cortex_a8.sh.
7151         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7152         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7153         New tests.
7154         * Makefile.in: Regenerate.
7155         * testsuite/arm_bl_out_of_range.s: Update test.
7156         * testsuite/thumb_bl_out_of_range.s: Ditto.
7157         * testsuite/thumb_blx_out_of_range.s: Ditto.
7158         * testsuite/arm_branch_out_of_range.sh: New file.
7159         * testsuite/arm_cortex_a8.sh: Ditto.
7160         * testsuite/arm_cortex_a8_b.s: Ditto.
7161         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7162         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7163         * testsuite/arm_cortex_a8_bl.s: Ditto.
7164         * testsuite/arm_cortex_a8_blx.s: Ditto.
7165         * testsuite/arm_cortex_a8_local.s: Ditto.
7166         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7167         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7168
7169 2010-09-08  Rafael Espindola  <espindola@google.com>
7170
7171         * Makefile.am (memory_test.stdout): Run readelf with -W.
7172         * Makefile.in: Regenerate.
7173         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7174         64 bit output.
7175
7176 2010-09-08  Rafael Espindola  <espindola@google.com>
7177
7178         * script-sections.cc (Script_sections::add_memory_region): Convert
7179         field precision to int.
7180         * script.cc (script_set_section_region, script_set_section_region):
7181         Convert field precision to int.
7182
7183 2010-09-08  Rafael Espindola  <espindola@google.com>
7184
7185         * arm.cc (do_finalize_sections): Create the __exidx_start and
7186         __exdix_end symbols even when the section is missing.
7187
7188 2010-09-08  Nick Clifton  <nickc@redhat.com>
7189
7190         * README: Remove claim that MEMORY is not supported.
7191         * expression.cc (script_exp_function_origin)
7192         (script_exp_function_length): Move from here to ...
7193         * script.cc: ... here.
7194         (script_set_section_region, script_add_memory)
7195         (script_parse_memory_attr, script_include_directive): New
7196         functions.
7197         * script-sections.cc
7198         (class Memory_region): New class.
7199         (class Output_section_definition): Add set_memory_region,
7200         set_section_vma, set_section_lma and get_section_name methods.
7201         (class Script_Sections): Add add_memory_region,
7202         find_memory_region, find_memory_region_origin,
7203         find_memory_region_length and set_memory_region methods.
7204         Have set_section_addresses method walk the list of set memory
7205         regions.
7206         Extend the print methos to display memory regions.
7207         * script-sections.h: Add prototypes for new methods.
7208         Add enum for MEMORY region attributes.
7209         * yyscript.y: Add support for parsing MEMORY regions.
7210         * script-c.h: Add prototypes for new functions.
7211         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7212         * testsuite/Makefile.in: Regenerate.
7213         * testsuite/memory_test.sh: New script.
7214         * testsuite/memory_test.s: New assembler source file.
7215         * testsuite/memory_test.t: New linker script.
7216
7217 2010-08-27  Doug Kwan  <dougkwan@google.com>
7218
7219         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7220         reference override an existing dynamic weak reference.
7221         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7222         * testsuite/Makefile.in: Regenerate.
7223         * testsuite/dyn_weak_ref.sh: New file.
7224         * testsuite/dyn_weak_ref_1.c: Ditto.
7225         * testsuite/dyn_weak_ref_2.c: Ditto.
7226
7227 2010-08-27  Ian Lance Taylor  <iant@google.com>
7228
7229         * incremental.h (class Incremental_input_entry): Add virtual
7230         destructor.
7231
7232 2010-08-27  Ian Lance Taylor  <iant@google.com>
7233
7234         * testsuite/start_lib_test_3.c: Mark t3 as used.
7235
7236 2010-08-27  Nick Clifton  <nickc@redhat.com>
7237
7238         * options.cc (version_script): Fix small typo in previous
7239         whitespace tidyup.
7240
7241 2010-08-25  Nick Clifton  <nickc@redhat.com>
7242
7243         * archive.cc: Formatting fixes: Remove whitespace between
7244         typename and following asterisk.  Remove whitespace between
7245         function name and opening parenthesis.
7246         * archive.h: Likewise.
7247         * arm.cc: Likewise.
7248         * attributes.cc: Likewise.
7249         * attributes.h: Likewise.
7250         * common.cc: Likewise.
7251         * copy-relocs.cc: Likewise.
7252         * dirsearch.h: Likewise.
7253         * dynobj.cc: Likewise.
7254         * ehframe.cc: Likewise.
7255         * ehframe.h: Likewise.
7256         * expression.cc: Likewise.
7257         * fileread.cc: Likewise.
7258         * fileread.h: Likewise.
7259         * gc.h: Likewise.
7260         * gold-threads.cc: Likewise.
7261         * gold.cc: Likewise.
7262         * i386.cc: Likewise.
7263         * icf.h: Likewise.
7264         * incremental-dump.cc: Likewise.
7265         * incremental.cc: Likewise.
7266         * layout.cc: Likewise.
7267         * layout.h: Likewise.
7268         * main.cc: Likewise.
7269         * merge.cc: Likewise.
7270         * merge.h: Likewise.
7271         * object.cc: Likewise.
7272         * object.h: Likewise.
7273         * options.cc: Likewise.
7274         * options.h: Likewise.
7275         * output.cc: Likewise.
7276         * output.h: Likewise.
7277         * plugin.cc: Likewise.
7278         * plugin.h: Likewise.
7279         * powerpc.cc: Likewise.
7280         * reloc.cc: Likewise.
7281         * script-c.h: Likewise.
7282         * script-sections.cc: Likewise.
7283         * script.cc: Likewise.
7284         * stringpool.cc: Likewise.
7285         * symtab.cc: Likewise.
7286         * symtab.h: Likewise.
7287         * target.cc: Likewise.
7288         * timer.cc: Likewise.
7289         * timer.h: Likewise.
7290         * version.cc: Likewise.
7291         * x86_64.cc: Likewise.
7292
7293 2010-08-24  Nick Clifton  <nickc@redhat.com>
7294
7295         PR 11899
7296         * layout.cc (segment_precedes): Sort segments by their physical
7297         addresses, if they have been set.
7298
7299 2010-08-23  Cary Coutant  <ccoutant@google.com>
7300
7301         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7302         symbols data.
7303         (Lib_group::include_member): Unlock object after deleting its
7304         symbols data.
7305         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7306         the bug fixed here.
7307
7308 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7309             Cary Coutant  <ccoutant@google.com>
7310
7311         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7312         constructor, and set_blocker.
7313         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7314         readsyms_blocker_.
7315         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7316         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7317         * testsuite/Makefile.am (start_lib_test): New test case.
7318         * testsuite/Makefile.in: Regenerate.
7319         * testsuite/start_lib_test_main.c: New file.
7320         * testsuite/start_lib_test_1.c: New file.
7321         * testsuite/start_lib_test_2.c: New file.
7322         * testsuite/start_lib_test_3.c: New file.
7323
7324 2010-08-19  Ian Lance Taylor  <iant@google.com>
7325
7326         * Makefile.in: Rebuild with automake 1.11.1.
7327         * aclocal.m4: Likewise.
7328         * testsuite/Makefile.in: Likewise.
7329
7330 2010-08-19  Ian Lance Taylor  <iant@google.com>
7331
7332         PR 10893
7333         * i386.cc (class Output_data_plt_i386): Update declarations.
7334         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7335         local_ifuncs_ fields.
7336         (Target_i386::do_plt_section_for_global): New function.
7337         (Target_i386::do_plt_section_for_local): New function.
7338         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7339         parameter; change all callers.  Initialize global_ifuncs_ and
7340         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7341         __rel_iplt_end.
7342         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7343         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7344         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7345         symbols.
7346         (Target_i386::make_plt_section): New function, broken out of
7347         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7348         (Target_i386::make_plt_entry): Call make_plt_section.
7349         (Target_i386::make_local_ifunc_plt_entry): New function.
7350         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7351         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7352         R_386_IRELATIVE to switch.
7353         (Target_i386::Scan::global): Likewise.
7354         (Target_i386::Relocate::relocate): Likewise.
7355         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7356         switch.
7357         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7358         (Target_x86_64::do_plt_section_for_global): New function.
7359         (Target_x86_64::do_plt_section_for_local): New function.
7360         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7361         parameter; change all callers.  If doing a static link define
7362         __rela_iplt_start and __rela_iplt_end.
7363         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7364         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7365         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7366         to point to .plt.
7367         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7368         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7369         switch.
7370         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7371         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7372         R_X86_64_IRELATIVE to switch.
7373         (Target_x86_64::Scan::global): Likewise.
7374         (Target_x86_64::Relocate::relocate): Likewise.
7375         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7376         switch.
7377         * target.h (class Target): Add plt_section_for_global and
7378         plt_section_for_local functions.  Add do_plt_section_for_global
7379         and do_plt_section_for_local virtual functions.
7380         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7381         clarifying comments.
7382         (Symbol::use_plt_offset): Handle IFUNC symbol.
7383         * object.cc (Sized_relobj::Sized_relobj): Initialize
7384         local_plt_offsets_.
7385         (Sized_relobj::local_has_plt_offset): New function.
7386         (Sized_relobj::local_plt_offset): New function.
7387         (Sized_relobj::set_local_plt_offset): New function.
7388         (Sized_relobj::do_count): Handle IFUNC symbol.
7389         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7390         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7391         is_ifunc_symbol functions.
7392         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7393         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7394         local_plt_offsets_ field.
7395         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7396         * output.h (class Output_section_data): Add non-const
7397         output_section function.
7398         (class Output_data_got): Update declarations.
7399         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7400         Add use_plt_offset parameter to global and local constructors.
7401         Change all callers.  Change local_sym_index_ field to 31 bits.
7402         Change GSYM_CODE and CONSTANT_CODE accordingly.
7403         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7404         doing a static link don't set sh_link field.
7405         (Output_data_got::Got_entry::write): Use PLT offset if
7406         appropriate.
7407         (Output_data_got::add_global_plt): New function.
7408         (Output_data_got::add_local_plt): New function.
7409         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7410         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7411         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7412         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7413         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7414         IFUNC conditional.
7415         * testsuite/ifunc-sel.h: New file.
7416         * testsuite/ifuncmain1.c: New file.
7417         * testsuite/ifuncmain1vis.c: New file.
7418         * testsuite/ifuncmod1.c: New file.
7419         * testsuite/ifuncdep2.c: New file.
7420         * testsuite/ifuncmain2.c: New file.
7421         * testsuite/ifuncmain3.c: New file.
7422         * testsuite/ifuncmod3.c: New file.
7423         * testsuite/ifuncmain4.c: New file.
7424         * testsuite/ifuncmain5.c: New file.
7425         * testsuite/ifuncmod5.c: New file.
7426         * testsuite/ifuncmain6pie.c: New file.
7427         * testsuite/ifuncmod6.c: New file.
7428         * testsuite/ifuncmain7.c: New file.
7429         * configure, testsuite/Makefile.in: Rebuild.
7430
7431 2010-08-18  Ian Lance Taylor  <iant@google.com>
7432
7433         * incremental.cc
7434         (Output_section_incremental_inputs::write_input_files): Add cast
7435         to avoid signed/unsigned comparison warning.
7436         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7437
7438 2010-08-12  Cary Coutant  <ccoutant@google.com>
7439
7440         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7441
7442 2010-08-13  Ian Lance Taylor  <iant@google.com>
7443
7444         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7445
7446 2010-08-12  Cary Coutant  <ccoutant@google.com>
7447             Doug Kwan  <dougkwan@google.com>
7448
7449         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7450         defintion overrides non-weak undef, remember that the original undef
7451         is not weak.
7452         * symtab.cc (Symbol_table::sized_write_global): For undef without
7453         an original weak binding, set binding to global in output.
7454         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7455         * testsuite/Makefile.in: Regenerate.
7456         * testsuite/strong_ref_weak_def.sh: New file.
7457         * testsuite/strong_ref_weak_def_1.c: Ditto.
7458         * testsuite/strong_ref_weak_def_2.c: Ditto.
7459
7460 2010-08-12  Cary Coutant  <ccoutant@google.com>
7461
7462         * testsuite/incremental_test.sh: Rewrite.
7463         * testsuite/incremental_test_1.c: Rewrite.
7464         * testsuite/incremental_test_2.c: Rewrite.
7465
7466 2010-08-12  Cary Coutant  <ccoutant@google.com>
7467
7468         * arm.cc (Target_arm::got_size): Add const.
7469         (Target_arm::got_entry_count): New function.
7470         (Target_arm::plt_entry_count): New function.
7471         (Target_arm::first_plt_entry_offset): New function.
7472         (Target_arm::plt_entry_size): New function.
7473         (Output_data_plt_arm::entry_count): New function.
7474         (Output_data_plt_arm::first_plt_entry_offset): New function.
7475         (Output_data_plt_arm::get_plt_entry_size): New function.
7476         * i386.cc (Target_i386::got_size): Add const.
7477         (Target_i386::got_entry_count): New function.
7478         (Target_i386::plt_entry_count): New function.
7479         (Target_i386::first_plt_entry_offset): New function.
7480         (Target_i386::plt_entry_size): New function.
7481         (Output_data_plt_i386::entry_count): New function.
7482         (Output_data_plt_i386::first_plt_entry_offset): New function.
7483         (Output_data_plt_i386::get_plt_entry_size): New function.
7484         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7485         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7486         * incremental.cc: Include target.h.
7487         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7488         parameter.  Adjust all callers.  Find incremental_got_plt section.
7489         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7490         section.
7491         (Output_section_incremental_inputs::set_final_data_size): Calculate
7492         size of incremental_got_plt section.
7493         (Output_section_incremental_inputs::do_write): Write the
7494         incremental_got_plt section.
7495         (Got_plt_view_info): New struct.
7496         (Local_got_offset_visitor): New class.
7497         (Global_got_offset_visitor): New class.
7498         (Global_symbol_visitor_got_plt): New class.
7499         (Output_section_incremental_inputs::write_got_plt): New function.
7500         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7501         Add parameter.  Adjust all callers.
7502         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7503         (Incremental_inputs::got_plt_section): New function.
7504         (Incremental_inputs::got_plt_section_): New data member.
7505         (Incremental_got_plt_reader): New class.
7506         * layout.cc (Layout::create_incremental_info_sections): Add the
7507         incremental_got_plt section.
7508         * object.h (Got_offset_list::get_list): New function.
7509         (Got offset_list::for_all_got_offsets): New function.
7510         (Sized_relobj::local_got_offset_list): New function.
7511         * powerpc.cc (Target_powerpc::got_size): Add const.
7512         (Target_powerpc::got_entry_count): New function.
7513         (Target_powerpc::plt_entry_count): New function.
7514         (Target_powerpc::first_plt_entry_offset): New function.
7515         (Target_powerpc::plt_entry_size): New function.
7516         (Output_data_plt_powerpc::entry_count): New function.
7517         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7518         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7519         * sparc.cc (Target_sparc::got_size): Add const.
7520         (Target_sparc::got_entry_count): New function.
7521         (Target_sparc::plt_entry_count): New function.
7522         (Target_sparc::first_plt_entry_offset): New function.
7523         (Target_sparc::plt_entry_size): New function.
7524         (Output_data_plt_sparc::entry_count): New function.
7525         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7526         (Output_data_plt_sparc::get_plt_entry_size): New function.
7527         * symtab.h (Symbol::got_offset_list): New function.
7528         (Symbol_table::for_all_symbols): New function.
7529         * target.h (Sized_target::got_entry_count): New function.
7530         (Sized_target::plt_entry_count): New function.
7531         (Sized_target::plt_entry_size): New function.
7532         * x86_64.cc (Target_x86_64::got_size): Add const.
7533         (Target_x86_64::got_entry_count): New function.
7534         (Target_x86_64::plt_entry_count): New function.
7535         (Target_x86_64::first_plt_entry_offset): New function.
7536         (Target_x86_64::plt_entry_size): New function.
7537         (Output_data_plt_x86_64::entry_count): New function.
7538         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7539         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7540
7541 2010-08-12  Cary Coutant  <ccoutant@google.com>
7542
7543         * archive.cc: Include incremental.h.
7544         (Archive::Archive): Initialize incremental_info_.
7545         (Archive::include_member): Record archive members in incremental info.
7546         (Add_archive_symbols::run): Record begin and end of an archive in
7547         incremental info.
7548         (Lib_group::include_member): Record objects in incremental info.
7549         * archive.h (Incremental_archive_entry): Forward declaration.
7550         (Archive::set_incremental_info): New member function.
7551         (Archive::incremental_info): New member function.
7552         (Archive::Unused_symbol_iterator): New class.
7553         (Archive::unused_symbols_begin): New member function.
7554         (Archive::unused_symbols_end): New member function.
7555         (Archive::incremental_info_): New data member.
7556         * incremental-dump.cc (find_input_containing_global): New function.
7557         (dump_incremental_inputs): Dump new incremental info sections.
7558         * incremental.cc: Include symtab.h.
7559         (Output_section_incremental_inputs): New class.
7560         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7561         new incremental info sections.
7562         (Sized_incremental_binary::do_check_inputs): Likewise.
7563         (Incremental_inputs::report_archive): Remove.
7564         (Incremental_inputs::report_archive_begin): New function.
7565         (Incremental_inputs::report_archive_end): New function.
7566         (Incremental_inputs::report_object): New function.
7567         (Incremental_inputs::finalize_inputs): Remove.
7568         (Incremental_inputs::report_input_section): New function.
7569         (Incremental_inputs::report_script): Rewrite.
7570         (Incremental_inputs::finalize): Do nothing but finalize string table.
7571         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7572         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7573         (Incremental_inputs::create_data_sections): New function.
7574         (Incremental_inputs::relocs_entsize): New function.
7575         (Output_section_incremental_inputs::set_final_data_size): New function.
7576         (Output_section_incremental_inputs::do_write): New function.
7577         (Output_section_incremental_inputs::write_header): New function.
7578         (Output_section_incremental_inputs::write_input_files): New function.
7579         (Output_section_incremental_inputs::write_info_blocks): New function.
7580         (Output_section_incremental_inputs::write_symtab): New function.
7581         * incremental.h (Incremental_script_entry): Forward declaration.
7582         (Incremental_object_entry): Forward declaration.
7583         (Incremental_archive_entry): Forward declaration.
7584         (Incremental_inputs): Forward declaration.
7585         (Incremental_inputs_header_data): Remove.
7586         (Incremental_inputs_header): Remove.
7587         (Incremental_inputs_header_write): Remove.
7588         (Incremental_inputs_entry_data): Remove.
7589         (Incremental_inputs_entry): Remove.
7590         (Incremental_inputs_entry_write): Remove.
7591         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7592         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7593         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7594         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7595         Likewise.
7596         (Incremental_input_entry): New class.
7597         (Incremental_script_entry): New class.
7598         (Incremental_object_entry): New class.
7599         (Incremental_archive_entry): New class.
7600         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7601         (Incremental_inputs::report_inputs): Remove.
7602         (Incremental_inputs::report_archive): Remove.
7603         (Incremental_inputs::report_archive_begin): New function.
7604         (Incremental_inputs::report_archive_end): New function.
7605         (Incremental_inputs::report_object): Change prototype.
7606         (Incremental_inputs::report_input_section): New function.
7607         (Incremental_inputs::report_script): Change prototype.
7608         (Incremental_inputs::get_reloc_count): New function.
7609         (Incremental_inputs::set_reloc_count): New function.
7610         (Incremental_inputs::create_data_sections): New function.
7611         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7612         (Incremental_inputs::inputs_section): New function.
7613         (Incremental_inputs::symtab_section): New function.
7614         (Incremental_inputs::relocs_section): New function.
7615         (Incremental_inputs::get_stringpool): Add const.
7616         (Incremental_inputs::command_line): Add const.
7617         (Incremental_inputs::inputs): Remove.
7618         (Incremental_inputs::command_line_key): New function.
7619         (Incremental_inputs::input_file_count): New function.
7620         (Incremental_inputs::input_files): New function.
7621         (Incremental_inputs::relocs_entsize): New function.
7622         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7623         (Incremental_inputs::finalize_inputs): Remove.
7624         (Incremental_inputs::Input_info): Remove.
7625         (Incremental_inputs::lock_): Remove.
7626         (Incremental_inputs::inputs_): Change type.
7627         (Incremental_inputs::inputs_map_): Remove.
7628         (Incremental_inputs::current_object_entry_): New data member.
7629         (Incremental_inputs::inputs_section_): New data member.
7630         (Incremental_inputs::symtab_section_): New data member.
7631         (Incremental_inputs::relocs_section_): New data member.
7632         (Incremental_inputs::reloc_count_): New data member.
7633         (Incremental_inputs_reader): New class.
7634         (Incremental_symtab_reader): New class.
7635         (Incremental_relocs_reader): New class.
7636         * layout.cc (Layout::finalize): Move finalization of incremental info
7637         and creation of incremental info sections to follow finalization of
7638         symbol table.  Set offsets for postprocessing sections.
7639         (Layout::create_incremental_info_sections): Call
7640         Incremental_inputs::create_data_sections.  Add incremental symtab
7641         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7642         sections to layout after input sections.
7643         * layout.h (struct Timespec): Forward declaration.
7644         (Layout::incremental_inputs): Add const.
7645         (Layout::create_incremental_info_sections): Add parameter.
7646         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7647         * object.cc: Include incremental.h.
7648         (Relobj::finalize_incremental_relocs): New function.
7649         (Sized_relobj::do_layout): Record input sections in incremental info.
7650         * object.h (Object::output_section): New function.
7651         (Object::output_section_offset): Moved from Relobj.
7652         (Object::get_incremental_reloc_base): New function.
7653         (Object::get_incremental_reloc_count): New function.
7654         (Object::do_output_section): New function.
7655         (Object::do_output_section_offset): Moved from Relobj.
7656         (Object::do_get_incremental_reloc_base): New function.
7657         (Object::do_get_incremental_reloc_count): New function.
7658         (Object::Object): Initialize new data members.
7659         (Relobj::output_section): Renamed do_output_section and moved to
7660         protected.
7661         (Relobj::output_section_offset): Moved to Object.
7662         (Relobj::do_get_incremental_reloc_base): New function.
7663         (Relobj::do_get_incremental_reloc_count): New function.
7664         (Relobj::allocate_incremental_reloc_counts): New function.
7665         (Relobj::count_incremental_reloc): New function.
7666         (Relobj::finalize_incremental_relocs): New function.
7667         (Relobj::next_incremental_reloc_index): New function.
7668         (Relobj::reloc_counts_): New data member.
7669         (Relobj::reloc_bases_): New data member.
7670         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7671         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7672         (Sized_relobj::incremental_relocs_scan): New function.
7673         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7674         (Sized_relobj::incremental_relocs_write): New function.
7675         (Sized_relobj::incremental_relocs_write_reltype): New function.
7676         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7677         incremental link.
7678         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7679         archives and object files elsewhere.
7680         (Add_symbols::run): Report object files here.
7681         (Finish_group::run): Report end of archive at end of group.
7682         * reloc.cc: Include layout.h, incremental.h.
7683         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7684         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7685         (Sized_relobj::incremental_relocs_scan): New function.
7686         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7687         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7688         (Sized_relobj::incremental_relocs_write): New function.
7689         (Sized_relobj::incremental_relocs_write_reltype): New function.
7690         * script.cc (read_input_script): Rewrite test for incremental link.
7691         Change call to Incremental_inputs::report_script.
7692         * symtab.h (Symbol_table::first_global_index): New function.
7693         (Symbol_table::output_count): New function.
7694
7695 2010-08-12  Doug Kwan  <dougkwan@google.com>
7696
7697         * arm.cc (Target_arm::merge_object_attributes): Check command line
7698         options --no-wchar-size-warning and --no-enum-size-warning.
7699         * options.h (General_options): Add ld-compatible options
7700         --no-enum-size-warning and --no-wchar-size-warning.
7701
7702 2010-08-04  Ian Lance Taylor  <iant@google.com>
7703
7704         * x86_64.cc (Target_x86_64::Scan::local): Use
7705         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7706         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7707         (Target_x86_64::Scan::global): Likewise.
7708         (Target_x86_64::Relocate::relocate): Likewise.
7709         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7710         Likewise.
7711
7712 2010-08-03  Cary Coutant  <ccoutant@google.com>
7713
7714         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7715         to reserve space in merged_strings vector. Keep total input size
7716         for stats.
7717         (Output_merge_string::do_print_merge_stats): Print total input size.
7718         * merge.h (Output_merge_string): Add input_size_ field.
7719         * stringpool.cc (Stringpool_template::string_length): Move
7720         implementations out of Stringpool_template class and place in
7721         stringpool.h.
7722         * stringpool.h (string_length): Move out of Stringpool_template.
7723
7724 2010-08-03  Ian Lance Taylor  <iant@google.com>
7725
7726         PR 11712
7727         * layout.cc (relaxation_loop_body): If address of load segment is
7728         set, adjust address to include headers if possible.
7729
7730 2010-08-03  Ian Lance Taylor  <iant@google.com>
7731
7732         * version.cc (version_string): Bump to 1.10.
7733
7734 2010-08-03  Ian Lance Taylor  <iant@google.com>
7735
7736         PR 11805
7737         * layout.h (enum Output_section_order): Define.
7738         (class Layout): Update declarations.
7739         * layout.cc (Layout::get_output_section): Add order parameter.
7740         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7741         is_first_non_relro parameters.  Change all callers.
7742         (Layout::choose_output_section): Likewise.
7743         (Layout::add_output_section_data): Likewise.
7744         (Layout::make_output_section): Likewise.  Set order.
7745         (Layout::default_section_order): New function.
7746         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7747         * output.cc (Output_section::Output_section): Initialize order_.
7748         Don't initialize deleted fields.
7749         (Output_segment::Output_segment): Don't initialize deleted
7750         fields.
7751         (Output_segment::add_output_section_to_load): New function
7752         replacing add_output_section.  Change all callers to call this or
7753         add_output_section_to_nonload.
7754         (Output_segment::add_output_section_to_nonload): New function.
7755         (Output_segment::remove_output_section): Rewrite.
7756         (Output_segment::add_initial_output_data): Likewise.
7757         (Output_segment::has_any_data_sections): Likewise.
7758         (Output_segment::is_first_section_relro): Likewise.
7759         (Output_segment::maximum_alignment): Likewise.
7760         (Output_segment::has_dynamic_reloc): New function replacing
7761         dynamic_reloc_count.  Change all callers.
7762         (Output_segment::has_dynamic_reloc_list): New function replacing
7763         dynamic_reloc_count_list.  Change all callers.
7764         (Output_segment::set_section_addresses): Rewrite.
7765         (Output_segment::set_offset): Rewrite.
7766         (Output_segment::find_first_and_last_list): Remove.
7767         (Output_segment::set_tls_offsets): Rewrite.
7768         (Output_segment::first_section_load_address): Likewise.
7769         (Output_segment::output_section_count): Likewise.
7770         (Output_segment::section_with_lowest_load_address): Likewise.
7771         (Output_segment::write_section_headers): Likewise.
7772         (Output_segment::print_sections_to_map): Likewise.
7773         * output.h (class Output_data): Remove dynamic_reloc_count_
7774         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7775         (Output_data::add_dynamic_reloc): Rewrite.
7776         (Output_data::has_dynamic_reloc): New function.
7777         (Output_data::dynamic_reloc_count): Remove.
7778         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7779         is_last_relro_, is_first_non_relro_, is_interp_,
7780         is_dynamic_linker_section_ fields.  Add order and set_order
7781         functions.  Remove is_relro_local, set_is_relro_local,
7782         is_last_relro, set_is_last_relro, is_first_non_relro,
7783         set_is_first_non_relro functions, is_interp, set_is_interp,
7784         is_dynamic_linker_section, and set_is_dynamic_linker_section
7785         functions.
7786         (class Output_segment): Change Output_data_list from std::list to
7787         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7788         output_bss_ fields.  Update declarations.
7789
7790 2010-08-02  Ian Lance Taylor  <iant@google.com>
7791
7792         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7793         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7794         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7795
7796 2010-08-02  Ian Lance Taylor  <iant@google.com>
7797
7798         PR 11855
7799         * script.cc (Script_options::Script_options): Initialize
7800         symbol_definitions_ and symbol_references_.
7801         (Script_options::add_symbol_assignment): Update
7802         symbol_definitions_ and symbol_references_.
7803         (Script_options::add_symbol_reference): New function.
7804         (script_symbol): New function.
7805         * script.h (class Script_options): Add symbol_definitions_ and
7806         symbol_references_ fields.
7807         (Script_options::referenced_const_iterator): New type.
7808         (Script_options::referenced_begin): New function.
7809         (Script_options::referenced_end): New function.
7810         (Script_options::is_referenced): New function.
7811         (Script_options::any_unreferenced): New function.
7812         * script-c.h (script_symbol): Declare.
7813         * yyscript.y (exp): Call script_symbol.
7814         * symtab.cc: Include "script.h".
7815         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7816         Change all callers.  Check symbols referenced by scripts.
7817         (Symbol_table::add_undefined_symbols_from_command_line): Add
7818         layout parameter.  Change all callers.
7819         (Symbol_table::do_add_undefined_symbols_from_command_line):
7820         Likewise.  Break out loop body.  Check symbols referenced by
7821         scripts.
7822         (Symbol_table::add_undefined_symbol_from_command_line): New
7823         function broken out of
7824         do_add_undefined_symbols_from_command_line.
7825         * symtab.h (class Symbol_table): Update declarations.
7826         * archive.cc: Include "layout.h".
7827         (Archive::should_include_member): Add layout parameter.  Change
7828         all callers.  Check for symbol mentioned in expression.
7829         * archive.h (class Archive): Update declaration.
7830         * object.cc (Sized_relobj::do_should_include_member): Add layout
7831         parameter.
7832         * object.h (Object::should_include_member): Add layout parameter.
7833         Change all callers.
7834         (Object::do_should_include_member): Add layout parameter.
7835         (class Sized_relobj): Update declaration.
7836         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7837         parameter.
7838         * dynobj.h (class Sized_dynobj): Update declaration.
7839         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7840         layout parameter.
7841         * plugin.h (class Sized_pluginobj): Update declaration.
7842
7843 2010-08-02  Ian Lance Taylor  <iant@google.com>
7844
7845         PR 11866
7846         * output.cc (Output_segment::set_offset): Search for the first and
7847         last sections rather than assuming that the list is in order.
7848         (Output_segment::find_first_and_last_list): New function.
7849         * output.h (class Output_segment): Update declarations.
7850         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7851         (relro_strip_test_SOURCES): New variable.
7852         (relro_strip_test_DEPENDENCIES): New variable.
7853         (relro_strip_test_LDFLAGS): New variable.
7854         (relro_strip_test_LDADD): New variable.
7855         (relro_strip_test.so): New target.
7856
7857 2010-08-02  Ian Lance Taylor  <iant@google.com>
7858
7859         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7860         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7861         (Target_i386::got_tlsdesc_section): New function.
7862         (Target_i386::got_section): Create space for GOT entries for
7863         TLSDESC relocations.
7864         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7865         R_386_TLS_GOTDESC.
7866         (Target_i386::Scan::global): Likewise.
7867         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7868         using TLSDESC GOT.
7869         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7870         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7871         (Target_x86_64::got_tlsdesc_section): New function.
7872         (Target_x86_64::got_section): Create space for GOT entries for
7873         TLSDESC relocations.
7874         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7875         R_386_TLS_GOTDESC.
7876         (Target_x86_64::Scan::global): Likewise.
7877         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7878         using TLSDESC GOT.
7879
7880 2010-08-02  Ian Lance Taylor  <iant@google.com>
7881
7882         * testsuite/final_layout.sh: Use dc to convert from hex to
7883         decimal.
7884
7885 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7886
7887         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7888         paramter to the call to gold::gc_process_relocs.
7889         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7890         paramter to the call to gold::gc_process_relocs.
7891         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7892         parameter to the call to gold::gc_process_relocs.
7893         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7894         template parameter to the call to gold::gc_process_relocs.
7895         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7896         paramter to the call to gold::gc_process_relocs.
7897         * gc.h (get_embedded_addend_size): New function.
7898         (gc_process_relocs): Save the size of the reloc for use by ICF.
7899         * icf.cc (get_section_contents): Get the addend from the text section
7900         for SHT_REL relocation sections.
7901         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7902         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7903         * int_encoding.h (read_from_pointer): New overloaded function.
7904         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7905         * testsuite/icf_sht_rel_addend_test.sh: New file.
7906         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7907         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7908
7909 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7910
7911         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7912         * Makefile.in: Regenerate.
7913         * testsuite/Makefile.in: Regenerate.
7914
7915 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7916
7917         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7918         * gold/testsuite/debug_msg.cc: Likewise.
7919         * gold/testsuite/odr_violation1.cc
7920         * gold/testsuite/odr_violation2.cc
7921
7922 2010-07-21  Cary Coutant  <ccoutant@google.com>
7923
7924         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7925         string, and length fields.
7926         (Output_merge_string::Merged_strings_list): New type.
7927         (Output_merge_string::Merged_strings_lists): New typedef.
7928         (Output_merge_string): Replace merged_strings_ with
7929         merged_strings_lists_.
7930         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7931         Merged_strings_list per input object and section.  Don't store pointer
7932         to the string.  Don't store length with each merged string entry.
7933         (Output_merge_string::finalize_merged_data): Loop over list of merged
7934         strings lists.  Recompute length of each merged string.
7935
7936 2010-07-15  Cary Coutant  <ccoutant@google.com>
7937
7938         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7939         here.
7940
7941 2010-07-14  Ian Lance Taylor  <iant@google.com>
7942
7943         * descriptors.cc (Descriptors::open): Report correct name in error
7944         message.
7945
7946 2010-07-13  Doug Kwan  <dougkwan@google.com>
7947
7948         * arm.cc (Arm_input_section::Arm_input_section): For a
7949         SHT_ARM_EXIDX section, always keeps the input sections.
7950         (Arm_input_section::set_exidx_section_link): New method.
7951         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7952         has_errors_ to false.
7953         (Arm_exidx_input_section::has_errors,
7954         Arm_exidx_input_section::set_has_errors): New methods.
7955         (Arm_exidx_input_section::has_errors_): New data member.
7956         (Arm_relobj::get_exidx_shndx_list): New method.
7957         (Arm_output_section::append_text_sections_to_list): Do not skip
7958         section without SHF_EXECINSTR.
7959         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7960         errors.
7961         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7962         section header.  Make error messages more verbose.  Check for
7963         a non-executable section linked to an EXIDX section.
7964         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7965         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7966         check that there is no deferred EXIDX section if we exit early.
7967         Instead of not making an EXIDX section in case of an error, make one
7968         and set the has_errors flag of it.
7969         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7970         in a relocatable link.
7971         (Target_arm::do_relax): Look for the EXIDX output section instead of
7972         assuming that it is called .ARM.exidx.
7973         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7974         section list.  Do not check for SHF_EXECINSTR section flags but
7975         skip any input section with errors.
7976         * output.cc (Output_section::Output_section): Initialize
7977         always_keeps_input_sections_ to false.
7978         (Output_section::add_input_section): Check for
7979         always_keeps_input_sections_.
7980         *  output.h (Output_section::always_keeps_input_sections,
7981         Output_section::set_always_keeps_input_sections): New methods.
7982         (Output_section::always_keeps_input_sections): New data member.
7983
7984 2010-07-13  Rafael Espindola  <espindola@google.com>
7985
7986         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7987         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7988
7989 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7990             Ian Lance Taylor  <iant@google.com>
7991
7992         * output.h (Output_section_lookup_maps::add_merge_section):
7993         Correct check of whether value was inserted.
7994         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7995         (Output_section_lookup_maps::add_relaxed_input_section):
7996         Likewise.
7997         * arm.cc (Target_arm::got_section): Remove used local os.
7998         * i386.cc (Target_i386::got_section): Likewise.
7999         * x86_64.cc (Target_x86_64::got_section): Likewise.
8000         * sparc.cc (Target_sparc::got_section): Likewise.
8001         (Target_sparc::relocate): Remove unused local have_got_offset.
8002         * powerpc.cc (Target_powerpc::relocate): Likewise.
8003
8004 2010-07-13  Ian Lance Taylor  <iant@google.com>
8005
8006         * compressed_output.cc (zlib_decompress): Fix signature in
8007         !HAVE_ZLIB_H case.
8008
8009         * archive.cc (Archive::include_member): Unlock an external member
8010         of a thin archive.  Don't bother to delete an object we know is
8011         NULL.
8012
8013 2010-07-12  Cary Coutant  <ccoutant@google.com>
8014
8015         * compressed_output.cc (zlib_decompress): New function.
8016         (get_uncompressed_size): New function.
8017         (decompress_input_section): New function.
8018         * compressed_output.h (get_uncompressed_size): New function.
8019         (decompress_input_section): New function.
8020         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
8021         Handle compressed debug sections.
8022         * layout.cc (is_compressed_debug_section): New function.
8023         (Layout::output_section_name): Map compressed section names to
8024         canonical names.
8025         * layout.h (is_compressed_debug_section): New function.
8026         (is_debug_info_section): Recognize compressed debug sections.
8027         * merge.cc: Include compressed_output.h.
8028         (Output_merge_data::do_add_input_section): Handle compressed
8029         debug sections.
8030         (Output_merge_string::do_add_input_section): Handle compressed
8031         debug sections.
8032         * object.cc: Include compressed_output.h.
8033         (Sized_relobj::Sized_relobj): Initialize new data members.
8034         (build_compressed_section_map): New function.
8035         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
8036         * object.h (Object::section_is_compressed): New method.
8037         (Object::do_section_is_compressed): New method.
8038         (Sized_relobj::Compressed_section_map): New type.
8039         (Sized_relobj::do_section_is_compressed): New method.
8040         (Sized_relobj::compressed_sections_): New data member.
8041         * output.cc (Output_section::add_input_section): Handle compressed
8042         debug sections.
8043         * reloc.cc: Include compressed_output.h.
8044         (Sized_relobj::write_sections): Handle compressed debug sections.
8045
8046 2010-07-08  Cary Coutant  <ccoutant@google.com>
8047
8048         * resolve.cc (Symbol_table::resolve): Remember whether undef was
8049         weak when resolving to a dynamic def.
8050         (Symbol_table::should_override): Add adjust_dyndef flag; set it
8051         for weak undef/dynamic def cases. Adjust callers.
8052         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
8053         undef_binding_weak_.
8054         (Symbol_table::sized_write_globals): Adjust symbol binding.
8055         (Symbol_table::sized_write_symbol): Add binding parameter.
8056         * symtab.h (Symbol::set_undef_binding): New method.
8057         (Symbol::is_undef_binding_weak): New method.
8058         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
8059         (Symbol_table::should_override): Add new parameter.
8060         (Symbol_table::sized_write_symbol): Add new parameter.
8061
8062         * testsuite/weak_undef_file1.cc: Add new test case.
8063         * testsuite/weak_undef_file2.cc: Fix header comment.
8064         * testsuite/weak_undef_test.cc: Add new test case.
8065
8066 2010-06-29  Doug Kwan  <dougkwan@google.com>
8067
8068         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8069         Initialize USE_SYMBOL_.
8070         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8071         definition.
8072         (Arm_reloc_property::uses_symbol_): New data member declaration.
8073         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8074         uses symbol value and symbol is undefined but not weakly undefined.
8075
8076 2010-06-28  Rafael Espindola  <espindola@google.com>
8077
8078         * plugin.cc (Plugin::load): Use dlerror.
8079
8080 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8081
8082         * symtab.cc (detect_odr_violations): When reporting an ODR
8083         violation, report an object where the symbol is defined.
8084
8085 2010-06-25  Doug Kwan  <dougkwan@google.com>
8086
8087         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8088         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8089         definition.
8090         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8091         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8092         target hook to detect function points.
8093         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8094         * icf.h (Icf::check_section_for_function_pointers): Change type of
8095         parameter SECTION_NAME to const reference to std::string.  Use
8096         target hook to determine if section may have unsafe pointers.
8097         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8098         method definition.
8099
8100 2010-06-21  Rafael Espindola  <espindola@google.com>
8101
8102         * fileread.cc (Input_file::find_fie): New
8103         (Input_file::open): Use Input_file::find_fie.
8104         * fileread.h (Input_file::find_fie): New
8105         * plugin.cc (set_extra_library_path): New.
8106         (Plugin::load): Add set_extra_library_path to the transfer vector.
8107         (Plugin_manager::set_extra_library_path): New.
8108         (Plugin_manager::add_input_file): Use the extra search path if set.
8109         (set_extra_library_path(): New.
8110         * plugin.h (Plugin_manager): Add set_extra_library_path and
8111         extra_search_path_.
8112
8113 2010-06-19  Cary Coutant  <ccoutant@google.com>
8114
8115         * layout.cc (gdb_sections): Add .debug_types.
8116         (lines_only_debug_sections): Likewise.
8117
8118 2010-06-18  Rafael Espindola  <espindola@google.com>
8119
8120         * plugin.cc (add_input_file,add_input_library)
8121         (Plugin_manager::add_input_file): Make filename arguments const.
8122         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8123         const.
8124
8125 2010-06-16  Doug Kwan  <dougkwan@google.com>
8126
8127         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8128         .ARM.attributes section if we have not merged any input
8129         attributes sections.
8130
8131 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8132
8133         * arm.cc: Allow combining objects with no EABI version
8134         information.
8135
8136 2010-06-15  Rafael Espindola  <espindola@google.com>
8137
8138         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8139
8140 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8141
8142         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8143         (struct iovec): Correct !HAVE_READV definition.
8144
8145 2010-06-10  Cary Coutant  <ccoutant@google.com>
8146
8147         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8148         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8149         reloc sections.
8150         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8151
8152         PR 11683
8153         * symtab.h (Symbol::is_placeholder): New member function.
8154         * target-reloc.h (relocate_section): Check for placeholder symbols.
8155
8156         * testsuite/Makefile.am (plugin_test_8): New test.
8157         (plugin_test_9): New test.
8158         * testsuite/Makefile.in: Regenerate.
8159
8160 2010-06-09  Nick Clifton  <nickc@redhat.com>
8161
8162         * yyscript.y (input_list_element): Allow strings prefixed with
8163         the '-' character.  Treat these as libraries.
8164         * script.cc (script_add_library): New function.  Adds a library
8165         specified by "-l<name>" found in an input script.
8166         * script-c.h: Add prototype for script_add_library.
8167
8168 2010-06-07  Doug Kwan  <dougkwan@google.com>
8169
8170         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8171         Restrict stub-group size to be within long conditional branch
8172         range when working around cortex-A8 erratum.
8173
8174 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8175
8176         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8177         #ifdef typo.
8178
8179 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8180
8181         PR gold/11658
8182         * output.cc
8183         (Output_section::Input_section_sort_entry::compare_section_ordering):
8184         Change to return non-zero correctly.
8185         (Output_section::Input_section_sort_section_order_index_compare
8186         ::operator()): Change to fix ambiguity in comparisons.
8187
8188 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8189
8190         * gold.h (is_wildcard_string): New function.
8191         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8192         (Layout::layout_eh_frame): Ditto.
8193         (Layout::find_section_order_index): New method.
8194         (Layout::read_layout_from_file): New method.
8195         * layout.h (Layout::find_section_order_index): New method.
8196         (Layout::read_layout_from_file): New method.
8197         (Layout::input_section_position_): New private member.
8198         (Layout::input_section_glob_): New private member.
8199         * main.cc (main): Call read_layout_from_file here.
8200         * options.h (--section-ordering-file): New option.
8201         * output.cc (Output_section::input_section_order_specified_): New
8202         member.
8203         (Output_section::Output_section): Initialize new member.
8204         (Output_section::add_input_section): Add new parameter.
8205         Keep input sections when --section-ordering-file is used.
8206         (Output_section::set_final_data_size): Sort input sections when
8207         section ordering file is specified.
8208         (Output_section::Input_section_sort_entry): Add new parameter.
8209         Check sorting type.
8210         (Output_section::Input_section_sort_entry::compare_section_ordering):
8211         New method.
8212         (Output_section::Input_section_sort_compare::operator()): Change to
8213         consider section_order_index.
8214         (Output_section::Input_section_sort_init_fini_compare::operator()):
8215         Change to consider section_order_index.
8216         (Output_section::Input_section_sort_section_order_index_compare
8217         ::operator()): New method.
8218         (Output_section::sort_attached_input_sections): Change to sort
8219         according to section order when specified.
8220         (Output_section::add_input_section<32, true>): Add new parameter.
8221         (Output_section::add_input_section<64, true>): Add new parameter.
8222         (Output_section::add_input_section<32, false>): Add new parameter.
8223         (Output_section::add_input_section<64, false>): Add new parameter.
8224         * output.h (Output_section::add_input_section): Add new parameter.
8225         (Output_section::input_section_order_specified): New
8226         method.
8227         (Output_section::set_input_section_order_specified): New method.
8228         (Input_section::Input_section): Initialize section_order_index_.
8229         (Input_section::section_order_index): New method.
8230         (Input_section::set_section_order_index): New method.
8231         (Input_section::section_order_index_): New member.
8232         (Input_section::Input_section_sort_section_order_index_compare): New
8233         struct.
8234         (Output_section::input_section_order_specified_): New member.
8235         * script-sections.cc (is_wildcard_string): Delete and move modified
8236         method to gold.h.
8237         (Output_section_element_input::Output_section_element_input): Modify
8238         call to is_wildcard_string.
8239         (Output_section_element_input::Input_section_pattern
8240         ::Input_section_pattern): Ditto.
8241         (Output_section_element_input::Output_section_element_input): Ditto.
8242         * testsuite/Makefile.am (final_layout): New test case.
8243         * testsuite/Makefile.in: Regenerate.
8244         * testsuite/final_layout.cc: New file.
8245         * testsuite/final_layout.sh: New file.
8246
8247 2010-06-01  Rafael Espindola  <espindola@google.com>
8248
8249         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8250
8251 2010-06-01  Rafael Espindola  <espindola@google.com>
8252
8253         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8254         visibility of symbols.
8255
8256 2010-05-27  Doug Kwan  <dougkwan@google.com>
8257
8258         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8259         from start of output section instead of address for a local symbol
8260         in a merged or relaxed section when doing a relocatable link.
8261
8262 2010-05-26  Rafael Espindola  <espindola@google.com>
8263
8264         PR 11604
8265         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8266         adding sections the garbage collector removed.
8267         * gold/testsuite/Makefile.am: Add test.
8268         * gold/testsuite/Makefile.in: Regenerate.
8269         * gold/testsuite/plugin_test_7.sh: New.
8270         * gold/testsuite/plugin_test_7_1.c: New.
8271         * gold/testsuite/plugin_test_7_2.c: New.
8272
8273 2010-05-26  Rafael Espindola  <espindola@google.com>
8274
8275         * script-sections.cc (Output_section_definition::set_section_addresses):
8276         Check for --section-start.
8277
8278 2010-05-26  Doug Kwan  <dougkwan@google.com>
8279
8280         * arm.cc (Arm_scan_relocatable_relocs): New class.
8281         (Target_arm::relocate_special_relocatable): New method.
8282         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8283         (Arm_relocate_functions::thumb_branch_common): Same.
8284         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8285         instead of Default_scan_relocatable_relocs.
8286         * target-reloc.h (relocate_for_relocatable): Let target handle
8287         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8288         * target.h (Sized_target::relocate_special_relocatable): New method.
8289
8290 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8291
8292         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8293
8294 2010-05-23  Doug Kwan  <dougkwan@google.com>
8295
8296         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8297         instead of a cast.
8298         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8299         with a direct branch, not a conditional branch, to a stub.
8300         * merge.cc (Output_merge_base::record_input_section): New method
8301         defintion.
8302         (Output_merge_data::do_add_input_section): Record input section if
8303         keeps-input-sections flag is set.
8304         (Output_merge_string::do_add_input_section): Ditto.
8305         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8306         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8307         INPUT_SECTIONS_.
8308         (Output_merge_base::keeps_input_sections,
8309         Output_merge_base::set_keeps_input_sections,
8310         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8311         method definitions.
8312         (Output_merge_base::Input_sections): New type declaration.
8313         (Output_merge_base::input_sections_begin,
8314         Output_merge_base::input_sections_end,
8315         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8316         (Output_merge_base::bool keeps_input_sections_,
8317         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8318         Output_merge_base::input_sections_): New data members.
8319         (Output_merge_data::do_set_keeps_input_sections): New method
8320         defintion.
8321         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8322         * output.cc (Output_section::Input_section::relobj): Move method
8323         defintion from class declaration to here and handle merge sections.
8324         (Output_section::Input_section::shndx): Ditto.
8325         (Output_section::Output_section): Remove initializations of removed
8326         data members and initialize new data member LOOKUP_MAPS_.
8327         (Output_section::add_input_section): Set keeps-input-sections flag
8328         for a newly created merge output section as appropriate.  Adjust code
8329         to use Output_section_lookup_maps class.
8330         (Output_section::add_relaxed_input_section): Adjst code for lookup
8331         maps code refactoring.
8332         (Output_section::add_merge_input_section): Add a new parameter
8333         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8334         class.  If adding input section to a newly created merge output
8335         section fails, remove the new merge section.
8336         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8337         Adjust code for use of the Output_section_lookup_maps class.
8338         (Output_section::find_merge_section): Ditto.
8339         (Output_section::build_lookup_maps): New method defintion.
8340         (Output_section::find_relaxed_input_section): Adjust code to use
8341         Output_section_lookup_maps class.
8342         (Output_section::get_input_sections): Export merge sections.  Adjust
8343         code to use Output_section_lookup_maps class.
8344         (Output_section:::add_script_input_section): Adjust code to use
8345         Output_section_lookup_maps class.  Update lookup maps for merge
8346         sections also.
8347         (Output_section::discard_states): Use Output_section_lookup_maps.
8348         (Output_section::restore_states): Same.
8349         * output.h (Merge_section_properties): Move class defintion out of
8350         Output_section.
8351         (Output_section_lookup_maps): New class.
8352         (Output_section::Input_section::is_merge_section): New method
8353         defintion.
8354         (Output_section::Input_section::relobj): Move defintion out of class
8355         defintion.  Declare method only.
8356         (Output_section::Input_section::shndx): Ditto.
8357         (Output_section::Input_section::output_merge_base): New method defintion.
8358         (Output_section::Input_section::u2_.pomb): New union field.
8359         (Output_section::Merge_section_by_properties_map,
8360         Output_section::Output_section_data_by_input_section_map,
8361         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8362         Remove types.
8363         (Output_section::add_merge_input_section): Add new parameter
8364         KEEPS_INPUT_SECTIONS.
8365         (Output_section::build_lookup_maps): New method declaration.
8366         (Output_section::merge_section_map_,
8367         Output_section::merge_section_by_properties_map_,
8368         Output_section::relaxed_input_section_map_,
8369         Output_section::is_relaxed_input_section_map_valid_): Remove data
8370         members.
8371         (Output_section::lookup_maps_): New data member.
8372
8373 2010-05-21  Doug Kwan  <dougkwan@google.com>
8374
8375         PR gold/11619
8376         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8377         avoid a compilation error.
8378
8379 2010-05-19  Rafael Espindola  <espindola@google.com>
8380
8381         * script-sections.cc (Output_section_definition::allocate_to_segment):
8382         Update the phdrs_list even when the output section is NULL.
8383         * testsuite/Makefile.am: Add test.
8384         * testsuite/Makefile.in: Regenerate.
8385         * testsuite/script_test_9.cc: New.
8386         * testsuite/script_test_9.sh: New.
8387         * testsuite/script_test_9.t: New.
8388
8389 2010-05-19  Doug Kwan  <dougkwan@google.com>
8390
8391         * arm.cc (Arm_input_section::original_size): New method.
8392         (Arm_input_section::do_addralign): Add a cast.
8393         (Arm_input_section::do_output_offset): Remove static cast.
8394         (Arm_input_section::original_addralign,
8395          Arm_input_section::original_size_): Change type to uint32_t.
8396         (Arm_input_section::init): Add safe casts for section alignment
8397         and size.
8398         (Arm_input_section::set_final_data_size): Do not set address and
8399         offset of stub table.
8400         (Arm_output_section::fix_exidx_coverage): Change use of of
8401         Output_section::Simple_input_section to that of
8402         Output_section::Input_section.
8403         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8404         except for the first pass.
8405         * output.cc (Output_section::get_input_sections): Change type of
8406         input_sections to std::list<Input_section>.
8407         (Output_section::add_script_input_section): Rename from
8408         Output_section::add_simple_input_section.  Change type of SIS
8409         parameter from Simple_input_section to Input_section.
8410         * output.h (Output_section::Simple_input_section): Remove class.
8411         (Output_section::Input_section): Change class visibility to public.
8412         (Output_section::Input_section::addralign): Use stored alignments
8413         for special input sections if set.
8414         (Output_section::Input_section::set_addralign): New method.
8415         (Output_section::get_input_sections): Change parameter type from
8416         list of Simple_input_section to list of Input_section.
8417         (Output_section::add_script_input_section): Rename from
8418         Output_section::add_simple_input_section. Change first parameter's
8419         type from Simple_input_section to Input_section and remove the
8420         second and third parameters.
8421         * script-sections.cc (Input_section::Input_section_list): Change
8422         type to list of Output_section::Input_section/
8423         (Input_section_info::Input_section_info): Change parameter type of
8424         INPUT_SECTION to Output_section::Input_section.
8425         (Input_section_info::input_section): Change return type.
8426         (Input_section_info::input_section_): Change type to
8427         Output_section::Input_section.
8428         (Output_section_element_input::set_section_addresses): Adjust code
8429         to use Output_section::Input_section instead of
8430         Output_section::Simple_input_section.  Adjust code for renaming
8431         of Output_section::add_simple_input_section.
8432         (Orphan_output_section::set_section_addresses): Ditto.
8433
8434 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8435
8436         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8437         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8438
8439 2010-05-18  Rafael Espindola  <espindola@google.com>
8440
8441         * options.cc (General_options::finalize): Handle -nostdlib.
8442         * options.h (nostdlib): New option.
8443         * script.cc (script_add_search_dir): Handle -nostdlib.
8444
8445 2010-05-12  Doug Kwan  <dougkwan@google.com>
8446
8447         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8448         attributes section only if there no attributes section after merging.
8449         (Target_arm::merge_object_attributes): Move value of
8450         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8451         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8452         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8453         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8454         and arm_attr_merge_7.stdout.
8455         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8456         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8457         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8458         arm_attr_merge_7b.o): New rules.
8459         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8460         arm_attr_merge_7
8461         * testsuite/Makefile.in: Regenerate.
8462         * testsuite/arm_attr_merge.sh: New file.
8463         * testsuite/arm_attr_merge_[67][ab].s: Same.
8464
8465 2010-05-05  Nick Clifton  <nickc@redhat.com>
8466
8467         * po/es.po: Updated Spanish translation.
8468
8469 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8470
8471         * Makefile.am (install-exec-local): Properly install gold as
8472         default cross linker.
8473         * Makefile.in: Regenerated.
8474
8475 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8476             Nick Clifton  <nickc@redhat.com>
8477
8478         * configure.ac (install_as_default): Define and set to false
8479         unless --enable-gold or --enable-gold=both/gold has been
8480         specified.
8481         * configure: Regenerate.
8482
8483         * Makefile.am (install-exec-local): Install the executable as
8484         'ld.gold'.  If install_as_default is true then also install it as
8485         'ld'.
8486         * Makefile.in: Regenerated.
8487
8488 2010-04-24  Ian Lance Taylor  <iant@google.com>
8489
8490         * layout.cc (Layout::layout_reloc): In relocatable link don't
8491         combine reloc sections for grouped sections.
8492
8493 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8494
8495         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8496         sections that are not ordinary to icf.
8497         * icf.cc (get_section_contents): Handle relocation pointing to section
8498         with no object or shndx information.
8499         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8500         * testsuite/Makefile.in: Regenerate.
8501         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8502         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8503
8504 2010-04-22  Ian Lance Taylor  <iant@google.com>
8505
8506         * expression.cc (Expression::Expression_eval_info): Add
8507         result_alignment_pointer field.
8508         (Expression::eval_with_dot): Add result_alignment_pointer
8509         parameter.  Change all callers.
8510         (Expression::eval_maybe_dot): Likewise.
8511         (class Binary_expression): Add alignment_pointer parameter to
8512         left_value and right_value.  Change all callers.
8513         (BINARY_EXPRESSION): Set result alignment.
8514         (class Trinary_expression): Add alignment_pointer parameter to
8515         arg2_value and arg3_value.  Change all callers.
8516         (Trinary_cond::value): Set result alignment.
8517         (Max_expression::value, Min_expression::value): Likewise.
8518         (Align_expression::value): Likewise.
8519         * script-sections.cc (class Sections_element): Add dot_alignment
8520         parameter to set_section_addresses virtual function.  Update
8521         instantiations.
8522         (class Output_section_element): Likewise.
8523         (Script_sections::create_segments): Add dot_alignment parameter.
8524         Change all callers.
8525         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8526         (Script_sections::set_phdrs_clause_addresses): Likewise.
8527         * script-sections.h: Update declarations.
8528         * script.h: Update declarations.
8529         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8530         min_p_align.
8531         * testsuite/script_test_3.t: Set large alignment.
8532         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8533         segment has expected alignment.
8534
8535 2010-04-22  Nick Clifton  <nickc@redhat.com>
8536
8537         * po/gold.pot: Updated by the Translation project.
8538         * po/vi.po: Updated Vietnamese translation.
8539
8540 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8541
8542         * testsuite/Makefile.am (check_PROGRAMS): Add
8543         icf_virtual_function_folding_test.
8544         * testsuite/Makefile.in: Regenerated.
8545
8546 2010-04-15  Andrew Haley  <aph@redhat.com>
8547
8548         * options.h (merge_exidx_entries): New option.
8549         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8550         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8551         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8552         (Target_arm::merge_exidx_entries): New function.
8553         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8554         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8555         to Arm_exidx_fixup constructor.
8556         Add new arg, merge_exidx_entries.
8557         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8558         Arm_output_section::fix_exidx_coverage.
8559
8560 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8561
8562         * icf.cc (get_section_contents): Check for preemptible functions.
8563         Ignore addend when appropriate.
8564         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8565         section folded.
8566         (add_from_relobj): Check for section folded.
8567         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8568         * symtab.h (should_add_dynsym_entry): Add new parameter.
8569         * target-reloc.h (scan_relocs): Check for section folded.
8570         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8571         Check reloc types for function pointers in shared objects.
8572         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8573         case.
8574         (icf_preemptible_functions_test): New test case.
8575         (icf_string_merge_test): New test case.
8576         * testsuite.Makefile.in: Regenerate.
8577         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8578         bar_glob.  Refactor code.
8579         * testsuite/icf_preemptible_functions_test.cc: New file.
8580         * testsuite/icf_preemptible_functions_test.sh: New file.
8581         * testsuite/icf_string_merge_test.cc: New file.
8582         * testsuite/icf_string_merge_test.sh: New file.
8583         * testsuite/icf_virtual_function_folding_test.cc: New file.
8584         * testsuite/icf_virtual_function_folding_test.sh: New file.
8585
8586 2010-04-14  Doug Kwan  <dougkwan@google.com>
8587
8588         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8589         for local symbol recounting if we remove a section due to ICF.
8590         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8591         there are no regular objects in input.
8592
8593 2010-04-13  Doug Kwan  <dougkwan@google.com>
8594
8595         * arm.cc (Arm_input_section::set_final_data_size): Compute
8596         accurate final data size instead of using current data size.
8597
8598 2010-04-09  Doug Kwan  <dougkwan@google.com>
8599
8600         * layout.cc (Layout::choose_output_section): Handle script section
8601         types.
8602         (Layout::make_output_section_for_script): Add section type parameter.
8603         Handle script section types.
8604         * layout.h (Layout::make_output_section_for_script): Add section
8605         type parameter.
8606         * output.cc (Output_section::Output_section): Initialize data member
8607         is_noload_.
8608         (Output_section::do_reset_address_and_file_offset): Do not set address
8609         to 0 if section is a NOLOAD section.
8610         * output.h (Output_section::is_noload): New method.
8611         (Output_section::set_is_noload): Ditto.
8612         (Output_section::is_noload_): New data member.
8613         * script-c.h (Script_section_type): New enum type.
8614         (struct Parser_output_section_header): Add new file section_type.
8615         * script-sections.cc (Sections_element::output_section_name): Add
8616         parameter for returning script section type.
8617         (Output_section_definition::output_section_name): Ditto.
8618         (Output_section_definition::section_type)P; New method.
8619         (Output_section_definiton::script_section_type_name): Ditto.
8620         (Output_section_definition::script_section_type_): New data member.
8621         (Output_section_definition::Output_section_definition): Initialize
8622         data member Output_section_definition::script_section_type_.
8623         (Output_section_definition::create_sections): Pass script section type
8624         to Layout::make_output_section_for_script.
8625         (Output_section_definition::output_section_name): Return script
8626         section type to caller.
8627         (Output_section_definition::set_section_address): Do not advance
8628         dot value and load address if section type is NOLOAD.  Set address
8629         of NOLOAD sections regardless of section flags.
8630         (Output_section_definition::print): Print section type if it is
8631         not SCRIPT_SECTION_TYPE_NONE.
8632         (Output_section_definition::section_type): New method.
8633         (Output_section_definition::script_section_type_name): Ditto.
8634         (Script_sections::output_section_name): Add new parameter
8635         PSECTION_TYPE for returning script section type.  Pass it to
8636         section elements.  Handle discard sections.
8637         (Sort_output_sections::operator()): Handle NOLOAD sections.
8638         * script-sections.h (Script_sections::Section_type): New enum type.
8639         (Script_sections::output_section_name): Add a new parameter for
8640         returning script section type.
8641         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8642         INFO and NOLOAD.
8643         * yyscript.y (union): Add new field SECTION_TYPE.
8644         (COPY, DSECT, INFO, NOLOAD): New tokens.
8645         (opt_address_and_section_type): Change type to output_section_header.
8646         (section_type): New non-terminal
8647         (section_header): Handle section type.
8648         (opt_address_and_section_type): Return section type value.
8649
8650 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8651
8652         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8653         * testsuite/plugin_common_test_2.c (foo): Likewise.
8654
8655 2010-04-08  Doug Kwan  <dougkwan@google.com>
8656
8657         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8658         Output_merge_data.
8659         * output.cc (Output_section::add_merge_input_section): Simplify
8660         code and return status of Output_merge_base::add_input_section.
8661         Update merge section map only if Output_merge_base::add_input_section
8662         returns true.
8663
8664 2010-04-07  Doug Kwan  <dougkwan@google.com>
8665
8666         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8667         if section is marked as containing instructions but has no mapping
8668         symbols.
8669         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8670         correct section index.
8671         (Arm_relobj::find_linked_text_section): Ditto.
8672
8673 2010-04-07  Cary Coutant  <ccoutant@google.com>
8674
8675         * archive.cc (include_member): Destroy Read_symbols_data object before
8676         releasing file.
8677         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8678         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8679         (Read_symbols_data::~Read_symbols_data) New destructor.
8680         (Section_relocs::Section_relocs) New constructor.
8681         (Section_relocs::~Section_relocs) New destructor.
8682         (Read_relocs_data::Read_relocs_data) New constructor.
8683         (Read_relocs_data::~Read_relocs_data) New destructor.
8684         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8685         pointers to NULL after deleting.
8686
8687 2010-04-07  Doug Kwan  <dougkwan@google.com>
8688
8689         * arm.cc: Replace "endianity" with "endianness" in comments.
8690         (Arm_exidx_cantunwind): Ditto.
8691         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8692         (Arm_relobj::merge_flags_and_attributes): New method.
8693         (Arm_relobj::merge_flags_and_attributes_): New data member.
8694         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8695         (Arm_relobj::scan_sections_for_stubs): Ditto.
8696         (Arm_relobj::do_read_symbols): Check to see if we really want to
8697         merge processor-specific flags and attributes.  Exit early if
8698         an object is empty except for section names and the undefined symbol.
8699         (Target_arm::do_finalize_sections): Move check for ELF format to
8700         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8701         attributes from a regular object only when we have determined that
8702         it is aapropriate.  Do not create an .ARM.attributes section in
8703         output if there is no regular input object.
8704         (Target_arm::merge_processor_specific_flags): Check
8705         --warn-mismatch before printing any error.
8706         (Target_arm::merge_object_attributes): Ditto.
8707         * gold.cc (queue_middle_tasks): Handle the case in which there is
8708         no regular object in input.
8709         * options.cc (General_options::parse_EB): New method.
8710         (General_options::parse_EL): Same.
8711         (General_options::General_options): Initialize endianness_.
8712         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8713         New options.
8714         (General_options::Endianness): New enum.
8715         (General_options::endianness): New method.
8716         (General_options::endianness_): New data member.
8717         * parameters.cc (Parameters::set_options): Check target endianness.
8718         (Parameters::set_target_once): Ditto.
8719         (Parameters::check_target_endianness): New method.
8720         (parameters_force_valid_target): If either -EL or -EB is specified,
8721         use it to define endianness of default target.
8722         * parameters.h (Parameters::check_target_endianness): New method
8723         declaration.
8724         * target.h (class Target): Change "endianity" to "endianness"
8725         in comments.
8726
8727 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8728
8729         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8730         * configure: Regenerate.
8731         * Makefile.in: Regenerate.
8732         * testsuite/Makefile.in: Regenerate.
8733
8734 2010-04-06  Cary Coutant  <ccoutant@google.com>
8735
8736         gcc PR lto/42757
8737         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8738         prevailing definitions of common symbols.
8739         * testsuite/plugin_test_6.sh: New test case.
8740         * testsuite/plugin_common_test_1.c: New test case.
8741         * testsuite/plugin_common_test_2.c: New test case.
8742         * testsuite/Makefile.am (plugin_test_6): New test case.
8743         * testsuite/Makefile.in: Regenerate.
8744
8745 2010-04-06  Nick Clifton  <nickc@redhat.com>
8746
8747         * po/vi.po: New Vietnamese translation.
8748
8749 2010-03-30  Doug Kwan  <dougkwan@google.com>
8750
8751         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8752
8753 2010-03-25  Doug Kwan  <dougkwan@google.com>
8754
8755         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8756         to avoid a conversion warning on a 32-bit host.
8757
8758 2010-03-24  Ian Lance Taylor  <iant@google.com>
8759
8760         * testsuite/script_test_3.t: Add a TLS segment.
8761         * testsuite/Makefile.am (check_PROGRAMS): Add
8762         tls_phdrs_script_test.
8763         (tls_phdrs_script_test_SOURCES): Define.
8764         (tls_phdrs_script_test_DEPENDENCIES): Define.
8765         (tls_phdrs_script_test_LDFLAGS): Define.
8766         (tls_phdrs_script_test_LDADD): Define.
8767         * testsuite/Makefile.in: Rebuild.
8768
8769 2010-03-23  Cary Coutant  <ccoutant@google.com>
8770
8771         * fileread.cc (find_or_make_view): Fix comment.
8772
8773 2010-03-23  Ian Lance Taylor  <iant@google.com>
8774
8775         * script-sections.cc (class Orphan_section_placement): Define
8776         PLACE_TLS and PLACE_TLS_BSS.
8777         (Orphan_section_placement::Orphan_section_placement): Initialize
8778         new places.
8779         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8780         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8781         (tls_script_test_SOURCES): Define.
8782         (tls_script_test_DEPENDENCIES): Define.
8783         (tls_script_test_LDFLAGS): Define.
8784         (tls_script_test_LDADD): Define.
8785         * testsuite/Makefile.in: Rebuild.
8786
8787 2010-03-22  Doug Kwan  <dougkwan@google.com>
8788
8789         * arm.cc (Arm_relocate_functions::abs8,
8790         Arm_relocate_functions::abs16): Use correct check for overflow
8791         specified in the ARM ELF specs.
8792         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8793         target of a BLX instruction specially.
8794         (Reloc_stub::stub_type_for_reloc): Ditto.
8795         (Relocate::relocate): Use symbolic names instead of numeric relocation
8796         codes to report error.
8797         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8798         workaround.
8799         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8800         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8801         thumb2_blx_out_of_range.stdout
8802         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8803         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8804         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8805         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8806         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8807         thumb2_blx_in_range, thumb2_blx_in_range.o,
8808         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8809         thumb2_blx_out_of_range.o): New rules.
8810         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8811         thumb2_blx_in_range and thumb2_blx_out_of_range.
8812         * testsuite/Makefile.in: Regenerate.
8813         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8814         * testsuite/thumb_blx_in_range.s: New file.
8815         * testsuite/thumb_blx_out_of_range.s: New file.
8816
8817 2010-03-22  Rafael Espindola  <espindola@google.com>
8818
8819         * archive.cc (Should_include): Move to archive.h.
8820         (should_include_member): Make it a member of Archive.
8821         (Lib_group): New.
8822         (Add_lib_group_symbols): New.
8823         * archive.h: Include options.h.
8824         (Archive_member): Moved from Archive.
8825         (Should_include): Moved from archive.cc.
8826         (Lib_group): New.
8827         (Add_lib_group_symbols): New.
8828         * dynobj.cc (do_should_include_member): New.
8829         * dynobj.h (do_should_include_member): New.
8830         * gold.cc (queue_initial_tasks): Update call to queue.
8831         * main.cc (main): Print lib group stats.
8832         * object.cc (do_should_include_member): New.
8833         * object.h: Include archive.h.
8834         (Object::should_include_member): New.
8835         (Object::do_should_include_member): New.
8836         (Sized_relobj::do_should_include_member): New.
8837         * options.cc (General_options::parse_start_lib): New.
8838         (General_options::parse_end_lib): New.
8839         (Input_arguments::add_file): Handle lib groups.
8840         (Input_arguments::start_group): Check we are not in a lib.
8841         (Input_arguments::start_lib): New.
8842         (Input_arguments::end_lib): New.
8843         * options.h (General_options): Add start_lib and end_lib.
8844         (Input_argument::lib_): New.
8845         (Input_argument::lib): New.
8846         (Input_argument::is_lib): New.
8847         (Input_file_lib): New.
8848         (Input_arguments::in_lib_): New.
8849         (Input_arguments::in_lib): New.
8850         (Input_arguments::start_lib): New.
8851         (Input_arguments::end_lib_): New.
8852         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8853         in unused members as preempted.
8854         (Sized_pluginobj::do_should_include_member): New.
8855         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8856         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8857         return the blocker.
8858         (Read_symbols::do_whole_lib_group): New.
8859         (Read_symbols::do_lib_group): New.
8860         (Read_symbols::do_read_symbols): Handle lib groups.
8861         (Read_symbols::get_name): Handle lib groups.
8862         * readsyms.h (Read_symbols): Add an archive member pointer.
8863         (Read_symbols::do_whole_lib_group): New.
8864         (Read_symbols::do_lib_group): New.
8865         (Read_symbols::member_): New.
8866         * script.cc (read_input_script): Update call to queue_soon.
8867
8868 2010-03-19  Doug Kwan  <dougkwan@google.com>
8869
8870         * arm.cc (Stub_table::Stub_table): Initialize new data members
8871         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8872         (Stub_table::add_reloc_stub): Assign stub offset and update
8873         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8874         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8875         New data members.
8876         (Stub_table::update_data_size_and_addralign): Use
8877         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8878         instead of going over all reloc stubs.
8879         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8880         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8881         Stringpool_template::offset_ to size of Stringpool_char.
8882         (Stringpool_template::new_key_offset): Remove code to initialize
8883         Stringpool_template::offset_.
8884         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8885         Stringpool_template::offset_ to zero.
8886
8887 2010-03-15  Doug Kwan  <dougkwan@google.com>
8888
8889         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8890         offset_.
8891         (Stringpool_template::new_key_offset): New method.
8892         (Stringpool_template::add_string): Assign offsets when adding new
8893         strings.
8894         (Stringpool_template::set_string_offsets): Do not set string offsets
8895         when not optimizing.
8896         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8897         member size_.
8898         (Chunked_vector::clear): Clear size_.
8899         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8900         (Chunked_vector::size): Return size_.
8901         (Chunked_vector::push_back): Use size_ to find insert position.
8902         (Chunked_vector::size_): New data member.
8903         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8904         (Stringpool_template::new_key_offset): New method declaration.
8905         (Stringpool_template::offset_): New data member.
8906
8907 2010-03-15   Rafael Espindola  <espindola@google.com>
8908
8909         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8910         Add_symbols' constructor.
8911         * readsyms.h (Add_symbols): Remove the input_group member.
8912
8913 2010-03-10  Ian Lance Taylor  <iant@google.com>
8914
8915         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8916         target to ask whether a reference to a symbol requires a stack
8917         split.
8918         * target.h (Target::is_call_to_non_split): New function.
8919         (Target::do_is_call_to_non_split): Declare virtual function.
8920         * target.cc: Include "symtab.h".
8921         (Target::do_is_call_to_non_split): New function.
8922         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8923
8924 2010-03-10  Cary Coutant  <ccoutant@google.com>
8925
8926         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8927         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8928         (File_read::open[2]): Add whole_file_view_ to list of views.
8929         (File_read::make_view): Remove test of whole_file_view_.
8930         (File_read::find_or_make_view): Create whole_file_view_ if
8931         necessary.
8932         (File_read::clear_views): Replace bool parameter with enum;
8933         adjust all callers.  Don't delete views with permanent data;
8934         do delete cached views and views from archives if
8935         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8936         if clearing the corresponding view.
8937         * fileread.h (File_read::Clear_views_mode): New enum.
8938         (File_read::View::is_permanent_view): New method.
8939         (File_read::clear_views): Replace bool parameter
8940         with enum; adjust all callers.
8941         * options.h (General_options): Change keep_files_mapped option;
8942         add map_whole_files.
8943         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8944         releasing the file.
8945         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8946         the file.
8947
8948 2010-03-10  David S. Miller  <davem@davemloft.net>
8949
8950         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8951
8952 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8953
8954         * icf.cc (get_section_contents): Add '@' marker after processing the
8955         merge reloc.
8956
8957 2010-03-08  Doug Kwan  <dougkwan@google.com>
8958
8959         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8960         due to a conversion warning.
8961         (Arm_relobj::update_output_local_symbol_count): Check for local
8962         symbol with unset output index.
8963
8964 2010-03-05  Ian Lance Taylor  <iant@google.com>
8965
8966         * options.h (class General_options): Add --spare-dynamic-tags.
8967         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8968         --spare-dynamic-tags.
8969
8970 2010-03-05  Ian Lance Taylor  <iant@google.com>
8971
8972         * incremental.cc: Include "libiberty.h".
8973
8974 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8975
8976         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8977         function, is_info_ member.
8978         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8979         (Versions::Versions): Update caller.
8980         (Versions::define_base_version): Likewise.
8981         (Versions::add_def): Likewise.
8982
8983 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8984
8985         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8986         (Scan::possible_function_pointer_reloc): New function.
8987         (Scan::local_reloc_may_be_function_pointer): Change to call
8988         possible_function_pointer_reloc.
8989         (Scan::global_reloc_may_be_function_pointer): Ditto.
8990         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8991         relocations in ".data.rel.ro._ZTV" section.
8992         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8993         * testsuite/icf_safe_so_test.cc: Ditto.
8994         * testsuite/icf_safe_test.cc: Ditto.
8995         * testsuite/icf_safe_test.sh: Ditto.
8996
8997 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8998             Ian Lance Taylor  <iant@google.com>
8999
9000         * target-reloc.h (relocate_section): Check the symbol table index
9001         for -1U before setting the local symbol index.
9002         (scan_relocatable_relocs): If copying the relocation, record that
9003         the local symbol is required.
9004         * object.h (Symbol_value::is_output_symtab_index_set): New
9005         function.
9006         (Symbol_value::may_be_discarded_from_output_symtab): New
9007         function.
9008         (Symbol_value::has_output_symtab_entry): New function.
9009         (Symbol_value::needs_output_symtab_entry): Remove.
9010         (Symbol_value::output_symtab_index): Make sure the symbol index is
9011         set.
9012         (Symbol_value::set_output_symtab_index): Make sure the symbol
9013         index is not set.  Make sure the new index is valid.
9014         (Symbol_value::set_must_have_output_symtab_entry): New function.
9015         (Symbol_value::has_output_dynsym_entry): New function.
9016         (Symbol_value::set_output_dynsym_index): Make sure the new index
9017         is valid.
9018         (Sized_relobj::set_must_have_output_symtab_entry): New function.
9019         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
9020         local symbol if permitted.
9021         (Sized_relobj::do_finalize_local_symbols): Call
9022         is_output_symtab_index_set rather than needs_output_symtab_entry.
9023         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
9024         rather than needs_output_symtab_entry.  Call
9025         has_output_dynsym_entry rather than needs_output_dynsym_entry.
9026         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
9027         is_output_symtab_index_set rather than needs_output_symtab_entry.
9028         * testsuite/discard_locals_relocatable_test.c: New file.
9029         * testsuite/discard_locals_test.sh: Test -r.
9030         * testsuite/Makefile.am (check_DATA): Add
9031         discard_locals_relocatable_test1.syms,
9032         discard_local_relocatable_test2.syms.
9033         (MOSTLYCLEANFILES): Likewise.  Also add
9034         discard_locals_relocatable_test1.lout and
9035         discard_locals_relocatable_test2.out.
9036         (discard_locals_relocatable_test1.syms): New target.
9037         (discard_locals_relocatable_test.o): New target.
9038         (discard_locals_relocatable_test1.out): New target.
9039         (discard_locals_relocatable_test2.syms): New target.
9040         (discard_locals_relocatable_test2.out): New target.
9041         (various): Add missing ../ld-new dependencies.
9042         * testsuite/Makefile.in: Rebuild.
9043
9044 2010-03-03  Nick Clifton  <nickc@redhat.com>
9045
9046         * po/fi.po: New Finnish translation.
9047
9048 2010-03-01  Doug Kwan  <dougkwan@google.com>
9049
9050         * layout.cc (Layout::Layout): Force section types of .init_array*,
9051         .preinit_array* and .fini_array* sections.
9052         * output.cc (Output_section::Input_section_sort_entry::has_priority):
9053         Fix check of return value of std::string::find.().
9054         (Output_section::Input_section_sort_compare::operator()): Remove
9055         comment about .init_array.
9056         (Output_section::Input_section_sort_init_fini_compare::operator()):
9057         New method.
9058         (Output_section::sort_attached_input_sections): Handle .init_array
9059         and .fini_array specially.
9060         * output.h (Output_section::Inut_section_sort_compare): Update
9061         comment.
9062         (Output_section::Input_section_sort_init_fini_compare): New struct.
9063
9064 2010-02-26  Doug Kwan  <dougkwan@google.com>
9065
9066         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9067         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9068         * testsuite/debug_msg.sh: Avoid matching source line number for
9069         use of global variable undef_int.
9070
9071 2010-02-26  Doug Kwan  <dougkwan@google.com>
9072
9073         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9074         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9075         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9076         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9077         * options.cc (General_options::General_options): Initialize member
9078         fix_v4bx_.
9079         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9080         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9081         and rm_no_fix_v4bx.stdout
9082         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9083         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9084         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9085         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9086         and arm_no_fix_v4bx.
9087         * Makefile.in: Regenerate.
9088         * testsuite/arm_fix_v4bx.s: New file.
9089         * testsuite/arm_fix_v4bx.sh: Ditto.
9090
9091 2010-02-24  Doug Kwan  <dougkwan@google.com>
9092
9093         * arm.cc (Target_arm::got_section): Make the .got section the first
9094         non RELRO section in the data segment.
9095         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9096         suffixes of section names.
9097
9098 2010-02-24  Doug Kwan  <dougkwan@google.com>
9099
9100         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9101         flags and attributes merging if an input file is a binary file.
9102         * fileread.cc (Input_file::open): Record format of original file.
9103         * fileread.h (Input_file::Format): New enum type.
9104         (Input_file::Input_file): Initialize data member format_.
9105         (Input_file::format): New method definition.
9106         (Input_file::format_):: New data member.
9107
9108 2010-02-24  Doug Kwan  <dougkwan@google.com>
9109
9110         * arm.cc (Arm_output_data_got): New class.
9111         (ARM_TCB_SIZE): New constant
9112         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9113         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9114         If user uses a script with a SECTIONS clause, issue only a warning
9115         for a misplaced EXIDX input section.  Otherwise, issue an error.
9116         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9117         garbage collection.
9118         (Target_arm::got_mode_index_entry): Handle static linking.
9119         (Target_arm::Scan::local): Ditto.
9120         (Target_arm::Scan::global): Ditto.
9121         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9122         all incorrectly implemented relocations.
9123         (Target_arm::fix_exidx_coverage): Pass layout to
9124         Arm_output_section::fix_exidx_coverage.
9125         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9126         from ".ARM.exidx." and ".ARM.extab.".
9127
9128 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9129
9130         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9131         section if it does not already exist.
9132         * attributes.cc (Attributes_section_data::Attributes_section_data):
9133         Don't crash if size is zero.
9134
9135 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9136             Ian Lance Taylor  <iant@google.com>
9137
9138         * gold.cc (queue_middle_tasks): If no input files were opened,
9139         exit.
9140         * workqueue.h (Task_function::Task_function): Assert that there is
9141         a blocker.
9142
9143 2010-02-22  Doug Kwan  <dougkwan@google.com>
9144
9145         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9146         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9147         types to avoid warnings due to different uint64_t implementations
9148         on different hosts.
9149
9150 2010-02-21  Doug Kwan  <dougkwan@google.com>
9151
9152         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9153         handling of the maximum backward branch offset.
9154         (Arm_relocate_functions::thumb_branch_common): Ditto.
9155         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9156         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9157         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9158         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9159         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9160         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9161         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9162         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9163         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9164         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9165         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9166         thumb2_bl_out_of_range.o): New rules.
9167         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9168         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9169         thumb2_bl_out_of_range
9170         * testsuite/Makefile.in: Regenerate.
9171         * testsuite/arm_bl_in_range.s: New file.
9172         * testsuite/arm_bl_out_of_range.s: Ditto.
9173         * testsuite/arm_branch_in_range.sh: Ditto.
9174         * testsuite/arm_branch_range.t: Ditto.
9175         * testsuite/thumb2_branch_range.t: Ditto.
9176         * testsuite/thumb_bl_in_range.s: Ditto.
9177         * testsuite/thumb_bl_out_of_range.s: Ditto.
9178         * testsuite/thumb_branch_range.t: Ditto.
9179
9180 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9181
9182         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9183         Add reloc offset information.
9184         * icf.cc (get_section_contents): Change iterators to point to the new
9185         vectors. Add reloc offset information to the contents.
9186         * icf.h (Icf::Sections_reachable_info): New typedef.
9187         (Icf::Sections_reachable_list): New typedef.
9188         (Icf::Offset_info): New typedef.
9189         (Icf::Reloc_info): New struct typedef.
9190         (Icf::Reloc_info_list): New typedef.
9191         (Icf::symbol_reloc_list): Delete method.
9192         (Icf::addend_reloc_list): Delete method.
9193         (Icf::section_reloc_list): Delete method.
9194         (Icf::reloc_info_list): New method.
9195         (Icf::reloc_info_list_): New member.
9196
9197 2010-02-19  Doug Kwan  <dougkwan@google.com>
9198
9199         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9200         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9201         * arm.cc (Arm_relocation_functions): New forward declaration.
9202         (Target_arm::Target_arm): Initialize new data members
9203         got_mod_index_offset_ and tls_base_symbol_defined_.
9204         (Target_arm::Relocate::relocate_tls): New method.
9205         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9206          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9207         New methods.
9208         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9209         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9210         (Target_arm::got_mod_index_offset_,
9211         Target_arm::tls_base_symbol_defined_): New data members.
9212         (Target_arm::Scan::local, Target::Scan::global,
9213         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9214         relocations.
9215
9216 2010-02-18  Doug Kwan  <dougkwan@google.com>
9217
9218         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9219         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9220         text section as a parameter becuase some broken tools may not set
9221         the link in section header.
9222         (Target_arm::has_got_section): New method.
9223         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9224         without any mapping symbol as data only.  Remove warning.
9225         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9226         link in its section header, try to discover the link by inspecting the
9227         REL31 relocation at the beginning of the section.
9228         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9229         in error message.
9230         (Target_arm::Scan::global): Treat any reference to the symbol
9231         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9232
9233 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9234
9235         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9236         (Scan::global_reloc_may_be_function_pointer): New function.
9237         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9238         (Scan::global_reloc_may_be_function_pointer): New function.
9239         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9240         (Scan::global_reloc_may_be_function_pointer): New function.
9241         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9242         (Scan::global_reloc_may_be_function_pointer): New function.
9243         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9244         (Scan::global_reloc_may_be_function_pointer): New function.
9245         (Scan::possible_function_pointer_reloc): New function.
9246         (Target_x86_64::can_check_for_function_pointers): New function.
9247         * gc.h (gc_process_relocs): Scan relocation types to determine if
9248         function pointers were taken for targets that support it.
9249         * icf.cc (Icf::find_identical_sections): Include functions for
9250         folding in safe ICF whose pointer is not taken.
9251         * icf.h (Secn_fptr_taken_set): New typedef.
9252         (fptr_section_id_): New member.
9253         (section_has_function_pointers): New function.
9254         (set_section_has_function_pointers): New function.
9255         (check_section_for_function_pointers): New function.
9256         * options.h: Fix comment for safe ICF option.
9257         * target.h (can_check_for_function_pointers): New function.
9258         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9259         Modify icf_safe_test for X86-64.
9260         * testsuite/Makefile.in: Regenerate.
9261         * testsuite/icf_safe_so_test.cc: New file.
9262         * testsuite/icf_safe_so_test.sh: New file.
9263         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9264         (main): Change to take pointer to function kept_func_3.
9265         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9266         folding is done correctly for X86-64.
9267
9268 2010-02-12  David S. Miller  <davem@davemloft.net>
9269
9270         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9271         is_symbolless parameter.
9272         (Output_reloc<SHT_REL>::is_symbolless): New.
9273         (Output_reloc<SHT_REL>::is_symbolless_): New.
9274         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9275         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9276         (Output_reloc<SHT_RELA>::is_symbolless): New.
9277         (Output_data_reloc::add_global): Handle is_symbolless.
9278         (Output_data_reloc::add_global_relative): Likewise.
9279         (Output_data_reloc::add_local): Likewise.
9280         (Output_data_reloc::add_local_relative): Likewise.
9281         (Output_data_reloc::add_symbolless_global_addend): New.
9282         (Output_data_reloc::add_symbolless_local_addend): New.
9283         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9284         is_symbolless.
9285         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9286         instead of ->is_relative_
9287         (Output_reloc::write): Likewise.
9288         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9289         (Output_reloc::write_rel): Simplify.
9290
9291         * sparc.cc (Target_sparc::Scan::local): Use
9292         ->add_symbolless_local_addend as needed.
9293         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9294         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9295         based upon relocation offset.
9296
9297 2010-02-11  Doug Kwan  <dougkwan@google.com>
9298
9299         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9300         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9301         beginning of function.
9302         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9303         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9304         parameter is_32bit in calls to should_apply_static_reloc.
9305         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9306         (check_DATA): Add arm_abs_global.stdout.
9307         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9308         arm_abs_global.stdout): New rules.
9309         (MOSTLLYCLEANFILES): Add arm_abs_global
9310         * Makefile.in: Regenerate.
9311         * testsuite/arm_abs_global.s: New file.
9312         * testsuite/arm_abs_global.sh: Ditto.
9313         * testsuite/arm_abs_lib.s: Ditto.
9314
9315 2010-02-11  Ian Lance Taylor  <iant@google.com>
9316
9317         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9318         Read_relocs task.
9319         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9320         Allocate_commons_task first.
9321         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9322         task, rather than symtab_lock_.
9323         (Gc_process_relocs::~Gc_process_relocs): New function.
9324         (Gc_process_relocs::is_runnable): Check this_blocker_.
9325         (Gc_process_relocs::locks): Use next_blocker_ rather than
9326         blocker_.
9327         (Scan_relocs::~Scan_relocs): New function.
9328         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9329         symtab_lock_.
9330         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9331         next_blocker_.
9332         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9333         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9334         constructor accordingly.
9335         (class Gc_process_relocs): Likewise.
9336         (class Scan_relocs): Likewise.
9337         * common.h (class Allocate_commons_task): Remove symtab_lock_
9338         field, and corresponding constructor parameter.
9339         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9340         symtab_lock_.
9341         (Allocate_commons_task::locks): Likewise.
9342
9343 2010-02-11  Ian Lance Taylor  <iant@google.com>
9344
9345         * gold-threads.h (class Once): Define.
9346         (class Initialize_lock): Rewrite as child of Once.
9347         * gold-threads.cc (class Once_initialize): Define.
9348         (once_pointer_control): New static variable.
9349         (once_pointer, once_arg): New static variables.
9350         (c_run_once): New static function.
9351         (Once::Once, Once::run_once, Once::internal_run): New functions.
9352         (class Initialize_lock_once): Remove.
9353         (initialize_lock_control): Remove.
9354         (initialize_lock_pointer): Remove.
9355         (initialize_lock_once): Remove.
9356         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9357         (Initialize_lock::initialize): Rewrite.
9358         (Initialize_lock::do_run_once): New function.
9359         * archive.cc (Archive::interpret_header): Only clear name if it is
9360         not already empty.
9361         * fileread.cc: Include "gold-threads.h"
9362         (file_counts_lock): New static variable.
9363         (file_counts_initialize_lock): Likewise.
9364         (File_read::release): Only increment counts when using --stats.
9365         Use a lock around the increment.
9366         * parameters.cc (class Set_parameters_target_once): Define.
9367         (set_parameters_target_once): New static variable.
9368         (Parameters::Parameters): Move here from parameters.h.
9369         (Parameters::set_target): Rewrite.
9370         (Parameters::set_target_once): New function.
9371         (Parameters::clear_target): Move here and rewrite.
9372         * parameters.h (class Parameters): Update declarations.  Add
9373         set_parameters_target_once_ field.
9374         (Parameters::Parameters): Move to parameters.cc.
9375         (Parameters::clear_target): Likewise.
9376         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9377         task.
9378         (Start_group::~Start_group): New function.
9379         (Start_group::is_runnable): New function.
9380         (Start_group::locks, Start_group::run): New functions.
9381         (Finish_group::run): Change saw_undefined to size_t.
9382         * readsyms.h (class Start_group): Define.
9383         (class Finish_group): Change saw_undefined_ field to size_t.
9384         (Finish_group::Finish_group): Remove saw_undefined and
9385         this_blocker parameters.  Change all callers.
9386         (Finish_group::set_saw_undefined): New function.
9387         (Finish_group::set_blocker): New function.
9388         * symtab.h (class Symbol_table): Change saw_undefined to return
9389         size_t.  Change saw_undefined_ field to size_t.
9390         * target-select.cc (Set_target_once::do_run_once): New function.
9391         (Target_selector::Target_selector): Initialize set_target_once_
9392         field.  Don't initialize lock_ and initialize_lock_ fields.
9393         (Target_selector::instantiate_target): Rewrite.
9394         (Target_selector::set_target): New function.
9395         * target-select.h (class Set_target_once): Define.
9396         (class Target_selector): Update declarations.  Make
9397         Set_target_once a friend.  Remove lock_ and initialize_lock_
9398         fields.  Add set_target_once_ field.
9399
9400 2010-02-10  Ian Lance Taylor  <iant@google.com>
9401
9402         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9403         queueing any tasks.
9404         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9405         (queue_middle_tasks): Add all blockers before queueing any tasks.
9406         (queue_final_tasks): Likewise.
9407         * token.h (Task_token::add_blockers): New function.
9408         * object.h (Input_objects::number_of_relobjs): New function.
9409
9410 2010-02-10  Ian Lance Taylor  <iant@google.com>
9411
9412         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9413         shared, not if not position independent.
9414         * x86_64.cc (Relocate::relocate_tls): Likewise.
9415         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9416         (tls_pie_pic_test): New target.
9417         * testsuite/Makefile.in: Rebuild.
9418
9419         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9420         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9421         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9422         * testsuite/Makefile.in: Rebuild.
9423
9424 2010-02-09  David S. Miller  <davem@davemloft.net>
9425
9426         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9427         R_SPARC_RELATIVE using ->add_local_relative().
9428         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9429
9430         * output.h (Output_data_dynamic::add_section_size): New method
9431         that takes two Output_data objects.
9432         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9433         entry param.  Handle it in initializers.
9434         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9435         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9436         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9437         arg.
9438         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9439         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9440         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9441         for dynrel_includes_plt.
9442         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9443         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9444         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9445         before .rela.plt
9446         (Target_sparc::do_finalize_sections): Update to pass true for
9447         dynrel_includes_plt.
9448         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9449         output before .rela.plt
9450         (Target_powerpc::do_finalize_sections): Update to pass true for
9451         dynrel_includes_plt when 32-bit.
9452
9453 2010-02-08  Doug Kwan  <dougkwan@google.com>
9454
9455         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9456         method.
9457         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9458         Arm_relobj::scan_section_for_cortex_a8_stubs,
9459         Arm_relobj::do_relocation_section): Instead of calling
9460         Output_section::output_address, use faster
9461         Arm_relobj::simple_input_section_output_address.
9462
9463 2010-02-08  David S. Miller  <davem@davemloft.net>
9464
9465         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9466         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9467         relocation helper function.
9468
9469         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9470         just like R_SPARC_GOT{10,13,22}.
9471         (Target_sparc::Scan::local): Likewise.
9472         (Target_sparc::Relocate:relocate): Likewise.
9473
9474 2010-02-06  Ian Lance Taylor  <iant@google.com>
9475
9476         * configure.ac: Rewrite targetobjs duplicate removal code to use
9477         only shell constructs.
9478         * configure: Rebuild.
9479
9480 2010-02-05  Doug Kwan  <dougkwan@google.com>
9481
9482         PR 11247
9483         * arm.cc (Arm_relobj::section_is_scannable): New method.
9484         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9485         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9486
9487 2010-02-04  Doug Kwan  <dougkwan@google.com>
9488
9489         PR 11247
9490         * arm-reloc-property.cc (cstdio): Include.
9491         * configure.ac (targetobjs): Remove duplicates.
9492         * configure: Regenerate.
9493         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9494         big and little endian version for a given address size.
9495
9496 2010-02-03  Doug Kwan  <dougkwan@google.com>
9497
9498         * arm-reloc-property.cc
9499         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9500         definition.
9501         * arm-reloc-property.h
9502         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9503         New method definition.
9504         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9505         declaration.
9506         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9507         overflow to N.
9508         (GOT_PREL): Change implemented to Y.
9509         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9510         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9511         (Arm_relocate_functions::movw_abs_nc): Remove method.
9512         (Arm_relocate_functions::movt_abs): Ditto.
9513         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9514         (Arm_relocate_functions::thm_movt_abs): Ditto.
9515         (Arm_relocate_functions::movw_rel_nc): Ditto.
9516         (Arm_relocate_functions::movw_rel): Ditto.
9517         (Arm_relocate_functions::movt_rel): Ditto.
9518         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9519         (Arm_relocate_functions:thm_movw_rel): Ditto.
9520         (Arm_relocate_functions:thm_movt_rel): Ditto.
9521         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9522         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9523         New method definitions.
9524         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9525         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9526         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9527         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9528         (Target_arm::Relocate::relocate): Check for non-static or
9529         unimplemented relocation code and exit early.  Change calls to
9530         Target_arm::reloc_uses_thumb_bit and
9531         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9532         instead.  Refactor code to handle similar relocations to increase
9533         code sharing.  Remove check for unsupported relocation code in switch
9534         statement.
9535         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9536         relocation property table to find out size.  Change error message to
9537         print out the name of a relocation code instead of the numeric value.
9538         (Target_arm::scan_reloc_for_stub): Use relocation property table
9539         instead of calling Target_arm::reloc_uses_thumb_bit().
9540
9541 2010-02-02  Doug Kwan  <dougkwan@google.com>
9542
9543         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9544         types of relaxed input section.
9545
9546 2010-02-02  Doug Kwan  <dougkwan@google.com>
9547
9548         * Makefile.am (HFILES): Add arm-reloc-property.h.
9549         (DEFFILES): New.
9550         (TARGETSOURCES): Add arm-reloc-property.cc
9551         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9552         (libgold_a_SOURCES): $(DEFFILES)
9553         * Makefile.in: Regenerate.
9554         * arm-reloc-property.cc: New file.
9555         * arm-reloc-property.h: New file.
9556         * arm-reloc.def: New file.
9557         * arm.cc: Update comments.
9558         (arm-reloc-property.h): New included header.
9559         (arm_reloc_property_table): New global variable.
9560         (Target_arm::do_select_as_default_target): New method definition.
9561         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9562         arm-reloc-property to targ_extra_obj.
9563         * parameters.cc (set_parameters_target): Call
9564         Target::select_as_default_target().
9565         * target.h (Target::select_as_default_target): New method definition.
9566         (Target::do_select_as_default_target): Same.
9567
9568 2010-02-01  Doug Kwan  <dougkwan@google.com>
9569
9570         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9571         first_output_text_section_.
9572         (Arm_exidx_fixup::first_output_text_section): New method definition.
9573         (Arm_exidx_fixup::first_output_text_section_): New data member.
9574         (Arm_exidx_fixup::process_exidx_section): Record the first text
9575         output section seen.
9576         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9577         and entsize in output section header.
9578
9579 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9580
9581         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9582         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9583         (Arm_relocate_functions::thm_alu11): New Method.
9584         (Arm_relocate_functions::thm_pc8): New Method.
9585         (Arm_relocate_functions::thm_pc12): New Method.
9586         (Target_arm::Scan::local): Handle the relocations.
9587         (Target_arm::Scan::global): Likewise.
9588         (Target_arm::Relocate::relocate): Likewise.
9589         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9590
9591 2010-01-29  Doug Kwan  <dougkwan@google.com>
9592
9593         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9594         of relocation types as ld.
9595
9596 2010-01-29  Doug Kwan  <dougkwan@google.com>
9597
9598         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9599         to public.
9600         (Arm_relocate_functions::thumb_branch_common): Ditto.
9601         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9602         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9603         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9604         Arm_relocate_functions::jump24): Remove.
9605         (Target_arm::Relocate::relocate): Adjust code to call
9606         Arm_relocation_functions::arm_branch_common and
9607         Arm_relocation_functions::thumb_branch_common instead of their removed
9608         wrappers.  Merge switch-cases together to reduce source code size.
9609
9610 2010-01-29  Doug Kwan  <dougkwan@google.com>
9611
9612         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9613         output_local_symbol_count_needs_update_.
9614         (Arm_relobj::output_local_symbol_count_needs_update,
9615          Arm_relobj::set_output_local_symbol_count_needs_update,
9616          Arm_relobj::update_output_local_symbol_count): New methods.
9617         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9618         member.
9619         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9620         of pointed function as in a R_ARM_PREL31 relocation.
9621         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9622         for output local symbol count updating.
9623         (Target_arm::do_relax): Update output local symbol counts in objects
9624         if necessary.
9625         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9626
9627 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9628
9629         * arm.cc: Added support for the ARM relocations:
9630         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9631         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9632         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9633         movw_prel_nc).
9634         (Arm_relocate_functions::movw_rel): New method.
9635         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9636         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9637         thm_movw_prel_nc).
9638         (Arm_relocate_functions::thm_movw_rel): New method.
9639         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9640         thm_movt_prel).
9641         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9642         relocations.
9643         (Target_arm::Scan::global): Likewise.
9644         (Target_arm::Relocate::relocate): Likewise.
9645         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9646         Likewise.
9647
9648 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9649
9650         * arm.cc: Added support for ARM group relocations.
9651         (Target_arm::reloc_needs_sym_origin): New method.
9652         (Arm_relocate_functions::calc_grp_kn): New method.
9653         (Arm_relocate_functions::calc_grp_residual): New method.
9654         (Arm_relocate_functions::calc_grp_gn): New method.
9655         (Arm_relocate_functions::arm_grp_alu): New Method.
9656         (Arm_relocate_functions::arm_grp_ldr): New Method.
9657         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9658         (Arm_relocate_functions::arm_grp_ldc): New Method.
9659         (Target_arm::Scan::local): Handle the ARM group relocations.
9660         (Target_arm::Scan::global): Likewise.
9661         (Target_arm::Relocate::relocate): Likewise.
9662         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9663         Likewise.
9664
9665 2010-01-26  Doug Kwan  <dougkwan@google.com>
9666
9667         * arm.cc (set): Include.
9668         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9669         pointer type.
9670         (Arm_output_section::Text_section_list): New type.
9671         (Arm_output_section::append_text_sections_to_list): New method.
9672         (Arm_output_section::fix_exidx_coverage): Ditto.
9673         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9674         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9675         Relobj::set_section_offset() instead of
9676         Sized_relobj::invalidate_section_offset().
9677         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9678         parameter for section headers. Ignore relocation sections for
9679         unallocated sections and EXIDX sections.
9680         (Target_arm::fix_exidx_coverage): New method.
9681         (Target_arm::output_section_address_less_than): New type.
9682         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9683         linked text section instead of the EXIDX section.
9684         (Arm_output_section::create_stub_group): Add an assertion to check
9685         that this is not an EXIDX output section.
9686         (Arm_output_section::append_text_sections_to_list): New method.
9687         (Arm_output_section::fix_exidx_coverage): Ditto.
9688         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9689         Arm_relobj::section_needs_reloc_stub_scanning.
9690         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9691         first pass.
9692         (Target_arm::fix_exidx_coverage): New method.
9693         * object.h (Relobj::set_output_section): New method.
9694         (Sized_relobj::invalidate_section_offset): Remove method.
9695         (Sized_relobj::do_invalidate_section_offset): Remove method.
9696         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9697
9698 2010-01-25  Doug Kwan  <dougkwan@google.com>
9699
9700         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9701         Fix warning due to signed and unsigned comparison on a 32-bit host.
9702
9703 2010-01-22  Doug Kwan  <dougkwan@google.com>
9704
9705         * arm.cc (Target_arm::do_relax): Record an output section for section
9706         offset adjustment it contains any stub table that has changed.
9707         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9708         offsets in an output section if necessary.
9709         * output.cc (Output_section::Output_section): Initialize
9710         section_offsets_need_adjustments_.
9711         (Output_section::add_input_section_for_script): Renamed to
9712         Output_section::add_simple_input_section.
9713         (Output_section::save_states): Add a comment.
9714         (Output_section::discard_states): New method defintion.
9715         (Output_section::adjust_section_offsets): Same.
9716         * output.h (Output_section::add_input_section_for_script): Renamed to
9717         Output_section::add_simple_input_section.
9718         (Output_section::discard_states): New method declaration.
9719         (Output_section::adjust_section_offsets): Same.
9720         (Output_section::section_offsets_need_adjustment,
9721         Output_section::set_section_offsets_need_adjustment): New method
9722         definitions.
9723         (Output_section::section_offsets_need_adjustment_): New data member.
9724         * script-sections.cc
9725         (Output_section_element_input::set_section_address): Adjust code for
9726         renaming of Output_section::add_input_section_for_script.
9727         (Orphan_output_section::set_section_address): Same.
9728
9729 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9730
9731         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9732         Fix_v4bx enum values .
9733         * gold/options.h (General_options): New option definitions.
9734         (General_options::fix_v4bx): New method.
9735         (General_options::Fix_v4bx): New enum.
9736         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9737         (General_options::parse_fix_v4bx_interworking): New method.
9738
9739 2010-01-22  Doug Kwan  <dougkwan@google.com>
9740
9741         * arm.cc (Arm_exidx_fixup): New class.
9742
9743 2010-01-21  Doug Kwan  <dougkwan@google.com>
9744
9745         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9746         classes.
9747         (Arm_exidx_section_offset_map): New type.
9748
9749 2010-01-21  Doug Kwan  <dougkwan@google.com>
9750
9751         * arm.cc (Arm_exidx_input_section): New class.
9752         (Arm_relobj::exidx_input_section_by_link,
9753         Arm_relobj::exidx_input_section_by_shndx,
9754         Arm_relobj::make_exidx_input_section): New methods.
9755         (read_arm_attributes_section): Remove.
9756         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9757         information about them.
9758         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9759         to here.
9760
9761 2010-01-20  Doug Kwan  <dougkwan@google.com>
9762
9763         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9764         Input_section_specifier to Section_id.
9765         (Target_arm::new_arm_input_section: Adjust code for change of key
9766         type.
9767         (Target_arm::find_arm_input_section): Ditto.
9768         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9769         (Section_id): Remove.
9770         (Garbage_collection::Section_id_hash): Remove.
9771         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9772         (Section_id): Remove.
9773         (Icf::Section_id_hash): Remove.
9774         * object.h (Section_id, Const_section_id, Section_id_hash,
9775         Const_section_id_hash): New type definitions.
9776         * output.cc (Output_section::add_relaxed_input_section): Change to
9777         use Const_section_id instead of Input_section_specifier as key type.
9778         (Output_section::add_merge_input_section): Ditto.
9779         (Output_section::build_relaxation_map): Change to use Section_id
9780         instead of Input_section_specifier as key type.
9781         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9782         Ditto.
9783         (Output_section::convert_input_sections_to_relaxed_sections): Change
9784         to use Const_section_id instead of Input_section_specifier as key type.
9785         (Output_section::find_merge_section): Ditto.
9786         (Output_section::find_relaxed_input_section): Ditto.
9787         * output.h (Input_section_specifier): Remove class.
9788         (Output_section::Output_section_data_by_input_section_map): Change
9789         key type to Const_section_id.
9790         (Output_section::Output_relaxed_input_section_by_input_section_map):
9791         Ditto.
9792         (Output_section::Relaxation_map): Change key type to Section_id.
9793
9794 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9795
9796         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9797         (class Arm_v4bx_stub): New class.
9798         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9799         (Stub_factory::make_arm_v4bx_stub): New method.
9800         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9801         (Stub_table::empty): Handle v4bx stubs.
9802         (Stub_table::add_arm_v4bx_stub): New method.
9803         (Stub_table::find_arm_v4bx_stub): New method.
9804         (Arm_relocate_functions::v4bx): New method.
9805         (Target_arm::fix_v4bx): New method.
9806         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9807         (Stub_table::relocate_stubs): Likewise.
9808         (Stub_table::do_write): Likewise.
9809         (Stub_table::update_data_size_and_addralign): Likewise.
9810         (Stub_table::finalize_stubs):  Likewise.
9811         (Target_arm::Scan::local): Likewise.
9812         (Target_arm::Scan::global): Likewise.
9813         (Target_arm::do_finalize_sections): Likewise.
9814         (Target_arm::Relocate::relocate): Likewise.
9815         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9816         Likewise.
9817         (Target_arm::scan_reloc_for_stub): Likewise.
9818         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9819
9820 2010-01-19  Ian Lance Taylor  <iant@google.com>
9821
9822         * output.cc (Output_section_headers::do_sized_write): Write large
9823         segment count to sh_info field.
9824         (Output_file_header::do_sized_write): For large segment count,
9825         write PN_XNUM to e_phnum field.
9826
9827 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9828
9829         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9830         (Arm_relocate_functions::thm_jump8): New function.
9831         (Arm_relocate_functions::thm_jump11): New function.
9832         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9833         R_ARM_THM_JUMP11.
9834         (Target_arm::Scan::global): Likewise.
9835         (Target_arm::Relocate::relocate): Likewise.
9836         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9837         Likewise.
9838
9839 2010-01-14  Doug Kwan  <dougkwan@google.com>
9840
9841         * arm.cc (map, utility): Include headers.
9842         (Target_arm::apply_cortex_a8_workaround): New method.
9843         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9844         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9845         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9846         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9847         the --[no-]fix-cortex-a8 command line options.
9848         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9849         (Target_arm::relocate_stub): Use addend in instruction template.
9850         * options.h (DEFINE_bool): Set the user-set flag.
9851         (General_options): Add --[no-]-fix-cortex options.
9852         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9853         : Update fast look-up map after conversion.
9854
9855 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9856
9857         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9858         in the first pass of do_layout.
9859
9860 2010-01-13  Doug Kwan  <dougkwan@google.com>
9861
9862         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9863         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9864         apparent compiler problem of not folding static constant integral
9865         data members of elfcpp::Elf_sizes<32>.
9866
9867 2010-01-13  Doug Kwan  <dougkwan@google.com>
9868
9869         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9870         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9871         Arm_relobj::scan_section_for_cortex_a8_erratum,
9872         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9873         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9874         sections to scan for relocation stubs into a new method
9875         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9876         relocation and Cortex-A8 stub scanning.
9877         (Target_arm::do_relax): Force stubs to be after stubbed sections
9878         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9879         the beginning of a new relaxation pass.  Update a comment.
9880         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9881
9882 2010-01-12  Ian Lance Taylor  <iant@google.com>
9883
9884         * target-reloc.h (visibility_error): New inline function.
9885         (relocate_section): Call visibility_error.
9886         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9887         (MOSTLYCLEANFILES): Likewise.
9888         (protected_4_pic.o, protected_3.err): New targets.
9889         * testsuite/protected_4.cc: New file.
9890
9891 2010-01-12  Doug Kwan  <dougkwan@google.com>
9892
9893         * arm.cc (Cortex_a8_reloc): New class.
9894         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9895         and cortex_a8_relocs_info_.
9896         (Target_arm::fix_cortex_a8): New method definition.
9897         (Target_arm::Cortex_a8_relocs_info): New type.
9898         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9899         New data member declarations.
9900         (Target_arm::scan_reloc_for_stub): Record information about
9901         relocations for THUMB branches that might be exempted from the
9902         Cortex-A8 workaround.
9903         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9904         at the beginning of a relaxation pass.
9905
9906 2010-01-12  Doug Kwan  <dougkwan@google.com>
9907
9908         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9909         (Arm_relobj::Mapping_symbol_position,
9910          Arm_reloj::Mapping_symbol_position_less,
9911          Arm_relobj::Mapping_symbols_info): New types.
9912         (Target_arm::is_mapping_symbol_name): New method definition.
9913         (Arm_relobj::do_count_local_symbols): Save information about mapping
9914         symbols.
9915
9916 2010-01-11  Doug Kwan  <dougkwan@google.com>
9917
9918         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9919         Arm_relocate_functions::thumb32_branch_upper,
9920         Arm_relocate_functions::thumb32_branch_lower,
9921         Arm_relocate_functions::thumb32_cond_branch_offset,
9922         Arm_relocate_functions::thumb32_cond_branch_upper,
9923         Arm_relocate_functions::thumb32_cond_branch_lower,
9924         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9925         branch offset encoding.
9926         (Arm_relocate_functions::thumb_branch_common): Use new branch
9927         offset encoding methods to avoid code duplication.
9928         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9929         (Stub_addend_reader::operator()): Use new branch encoding method
9930         to avoid code duplication.
9931
9932 2010-01-11  Doug Kwan  <dougkwan@google.com>
9933
9934         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9935         (Target_arm::do_finalize_sections): Define special EXIDX section
9936         symbols only if referenced.
9937         * gc.h (Garbage_collection::add_reference): New method.
9938         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9939         code duplication.
9940
9941 2010-01-11  Ian Lance Taylor  <iant@google.com>
9942
9943         * script.cc (Version_script_info::build_expression_list_lookup):
9944         Change complaing about duplicate wildcard match from error to
9945         warning.
9946
9947         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9948         of 2009-12-30.
9949         (Version_script_info::Version_script_info): Initialize globs_,
9950         default_version_, default_is_global_, and exact_.  Don't
9951         initialize globals_ or locals_.
9952         (Version_script_info::build_lookup_tables): Build local symbols
9953         first.
9954         (Version_script_info::unquote): New function.
9955         (Version_script_info::add_exact_match): New function.
9956         (Version_script_info::build_expression_list_lookup): Remove lookup
9957         parameter.  Add is_global parameter.  Change all callers.  Handle
9958         wildcard pattern specially.  Unquote pattern.  Call
9959         add_exact_match.
9960         (Version_script_info::get_name_to_match): New function.
9961         (Version_script_info::get_symbol_version): New function.
9962         (Version_script_info::get_symbol_version_helper): Remove.
9963         (Version_script_info::check_unmatched_names): Call unquote.
9964         * script.h (class Version_script_info): Change get_symbol_version
9965         to be non-inline and add is_global parameter; change all callers.
9966         Rewrite symbol_is_local.  Update declarations.  Define struct
9967         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9968         Remove globals_ and locals_ members.  Add exact_, globs_,
9969         default_version_, is_global_.
9970         (Version_script_info::Glob): Remove pattern, add expression and
9971         is_global.  Update constructor.  Change all callers.
9972         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9973         default version.
9974         (Versions::symbol_section_contents): If a symbol is undefined, or
9975         defined in a dynamic object, set the version index to
9976         VER_NDX_LOCAL.
9977         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9978         symbol_is_local.
9979         (Symbol_table::add_from_pluginobj): Likewise.
9980         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9981
9982 2010-01-11  Doug Kwan  <dougkwan@google.com>
9983
9984         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9985         (incremental_dump_LDADD): Add linking option for libintl.
9986         * Makefile.in: Regenerate.
9987
9988 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9989
9990         PR gold/11144
9991         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9992         instead of -Ds.
9993         * testsuite/Makefile.in: Regenerated.
9994
9995 2010-01-10  Doug Kwan  <dougkwan@google.com>
9996
9997         * options.h (DEFINE_var): Use parentheses around argument varname__
9998         in macro body to avoid any unintended subsequent substitutions.
9999
10000 2010-01-10  Ian Lance Taylor  <iant@google.com>
10001
10002         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
10003         candidates before doing symbol resolution.
10004
10005         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
10006         ODR candidates if only one is weak.
10007
10008 2010-01-08  Ian Lance Taylor  <iant@google.com>
10009
10010         * script.cc (Version_script_info::build_expression_list_lookup):
10011         Don't warn about ambiguous version, just record the ambiguity.
10012         (Version_script_info::get_symbol_version_helper): Give error if
10013         version is ambiguous.
10014
10015 2010-01-08  Doug Kwan  <dougkwan@google.com>
10016
10017         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
10018         prev_data_size_ and prev_addralign_.  Remove initializer for
10019         deleted data member has_been_changed_.
10020         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
10021         to determine if the table is empty.
10022         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
10023         Remove.
10024         (Stub_table::add_reloc_stub): Define method in class definition
10025         instead of just declaring it there.
10026         (Stub_table::add_cortex_a8_stub): New method definition.
10027         (Stub_table::update_data_size_and_addralign): Ditto.
10028         (Stub_table::finalize_stubs): Ditto.
10029         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
10030         (Stub_table::do_addralign_): Return address alignment in the
10031         (Stub_table::do_reset_address_and_file_offset): Define method in
10032         class definition instead of declaring it there.  Set current data
10033         size to be the data size of the previous pass.
10034         (Stub_table::set_final_data_size): Use current data size as the
10035         final data size.
10036         (Stub_table::relocate_stub): Change parameter type of stub from
10037         Reloc_stub pointer to Stub pointer.
10038         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
10039         (Stub_table::Cortex_a8_stub_list): New typedef.
10040         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
10041          Stub_table::prev_addralign_): New data member.
10042         (Arm_relobj::Arm_relobj): Initialize data member
10043         section_has_cortex_a8_workaround_.
10044         (Arm_relobj::section_has_cortex_a8_workaround,
10045          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
10046          definitions.
10047         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
10048         declarations.
10049         (Target_arm::relocate_stub): Change parameter type of stub from
10050         Reloc_stub pointer to Stub pointer.
10051         (Insn_template::size, Insn_template::alignment): Handle
10052         THUMB16_SPECIAL_TYPE.
10053         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
10054          Stub_table::update_data_size_and_addralign,
10055          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
10056         definitions.
10057         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
10058         (Stub_table::do_write): Ditto.
10059         (Target_arm::do_relax): Adjust code for changes in Stub_table.
10060
10061 2010-01-08  Ian Lance Taylor  <iant@google.com>
10062
10063         PR 11108
10064         * symtab.h (class Symbol): Remove fields is_target_special_ and
10065         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10066         (Symbol::is_defined_in_discarded_section): New function.
10067         (Symbol::set_is_defined_in_discarded_section): New function.
10068         (Symbol::has_plt_offset): Rewrite.
10069         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10070         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10071         Don't initialize is_target_special_ or has_plt_offset_.
10072         Initialize is_defined_in_discarded_section_.
10073         (Symbol_table::add_from_relobj): If appropriate, set
10074         is_defined_in_discarded_section.
10075         * resolve.cc (Symbol::override_base_with_special): Don't test
10076         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10077         * target-reloc.h (relocate_section): Do special handling for
10078         symbols defined in discarded sections for global symbols as well
10079         as local symbols.
10080
10081 2010-01-08  Ian Lance Taylor  <iant@google.com>
10082
10083         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10084         the SHT_SYMTAB case.
10085
10086 2010-01-08  Ian Lance Taylor  <iant@google.com>
10087
10088         * object.cc (Sized_relobj::do_layout): Don't get confused if
10089         layout_eh_frame returns NULL.
10090
10091 2010-01-08  Ian Lance Taylor  <iant@google.com>
10092
10093         PR 11084
10094         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10095         dynamic symbol table, use the normal symbol table.
10096         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10097         symbol table.
10098
10099 2010-01-08  Ian Lance Taylor  <iant@google.com>
10100
10101         PR 11072
10102         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10103         sections.
10104
10105 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10106
10107         * version.cc (print_version): Change to "Copyright 2010".
10108
10109 2010-01-08  Ian Lance Taylor  <iant@google.com>
10110
10111         PR 10287
10112         PR 11063
10113         * i386.cc (class Target_i386): Change return type of plt_section
10114         to be non-const.
10115         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10116         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10117         tls_desc_rel_ field.
10118         (Output_data_plt_i386::rel_tls_desc): New function.
10119         (Target_i386::rel_tls_desc_section): New function.
10120         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10121         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10122         R_386_TLS_DESC reloc in rel_tls_desc_section.
10123         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10124         Define struct Tlsdesc_info.
10125         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10126         (Target_x86_64::do_reloc_symbol_index): New function.
10127         (Target_x86_64::add_tlsdesc_info): New function.
10128         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10129         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10130         tlsdesc_rel_ field.
10131         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10132         all callers.
10133         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10134         (Target_x86_64::rela_tlsdesc_section): New function.
10135         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10136         handling.
10137         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10138         (Target_x86_64::do_reloc_addend): New function.
10139         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10140         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10141         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10142         (Output_reloc::type): New function.
10143         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10144         (Output_reloc::is_target_specific): New function.
10145         (Output_reloc::target_arg): New function.
10146         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10147         absolute relocs and target specific relocs.
10148         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10149         add_target_specific.
10150         (class Output_data_reloc) [SHT_RELA]: Likewise.
10151         * output.cc (Output_reloc::Output_reloc): Add four new versions
10152         for absolute relocs and target specific relocs.
10153         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10154         (Output_reloc::get_symbol_index): Likewise.
10155         (Output_reloc::local_section_offset): Check that local_sym_index_
10156         is not TARGET_CODE or 0.
10157         (Output_reloc::symbol_value): Likewise.
10158         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10159         reloc.
10160         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10161         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10162         functions.
10163         * layout.cc (add_target_dynamic_tags): Use output section for
10164         DT_PLTRELSZ and DT_JMPREL.
10165
10166 2010-01-07  Ian Lance Taylor  <iant@google.com>
10167
10168         PR 11061
10169         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10170         function.
10171         (class Output_data_reloc_generic): Define.
10172         (class Output_data_reloc_base): Change base class to
10173         Output_data_reloc_generic.  Change add() method to call
10174         bump_relative_reloc_count for a relative reloc.  Remove
10175         sort_relocs_ field.
10176         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10177         to sort_relocs().
10178         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10179         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10180         appropriate.
10181         * layout.h (class Layout): Update declaration.
10182
10183 2010-01-07  Ian Lance Taylor  <iant@google.com>
10184
10185         * output.h (class Output_data): Add const version of
10186         output_section and do_output_section.
10187         (class Output_section_data): Add const version of
10188         do_output_section.
10189         (class Output_section): Likewise.
10190         * layout.cc (Layout::add_target_dynamic_tags): New function.
10191         * layout.h (class Layout): Update declarations.
10192         * arm.cc (Target_arm::do_finalize_sections): Use
10193         add_target_dynamic_tags.
10194         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10195         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10196         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10197         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10198
10199 2010-01-07  Ian Lance Taylor  <iant@google.com>
10200
10201         PR 11042
10202         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10203         object as needed.
10204
10205 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10206             Ian Lance Taylor  <iant@google.com>
10207
10208         PR 11019
10209         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10210         Xindex::read_symtab_xindex.
10211
10212 2010-01-07  Doug Kwan  <dougkwan@google.com>
10213
10214         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10215         (Insn_template::thumb16_bcond_insn): New method declaration.
10216         (Insn_template): Fix spelling.
10217         (Stub::thumb16_special): New method declaration.
10218         (Stub::do_write): Define virtual method which was previously pure
10219         virtual.
10220         (Stub::do_thumb16_special): New method declaration.
10221         (Stub::do_fixed_endian_write): New template member.
10222         (Reloc_stub::do_write): Remove.
10223         (Reloc_stub::do_fixed_endian_write): Remove.
10224         (Cortex_a8_stub): New class definition.
10225         (Stub_factory::make_cortex_a8_stub): New method definition.
10226         (Stub_factory::Stub_factory): Add missing static storage class
10227         qualifier for elf32_arm_stub_a8_veneer_blx.
10228
10229 2010-01-07  Ian Lance Taylor  <iant@google.com>
10230
10231         PR 10980
10232         * options.h (class General_options): Add --warn-unresolved-symbols
10233         and --error-unresolved-symbols.
10234         * errors.cc (Errors::undefined_symbol): Implement
10235         --warn-unresolved-symbols.
10236
10237         * options.h (class General_options): Add -z text and -z textoff.
10238         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10239
10240 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10241
10242         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10243         (Garbage_collection::cident_sections): New function.
10244         (Garbage_collection::add_cident_section): New function.
10245         (Garbage_collection::cident_sections_): New member.
10246         (gc_process_relocs): Add references to sections whose names are C
10247         identifiers.
10248         * gold.h (cident_section_start_prefix): New constant.
10249         (cident_section_stop_prefix): New constant.
10250         (is_cident): New function.
10251         * layout.cc (Layout::define_section_symbols): Replace string constants
10252         with the newly defined constants.
10253         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10254         C identifiers.
10255         * testsuite/Makefile.am: Add gc_orphan_section_test.
10256         * testsuite/Makefile.in: Regenerate.
10257         * testsuite/gc_orphan_section_test.cc: New file.
10258         * testsuite/gc_orphan_section_test.sh: New file.
10259
10260 2010-01-06  Ian Lance Taylor  <iant@google.com>
10261
10262         PR 10980
10263         * options.h (class General_options): Add --warn-shared-textrel.
10264         * layout.cc (Layout::finish_dynamic_section): Implement
10265         --warn-shared-textrel.
10266
10267         PR 10980
10268         * options.h (class General_options): Add --warn-multiple-gp.
10269
10270 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10271
10272         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10273         $(THREADSLIB) and $(LIBDL).
10274         * Makefile.in: Rebuild.
10275
10276 2010-01-06  Ian Lance Taylor  <iant@google.com>
10277
10278         PR 10980
10279         * options.cc (General_options::parse_section_start): New function.
10280         (General_options::section_start): New function.
10281         (General_options::General_options): Initialize all members.
10282         * options.h: Include <map>
10283         (class General_options): Add --section-start.  Add section_starts_
10284         member.
10285         * layout.cc (Layout::attach_allocated_section_to_segment): If
10286         --section-start was used, set the address of the segment.  Remove
10287         local sort_sections.
10288         (Layout::relaxation_loop_body): If the address of the load segment
10289         has been set by --section-start, don't use it.
10290         * output.h (Output_segment::update_flags_for_output_section): New
10291         function.
10292         * output.cc (Output_segment::add_output_section): Call
10293         update_flags_for_output_section.
10294
10295 2010-01-05  Ian Lance Taylor  <iant@google.com>
10296
10297         PR 10980
10298         * options.h (class General_options): Add --undefined-version.
10299         * script.cc (struct Version_expression): Add was_matched_by_symbol
10300         field.
10301         (Version_script_info::matched_symbol): New function.
10302         (Version_script_info::get_symbol_version_helper): Call
10303         matched_symbol.
10304         (Version_script_info::check_unmatched_names): New function.
10305         * script.h (class Version_script_info): Update declarations.
10306         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10307
10308         * options.h (class General_options): Use DEFINE_bool_alias for
10309         allow_multiple_definition.
10310         * resolve.cc (Symbol_table::should_override): Don't test
10311         allow_multiple_definition.
10312
10313         PR 10980
10314         * options.h (class General_options): Add --cref.
10315         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10316         until after printing cref table.
10317         * cref.cc: Include "symtab.h".
10318         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10319         (Cref_table_compare::operator()): New function.
10320         (Cref_inputs::gather_cref): New function.
10321         (filecol): New static const.
10322         (Cref_inputs::print_cref): New function.
10323         (Cref::print_cref): New function.
10324         * cref.h: Include <cstdio>.
10325         (class Cref): Update declarations.
10326         * mapfile.h (Mapfile::file): New function.
10327         * object.h (class Object): Define Symbols.  Declare virtual
10328         do_get_global_symbols.
10329         (Object::get_global_symbols): New function.
10330         * object.cc (Input_objects::add_object): Pass object to cref_ if
10331         --cref.
10332         (Input_objects::archive_start): Likewise.
10333         (Input_objects::archive_stop): Likewise.
10334         (Input_objects::print_cref): New function.
10335         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10336         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10337         --cref.
10338         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10339         function.
10340         * plugin.h (class Sized_pluginobj): Update declarations.
10341
10342 2010-01-05  Ian Lance Taylor  <iant@google.com>
10343
10344         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10345         to is_default_version.  Rename insdef to insdefault.
10346         (Symbol_table::add_from_relobj): Rename def to is_default_version
10347         and local to is_forced_local.
10348         (Symbol_table::add_from_pluginobj): Likewise.
10349         (Symbol_table::add_from_dynobj): Likewise.
10350         (Symbol_table::define_special_symbol): Rename insdef to
10351         insdefault.
10352
10353 2010-01-04  Ian Lance Taylor  <iant@google.com>
10354
10355         PR 10980
10356         * options.h (class General_options): Add
10357         --allow-multiple-definition and -z muldefs.
10358         * resolve.cc (Symbol_table::should_override): Don't warn about a
10359         multiple symbol definition if --allow-multiple-definition or -z
10360         muldefs.
10361
10362         PR 10980
10363         * options.h (class General_options): Add --add-needed and
10364         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10365         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10366         error if --copy-dt-needed-entries aka --add-needed is used and
10367         would cause a change in behaviour.
10368
10369         PR 10980
10370         * options.h (class General_options): Add -G as a short version of
10371         --shared.  Add no-op options -assert, -g, and -i.
10372
10373 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10374
10375         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10376         check for .text or .gnu.linkonce.t sections.
10377         * icf.cc (Icf::find_identical_sections): Ditto.
10378         Change the detection for mangled function name within the section
10379         name.
10380         * icf.h (is_section_foldable_candidate): New function.
10381
10382 2009-12-30  Ian Lance Taylor  <iant@google.com>
10383
10384         PR 10980
10385         * options.h (class General_options): Permit two dashes with
10386         --retain-symbols-file.
10387
10388 2009-12-30  Ian Lance Taylor  <iant@google.com>
10389
10390         PR 10979
10391         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10392         don't put the file header and segment headers in the text
10393         segment.
10394
10395         PR 10979
10396         * common.cc (Sort_commons::operator()): Stabilize sort when both
10397         entries are NULL.
10398         (Symbol_table::do_allocate_commons_list): When allocating common
10399         symbols, skip a symbol which is no longer common.
10400         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10401         an object before checking its type.
10402         * testsuite/common_test_2.c: New file.
10403         * testsuite/common_test_3.c: New file.
10404         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10405         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10406         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10407         (common_test_2_pic.o, common_test_2.so): New targets.
10408         (common_test_3_pic.o, common_test_3.so): New targets.
10409         * testsuite/Makefile.in: Rebuild.
10410
10411         PR 10979
10412         * script.cc (read_input_script): If we see a new SECTIONS clause,
10413         and we have added an input section, give an error.
10414         * layout.h (class Layout): Add have_added_input_section function.
10415         Add have_added_input_section_ field.
10416         * layout.cc (Layout::Layout): Initialize
10417         have_added_input_section_.
10418         (Layout::layout): Set have_added_input_section_.
10419         (Layout::layout_eh_frame): Likewise.
10420
10421 2009-12-30  Ian Lance Taylor  <iant@google.com>
10422
10423         PR 10931
10424         * options.h (class General_options): Add --sort-common option.
10425         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10426         * common.cc (Sort_common): Add sort_order parameter to
10427         constructor.  Add sort_order_ field.
10428         (Sort_commons::operator): Check sort_order_.
10429         (Symbol_table::allocate_commons): Determine the sort order.
10430         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10431         Change all callers.
10432         (Symbol_table::do_allocate_commons_list): Likewise.
10433
10434 2009-12-30  Ian Lance Taylor  <iant@google.com>
10435
10436         PR 10916
10437         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10438         symbols from this object, don't change the visibility of an
10439         undefined symbol.
10440         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10441
10442 2009-12-30  Ian Lance Taylor  <iant@google.com>
10443
10444         PR 10861
10445         * script.h (class Version_script_info): Define Language enum.
10446         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10447         new fields globals_, locals_, and is_finalized_.
10448         * script.cc: Various formatting fixes.
10449         (class Parser_closure): Change language_stack_ from a vector of
10450         std::string to one of Version_script_info::Language.  Adjust all
10451         uses accordingly.
10452         (class Lazy_demangler): Remove.
10453         (struct Version_expression): Change language from std::string to
10454         Version_script_info::Language.
10455         (Version_script_info::Version_script_info): New function.
10456         (Version_script_info::~Version_script_info): Don't call clear.
10457         (Version_script_info::finalize): New function.
10458         (Version_script_info::build_lookup_tables): New function.
10459         (Version_script_info::build_expression_list_lookup): New
10460         function.
10461         (Version_script_info::get_symbol_version_helper): Rewrite to use
10462         lookup tables.
10463         (Version_script_info::print_expression_list): Adjust to use
10464         Version_script_info::Language.
10465         (script_push_lex_into_version_mode): Check that the version script
10466         has not been finalized.
10467         (version_script_push_lang): Change language string to
10468         Version_script_info::Language.
10469         * options.cc (Command_line::version_script): New function.
10470         * options.h (class General_options): Add finalize_dynamic_list
10471         function.  Change version_script from declaration to definition.
10472         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10473         * testsuite/version_script.map: Remove duplicate def of foo.
10474         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10475         version_script.map.
10476         * testsuite/Makefile.in: Rebuild.
10477
10478 2009-12-30  Ian Lance Taylor  <iant@google.com>
10479
10480         PR 10843
10481         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10482         if the input symbol index is 0, make the output symbol index 0.
10483
10484 2009-12-30  Ian Lance Taylor  <iant@google.com>
10485
10486         PR 10670
10487         * options.h (class General_options): Add -x/--discard-all.
10488         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10489         --discard-all.  If the local symbol needs a dynamic entry, check
10490         that before handling --discard-locals.
10491
10492 2009-12-30  Ian Lance Taylor  <iant@google.com>
10493
10494         PR 10450
10495         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10496         flags to PF_R.
10497         (Output_segment::add_output_section): Don't change the flags if
10498         the type is PT_TLS.
10499
10500         PR 10450
10501         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10502         GNU hash table if they need a dynamic value.  Otherwise, don't add
10503         them if they are defined in a dynamic object or are forced local.
10504
10505 2009-12-29  Ian Lance Taylor  <iant@google.com>
10506
10507         PR 10450
10508         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10509         .gnu.hash table for a 32-bit target.
10510
10511         PR 10450
10512         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10513         regular and a dynamic object only needs a dynamic symbol table
10514         entry if it is externally visible.
10515
10516         PR 10450
10517         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10518         constructor.  Add global_offset_table_ field.
10519         (Target_i386::got_section): Set global_offset_table_.
10520         (Target_i386::do_finalize_sections): Set global_offset_table_
10521         size.
10522         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10523         in constructor.  Add global_offset_table_ field.
10524         (Target_x86_64::got_section): Set global_offset_table_.
10525         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10526         size.
10527
10528         * layout.cc (Layout::Layout): Initialize increase_relro_.
10529         (Layout::get_output_section): Add is_relro, is_last_relro, and
10530         is_first_non_relro parameters.  Change all callers.
10531         (Layout::choose_output_section): Likewise.
10532         (Layout::add_output_section_data): Likewise.
10533         (Layout::make_output_section): Likewise.
10534         (Layout::set_segment_offsets): Clear increase_relro when using a
10535         linker script.
10536         * layout.h (class Layout): Add increase_relro method.  Add
10537         increase_relro_ field.  Update declarations.
10538         * output.cc (Output_section::Output_section): Initialize
10539         is_last_relro_ and is_first_non_relro_.
10540         (Output_segment::add_output_section): Group relro sections is
10541         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10542         (Output_segment::maximum_alignment): Remove relro handling.
10543         (Output_segment::set_section_addresses): Add increase_relro
10544         parameter.  Change all callers.  Add initial alignment to align
10545         relro sections on separate page.  Remove old relro handling.
10546         (Output_segment::set_section_list_addresses): Remove in_relro
10547         parameter.  Change all callers.
10548         (Output_segment::set_offset): Add increase parameter.  Change all
10549         callers.  Remove old relro handling.
10550         * output.h (class Output_section): Add new methods: is_last_relro,
10551         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10552         Add is_last_relro_ and is_first_non_relro_ fields.
10553         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10554         Create separate .got.plt section.  Call increase_relro.
10555         * x86_64.cc (Target_x86_64::got_section): Likewise.
10556         * testsuite/relro_script_test.t: Add .got.plt.
10557
10558         PR 10450
10559         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10560         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10561         (Layout::finalize): Call set_dynamic_symbol_size.
10562         (Layout::set_dynamic_symbol_size): New function.
10563         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10564         set_dynamic_symbol_size.
10565
10566         PR 10450
10567         * output.h (class Output_section): Add is_entsize_zero_ field.
10568         * output.cc (Output_section::Output_section): Initialize
10569         is_entsize_zero_.
10570         (Output_section::set_entsize): If two different entsizes are
10571         requested, force it to zero.
10572         (Output_section::add_input_section): Set flags for .debug_str
10573         before updating section flags.  Set entsize.
10574         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10575         and SHF_STRING if all input sections have those flags.
10576
10577 2009-12-29   Rafael Espindola  <espindola@google.com>
10578
10579         * main.cc (main): Fix the sys time reporting.
10580         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10581         reporting.
10582
10583 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10584
10585         * options.cc (General_options::parse_version): Allow -v to exit
10586         without an error if there is nothing to link.
10587
10588 2009-12-29  Ian Lance Taylor  <iant@google.com>
10589
10590         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10591         using a version of gcc before 4.1.
10592         * configure: Rebuild.
10593
10594 2009-12-28  Chris Demetriou  <cgd@google.com>
10595
10596         * attributes.cc (Output_attributes_section_data::do_write): Use
10597         std::vector::front rather than std::vector::data.
10598
10599 2009-12-28  Ian Lance Taylor  <iant@google.com>
10600
10601         * symtab.h (class Symbol_table): Add enum Defined.
10602         * resolve.cc (Symbol_table::should_override): Add defined
10603         parameter.  Change all callers.  Test whether object is NULL
10604         before calling a method on it.
10605         (Symbol_table::report_resolve_problem): Add defined parameter.
10606         Change all callers.
10607         (Symbol_table::should_override_with_special): Likewise.
10608         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10609         parameter.  Change all callers.
10610         (Symbol_table::do_define_in_output_data): Likewise.
10611         (Symbol_table::define_in_output_segment): Likewise.
10612         (Symbol_table::do_define_in_output_segment): Likewise.
10613         (Symbol_table::define_as_constant): Likewise.
10614         (Symbol_table::do_define_as_constant): Likewise.
10615         * script.h (class Symbol_assignment): Add is_defsym parameter to
10616         constructor; change all callers.
10617         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10618         parameter.  Change all callers.  Add is_defsym_ field.
10619         (class Parser_closure): Add parsing_defsym parameter to
10620         constructor; change all callers.  Add parsing_defsym accessor
10621         function.  Add parsing_defsym_ field.
10622
10623 2009-12-28  Ian Lance Taylor  <iant@google.com>
10624
10625         * gold.cc (queue_middle_tasks): Fix formatting.
10626         * object.cc (Relobj::is_section_name_included): Likewise.
10627
10628 2009-12-23  Ian Lance Taylor  <iant@google.com>
10629
10630         * i386.cc (Target_i386::do_calls_non_split): Recognize
10631         -fsplit-stack prologue for a function with a static chain.
10632         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10633         -fsplit-stack prologue when using %r11.
10634
10635 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10636
10637         * options.cc (General_options::parse_version): Make -v continue and do
10638         the link like GNU ld does.
10639
10640 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10641
10642         * Makefile.am (CCFILES): Add timer.cc.
10643         (HFILES): Add timer.h.
10644         * configure.ac: Check for sysconf and times.
10645         * main.cc: include timer.h.
10646         (main): Use Timer instead of get_run_time.
10647         * timer.cc: New.
10648         * timer.h: New.
10649         * workqueue.cc: include timer.h.
10650         (Workqueue::find_and_run_task):
10651         Report user, sys and wall time.
10652         * Makefile.in: Regenerate.
10653         * config.in: Regenerate.
10654         * configure: Regenerate.
10655
10656 2009-12-16  Doug Kwan  <dougkwan@google.com>
10657
10658         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10659         sections.
10660         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10661         relaxed input sections.
10662         * output.cc (Output_section::find_relaxed_input_section): Change
10663         return type to Output_relaxed_input_section pointer.  Adjust code
10664         for new type of relaxed_input_section_map_.
10665         * output.h (Output_section::find_relaxed_input_section): Change
10666         return type to Output_relaxed_input_section pointer.
10667         (Output_section::Output_relaxed_input_section_by_input_section_map):
10668         New type.
10669         (Output_section::relaxed_input_section_map_): Change type to
10670         Output_section::Output_relaxed_input_section_by_input_section_map.
10671         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10672         input section.
10673
10674 2009-12-15  Ian Lance Taylor  <iant@google.com>
10675
10676         * layout.cc (Layout::create_shstrtab): Only write out after input
10677         sections if we are compressing debug sections.
10678
10679 2009-12-15  Ian Lance Taylor  <iant@google.com>
10680
10681         * archive.cc (Archive::add_symbols): Only look up a symbol without
10682         a version if there is, in fact, a version.
10683
10684 2009-12-14  Ian Lance Taylor  <iant@google.com>
10685
10686         Revert -Wshadow changes, all changes from:
10687         2009-12-11  Doug Kwan  <dougkwan@google.com>
10688         2009-12-11  Nick Clifton  <nickc@redhat.com>
10689         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10690
10691 2009-12-11  Doug Kwan  <dougkwan@google.com>
10692
10693         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10694         due to -Wshadow.
10695         * attributes.cc (Object_attribute::size): Ditto.
10696         (Attributes_section_data::size): Ditto.
10697         (Attributes_section_data::Attributes_section_data): Ditto.
10698         (Output_attributes_section_data::do_write): Ditto.
10699         * attributes.h (Object_attribute::set_type): Ditto.
10700         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10701
10702 2009-12-11  Nick Clifton  <nickc@redhat.com>
10703
10704         * archive.cc: Fix shadowed variable warnings.
10705         * arm.cc: Likewise.
10706         * compressed_output.cc: Likewise.
10707         * compressed_output.h: Likewise.
10708         * configure: Likewise.
10709         * dwarf_reader.cc: Likewise.
10710         * dynobj.cc: Likewise.
10711         * dynobj.h: Likewise.
10712         * ehframe.cc: Likewise.
10713         * ehframe.h: Likewise.
10714         * errors.cc: Likewise.
10715         * expression.cc: Likewise.
10716         * fileread.cc: Likewise.
10717         * fileread.h: Likewise.
10718         * freebsd.h: Likewise.
10719         * i386.cc: Likewise.
10720         * icf.cc: Likewise.
10721         * incremental.h: Likewise.
10722         * layout.cc: Likewise.
10723         * layout.h: Likewise.
10724         * mapfile.cc: Likewise.
10725         * merge.cc: Likewise.
10726         * merge.h: Likewise.
10727         * object.cc: Likewise.
10728         * object.h: Likewise.
10729         * options.h: Likewise.
10730         * output.cc: Likewise.
10731         * output.h: Likewise.
10732         * parameters.cc: Likewise.
10733         * plugin.cc: Likewise.
10734         * powerpc.cc: Likewise.
10735         * reduced_debug_output.cc: Likewise.
10736         * reduced_debug_output.h: Likewise.
10737         * reloc.cc: Likewise.
10738         * reloc.h: Likewise.
10739         * resolve.cc: Likewise.
10740         * script-sections.cc: Likewise.
10741         * script.cc: Likewise.
10742         * script.h: Likewise.
10743         * sparc.cc: Likewise.
10744         * symtab.cc: Likewise.
10745         * symtab.h: Likewise.
10746         * target-select.cc: Likewise.
10747         * target-select.h: Likewise.
10748         * token.h: Likewise.
10749         * workqueue.cc: Likewise.
10750         * workqueue.h: Likewise.
10751         * x86_64.cc: Likewise.
10752
10753 2009-12-10  Doug Kwan  <dougkwan@google.com>
10754
10755         * arm.cc (attributes.h): New include.
10756         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10757         (Arm_relobj::~Arm_relobj): Delete object pointed by
10758         attributes_section_data_.
10759         (Arm_relobj::attributes_section_data): New method definition.
10760         (Arm_relobj::attributes_section_data_): New data member declaration.
10761         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10762         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10763         attributes_section_data_.
10764         (Arm_dynobj::attributes_section_data): New method definition.
10765         (Arm_dynobj::attributes_section_data_): New data member declaration.
10766         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10767         initialization value of may_use_blx_ to false.
10768         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10769         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10770         object attributes to compute results instead of hard-coding.
10771         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10772         Target_arm::get_secondary_compatible_arch,
10773         Target_arm::set_secondary_compatible_arch
10774         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10775         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10776         New method declarations.
10777         (Target_arm::get_aeabi_object_attribute): New method definition.
10778         (Target_arm::attributes_section_data_): New data member declaration.
10779         (read_arm_attributes_section): New template definition.
10780         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10781         (Arm_dynobj::do_read_symbols): Ditto.
10782         (Target_arm::do_finalize_sections): Merge attributes sections from
10783         input.  Check for BLX use after attributes section merging.
10784         Fix __exidx_start and __exidx_end visibility.  Create an
10785         .ARM.attributes section if necessary.
10786         (Target_arm::get_secondary_compatible_arch,
10787         Target_arm::set_secondary_compatible_arch,
10788         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10789         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10790         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10791         New method definitions.
10792
10793 2009-12-09  Ian Lance Taylor  <iant@google.com>
10794
10795         * plugin.cc (Plugin::load): Don't cast from void* to a function
10796         pointer.
10797
10798 2009-12-09  Ian Lance Taylor  <iant@google.com>
10799
10800         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10801         information fields.
10802
10803 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10804
10805         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10806         Replace two_file_shared_1.so with two_file_shared_2.so.
10807         * testsuite/Makefile.in: Regenerated.
10808
10809 2009-12-08  Doug Kwan  <dougkwan@google.com>
10810
10811         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10812         (HFILES): Add attributes.h and int_encoding.h.
10813         * Makefile.in: Regenerate.
10814         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10815         function definitions to int_encoding.cc
10816         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10817         prototypes to int_encoding.h
10818         * reduced_debug_output.cc (int_encoding.h): New include.
10819         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10820         function definitions to int_encoding.cc
10821         (insert_into_vector, read_from_pointer): Move template definitions to
10822         int_encoding.h
10823         * attributes.cc: New file.
10824         * attributes.h: New file.
10825         * int_encoding.cc: New file.
10826         * int_encoding.h: New file.
10827
10828 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10829
10830         PR gold/11055
10831         * incremental-dump.cc (dump_incremental_inputs): New.
10832         (main): Use dump_incremental_inputs.
10833
10834 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10835
10836         PR gold/10893
10837         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10838         checking elfcpp::STT_FUNC.
10839         (Target_i386::Relocate::relocate): Likewise.
10840         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10841
10842         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10843         symbols from shared libraries into normal FUNC symbols.
10844
10845         * symtab.h (Symbol): Add is_func and use it.
10846
10847 2009-12-05  Doug Kwan  <dougkwan@google.com>
10848
10849         * arm.cc (Target_arm::arm_info): Initialize new fields
10850         attributes_section and attributes_vendor.
10851         * i386.cc (Target_i386::i386_info): Same.
10852         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10853         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10854         fields attributes_section and attributes_vendor.
10855         * sparc.cc (Target_sparc::sparc_info): Same.
10856         * target.h (Target::attributes_section, Target::attributes_vendor,
10857         Target::is_attributes_section, Target::attribute_arg_type,
10858         Target::attributes_order): New method definitions.
10859         (Target::Target_info::attributes_section,
10860         Target::Target_info::attributes_vendor): New fields.
10861         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10862         virtual method definitions.
10863         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10864         attributes_section and attributes_vendor.
10865         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10866
10867 2009-12-05  Doug Kwan  <dougkwan@google.com>
10868
10869         * arm.cc: Update comments about interworking and stub generation.
10870         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10871         considered as non-PIC.
10872         (Arm_relocate_functions::base_abs): Fix formatting.
10873         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10874         of function to use GOT entry address instead of offset.
10875         (Target_arm::Scan::global): Issue an error if a symbol would need a
10876         PLT does not get one because it is untyped.  Remove code to create
10877         dynamic symbols for relative branches.
10878         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10879         takes unsigned integer instead of boolean.
10880
10881 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10882
10883         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10884         (two_file_test_LDADD): Likewise.
10885         (common_test_1_LDADD): Likewise.
10886         (exception_test_LDADD) Likewise.
10887         (weak_test_LDADD): Likewise.
10888         (many_sections_test_LDADD): Likewise.
10889         (initpri1_LDADD): Likewise.
10890         (script_test_1_LDADD): Likewise.
10891         (script_test_2_LDADD): Likewise.
10892         (justsyms_LDADD): Likewise.
10893         (binary_test_LDADD): Likewise.
10894         (large_LDADD): Likewise.
10895         * testsuite/Makefile.in: Regenerated.
10896
10897 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10898
10899         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10900         (Symbol_table::override_with_special): Likewise.
10901         (Symbol_table::add_from_object): Likewise.
10902
10903 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10904
10905         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10906         Don't set the data_offset twice.
10907
10908 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10909
10910         * testsuite/Makefile.in: Regenerate.
10911
10912 2009-12-03  Doug Kwan  <dougkwan@google.com>
10913
10914         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10915         (Target_arm::do_finalize_sections): Add parameter for symbol table
10916         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10917         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10918         parameter for symbol table pointer.
10919         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10920         an additional parameter for a pointer to symbol table.
10921         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10922         parameter for a symbol table pointer.
10923         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10924         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10925         Ditto.
10926         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10927         parameter for a symbol table pointer.
10928
10929 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10930
10931         * incremental.cc (Incremental_inputs_header)
10932         (Incremental_inputs_header_write, Incremental_inputs_entry)
10933         (Incremental_inputs_entry_write): Move ...
10934         * incremental.h (Incremental_inputs_header)
10935         (Incremental_inputs_header_write, Incremental_inputs_entry)
10936         (Incremental_inputs_entry_write): here.
10937
10938 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10939
10940         * incremental.cc (make_sized_incremental_binary): Set the target.
10941         Error if it is incompatible.
10942         * output.h (Output_file): Add filename method.
10943
10944 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10945
10946         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10947         from the get_* methods.
10948
10949 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10950
10951         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10952         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10953         Write 0 for the data_offset of scripts.
10954
10955 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10956
10957         * testsuite/Makefile.am: Add the incremental_test.sh test.
10958         * testsuite/incremental_test.sh: New.
10959         * testsuite/incremental_test_1.c: New.
10960         * testsuite/incremental_test_2.c: New.
10961
10962 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10963
10964         * incremental-dump.cc (main): Fix typos.
10965
10966 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10967
10968         PR gold/11025
10969         * incremental-dump.cc (main): Use llu to print 64 bit values.
10970
10971 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10972             H.J. Lu  <hongjiu.lu@intel.com>
10973
10974         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10975         $(LIBDL).
10976         (incremental_dump_LDADD): Likewise.
10977         * Makefile.in: Regenerated.
10978
10979 2009-11-25  Doug Kwan  <dougkwan@google.com>
10980
10981         Revert:
10982
10983         2009-11-25  Doug Kwan  <dougkwan@google.com>
10984
10985                 * arm.cc (Target_arm::Target_arm): Move method definition
10986                 outside of class definition.  Add code to handle
10987                 --target1-rel, --target1-abs and --target2= options.
10988                 (Target_arm::get_reloc_reloc_type): Change method to be
10989                 non-static and const.
10990                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10991                 New data member declaration.
10992                 (Target_arm::Scan::local, Target_arm::Scan::global,
10993                 Target_arm::Relocate::relocate,
10994                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10995                 Adjust call to Target_arm::get_real_reloc_type.
10996                 (Target_arm::get_real_reloc_type): Use command line options
10997                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10998                 * options.h (--target1-rel, --target1-abs, --target2): New
10999                 ARM-only options.
11000
11001 2009-11-25  Doug Kwan  <dougkwan@google.com>
11002
11003         * arm.cc (Target_arm::Target_arm): Move method definition outside of
11004         class definition.  Add code to handle --target1-rel, --target1-abs
11005         and --target2= options.
11006         (Target_arm::get_reloc_reloc_type): Change method to be non-static
11007         and const.
11008         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
11009         member declaration.
11010         (Target_arm::Scan::local, Target_arm::Scan::global,
11011         Target_arm::Relocate::relocate,
11012         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
11013         call to Target_arm::get_real_reloc_type.
11014         (Target_arm::get_real_reloc_type): Use command line options to
11015         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
11016         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
11017         options.
11018
11019 2009-11-25  Doug Kwan  <dougkwan@google.com>
11020
11021         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
11022         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
11023         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
11024         formatting.
11025         (Arm_relocate_functions::thm_call): Replace body with a call to
11026         Arm_relocate_functions::thumb_branch_common.
11027         (Arm_relocate_functions::thm_jump24,
11028         Arm_relocate_functions::thm_xpc22): New method definitions.
11029         (Arm_relocate_functions::thumb_branch_common): New method definition.
11030         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
11031         operator.
11032         (Target_arm::Relocate::relocate): Adjust call to thm_call.
11033         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
11034
11035 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11036
11037         * Makefile.am: Build incremental-dump
11038         * Makefile.in: Regenerate.
11039         * incremental-dump.cc: New.
11040         * incremental.cc (Incremental_inputs_header_data,
11041         Incremental_inputs_entry_data): Move to incremental.h
11042         * incremental.h: (Incremental_inputs_header_data,
11043         Incremental_inputs_entry_data): Move from incremental.cc
11044
11045 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11046
11047         * incremental.cc (Incremental_inputs_header,
11048         Incremental_inputs_header_write, Incremental_inputs_entry,
11049         Incremental_inputs_entry_write): Add a typedef with the data type.
11050
11051 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
11052
11053         * incremental.cc (Incremental_inputs_header,
11054         Incremental_inputs_header_write, Incremental_inputs_entry,
11055         Incremental_inputs_entry_write): Update comment about which
11056         type has the filed descriptions.
11057
11058 2009-11-15  Doug Kwan  <dougkwan@google.com>
11059
11060         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11061         (Arm_relocate_functions::arm_branch_common): Change method defintion
11062         in class definition to a method declaration and update list of formal
11063         parameters.
11064         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11065         Arm_relocation_functions::jump24): Adjust call to
11066         Arm_relocate_functions::arm_branch_common.  Update list of formal
11067         parameters.
11068         (Arm_relocate_functions::xpc25): New method definition.
11069         (Arm_relocate_functions::arm_branch_common): Move method defintion
11070         out from class definition.  Use stubs for mode-switching and extending
11071         branch ranges.
11072         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11073         specially.  Change code to enable use of stubs in ARM branches.
11074
11075 2009-11-10  Doug Kwan  <dougkwan@google.com>
11076
11077         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11078         in method declaration.
11079         (Target_arm::relocate_stub): New method declaration.
11080         (Target_arm::default_target): Change to return a pointer instead of
11081         a const reference.
11082         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11083         Target_arm::default_target.
11084         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11085         method definition.
11086         (Target_arm::relocate_section): Adjust view.
11087         (Target_arm::relocate_stub): New method definition.
11088
11089 2009-11-10  Doug Kwan  <dougkwan@google.com>
11090
11091         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11092         a format warning.
11093         * incremental.cc (open_incremental_binary): Initialized local
11094         variables to avoid warnings.
11095         * object.cc (make_elf_object): Ditto.
11096         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11097         a format warning.
11098
11099 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11100
11101         PR gold/10930
11102         * testsuite/plugin_test.c: Include "config.h".
11103
11104 2009-11-09  Doug Kwan  <dougkwan@google.com>
11105
11106         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11107         (arm_symbol_value): Remove.
11108         (Arm_relocate_functions::arm_branch_common,
11109         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11110         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11111         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11112         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11113         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11114         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11115         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11116         Arm_relocate_functions::thm_mobw_abs_nc,
11117         Arm_relocate_functions::thm_mov_abs,
11118         Arm_relocate_functions::movw_prel_nc,
11119         Arm_relocate_functions::thm_movt_abs,
11120         Arm_relocate_functions::movt_prel,
11121         Arm_relocate_functions::thm_movw_prel_nc,
11122         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11123         (Target_arm::Relocate::relocate): Only decompose address into two
11124         parts if relocation type uses the thumb-bit and pass the actual
11125         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11126         calls to methods in Arm_relocate_functions for this change.
11127
11128 2009-11-08  Ian Lance Taylor  <iant@google.com>
11129
11130         PR 10925
11131         * reloc.cc: Instantiate
11132         Sized_relobj::initialize_input_to_output_maps and
11133         Sized_relobj:free_input_to_output_maps.
11134
11135 2009-11-06  Ian Lance Taylor  <iant@google.com>
11136
11137         PR 10876
11138         * defstd.cc (in_segment): Set only_if_ref true for "end".
11139
11140 2009-11-06  Doug Kwan  <dougkwan@google.com>
11141
11142         * arm.cc (class Reloc_stub): Correct a comment.
11143         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11144         (Target_arm::scan_section_for_stubs): New method declaration.
11145         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11146         Change methods from private to protected.
11147         (Target_arm::do_may_relax): New method definition.
11148         (Target_arm::do_relax, Target_arm::group_sections,
11149         Target_arm::scan_reloc_for_stub,
11150         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11151         (Target_arm::arm_input_section_map_): New data member declaration.
11152         (Target_arm::scan_reloc_for_stub,
11153         Target_arm::scan_reloc_section_for_stubs,
11154         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11155         Target_arm::do_relax): New method definitions.
11156
11157 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11158
11159         * configure.ac: Check for (struct stat)::st_mtim
11160         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11161         * config.in: Regenerate.
11162         * configure: Regenerate.
11163
11164 2009-11-05  Ian Lance Taylor  <iant@google.com>
11165
11166         PR 10910
11167         * output.cc (Output_segment::add_output_section): Add missing
11168         return statement.
11169
11170 2009-11-04  Ian Lance Taylor  <iant@google.com>
11171
11172         PR 10880
11173         * object.h (class Object): Add is_needed and set_is_needed
11174         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11175         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11176         defined in a dynamic object and referenced by a regular object,
11177         set is_needed for the dynamic object.
11178         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11179         if the file is marked with as_needed and it is not needed.
11180
11181 2009-11-04  Ian Lance Taylor  <iant@google.com>
11182
11183         PR 10887
11184         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11185         tags if data is discarded by linker script.
11186         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11187         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11188         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11189         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11190
11191 2009-11-04  Ian Lance Taylor  <iant@google.com>
11192
11193         * layout.cc (Layout::get_output_section): Add is_interp and
11194         is_dynamic_linker_section parameters.  Change all callers.
11195         (Layout::choose_output_section): Likewise.
11196         (Layout::make_output_section): Likewise.
11197         (Layout::add_output_section_data): Add is_dynamic_linker_section
11198         parameter.  Change all callers.
11199         * layout.h (class Layout): Update declarations.
11200         * output.h (class Output_section): Add is_interp, set_is_interp,
11201         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11202         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11203         generate_code_fills_at_write_ to a bitfield.
11204         * output.cc (Output_section::Output_sections): Initialize new
11205         fields.
11206         (Output_segment::add_output_section): Add do_sort parameter.
11207         Change all callers.
11208
11209 2009-11-03  Ian Lance Taylor  <iant@google.com>
11210
11211         PR 10860
11212         * options.h (class General_options): Add --warn-common.
11213         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11214         merging two common symbols.
11215         (Symbol_table::should_override): Handle --warn-common when merging
11216         a common symbol with a defined symbol.  Use report_resolve_problem
11217         for multiple definitions.
11218         (Symbol_table::report_resolve_problem): New function.
11219         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11220
11221 2009-11-03  Doug Kwan  <dougkwan@google.com>
11222
11223         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11224         stub_factory_.
11225         (Target_arm::stub_factory): New method definition.
11226         (Target_arm::new_arm_input_section,
11227         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11228         Target_arm::reloc_uses_thumb_bit): New method declarations.
11229         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11230         New type definitions.
11231         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11232         member declarations.
11233         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11234         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11235         New method definitions.
11236
11237 2009-11-03  Ian Lance Taylor  <iant@google.com>
11238
11239         * options.h (class General_options): Add --warn_constructors.
11240
11241 2009-11-03  Ian Lance Taylor  <iant@google.com>
11242
11243         PR 10893
11244         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11245         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11246
11247 2009-11-03  Ian Lance Taylor  <iant@google.com>
11248
11249         PR 10895
11250         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11251         --msgid-bugs-address.
11252         (install-pdf): New target.
11253         (install-data_yes): Look up one directory to find mkinstalldirs.
11254
11255 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11256
11257         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11258         tree.
11259
11260 2009-10-30  Doug Kwan  <dougkwan@google.com>
11261
11262         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11263
11264 2009-10-30  Doug Kwan  <dougkwan@google.com>
11265
11266         * arm.cc (Stub_addend_reader): New struct template definition
11267         and partial specializations.
11268         (Stub_addend_reader::operator()): New method definition for a
11269         partially specialized template.
11270
11271 2009-10-30  Doug Kwan  <dougkwan@google.com>
11272
11273         * arm.cc (Arm_relobj::processor_specific_flags): New method
11274         definition.
11275         (Arm_relobj::do_read_symbols): New method declaration.
11276         (Arm_relobj::processor_specific_flags_): New data member declaration.
11277         (Arm_dynobj): New class definition.
11278         (Target_arm::do_finalize_sections): Add input_objects parameter.
11279         (Target_arm::do_adjust_elf_header): New method declaration.
11280         (Target_arm::are_eabi_versions_compatible,
11281         (Target_arm::merge_processor_specific_flags): New method declaration.
11282         (Target_arm::do_make_elf_object): New overloaded method definitions
11283         and declaration.
11284         (Arm_relobj::do_read_symbols): New method definition.
11285         (Arm_dynobj::do_read_symbols): Ditto.
11286         (Target_arm::do_finalize_sections): Add input_objects parameters.
11287         Merge processor-specific flags from all input objects.
11288         (Target_arm::are_eabi_versions_compatible,
11289         Target_arm::merge_processor_specific_flags,
11290         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11291         New method definitions.
11292         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11293         Input_objects pointer type parameter.
11294         * layout.cc (Layout::finalize): Pass input objects to target's.
11295         finalize_sections function.
11296         * output.cc (Output_file_header::do_sized_write): Set ELF file
11297         header's processor-specific flags.
11298         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11299         Input_objects pointer type parameter.
11300         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11301         * target.h (Input_objects): New forward class declaration.
11302         (Target::processor_specific_flags,
11303         Target::are_processor_specific_flags_sect): New method definitions.
11304         (Target::finalize_sections): Add input_objects parameter.
11305         (Target::Target): Initialize processor_specific_flags_ and
11306         are_processor_specific_flags_set_.
11307         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11308         parameter.
11309         (Target::set_processor_specific_flags): New method definition.
11310         (Target::processor_specific_flags_,
11311         Target::are_processor_specific_flags_set_): New data member
11312         declarations.
11313         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11314         Input_objects pointer type parameter.
11315
11316 2009-10-30  Doug Kwan  <dougkwan@google.com>
11317
11318         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11319
11320 2009-10-28  Ian Lance Taylor  <iant@google.com>
11321
11322         * object.h (class Relobj): Drop options parameter from
11323         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11324         do_scan_relocs, do_relocate.  Change all callers.
11325         (class Sized_relobj): Drop options parameters from
11326         do_gc_process_relocs, do_scan_relocs, do_relocate,
11327         do_relocate_sections, relocate_sections, emit_relocs_scan,
11328         emit_relocs_scan_reltype.  Change all callers.
11329         (struct Relocate_info): Remove options field and all references to
11330         it.
11331         * reloc.h (class Read_relocs): Remove options constructor
11332         parameter and options_ field.  Change all callers.
11333         (class Gc_process_relocs, class Scan_relocs): Likewise.
11334         (class Relocate_task): Likewise.
11335         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11336         all callers.
11337         (scan_relocatable_relocs): Likewise.
11338         * target.h (class Sized_target): Remove options parameter from
11339         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11340         all callers.
11341         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11342         callers.
11343         * arm.cc: Update functions to remove options parameters.
11344         * i386.cc: Likewise.
11345         * powerpc.cc: Likewise.
11346         * sparc.cc: Likewise.
11347         * x86_64.cc: Likewise.
11348         * testsuite/testfile.cc: Likewise.
11349
11350 2009-10-28  Doug Kwan  <dougkwan@google.com>
11351
11352         * arm.cc (Arm_relobj): New class definition.
11353         (Arm_relobj::scan_sections_for_stubs,
11354         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11355         New method definitions.
11356
11357 2009-10-28  Cary Coutant  <ccoutant@google.com>
11358
11359         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11360         (Plugin::cleanup_done_): New member.
11361         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11362         (Plugin_manager::cleanup_done_): Remove.
11363         (Plugin_manager::add_input_file): Edit error message.
11364         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11365         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11366
11367 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11368
11369         * fileread.cc: (File_read::View::~View): Use the new
11370         data_ownership_ filed.
11371         (File_read::~File_read): Dispose the new whole_file_view_.
11372         (File_read::open): Mmap the whole file if needed.
11373         (File_read::open): Use whole_file_view_ instead of contents_.
11374         (File_read::find_view): Use whole_file_view_ if applicable.
11375         (File_read::do_read): Use whole_file_view_ instead of contents_.
11376         (File_read::make_view): Use whole_file_view_ instead of contents_,
11377         update File_read::View::View call.
11378         (File_read::find_or_make_view): Update File_read::View::View
11379         call.
11380         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11381         remove contents_
11382         (File_read::View::Data_ownership): New enum.
11383         (File_read::View::View): Replace bool mapped_ with Data_ownership
11384         argument.
11385         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11386         (File_read::View::data_ownership_): New field.
11387         (File_read::contents_): Remove (replaced by whole_file_view_).
11388         (File_read::whole_file_view_): New field.
11389         * options.h (class General_options): Add --keep-files-mapped.
11390
11391 2009-10-27  Cary Coutant  <ccoutant@google.com>
11392
11393         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11394         * testsuite/Makefile.am (plugin_test_5): New test case.
11395         * testsuite/Makefile.in: Regenerate.
11396
11397 2009-10-25  Doug Kwan  <dougkwan@google.com>
11398
11399         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11400         from private to protected to allow access by child class.
11401         (Sized_relobj::do_relocate_sections): New method declaration.
11402         (Sized_relobj::relocate_sections): Virtualize.
11403         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11404         Sized_relobj::relocate_sections.  Instantiate template explicitly
11405         for different target sizes and endianity.
11406
11407 2009-10-24  Doug Kwan  <dougkwan@google.com>
11408
11409         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11410         (Arm_input_section::as_arm_input_section): New method.
11411         (Arm_output_section): New class definition.
11412         (Arm_output_section::create_stub_group,
11413         Arm_output_section::group_sections): New method definitions.
11414
11415 2009-10-22  Doug Kwan  <dougkwan@google.com>
11416
11417         * arm.cc (Arm_input_section): New class definition.
11418         (Arm_input_section::init, Arm_input_section:do_write,
11419         Arm_input_section::set_final_data_size,
11420         Arm_input_section::do_reset_address_and_file_offset): New method
11421         definitions.
11422
11423 2009-10-21  Doug Kwan  <dougkwan@google.com>
11424
11425         * arm.cc (Stub_table, Arm_input_section): New forward class
11426         declarations.
11427         (Stub_table): New class defintion.
11428         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11429         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11430         New method definition.
11431
11432 2009-10-21  Doug Kwan  <dougkwan@google.com>
11433
11434         * arm.cc: Update copyright comments.
11435         (Target_arm): New forward class template declaration.
11436         (Arm_address): New type.
11437         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11438         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11439         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11440         constants.
11441         (Insn_template): Same.
11442         (DEF_STUBS): New macro.
11443         (Stub_type): New enum type.
11444         (Stub_template): New class definition.
11445         (Stub): Same.
11446         (Reloc_stub): Same.
11447         (Stub_factory): Same.
11448         (Target_arm::Target_arm): Initialize may_use_blx_ and
11449         should_force_pic_veneer_.
11450         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11451         Target_arm::should_force_pic_veneer,
11452         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11453         Target_arm::using_thumb_only, Target_arm:;default_target): New
11454         method defintions.
11455         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11456         New data member declarations.
11457         (Insn_template::size, Insn_template::alignment): New method defintions.
11458         (Stub_template::Stub_template): New method definition.
11459         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11460         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11461         (Stub_factory::Stub_factory): New method definition.
11462         * gold.h (string_hash): New template.
11463         * output.h (Input_section_specifier::hash_value): Use
11464         gold::string_hash.
11465         (Input_section_specifier::string_hash): Remove.
11466         * stringpool.cc (Stringpool_template::string_hash): Use
11467         gold::string_hash.
11468
11469 2009-10-20  Doug Kwan  <dougkwan@google.com>
11470
11471         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11472         symbols of relaxed input sections.
11473         * output.h (Output_section::find_relaxed_input_section): Make
11474         method public.
11475
11476 2009-10-16  Doug Kwan  <dougkwan@google.com>
11477
11478         * dynobj.cc (Versions::Versions): Initialize version_script_.
11479         Only insert base version symbol definition for a shared object
11480         if version script defines any version versions.
11481         (Versions::define_base_version): New method definition.
11482         (Versions::add_def): Check that base version is not needed.
11483         (Versions::add_need): Define base version lazily.
11484         * dynobj.h (Versions::define_base_version): New method declaration.
11485         (Versions::needs_base_version_): New data member declaration.
11486         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11487         (check_DATA): Add no_version_test.stdout.
11488         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11489         New make rules.
11490         * testsuite/Makefile.in: Regenerate.
11491         * testsuite/no_version_test.c: New file.
11492         * testsuite/no_version_test.sh: Ditto.
11493
11494 2009-10-16  Doug Kwan  <dougkwan@google.com>
11495
11496         * expression.cc (class Segment_start_expression): New class definition.
11497         (Segment_start_expression::value): New method definition.
11498         (script_exp_function_segment_start): Return a new
11499         Segment_start_expression.
11500         * gold/script-c.h (script_saw_segment_start_expression): New function
11501         prototype.
11502         * script-sections.cc (Script_sections::Script_sections): Initialize
11503         SAW_SEGMENT_START_EXPRESSION_ to false.
11504         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11505         and -Tbbs options to specify section addresses if given in
11506         command line and no SEGMENT_START expression is seen in a script.
11507         * script-sections.h (Script_sections::saw_segment_start_expression,
11508         Script_sections::set_saw_segment_start_expression): New method
11509         definition.
11510         (Script_sections::saw_segment_start_expression_): New data member
11511         declaration.
11512         * script.cc (script_saw_segment_start_expression): New function.
11513         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11514         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11515         script_test_7.sh and script_test_8.sh.
11516         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11517         script_test_8.stdout.
11518         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11519         (script_test_6, script_test_6.stdout, script_test_7,
11520         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11521         * Makefile.in: Regenerate.
11522         * testsuite/script_test_6.sh: New file.
11523         * testsuite/script_test_6.t: Same.
11524         * testsuite/script_test_7.sh: Same.
11525         * testsuite/script_test_7.t: Same.
11526         * testsuite/script_test_8.sh: Same.
11527
11528 2009-10-16  Doug Kwan  <dougkwan@google.com>
11529
11530         * output.cc (Output_segment::set_section_list_address): Cast
11531         expressions to unsigned long long type to avoid format warnings.
11532
11533 2009-10-15  Ian Lance Taylor  <iant@google.com>
11534
11535         * script.cc (Script_options::add_symbol_assignment): Always add a
11536         dot assignment to script_sections_.
11537         * script-sections.cc (Script_sections::add_dot_assignment):
11538         Initialize if necessary.
11539
11540         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11541         program headers with no load segment if there is a linker script.
11542
11543         * layout.cc (Layout::set_segment_offsets): Align the file offset
11544         to the segment aligment for -N or -n with no load segment.
11545         * output.cc (Output_segment::add_output_section): Don't crash if
11546         the first section is a TLS section.
11547         (Output_segment::set_section_list_addresses): Print an error
11548         message if the address moves backward in a linker script.
11549         * script-sections.cc
11550         (Output_section_element_input::set_section_addresses): Don't
11551         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11552         (Orphan_output_section::set_section_addresses): Likewise.
11553
11554 2009-10-15  Doug Kwan  <dougkwan@google.com>
11555
11556         * layout.cc (Layout::finish_dynamic_section): Generate tags
11557         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11558         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11559         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11560
11561 2009-10-14  Ian Lance Taylor  <iant@google.com>
11562
11563         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11564         fields.
11565         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11566         data_shdr fields of relinfo.
11567         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11568         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11569         R_386_TLS_LDO_32, adjust based on section flags.
11570         (Target_i386::Relocate::fix_up_ldo): Remove.
11571
11572 2009-10-13  Ian Lance Taylor  <iant@google.com>
11573
11574         Add support for -pie.
11575         * options.h (class General_options): Add -pie and
11576         --pic-executable.
11577         (General_options::output_is_position_independent): Test -pie.
11578         (General_options::output_is_executable): Return true if not shared
11579         and not relocatable.
11580         (General_options::output_is_pie): Remove.
11581         * options.cc (General_options::finalize): Reject incompatible uses
11582         of -pie.
11583         * gold.cc (queue_middle_tasks): A -pie link is not static.
11584         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11585         * symtab.cc (Symbol::final_value_is_known): Return false if
11586         output_is_position_independent.
11587         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11588         output_is_position_independent.
11589         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11590         output_is_position_independent.
11591         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11592         output_is_position_independent.
11593         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11594         two_file_pie_test.
11595         (basic_pie_test.o, basic_pie_test): New targets.
11596         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11597         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11598         (two_file_pie_test): New target.
11599         * testsuite/Makefile.in: Rebuild.
11600         * README: Remove note saying that -pie is not supported.
11601
11602 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11603
11604         * options.h (class General_options): Add -init and -fini.
11605         * layout.cc (Layout::finish_dynamic_section): Emit
11606         given init and fini functions.
11607
11608 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11609
11610         * gc.h (gc_process_relocs): Check if icf is enabled using new
11611         function.
11612         * gold.cc (queue_initial_tasks): Likewise.
11613         (queue_middle_tasks): Likewise.
11614         * object.cc (do_layout): Likewise.
11615         * symtab.cc (is_section_folded): Likewise.
11616         * main.cc (main): Likewise.
11617         * reloc.cc (Read_relocs::run): Likewise.
11618         (Sized_relobj::do_scan_relocs): Likewise.
11619         * icf.cc (is_function_ctor_or_dtor): New function.
11620         (Icf::find_identical_sections): Check if function is ctor or dtor when
11621         safe icf is chosen.
11622         * options.h (General_options::icf): Change option to be an enum.
11623         (Icf_status): New enum.
11624         (icf_enabled): New method.
11625         (icf_safe_folding): New method.
11626         (set_icf_status): New method.
11627         (icf_status_): New variable.
11628         * (options.cc) (General_options::finalize): Set icf_status_.
11629         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11630         icf_test and icf_keep_unique_test to use the --icf enum flag.
11631         * testsuite/icf_safe_test.sh: New file.
11632         * testsuite/icf_safe_test.cc: New file.
11633
11634 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11635
11636         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11637         includes to gc.h and icf.h.
11638         * arm.cc: Include gc.h.
11639         * gold.cc: Likewise.
11640         * i386.cc: Likewise.
11641         * powerpc.cc: Likewise.
11642         * sparc.cc: Likewise.
11643         * x86_64.cc: Likewise.
11644         * gc.h: Include icf.h.
11645
11646 2009-10-11  Ian Lance Taylor  <iant@google.com>
11647
11648         * plugin.cc: Include "gold.h" before other header files.
11649
11650 2009-10-10  Chris Demetriou  <cgd@google.com>
11651
11652         * options.h (Input_file_argument::Input_file_type): New enum.
11653         (Input_file_argument::is_lib_): Replace with...
11654         (Input_file_argument::type_): New member.
11655         (Input_file_argument::Input_file_argument): Take Input_file_type
11656         'type' rather than boolean 'is_lib' as second argument.
11657         (Input_file_argument::is_lib): Use type_.
11658         (Input_file_argument::is_searched_file): New function.
11659         (Input_file_argument::may_need_search): Handle is_searched_file.
11660         * options.cc (General_options::parse_library): Support -l:filename.
11661         (General_options::parse_just_symbols): Update for Input_file_argument
11662         changes.
11663         (Command_line::process): Likewise.
11664         * archive.cc (Archive::get_file_and_offset): Likewise.
11665         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11666         * script.cc (read_script_file, script_add_file): Likewise.
11667         * fileread.cc (Input_file::Input_file): Likewise.
11668         (Input_file::will_search_for): Handle is_searched_file.
11669         (Input_file::open): Likewise.
11670         * readsyms.cc (Read_symbols::get_name): Likewise.
11671         * testsuite/Makefile.am (searched_file_test): New test.
11672         * testsuite/Makefile.in: Regenerate.
11673         * testsuite/searched_file_test.cc: New file.
11674         * testsuite/searched_file_test_lib.cc: New file.
11675
11676 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11677             Ian Lance Taylor  <iant@google.com>
11678
11679         * descriptor.cc: Include <cstdio> and "binary-io.h".
11680         (Descriptors::open): Open the files in binary mode always.
11681         * script.cc (Lex::get_token): Treat \r as whitespace.
11682
11683 2009-10-09  Ian Lance Taylor  <iant@google.com>
11684
11685         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11686
11687 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11688             Ian Lance Taylor  <iant@google.com>
11689
11690         * configure.ac: Check for readv function also.
11691         * fileread.cc (readv): Define if not HAVE_READV.
11692         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11693         does not exist.
11694         * config.in: Regenerate.
11695         * configure: Regenerate.
11696
11697 2009-10-09  Doug Kwan  <dougkwan@google.com>
11698
11699         * layout.cc (Layout::make_output_section): Call target hook to make
11700         ordinary output section.
11701         (Layout::finalize): Adjust parameter list of call the
11702         Target::may_relax().
11703         * layout.h (class Layout::section_list): New method.
11704         * merge.h (Output_merge_base::entsize): Change visibility to public.
11705         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11706         New methods.
11707         (Output_merge_string::do_is_string): New method.
11708         * object.cc (Sized_relobj::do_setup): renamed from
11709         Sized_relobj::set_up.
11710         * object.h (Sized_relobj::adjust_shndx,
11711         Sized_relobj::initializ_input_to_output_maps,
11712         Sized_relobj::free_input_to_output_maps): Change visibilities to
11713         protected.
11714         (Sized_relobj::setup): Virtualize.
11715         (Sized_relobj::do_setup): New method declaration.
11716         (Sized_relobj::invalidate_section_offset,
11717         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11718         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11719         * options.cc (parse_int): New function.
11720         * options.h (parse_int): New declaration.
11721         (DEFINE_int): New macro.
11722         (stub_group_size): New option.
11723         * output.cc (Output_section::Output_section): Initialize memebers
11724         merge_section_map_, merge_section_by_properties_map_,
11725         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11726         (Output_section::add_input_section): Handled deferred code-fill
11727         generation and remove an old comment.
11728         (Output_section::add_relaxed_input_section): New method definition.
11729         (Output_section::add_merge_input_section): Use merge section by
11730         properties map to speed to search.  Update merge section maps
11731         as appropriate.
11732         (Output_section::build_relaxation_map): New method definition.
11733         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11734         Same.
11735         (Output_section::relax_input_section): Renamed to
11736         Output_section::convert_input_sections_to_relaxed_sections and change
11737         interface to take a vector of pointers to relaxed sections.
11738         (Output_section::find_merge_section,
11739         Output_section::find_relaxed_input_section): New method definitions.
11740         (Output_section::is_input_address_mapped,
11741         Output_section::output_offset, Output_section::output_address):
11742         Use output section data maps to speed up searching.
11743         (Output_section::find_starting_output_address): Add comments.
11744         (Output_section::do_write,
11745         Output_section::write_to_postprocessing_buffer): Do code-fill
11746         generation as appropriate.
11747         (Output_section::get_input_sections): Invalidate relaxed input section
11748         map.
11749         (Output_section::restore_states): Adjust type of checkpoint .
11750         Invalidate relaxed input section map.
11751         * output.h (Output_merge_base): New class declaration.
11752         (Input_section_specifier): New class defintion.
11753         (class Output_relaxed_input_section) Change base class to
11754         Output_section_data_build.
11755         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11756         base class initializer.
11757         (Output_section::add_relaxed_input_section): New method declaration.
11758         (Output_section::Input_section): Change visibility to protected.
11759         (Output_section::Input_section::relobj,
11760         Output_section::Input_section::shndx): Handle relaxed input sections.
11761         Output_section::input_sections) Change visibility to protected.  Also
11762         define overload to return a non-const pointer.
11763         (Output_section::Merge_section_properties): New class defintion.
11764         (Output_section::Merge_section_by_properties_map,
11765         Output_section::Output_section_data_by_input_section_map,
11766         Output_section::Relaxation_map): New types.
11767         (Output_section::relax_input_section): Rename method to
11768         Output_section::convert_input_sections_to_relaxed_sections and change
11769         interface to take a vector of relaxed section pointers.
11770         (Output_section::find_merge_section,
11771         Output_section::find_relaxed_input_section,
11772         Output_section::build_relaxation_map,
11773         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11774         New method declarations.
11775         (Output_section::merge_section_map_
11776         Output_section::merge_section_by_properties_map_,
11777         Output_section::relaxed_input_section_map_,
11778         Output_section::is_relaxed_input_section_map_valid_,
11779         Output_section::generate_code_fills_at_write_): New data members.
11780         * script-sections.cc
11781         (Output_section_element_input::set_section_addresses): Call
11782         current_data_size and addralign methods of relaxed input sections.
11783         (Orphan_output_section::set_section_addresses): Call current_data_size
11784         and addralign methods of relaxed input sections.
11785         * symtab.cc (Symbol_table::compute_final_value): Extract template
11786         from the body of Symbol_table::sized_finalize_symbol.
11787         (Symbol_table::sized_finalized_symbol): Call
11788         Symbol_table::compute_final_value.
11789         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11790         (Symbol_table::compute_final_value): New templated method declaration.
11791         * target.cc (Target::do_make_output_section): New method defintion.
11792         * target.h (Target::make_output_section): New method declaration.
11793         (Target::relax): Add more parameters for input objects, symbol table
11794         and layout.  Adjust call to do_relax.
11795         (Target::do_make_output_section): New method declaration.
11796         (Target::do_relax): Add parameters for input objects, symbol table
11797         and layout.
11798
11799 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11800
11801         * pread.c: Include stdio.h.
11802
11803 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11804
11805         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11806         defined.
11807
11808 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11809
11810         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11811         Change read_shndx type to unsigned int.
11812         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11813         int.
11814         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11815         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11816         Change read_shndx type to unsigned int.
11817         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11818         int.
11819         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11820         * layout.cc (Layout::create_symtab_sections): Cast the result of
11821         local_symcount * symsize to off_t in the gold_assert.
11822
11823 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11824
11825         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11826         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11827         R_ARM_BASE_ABS.
11828         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11829         (Arm_relocate_functions::thm_abs5): New function.
11830         (Arm_relocate_functions::abs12): New function.
11831         (Arm_relocate_functions::abs16): New function.
11832         (Arm_relocate_functions::base_abs): New function.
11833         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11834         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11835         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11836         R_ARM_BASE_ABS.
11837         (Scan::global): Likewise.
11838         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11839         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11840         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11841         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11842         R_ARM_BASE_ABS.
11843
11844 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11845
11846         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11847         (Arm_relocate_functions::movt_prel): New function.
11848         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11849         (Arm_relocate_functions::thm_movt_prel): New function.
11850         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11851         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11852         (Scan::global, Relocate::relocate): Likewise.
11853         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11854
11855 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11856
11857         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11858         Incremental_checker.
11859         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11860         unsigned int.
11861         (class Incremental_inputs_header): New class.
11862         (Incremental_inputs_header_writer): Edit comment.
11863         (Incremental_inputs_entry): New class.
11864         (Incremental_inputs_entry_writer): Edit comment.
11865         (Sized_incremental_binary::do_find_incremental_inputs_section):
11866         Add *strtab_shndx parameter, fill it.
11867         (Sized_incremental_binary::do_check_inputs): New method.
11868         (Incremental_checker::can_incrementally_link_output_file): Use
11869         Sized_incremental_binary::check_inputs.
11870         (Incremental_inputs::report_command_line): Save command line in
11871         command_line_.
11872         * incremental.h:
11873         (Incremental_binary::find_incremental_inputs_section): New
11874         method.
11875         (Incremental_binary::do_find_incremental_inputs_section): Add
11876         strtab_shndx parameter.
11877         (Incremental_binary::do_check_inputs): New pure virtual method.
11878         (Sized_incremental_binary::do_check_inputs): Declare.
11879         (Incremental_checker::Incremental_checker): Add incremental_inputs
11880         parameter, use it to initialize incremental_inputs_.
11881         (Incremental_checker::incremental_inputs_): New field.
11882         (Incremental_checker::command_line): New method.
11883         (Incremental_checker::inputs): New method.
11884         (Incremental_checker::command_line_): New field.
11885
11886 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11887
11888         * incremental.cc: Include <cstdarg> and "target-select.h".
11889         (vexplain_no_incremental): New function.
11890         (explain_no_incremental): New function.
11891         (Incremental_binary::error): New method.
11892         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11893         method.
11894         (make_sized_incremental_binary): New function.
11895         (open_incremental_binary): New function.
11896         (can_incrementally_link_file): Add checks if output is ELF and has
11897         inputs section.
11898         * incremental.h: Include "elfcpp_file.h" and "output.h".
11899         (Incremental_binary): New class.
11900         (Sized_incremental_binary): New class.
11901         (open_incremental_binary): Declare.
11902         * object.cc (is_elf_object): Use
11903         elfcpp::Elf_recognizer::is_elf_file.
11904         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11905         * output.h (Output_file::filesize): New method.
11906
11907 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11908
11909         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11910         New function.
11911         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11912         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11913         function.
11914         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11915         function.
11916         (Arm_relocate_functions::movw_abs_nc): New function.
11917         (Arm_relocate_functions::movt_abs): New function.
11918         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11919         (Arm_relocate_functions::thm_movt_abs): New function.
11920         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11921         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11922         (Scan::global): Likewise.
11923         (Relocate::relocate): Likewise.
11924         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11925
11926 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11927
11928         * arm.cc (Arm_relocate_functions::got_prel) New function.
11929         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11930         (Relocate::relocate): Likewise.
11931         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11932
11933 2009-10-06  Ian Lance Taylor  <iant@google.com>
11934
11935         * options.h (class General_options): Define
11936         split_stack_adjust_size parameter.
11937         * object.h (class Object): Add uses_split_stack_ and
11938         has_no_split_stack_ fields.  Add uses_split_stack and
11939         has_no_split_stack accessor functions.  Declare
11940         handle_split_stack_section.
11941         (class Reloc_symbol_changes): Define.
11942         (class Sized_relobj): Define Function_offsets.  Declare
11943         split_stack_adjust, split_stack_adjust_reltype, and
11944         find_functions.
11945         * object.cc (Object::handle_split_stack_section): New function.
11946         (Sized_relobj::do_layout): Call handle_split_stack_section.
11947         * dynobj.cc (Sized_dynobj::do_layout): Call
11948         handle_split_stack_section.
11949         * reloc.cc (Sized_relobj::relocate_sections): Call
11950         split_stack_adjust for executable sections in split_stack
11951         objects.  Pass reloc_map to relocate_section.
11952         (Sized_relobj::split_stack_adjust): New function.
11953         (Sized_relobj::split_stack_adjust_reltype): New function.
11954         (Sized_relobj::find_functions): New function.
11955         * target-reloc.h: Include "object.h".
11956         (relocate_section): Add reloc_symbol_changes parameter.  Change
11957         all callers.
11958         * target.h (class Target): Add calls_non_split method.  Declare
11959         do_calls_non_split virtual method.  Declare match_view and
11960         set_view_to_nop.
11961         * target.cc: Include "elfcpp.h".
11962         (Target::do_calls_non_split): New function.
11963         (Target::match_view): New function.
11964         (Target::set_view_to_nop): New function.
11965         * gold.cc (queue_middle_tasks): Give an error if mixing
11966         split-stack and non-split-stack objects with -r.
11967         * i386.cc (Target_i386::relocate_section): Add
11968         reloc_symbol_changes parameter.
11969         (Target_i386::do_calls_non_split): New function.
11970         * x86_64.cc (Target_x86_64::relocate_section): Add
11971         reloc_symbol_changes parameter.
11972         (Target_x86_64::do_calls_non_split): New function.
11973         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11974         parameter.
11975         * powerpc.cc (Target_powerpc::relocate_section): Add
11976         reloc_symbol_changes parameter.
11977         * sparc.cc (Target_sparc::relocate_section): Add
11978         reloc_symbol_changes parameter.
11979         * configure.ac: Call AM_CONDITIONAL for the default target.
11980         * configure: Rebuild.
11981         * testsuite/Makefile.am (TEST_AS): New variable.
11982         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11983         (check_DATA): Add split_i386 and split_x86_64 files.
11984         (SPLIT_DEFSYMS): Define.
11985         (split_i386_[1234n].o): New targets.
11986         (split_i386_[124]): New targets.
11987         (split_i386_[1234r].stdout): New targets.
11988         (split_x86_64_[1234n].o): New targets.
11989         (split_x86_64_[124]): New targets.
11990         (split_x86_64_[1234r].stdout): New targets.
11991         (MOSTLYCLEANFILES): Add new executables.
11992         * testsuite/split_i386.sh: New file.
11993         * testsuite/split_x86_64.sh: New file.
11994         * testsuite/split_i386_1.s: New file.
11995         * testsuite/split_i386_2.s: New file.
11996         * testsuite/split_i386_3.s: New file.
11997         * testsuite/split_i386_4.s: New file.
11998         * testsuite/split_i386_n.s: New file.
11999         * testsuite/split_x86_64_1.s: New file.
12000         * testsuite/split_x86_64_2.s: New file.
12001         * testsuite/split_x86_64_3.s: New file.
12002         * testsuite/split_x86_64_4.s: New file.
12003         * testsuite/split_x86_64_n.s: New file.
12004         * testsuite/testfile.cc (Target_test): Update relocation_section
12005         function.
12006         * testsuite/Makefile.in: Rebuild.
12007
12008 2009-10-06  Ian Lance Taylor  <iant@google.com>
12009
12010         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
12011         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
12012         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
12013         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
12014         the address on ldo_addrs_.
12015         (Target_i386::Relocate::fix_up_ldo): New function.
12016
12017 2009-10-06   Rafael Espindola  <espindola@google.com>
12018
12019         * plugin.cc (add_input_library): New.
12020         (Plugin::load): Add add_input_library to tv.
12021         (Plugin_manager::add_input_file): Add the is_lib argument.
12022         (add_input_file): Update call to Plugin_manager::add_input_file.
12023         (add_input_library): New.
12024         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
12025
12026 2009-09-30  Doug Kwan  <dougkwan@google.com>
12027
12028         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
12029         symbol and call Symbol::may_need_copy_reloc to determine if
12030         a copy reloc is needed.
12031         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
12032         nocopyreloc is given in command line.
12033         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
12034         given in command line.
12035         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
12036         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
12037         of the removed Target_i386::may_need_copy_reloc.
12038         * options.h (copyreloc): New option with default value false.
12039         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12040         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
12041         instead of the removed Target_powerpc::may_need_copy_reloc.
12042         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
12043         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
12044         instead of the removed Target_sparc::may_need_copy_reloc.
12045         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
12046         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
12047         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
12048         instead of the removed Target_x86_64::may_need_copy_reloc.
12049
12050 2009-09-30  Ian Lance Taylor  <iant@google.com>
12051
12052         * object.h (class Object): Remove target_ field, and target,
12053         sized_target, and set_target methods.
12054         (Object::sized_target): Remove.
12055         (class Sized_relobj): Update declarations.  Remove sized_target.
12056         * object.cc (Sized_relobj::setup): Remove target parameter.
12057         Change all callers.
12058         (Input_objects::add_object): Don't do anything with the target.
12059         (make_elf_sized_object): Add punconfigured parameter.  Change all
12060         callers.  Set or test parameter target.
12061         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12062         Change all callers.
12063         * parameters.cc (Parameters::set_target): Change parameter type to
12064         be non-const.
12065         (Parameters::default_target): Remove.
12066         (set_parameters_target): Change parameter type to be non-const.
12067         (parameters_force_valid_target): New function.
12068         (parameters_clear_target): New function.
12069         * parameters.h (class Parameters): Update declarations.  Remove
12070         default_target method.  Add sized_target and clear_target
12071         methods.  Change target_ to be non-const.
12072         (set_parameters_target): Update declaration.
12073         (parameters_force_valid_target): Declare.
12074         (parameters_clear_target): Declare.
12075         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12076         as NULL if we aren't searching.
12077         (Add_symbols::run): Don't check for compatible target.
12078         * fileread.cc (Input_file::open_binary): Call
12079         parameters_force_valid_target.
12080         * gold.cc (queue_middle_tasks): Likewise.
12081         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12082         set_target on object.
12083         * dynobj.h (class Sized_dynobj): Update declarations.
12084         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12085         make_elf_object returns NULL.
12086         (Archive::include_member): Don't check whether object target is
12087         compatible.
12088         * output.cc (Output_section::add_input_section): Get target from
12089         parameters.
12090         (Output_section::relax_input_section): Likewise.
12091         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12092         parameters.
12093         (Sized_relobj::do_scan_relocs): Likewise.
12094         (Sized_relobj::relocate_sections): Likewise.
12095         * resolve.cc (Symbol_table::resolve): Likewise.
12096         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12097         parameter.  Change all callers.
12098         (Symbol_table::add_from_object): Get target from parameters.
12099         (Symbol_table::add_from_relobj): Don't check object target.
12100         (Symbol_table::add_from_dynobj): Likewise.
12101         (Symbol_table::define_special_symbol): Get target from
12102         parameters.
12103         * symtab.h (class Symbol_table): Update declaration.
12104         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12105         parameter.  Change all callers.  Clear parameter target.
12106         (Binary_test): Test target here.
12107         * testsuite/object_unittest.cc (gold_testsuite): Remove
12108         target_test_pointer parameter.  Change all callers.
12109         (Object_test): Test target here.
12110
12111 2009-09-26  Ian Lance Taylor  <iant@google.com>
12112
12113         * testsuite/initpri1.c: Don't try to use constructor priorities if
12114         compiling with gcc before 4.3.
12115
12116 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12117
12118         * testsuite/retain_symbols_file_test.sh (check_present): Change
12119         output file name to retain_symbols_file_test.stdout.
12120         (check_absent): Likewise.
12121
12122 2009-09-18  Craig Silverstein  <csilvers@google.com>
12123
12124         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12125         * options.cc: Include <cerrno> and <fstream>.
12126         (General_options::finalize): Parse -retain-symbols-file tag.
12127         * options.h: New flag.
12128         (General_options): New method should_retain_symbol, new
12129         variable symbols_to_retain.
12130         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12131         should_retain_symbol map.
12132         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12133         * testsuite/Makefile.in: Regenerate.
12134         * testsuite/retain_symbols_file_test.sh: New file.
12135
12136 2009-09-18  Nick Clifton  <nickc@redhat.com>
12137
12138         * po/es.po: Updated Spanish translation.
12139
12140 2009-09-17  Doug Kwan  <dougkwan@google.com>
12141
12142         * debug.h (DEBUG_RELAXATION): New constant.
12143         (DEBUG_ALL): Add DEBUG_RELAXATION.
12144         (debug_string_to_enum): Add relaxation debug option.
12145         * layout.cc
12146         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12147         Layout::Relaxation_debug_check::read_sections,
12148         Layout::Relaxation_debug_check::read_sections): New method definitions.
12149         (Layout::Layout): Initialize data members
12150         record_output_section_data_from_scrips_,
12151         script_output_section_data_list_ and relaxation_debug_check_.
12152         (Layout::save_segments, Layout::restore_segments,
12153         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12154         Layout::relaxation_loop_body): New method definitions.
12155         (Layout::finalize): Support relaxation.  Move section layout code to
12156         Layout::relaxation_loop_body.
12157         (Layout::set_asection_address_from_script): Move code for orphan
12158         section placement out.
12159         (Layout::place_orphan_sections_in_script): New method definition.
12160         * layout.h (Output_segment_headers, Output_file_header):
12161         New forward class declarations.
12162         (Layout::~Layout): Define.
12163         (Layout::new_output_section_data_from_script): New method definition.
12164         (Layout::place_orphan_sections_in_script): New method declaration.
12165         (Layout::Segment_states): New type declaration.
12166         (Layout::save_segments, Layout::restore_segments,
12167         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12168         Layout::relaxation_loop_body): New method declarations.
12169         (Layout::Output_section_data_list): New type declaration.
12170         (Layout::Relaxation_debug_check): New class definition.
12171         (Layout::record_output_section_data_from_script_,
12172         Layout::script_output_section_data_list_, Layout::segment_states_,
12173         Layout::relaxation_debug_check_): New data members.
12174         * output.cc: (Output_section_headers::do_size): New method definition.
12175         (Output_section_headers::Output_section_headers): Move size
12176         computation to Output_section_headers::do_size.
12177         (Output_segment_headers::do_size): New method definition.
12178         (Output_file_header::Output_file_header): Move size computation to
12179         Output_file_header::do_size and call it.
12180         (Output_file_header::do_size): New method definition.
12181         (Output_data_group::Output_data_group): Adjust call to
12182         Output_section_data.
12183         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12184         (Output_symtab_xindex::do_write): Add array bound check.
12185         (Output_section::Input_section::print_to_mapfile): Handle
12186         RELAXED_INPUT_SECTION_CODE.
12187         (Output_section::Output_section): Initialize data member checkpoint_.
12188         (Output_section::~Output_section): Delete checkpoint object pointed
12189         by checkpoint_.
12190         (Output_section::add_input_section): Always add an Input_section if
12191         relaxing.
12192         (Output_section::add_merge_input_section): Add assert.
12193         (Output_section::relax_input_section): New method definition.
12194         (Output_section::set_final_data_size): Set load address to zero for
12195         an unallocated section.
12196         (Output_section::do_address_and_file_offset_have_reset_values):
12197         New method definition.
12198         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12199         Handle relaxed input section.
12200         (Output_section::sort_attached_input_sections): Checkpoint input
12201         section list lazily.
12202         (Output_section::get_input_sections): Change type of input_sections to
12203         list of Simple_input_section pointers.  Checkpoint input section list
12204         lazily.  Also handle relaxed input sections.
12205         (Output_section::add_input_section_for_script): Take a reference to
12206         a Simple_input_section object instead of Relobj pointer and section
12207         index as parameter.  Handle relaxed input sections.
12208         (Output_section::save_states, Output_section::restore_states): New
12209         method definitions.
12210         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12211         (Output_data::is_data_size_fixed): New method definition.
12212         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12213         if it is fixed.
12214         (Output_data::address_and_file_offset_have_reset_values): New method
12215         definition.
12216         (Output_data::do_address_and_file_offset_have_reset_values): New method
12217         definition.
12218         (Output_data::set_data_size): Check that data size is not fixed.
12219         (Output_data::fix_data_size): New method definition.
12220         (Output_data::is_data_size_fixed_): New data member.
12221         (Output_section_headers::set_final_data_size): New method definition.
12222         (Output_section_headers::do_size): New method declaration.
12223         (Output_segment_headers::set_final_data_size): New method definition.
12224         (Output_segment_headers::do_size): New method declaration.
12225         (Output_file_header::set_final_data_size)::New method definition.
12226         (Output_file_header::do_size)::New method declaration.
12227         (Output_section_data::Output_section_data): Add new parameter
12228         is_data_size_fixed and use it to fix data size.
12229         (Output_data_const::Output_data_const): Adjust call to base class
12230         constructor and fix data size.
12231         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12232         base class constructor and fix data size.
12233         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12234         base class constructor and fix data size.
12235         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12236         class constructor and fix data size.
12237         (Output_data_group::set_final_data_size): New method definition.
12238         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12239         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12240         class constructor and fix data size.
12241         (Output_relaxed_input_section): New class definition.
12242         (Output_section::Simple_input_section): New class definition.
12243         (Output_section::get_input_sections): Adjust parameter list.
12244         (Output_section::add_input_section_for_script): Same.
12245         (Output_section::save_states, Output_section::restore_states,
12246         Output_section::do_address_and_file_offset_have_reset_values,
12247         (Output_section::Input_section::Input_section): Handle
12248         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12249         Output_relaxed_input_section.
12250         (Output_section::Input_section::is_input_section,
12251         Output_section::Input_section::set_output_section): Handle relaxed
12252         input section.
12253         (Output_section::Input_section::is_relaxed_input_section,
12254         Output_section::Input_section::output_section_data,
12255         Output_section::Input_section::relaxed_input_section): New method
12256         definitions.
12257         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12258         value.
12259         (Output_section::Input_section::u1_): Update comments.
12260         (Output_section::Input_section::u2_): Add new union member poris.
12261         (Output_section::Checkpoint_output_section): New classs definition.
12262         (Output_section::relax_input_section): New method declaration.
12263         (Output_section::checkpoint_): New data member.
12264         (Output_segment): Update comments.
12265         (Output_segment::Output_segment): Un-privatize copy constructor.
12266         (Output_segment::operator=): Un-privatize.
12267         * script-sections.cc (Output_section_element::Input_section_list):
12268         Change element type to Output_section::Simple_input_section.
12269         (Output_section_element_dot_assignment::set_section_addresses):
12270         Register output section data for relaxation clean up.
12271         (Output_data_exression::Output_data_expression): Adjust call to base
12272         constructor to fix data size.
12273         (Output_section_element_data::set_section_addresses): Register
12274         Output_data_expression object for relaxation clean up.
12275         (struct Input_section_info): Replace Relobj pointer and section index
12276         pair with Output_section::Simple_input_section and Convert struct to a
12277         class.
12278         (Input_section_sorter::operator()): Adjust access to
12279         Input_section_info data member to use accessors.
12280         (Output_section_element_input::set_section_addresses): Use layout
12281         parameter.  Adjust code to use Output_section::Simple_input_section
12282         and Input_secction_info classes.  Register filler for relaxation
12283         clean up.
12284         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12285         and section index pair with Output_section::Simple_input_section
12286         class.  Adjust code accordingly.
12287         (Phdrs_element::release_segment): New method definition.
12288         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12289         segment list.
12290         (Script_sections::release_segments): New method definition.
12291         * gold/script-sections.h (Script_sections::release_segments): New
12292         method declaration.
12293         * gold/target.h (Target::may_relax, Target::relax,
12294         Target::do_may_relax, Target::do_relax): New method definitions.
12295
12296 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12297
12298         * arm.cc (has_signed_unsigned_overflow): New function.
12299         (Arm_relocate_functions::abs8): New function.
12300         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12301         (Target_arm::Scan::global): Likewise.
12302         (Target_arm::relocate::relocate): Likewise.
12303         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12304         Likewise.
12305
12306 2009-09-16  Cary Coutant  <ccoutant@google.com>
12307
12308         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12309         * testsuite/Makefile.in: Regenerate.
12310
12311 2009-09-11  Nick Clifton  <nickc@redhat.com>
12312
12313         * po/gold.pot: Updated by the Translation project.
12314
12315 2009-09-08  Cary Coutant  <ccoutant@google.com>
12316
12317         * output.cc (Output_file::open): Add execute permission to empty file.
12318         * testsuite/Makefile.am (permission_test): New test.
12319         * testsuite/Makefile.in: Regenerate.
12320
12321 2009-09-02  Ian Lance Taylor  <iant@google.com>
12322
12323         * output.cc (Output_file::resize): Call map_no_anonymous rather
12324         than map.
12325
12326 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12327
12328         * gold.cc: Include "incremental.h".
12329         (queue_initial_tasks): Call Incremental_checker methods.
12330         * incremental.cc: Include "output.h".
12331         (Incremental_checker::can_incrementally_link_output_file): New
12332         method.
12333         * incremental.h (Incremental_checker): New class.
12334
12335         * output.cc (Output_file::open_for_modification): New method.
12336         (Output_file::map_anonymous): Changed return type to bool.  Record
12337         map in base_ field.
12338         (Output_file::map_no_anonymous): New method, broken out of map.
12339         (Output_file::map): Use map_no_anonymous and map_anonymous.
12340         * output.h (class Output_file): Update declarations.
12341
12342 2009-08-24  Cary Coutant  <ccoutant@google.com>
12343
12344         * options.h (Command_line::Pre_options): New class.
12345         (Command_line::pre_options): New member.
12346         * options.cc (gold::options::ready_to_register): New variable.
12347         (One_option::register_option): Do nothing if not registering options.
12348         Assert if same short option registered twice.
12349         (General_options::General_options): Turn off option registration when
12350         done constructing.
12351         (Command_line::Pre_options::Pre_options): New constructor.
12352
12353 2009-08-24  Cary Coutant  <ccoutant@google.com>
12354
12355         * options.h (General_options::no_keep_memory): Remove incorrect
12356         short option.
12357
12358 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12359
12360         * Makefile.am (am__skiplex, am__skipyacc): New.
12361         * Makefile.in: Regenerate.
12362
12363 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12364
12365         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12366         (INCLUDES): ... this.
12367         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12368         (AM_CPPFLAGS): Renamed from ...
12369         (INCLUDE): ... this.
12370         * Makefile.in, testsuite/Makefile.in: Regenerate.
12371
12372         * Makefile.in: Regenerate.
12373         * aclocal.m4: Likewise.
12374         * config.in: Likewise.
12375         * configure: Likewise.
12376         * testsuite/Makefile.in: Likewise.
12377
12378         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12379         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12380         * Makefile.in: Regenerate.
12381         * testsuite/Makefile.in: Regenerate.
12382
12383 2009-08-19  Cary Coutant  <ccoutant@google.com>
12384
12385         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12386         symbols in shared libraries overridden by hidden or internal symbols
12387         in the main program.
12388
12389 2009-08-19  Chris Demetriou  <cgd@google.com>
12390
12391         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12392         checking source file names in error messages.
12393
12394 2009-08-18  Doug Kwan  <dougkwan@google.com>
12395
12396         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12397         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12398         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12399         an elfcpp::Ehdr as parameter.
12400         * object.cc (Object::set_target): Remove the version that looks up
12401         a target and sets it.
12402         (Sized_relobj::setup): Take a Target object instead of
12403         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12404         (make_elf_sized_object): Find target and ask target to
12405         make an ELF object.
12406         * object.h: (Object::set_target): Remove the version that looks up
12407         a target and sets it.
12408         (Sized_relobj::setup): Take a Target object instead of
12409         an elfcpp:Ehdr as parameter.
12410         * target.cc: Include dynobj.h.
12411         (Target::do_make_elf_object_implementation): New.
12412         (Target::do_make_elf_object): New.
12413         * target.h (Target::make_elf_object): New template declaration.
12414         (Target::do_make_elf_object): New method declarations.
12415         (Target::do_make_elf_object_implementation): New template declaration.
12416
12417 2009-08-14  Ian Lance Taylor  <iant@google.com>
12418
12419         * gold.h (FUNCTION_NAME): Define.
12420         (gold_unreachable): Use FUNCTION_NAME.
12421
12422 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12423
12424         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12425         symbol in the --keep-unique list is not found.
12426
12427 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12428
12429         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12430         been maked as --keep-unique.
12431         (Icf::unfold_section): New function.
12432         * icf.h (Icf::unfold_section): New function.
12433         * options.h (General_options::keep_unique): New option.
12434         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12435         * testsuite/Makefile.in: Regenerate.
12436         * testsuite/icf_keep_unique_test.sh: New file.
12437         * testsuite/icf_keep_unique_test.cc: New file.
12438
12439 2009-08-12  Cary Coutant  <ccoutant@google.com>
12440
12441         PR 10471
12442         * resolve.cc (Symbol_table::resolve): Check for references from
12443         dynamic objects to hidden and internal symbols.
12444         * testsuite/Makefile.am (hidden_test.sh): New test.
12445         * testsuite/Makefile.in: Regenerate.
12446         * testsuite/hidden_test.sh: New script.
12447         * testsuite/hidden_test_1.c: New test source.
12448         * testsuite/hidden_test_main.c: New test source.
12449
12450 2009-08-11  Doug Kwan  <dougkwan@google.com>
12451
12452         * arm.cc: Update comments.
12453         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12454         segment to locate the .ARM.exidx section if present.
12455
12456 2009-08-09  Doug Kwan  <dougkwan@google.com>
12457
12458         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12459         patch.
12460
12461 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12462         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12463         compiler warnings.
12464
12465 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12466
12467         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12468         valid tls_segment only for non-debug-section relocations.
12469         * testsuite/Makefile.am: Add gc_tls_test.
12470         * testsuite/Makefile.in: Regenerate.
12471         * testsuite/gc_tls_test.cc: New file.
12472         * testsuite/gc_tls_test.sh: New file.
12473
12474 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12475
12476         * icf.cc: New file.
12477         * icf.h: New file.
12478         * Makefile.am (CCFILES): Add icf.cc.
12479         (HFILES): Add icf.h
12480         * Makefile.in: Regenerate.
12481         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12482         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12483         section, symbol and addend information for the relocs.
12484         * gold.cc (queue_middle_tasks): Call identical code folding.
12485         * gold.h: Add defines for multimap.
12486         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12487         to the call of finalize_local_symbols.
12488         * main.cc (main): Create object of class Icf.
12489         * object.cc (Sized_relobj::do_layout): Allow this function to be
12490         called twice during icf.
12491         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12492         to sections marked as identical by icf.
12493         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12494         when available.
12495         (Sized_relobj::do_section_entsize): New function.
12496         * object.h (Object::section_entsize): New function.
12497         (Object::do_section_entsize): New pure virtual function.
12498         (Relobj::finalize_local_symbols): Add new parameter.
12499         (Relobj::do_section_entsize): New function.
12500         * options.h (General_options::icf): New option.
12501         (General_options::icf_iterations): New option.
12502         (General_options::print_icf_sections): New option.
12503         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12504         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12505         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12506         icf.
12507         * symtab.cc (Symbol_table::is_section_folded): New function.
12508         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12509         to sections marked as identical by icf.
12510         * symtab.h (Symbol_table::set_icf): New function.
12511         (Symbol_table::icf): New function.
12512         (Symbol_table::is_section_folded): New function.
12513         (Symbol_table::icf_): New data member.
12514         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12515         * testsuite/Makefile.am: Add commands to build icf_test.
12516         * testsuite/Makefile.in: Regenerate.
12517         * testsuite/icf_test.sh: New file.
12518         * testsuite/icf_test.cc: New file.
12519
12520 2009-07-24  Chris Demetriou  <cgd@google.com>
12521
12522         * layout.cc (is_compressible_debug_section): Fix incorrect
12523         comment about compressed section names.
12524
12525 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12526
12527         PR 10419
12528         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12529
12530 2009-07-16  Ian Lance Taylor  <iant@google.com>
12531
12532         PR 10400
12533         * layout.h: #include <map>.
12534         (class Kept_section): Change from struct to class.  Add accessors
12535         and setters.  Add section size to Comdat_group mapping.  Change
12536         Comdat_group to std::map.  Add is_comdat_ field.  Add
12537         linkonce_size field in union.
12538         (class Layout): Update declaration of find_or_add_kept_section.
12539         Don't declare find_kept_object.
12540         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12541         parameter.  Add object, shndx, is_comdat, and is_group_name
12542         parameters.  Change all callers.  Adjust for new Kept_section.
12543         (Layout::find_kept_object): Remove.
12544         * object.cc (Sized_relobj::include_section_group): Update use of
12545         Kept_section.  Rename secnum to shndx.  Only record
12546         Kept_comdat_section if sections are the same size.
12547         (Sized_relobj::include_linkonce_section): Update use of
12548         Kept_section.  Only record Kept_comdat_section if sections are the
12549         same size.  Set size of linkonce section.
12550         (Sized_relobj::map_to_kept_section): Update call to
12551         get_kept_comdat_section.
12552         * object.h (class Sized_relobj): Rename fields in
12553         Kept_comdat_section to drop trailing underscores; change object
12554         field to Relobj*.  Change Kept_comdat_section_table to store
12555         struct rather than pointer.
12556         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12557         Add kept_object and kept_shndx parameters.  Change all callers.
12558         (Sized_relobj::get_kept_comdat_section): Change return type to
12559         bool.  Add kept_object and kept_shndx parameters.  Change all
12560         callers.
12561         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12562         Layout::find_or_add_kept_section.
12563
12564 2009-07-09  Ian Lance Taylor  <iant@google.com>
12565
12566         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12567         Reserve space in the hash table.
12568
12569 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12570
12571         * fileread.cc (File_read::get_mtime): New method.
12572         * fileread.h (Timespec): New structure.
12573         (File_read::get_mtime): New method.
12574         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12575         Renamed from timestamp_nsec.
12576         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12577         Elf_Xword.
12578         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12579         timestamp_nsec.
12580         (Incremental_inputs::report_archive): Save mtime; style fix.
12581         (Incremental_inputs::report_obejct): Save mtime; style fix.
12582         (Incremental_inputs::report_script): Save mtime; style fix.
12583         (Incremental_inputs::finalize_inputs): Style fix.
12584         (Incremental_inputs::finalize): Style fix.
12585         (Incremental_inputs::create_input_section_data): Store inputs
12586         mtime.
12587         * incremental.h (Incremental_inputs::report_script): Add mtime
12588         argument.
12589         (Incremental_inputs::Input_info::Input_info): Intialize only one
12590         union member.
12591         (Incremental_inputs::Input_info::archive): Move to nameless
12592         union.
12593         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12594         (Incremental_inputs::Input_info::script): Move to nameless union.
12595         (Incremental_inputs::mtime): New field.
12596         * script.cc (read_input_script): Pass file mtime to
12597         Incremental_input.
12598         * script.h (Script_info::inputs): Style fix.
12599
12600 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12601
12602         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12603         instead of 32.
12604
12605 2009-06-24  Ian Lance Taylor  <iant@google.com>
12606
12607         PR 10156
12608         * layout.cc (Layout::choose_output_section): If we find an
12609         existing section, update the flags.
12610         (Layout::create_notes): New function, broken out of
12611         Layout::finalize.
12612         (Layout::finalize): Don't create note sections.
12613         (Layout::create_note): Don't crash if linker script discards
12614         section.
12615         (Layout::create_gold_note): Likewise.
12616         (Layout::create_build_id): Likewise.  Don't set
12617         after_input_sections on the section.
12618         (Layout::create_executable_stack_info): Remove target parameter.
12619         Change caller.
12620         * layout.h (class Layout): Declare create_notes.  Update
12621         declaration of create_executable_stack_info.
12622         * gold.cc (queue_middle_tasks): Call create_notes.
12623         * output.cc (Output_section::update_flags_for_input_section): Move
12624         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12625         invalid.
12626         * output.h (Output_data::mark_address_invalid): New function.
12627         (class Output_section): Only declare, not define,
12628         update_flags_for_input_section.  Remove set_flags.
12629
12630 2009-06-24  Ian Lance Taylor  <iant@google.com>
12631
12632         * script-sections.cc (Output_section_definition::
12633         set_section_addresses): Rename shadowing local load_address to
12634         laddr.
12635
12636 2009-06-24  Ian Lance Taylor  <iant@google.com>
12637
12638         PR 10244
12639         * reloc.cc (relocate_sections): Skip empty relocation sections.
12640
12641 2009-06-23  Ian Lance Taylor  <iant@google.com>
12642
12643         PR 10156
12644         * layout.cc (Layout::create_note): Use choose_output_section
12645         rather than make_output_section.
12646
12647 2009-06-23  Ian Lance Taylor  <iant@google.com>
12648
12649         PR 10237
12650         * options.cc (General_options::parse_V): Set printed_version_.
12651         (General_options::General_options): Initialize printed_version_.
12652         * options.h (class General_options): Add printed_version_ field.
12653         * gold.cc (queue_initial_tasks): If there are no input files,
12654         don't give a fatal error if we printed the version information.
12655         (queue_middle_tasks): If using -r with a shared object, give a
12656         fatal error rather than an ordinary error.
12657
12658 2009-06-23  Ian Lance Taylor  <iant@google.com>
12659
12660         PR 10219
12661         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12662         (Layout::make_output_section): Set have_stabstr_section_ if we see
12663         a .stab*str section.
12664         (Layout::finalize): Call link_stabs_sections.
12665         (Layout::link_stabs_sections): New file.
12666         * layout.h (class Layout): Add have_stabstr_section_ field.
12667         Declare link_stabs_sections.
12668
12669 2009-06-23  Doug Kwan  <dougkwan@google.com>
12670
12671         * Makefile.am (libgold_a_LIBADD): New.
12672         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12673         * Makefile.in: Regenerate.
12674         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12675         * configure: Regenerate.
12676         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12677         * fileread.cc: Include sys/state.h
12678         * gold.h: Declare memmem and strndup if found missing.
12679         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12680
12681 2009-06-23  Ian Lance Taylor  <iant@google.com>
12682
12683         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12684         * configure: Rebuild.
12685
12686 2009-06-23  Ian Lance Taylor  <iant@google.com>
12687
12688         PR 10147
12689         * object.cc (Object::section_contents): Don't try to get a view if
12690         the section has length zero.
12691         (Object::handle_gnu_warning_section): If the section is empty, use
12692         the name of the section as the warning.
12693
12694 2009-06-23  Ian Lance Taylor  <iant@google.com>
12695
12696         PR 10133
12697         * stringpool.h (class Stringpool_template): Add optimize_ field.
12698         (Stringpool_template::set_optimize): New function.
12699         * stringpool.cc (Stringpool_template::Stringpool_template):
12700         Initialize optimize_ field.
12701         (Stringpool_template::set_string_offsets): Test local optimize
12702         fild rather than parameter.
12703         * layout.cc (Layout::Layout): Call set_optimize on the section
12704         name stringpool.
12705
12706 2009-06-22  Ian Lance Taylor  <iant@google.com>
12707
12708         PR 10030
12709         * yyscript.y: Parse TARGET.
12710         * script.cc (script_set_target): New function.
12711         * script-c.h (script_set_target): Declare.
12712         * options.cc (General_options::string_to_object_format): Rename
12713         from string_to_object_format in anonymous namespace.  Change
12714         callers.
12715         * options.h (class General_options): Declare
12716         string_to_object_format.
12717
12718 2009-06-22  Ian Lance Taylor  <iant@google.com>
12719
12720         * script-sections.cc (Script_sections::create_segments): Don't put
12721         program headers in a PT_LOAD segment if -n or -N.
12722
12723 2009-06-22  Ian Lance Taylor  <iant@google.com>
12724
12725         PR 10141
12726         * options.h (class General_options): Add -z lazy and -z now.  Sort
12727         -z options into alphabetical order.
12728         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12729
12730 2009-06-21  Ian Lance Taylor  <iant@google.com>
12731
12732         * layout.cc (Layout::make_output_section): Call
12733         Target::new_output_section.
12734         (Layout::attach_allocated_section_to_segment): Put large section
12735         sections in a separate load segment with the large segment flag
12736         set.
12737         (Layout::segment_precedes): Sort large data segments after other
12738         load segments.
12739         (align_file_offset): New static function.
12740         (Layout::set_segment_offsets): Use align_file_offset.
12741         * output.h (class Output_section): Add is_small_section_ and
12742         is_large_section_ fields.
12743         (Output_section::is_small_section): New function.
12744         (Output_section::set_is_small_section):  New function.
12745         (Output_section::is_large_section): New function.
12746         (Output_section::set_is_large_section): New function.
12747         (Output_section::is_large_data_section): New function.
12748         (class Output_segment): Add is_large_data_segment_ field.
12749         (Output_segment::is_large_data_segment): New function.
12750         (Output_segment::set_is_large_data_segment): New function.
12751         * output.cc (Output_section::Output_section): Initialize new
12752         fields.
12753         (Output_segment::Output_segment): Likewise.
12754         (Output_segment::add_output_section): Add assertion that large
12755         data sections always go in large data segments.  Force small data
12756         sections to the end of the list of data sections.  Force small BSS
12757         sections to the start of the list of BSS sections.  For large BSS
12758         sections to the end of the list of BSS sections.
12759         * symtab.h (class Symbol): Declare is_common_shndx.
12760         (Symbol::is_defined): Check Symbol::is_common_shndx.
12761         (Symbol::is_common): Likewise.
12762         (class Symbol_table): Define enum Commons_section_type.  Update
12763         declarations.  Add small_commons_ and large_commons_ fields.
12764         * symtab.cc (Symbol::is_common_shndx): New function.
12765         (Symbol_table::Symbol_table): Initialize new fields.
12766         (Symbol_table::add_from_object): Put small and large common
12767         symbols in the right list.
12768         (Symbol_table::sized_finalized_symbol): Check
12769         Symbol::is_common_shndx.
12770         (Symbol_table::sized_write_globals): Likewise.
12771         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12772         common symbol lists.  Don't call do_allocate_commons_list if the
12773         list is empty.
12774         (Symbol_table::do_allocate_commons_list): Remove is_tls
12775         parameter.  Add comons_section_type parameter.  Change all
12776         callers.  Handle small and large common symbols.
12777         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12778         Symbol::is_common_shndx.
12779         * resolve.cc (symbol_to_bits): Likewise.
12780         * target.h (Target::small_common_shndx): New function.
12781         (Target::small_common_section_flags): New function.
12782         (Target::large_common_shndx): New function.
12783         (Target::large_common_section_flags): New function.
12784         (Target::new_output_section): New function.
12785         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12786         small_common_section_flags, and large_common_section_flags
12787         fields.
12788         (Target::do_new_output_section): New virtual function.
12789         * arm.cc (Target_arm::arm_info): Initialize new fields.
12790         * i386.cc (Target_i386::i386_info): Likewise.
12791         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12792         Likewise.
12793         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12794         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12795         (Target_x86_64::do_new_output_section): New function.
12796         * configure.ac: Define conditional MCMODEL_MEDIUM.
12797         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12798         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12799         (large_LDFLAGS): Define.
12800         * testsuite/large.c: New file.
12801         * testsuite/testfile.cc (Target_test::test_target_info):
12802         Initialize new fields.
12803         * configure, testsuite/Makefile.in: Rebuild.
12804
12805 2009-06-05  Doug Kwan  <dougkwan@google.com>
12806
12807         * Makefile.am (CCFILES): Add target.cc.
12808         * Makefile.in: Regenerate.
12809         * i386.cc (class Target_i386): Define new virtual method to
12810         override do_is_local_label_name in parent.
12811         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12812         local symbols if --discard-locals or -X is given.
12813         * options.h (class General_options): Declare new options
12814         '--discard-locals' and '-X' for discarding locals.
12815         * target.h (class Target): Define new methods is_local_label_name.
12816         Declare new virtual method do_is_local_label_name.
12817         * target.cc: New file.
12818         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12819         (check_SCRIPTS): Add discard_locals_test.sh.
12820         (check_DATA): Add discard_local_tests.syms.
12821         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12822         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12823         * testsuite/Makefile.in: Regenerate.
12824         * testsuite/discard_locals_test.c: New file.
12825         * testsuite/discard_locals_test.sh: Same.
12826
12827 2009-06-05  Doug Kwan  <dougkwan@google.com>
12828
12829         * object.cc (Sized_relobj::Sized_relobj): Initialize
12830         discarded_eh_frame_shndx_ to -1U.
12831         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12832         section.
12833         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12834         a discarded .eh_frame section.
12835         (Sized_relobj::do_finalize_local_symbols): Ditto.
12836         * object.h (class Sized_relobj): Declare new member
12837         discarded_eh_frame_shndx_.
12838         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12839         (local_labels_test.o, local_labels_test): New rules.
12840         * testsuite/Makefile.in: Regenerate.
12841
12842 2009-06-04  Doug Kwan  <dougkwan@google.com>
12843
12844         * layout.cc (Layout::section_name_mapping): Add mapping for
12845         special ARM sections.
12846
12847 2009-06-03  Doug Kwan  <dougkwan@google.com>
12848
12849         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12850         (utils::has_overflow): Same.
12851
12852 2009-06-03  Ian Lance Taylor  <iant@google.com>
12853
12854         * layout.cc (Layout::section_name_mapping): New array, replacing
12855         Layout::linkonce_mapping.
12856         (Layout::section_name_mapping_count): New variable, replacing
12857         Layout::linkonce_mapping_count.
12858         (Layout::linkonce_output_name): Remove.
12859         (Layout::output_section_name): Rewrite.
12860         * layout.h (class Layout): Rename Linkonce_mapping to
12861         Section_name_mapping, linkonce_mapping to section_name_mapping,
12862         linkonce_mapping_count to section_name_mapping_count.  Don't
12863         declare linkonce_output_name.
12864
12865 2009-06-03  Doug Kwan  <dougkwan@google.com>
12866
12867         * gold/arm.cc (namespace utils): New.
12868         (Target_arm::reloc_is_non_pic): Define new method.
12869         (class Arm_relocate_functions): New.
12870         (Target_arm::Relocate::relocate): Handle relocation types used by
12871         Android.
12872
12873 2009-06-03  Ian Lance Taylor  <iant@google.com>
12874
12875         * arm.cc (Target_arm::scan::global): Use || instead of |.
12876
12877 2009-06-02  Doug Kwan  <dougkwan@google.com>
12878
12879         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12880         issued_non_pic_error_.
12881         (class Target_arm::Scan): Declare new method check_non_pic.
12882         Define new method symbol_needs_plt_entry.
12883         Declare new data member issued_non_pic_error_.
12884         (class Target_arm::Relocate): Declare new method
12885         should_apply_static_reloc.
12886         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12887         (Target_arm::Scan::check_non_pic): Define new method.
12888         (Target_arm::Scan::local): Handle a small subset of reloc types used
12889         by Android.
12890         (Target_arm::Scan::local): Same.
12891         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12892
12893 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12894
12895         * incremental.cc (Incremental_inputs::report_command_line): Filter
12896         out --incremental-* options.
12897
12898 2009-05-29  Doug Kwan  <dougkwan@google.com>
12899
12900         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12901         template class.
12902         (class Target_arm): Update comment.
12903         (Target_arm::Target_arm): Initialize new data members GOT_,
12904         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12905         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12906         and Target_arm::rel_dyn_section.
12907         Declare new_enum Target_arm::Got_type.
12908         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12909         and DYNBSS_.
12910         Update commments for member do_dynsym_value.
12911         (Target_arm::got_size, Target_arm::plt_section,
12912         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12913         new methods inside class defintion.
12914         (Target_arm::got_section): Define new method.
12915         (Target_arm::rel_dyn_section): Same.
12916         (Output_data_plt_arm): New template class.
12917         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12918         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12919         (Output_data_plt_arm::add_entry): Same.
12920         (Output_data_plt_arm::first_plt_entry): Define new
12921         static data member for PLT instruction template.
12922         (Output_data_plt_arm::plt_entry): Same.
12923         (Output_data_plt_arm::do_write): Define new method.
12924         (Target_arm::make_plt_entry): Same.
12925         (Target_arm::do_finalize_sections): Same.
12926         (Target_arm::do_dynsym_value): Same.
12927
12928 2009-05-28  Doug Kwan  <dougkwan@google.com>
12929
12930         * Makefile.am (TARGETSOURCES): Add arm.cc.
12931         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12932         * Makefile.in: Regenerate.
12933         * arm.cc: New file.
12934         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12935
12936 2009-05-26  Doug Kwan  <dougkwan@google.com>
12937
12938         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12939         (General_options::check_excluded_libs): Strip off directories in
12940         archive name before matching like GNU ld does.
12941         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12942         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12943         (exclude_libs_test_LDFLAGS): Add linker option
12944         -Wl,--exclude-libs,libexclude_libs_test_3
12945         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12946         an explicit archive without using -l.
12947         (alt/libexclude_libs_test_3.a): New make rule.
12948         * testsuite/Makefile.in: Regenerate.
12949         * testsuite/exclude_libs_test.c : Declare lib3_default().
12950         (main): Call it.
12951         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12952         * exclude_libs_test_3.c: New file.
12953
12954 2009-05-26  Nick Clifton  <nickc@redhat.com>
12955
12956         * po/id.po: New Indonesian translation.
12957         * po/gold.pot: Updated template file.
12958
12959 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12960
12961         * testsuite/Makefile.am: Add -ffunction-sections to compile
12962         gc_comdat_test files.  Add -Wl,--gc-sections to build
12963         gc_comdat_test.
12964         * testsuite/Makefile.in: Regenerate.
12965         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12966
12967 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12968
12969         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12970         kept comdat section was garbage collected.
12971         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12972         * testsuite/Makefile.in: Regenerate.
12973         * testsuite/gc_comdat_test.sh: New file.
12974         * testsuite/gc_comdat_test_1.cc: New file.
12975         * testsuite/gc_comdat_test_2.cc: New file.
12976
12977 2009-05-19  Doug Kwan  <dougkwan@google.com>
12978
12979         * archive.cc (Archive::Archive): Move constructor from archive.h
12980         to here.  Initialize no_export_.
12981         (Archive::get_elf_object_for_member): Set no_export flag of object.
12982         * archive.h (Archive::Archive): Move constructor body to
12983         archive.cc.
12984         (Archive::no_export): New method.
12985         (Archive::no_export_): New field.
12986         * object.h (Object::Object): Initialize no_export_ to false.
12987         (Object::no_export, Object::set_no_export): New methods.
12988         (Object::no_export_): New field.
12989         * options.cc (General_options::parse_exclude_libs): New method.
12990         (General_options::check_excluded_libs) Same.
12991         * options.h (exclude_libs): New option.
12992         (General_options::check_excluded_libs): New method declaration.
12993         (General_options::excluded_libs_): New field.
12994         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12995         default or protected visibility if an object has no-export flag set.
12996         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12997         (check_SCRIPTS): Add exclude_libs_test.sh.
12998         (check_DATA): Add exclude_libs_test.syms.
12999         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
13000         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
13001         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
13002         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
13003         (exclude_libs_test.syms, libexclude_libs_test_1.a,
13004         libexclude_libs_test_2.a): New rules.
13005         * testsuite/Makefile.in: Regenerate.
13006         * testsuite/exclude_libs_test.c: New file.
13007         * testsuite/exclude_libs_test.sh: Ditto.
13008         * testsuite/exclude_libs_test_1.c: Ditto.
13009         * testsuite/exclude_libs_test_2.c: Ditto.
13010
13011 2009-05-15  Ian Lance Taylor  <iant@google.com>
13012
13013         * configure.ac: Check for declarations for cases where libiberty.h
13014         checks HAVE_DECL_xxx.
13015         * configure, config.in: Rebuild.
13016
13017 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
13018
13019         * gold.h (Incremental_argument_list): Remove (invalid) forward
13020         declaration.
13021         * incremental.cc (Incremental_inputs::report_achive): New method.
13022         (Incremental_inputs::report_object): New method.
13023         (Incremental_inputs::report_script): New method.
13024         (Incremental_inputs::finalize_inputs): New method.
13025         (Incremental_inputs::finalize): Call finalize_inputs().
13026         (Incremental_inputs::sized_create_incremental_inputs_section_data):
13027         Create inputs entries.
13028         * incremental.h (Incremental_input_type): New enum.
13029         (Incremental_inputs::Incremental_input): Initialize new fields.
13030         (Incremental_inputs::report_inputs): New method.
13031         (Incremental_inputs::report_achive): New method.
13032         (Incremental_inputs::report_object): New method.
13033         (Incremental_inputs::report_script): New method.
13034         (Incremental_inputs::finalize_inputs): New method.
13035         (Incremental_inputs::Input_info): New struct.
13036         (Incremental_inputs::Input_info_map): New typedef.
13037         (Incremental_inputs::lock_): New field.
13038         (Incremental_inputs::Inputs_): New field.
13039         (Incremental_inputs::Inputs_map): New field.
13040         * main.cc (main): Call Incremental_input::report_inputs.
13041         * options.h (Input_argument_list): Typedef moved from
13042         Input_arguments.
13043         (Input_file_group::Files): Remove, use ::Input_argument_list.
13044         (Input_file_group::Input_argument_list): Remove, use
13045         ::Input_argument_list.
13046         * plugin.cc (Plugin_manager::add_input_file): Add error in
13047         incremental build.
13048         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
13049         functions.
13050         * script.cc (read_input_script): Call
13051         Incremental_input::report_script.
13052         * script.h (Script_info): New class.
13053
13054 2009-04-27  Ian Lance Taylor  <iant@google.com>
13055
13056         * x86_64.cc (do_adjust_output_section): Set entsize to
13057         plt_entry_size.
13058
13059 2009-04-23  Elliott Hughes  <enh@google.com>
13060
13061         * output.cc (Output_file::close): After short writes, continue
13062         writing from the correct offset in the buffer being written.
13063
13064 2009-04-23  Chris Demetriou  <cgd@google.com>
13065
13066         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13067         * configure: Regenerate.
13068         * config.in: Regenerate.
13069         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13070         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13071
13072 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13073
13074         * incremental.cc (Incremental_inputs_header_data): Renamed from
13075         Incremental_input_header_data.
13076         (Incremental_inputs_header_data::data_size): New field.
13077         (Incremental_inputs_header_data::put_input_file_count): Renamed
13078         from input_file_count.
13079         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13080         from command_line_offset.
13081         (Incremental_inputs_header_data::put_reserved): Renamed from
13082         put_reserved.
13083         (Incremental_inputs_entry_data): Renamed from
13084         Incremental_input_entry_data.
13085         (Incremental_inputs_entry_data::data_size): New field.
13086         (Incremental_inputs::report_command_line): New method.
13087         (Incremental_inputs::finalize): New method.
13088         (Incremental_inputs::create_incremental_inputs_data): New method.
13089         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13090         * incremental.h: New file.
13091         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13092         (Layout::finalize): Create incremental inputs section in
13093         incremental builds.
13094         (Layout::create_incremental_info_sections): New method.
13095         * layout.h (Layout::incremental_inputs): New method.
13096         (Layout::create_incremental_info_sections): New method.
13097         (Layout::incremental_inputs_): New field.
13098         * main.cc (main): Notify Incremental_input of the command line.
13099
13100 2009-04-01  Ian Lance Taylor  <iant@google.com>
13101             Mikolaj Zalewski  <mikolajz@google.com>
13102
13103         * gold.h (reserve_unordered_map): Define, three versions, one for
13104         each version of Unordered_map.
13105         * layout.cc (Layout::Layout): Remove options parameter.  Add
13106         number_of_input_files parameter.  Don't initialize options_.
13107         Initialize number_of_input_files_ and resized_signatures_.  Move
13108         sections_are_attached_.
13109         (Layout::layout_group): Reserve space for group_signatures_.
13110         (Layout::find_or_add_kept_section): Change name parameter to be a
13111         reference.  Resize signatures_ map when it gets large enough.
13112         (Layout::layout_eh_frame): Use parameters->options() instead of
13113         this->options_.
13114         (Layout::make_output_section): Likewise.
13115         (Layout::attach_allocated_section_to_segment): Likewise.
13116         (Layout::finalize, Layout::create_executable_stack): Likewise.
13117         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13118         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13119         * layout.h (class Layout): Update declarations.  Remove options_
13120         field.  Add number_of_input_files_ and resized_signatures_
13121         fields.  Move sections_are_attached_ field.
13122         * main.cc (main): Pass number of input files to Layout
13123         constructor.  Don't pass options.
13124
13125 2009-03-30  Ian Lance Taylor  <iant@google.com>
13126
13127         * ffsll.c (ffsll): Correct implementation.
13128
13129 2009-03-27  Ian Lance Taylor  <iant@google.com>
13130
13131         * ffsll.c: New file.
13132         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13133         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13134         * ftruncate.c (ftruncate): Declare before definition.
13135         * mremap.c (mremap): Likewise.
13136         * pread.c (pread): Likewise.
13137         * configure, Makefile.in, config.in: Rebuild.
13138
13139         * mremap.c: New file.
13140         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13141         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13142         (mremap): Declare if HAVE_MREMAP is not defined.
13143         * configure, Makefile.in, config.in: Rebuild.
13144
13145 2009-03-27  Cary Coutant  <ccoutant@google.com>
13146
13147         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13148         position independent.
13149         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13150         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13151
13152 2009-03-24  Cary Coutant  <ccoutant@google.com>
13153
13154         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13155         an executable.
13156         (needs_dynamic_reloc): Likewise.
13157
13158 2009-03-24  Ian Lance Taylor  <iant@google.com>
13159
13160         * yyscript.y (file_cmd): Recognize EXTERN.
13161         (extern_name_list, extern_name_list_body): New nonterminals.
13162         * script.cc (script_add_extern): Define.
13163         * script-c.h (script_add_extern): Declare.
13164
13165 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13166
13167         * object.cc (is_elf_object): Define.
13168         * object.h (is_elf_object): Declare.
13169         * archive.cc (Archive::get_elf_object_for_member): Call
13170         is_elf_object.
13171         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13172
13173 2009-03-24  Elliott Hughes  <enh@google.com>
13174
13175         * output.cc (Output_file::map_anonymous): Define.
13176         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13177         try an anonymous one.  Report the size if the mmap fails.
13178         * output.h (class Output_file): Declare map_anonymous.
13179
13180 2009-03-24  Ian Lance Taylor  <iant@google.com>
13181
13182         * target-select.cc (instantiate_target): Don't acquire the lock if
13183         the instantiated_target_ field has already been set.
13184
13185 2009-03-23  Ian Lance Taylor  <iant@google.com>
13186
13187         * gold-threads.h (class Initialize_lock): Define.
13188         * gold-threads.cc (class Initialize_lock_once): Define.
13189         (initialize_lock_control): New static variable.
13190         (initialize_lock_pointer): New static variable.
13191         (initialize_lock_once): New static function.
13192         (Initialize_lock::Initialize_lock): Define.
13193         (Initialize_lock::initialize): Define.
13194         * target-select.h: Include "gold-threads.h".
13195         (class Target_selector): Add lock_ and initialize_lock_ fields.
13196         Don't define instantiate_target, just declare it.
13197         * target-select.cc (Target_selector::Target_selector): Initialize
13198         new fields.
13199         (Target_selector::instantiate_target): Define.
13200         * descriptors.h: Include "gold-threads.h".
13201         (class Descriptors): Add initialize_lock_ field.
13202         * descriptors.cc (Descriptors::Descriptors): Initialize new
13203         field.
13204         (Descriptors::open): Use initialize_lock_ field
13205         * errors.h (class Errors): Add initialize_lock_ field.
13206         * errors.cc (Errors::Errors): Initialize new field.
13207         (Errors::initialize_lock): Use initialize_lock_ field.
13208         * powerpc.cc (class Target_selector_powerpc): Remove
13209         instantiated_target_ field.  In do_recognize call
13210         instantiate_target rather than do_instantiate_target.  In
13211         do_instantiate_target just allocate a new target.
13212         * sparc.cc (class Target_selector_sparc): Likewise.
13213
13214         * freebsd.h: New file.
13215         * i386.cc: Include "freebsd.h".
13216         (Target_i386): Derive from Target_freebsd rather than
13217         Sized_target.
13218         (Target_selector_i386): Derive from Target_selector_freebsd rather
13219         than Target_selector.
13220         * x86_64.cc: Include "freebsd.h".
13221         (Target_x86_64): Derive from Target_freebsd rather than
13222         Sized_target.
13223         (Target_selector_x86_64): Derive from Target_selector_freebsd
13224         rather than Target_selector.
13225         * target.h (class Target): Add adjust_elf_header and
13226         do_adjust_elf_header.
13227         * output.cc (Output_file_header:: do_sized_write): Call target
13228         adjust_elf_header routine.
13229         * configure.tgt: Set targ_osabi.
13230         * configure.ac: Define GOLD_DEFAULT_OSABI.
13231         * parameters.cc (Parameters::default_target): Pass
13232         GOLD_DEFAULT_OSABI to select_target.
13233         * target-select.h (class Target_selector): Make instantiate_target
13234         protected rather than private.
13235         * Makefile.am (HFILES): Add freebsd.h.
13236         * configure, Makefile.in, config.in: Rebuild.
13237
13238         * merge.cc (do_add_input_section): Correct pend value.  Change
13239         message about last entry not being null terminated from error to
13240         warning.
13241
13242 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13243
13244         * incremental.cc: New file.
13245         * Makefile.am (CCFILES): Add incremental.cc.
13246         * Makefile.in: Rebuild.
13247
13248 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13249
13250         * layout.cc (Layout::output_section_name): Preserve names
13251         of '.note.' sections.
13252
13253 2009-03-19  Ian Lance Taylor  <iant@google.com>
13254
13255         * descriptors.cc (Descriptors::open): Check that the options are
13256         valid before using them.
13257
13258 2009-03-18  Ian Lance Taylor  <iant@google.com>
13259
13260         * script-sections.h: Include <list>.
13261         (class Script_sections): Change Sections_elements from std::vector
13262         to std::list.  Typedef public Elements_iterator.  Add
13263         orphan_section_placement_, data_segment_align_start_, and
13264         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13265         field.
13266         * script-sections.cc (class Orphan_section_placement): New class.
13267         (class Sections_element): Add virtual functions is_relro and
13268         orphan_section_init.  Remove virtual function place_orphan_here.
13269         (class Output_section_definition): Add is_relro and
13270         orphan_section_init.  Remove place_orphan_here.
13271         (class Orphan_output_section): Likewise.
13272         (Script_sections::Script_sections): Update for field changes.
13273         (Script_sections::data_segment_align): Set saw_data_segment_align_
13274         and data_segment_align_start_, not data_segment_align_index.
13275         (Script_sections::data_segment_relro_end): Check
13276         saw_data_segment_align_.  Use data_segment_align_start_ rather
13277         than data_segment_align_index_.
13278         (Script_sections::place_orphan): Rewrite to use
13279         Orphan_section_placement.
13280
13281 2009-03-17  Ian Lance Taylor  <iant@google.com>
13282
13283         * archive.cc (Archive::add_symbols): Check for a version attached
13284         to the symbol name in the archive map.
13285         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13286         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13287         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13288         (ver_test_11.a): New target.
13289         * testsuite/Makefile.in: Rebuild.
13290
13291         * configure.ac: Check for chsize and posix_fallocate.  Replace
13292         ftruncate.
13293         * ftruncate.c: New file, from gnulib.
13294         * output.cc (posix_fallocate): Define dummy version if not
13295         HAVE_POSIX_FALLOCATE.
13296         (Output_file::map): Call posix_fallocate rather than lseek and
13297         write.
13298         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13299         * configure, Makefile.in, config.in: Rebuild.
13300
13301 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13302
13303         * layout.h (Layout::create_note): Add section_name parameter.
13304         * layout.cc (Layout::create_note): Likewise.
13305         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13306
13307 2009-03-17  Ian Lance Taylor  <iant@google.com>
13308
13309         * descriptors.cc: Include "options.h".
13310         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13311         (Descriptors::open): Always use O_CLOEXEC when opening a new
13312         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13313         then set FD_CLOEXEC.
13314
13315         * sparc.cc (class Target_sparc): Add has_got_section.
13316         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13317         make sure we have a GOT section.
13318
13319         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13320         (Target_sparc::Scan::local): Likewise.
13321         (Target_sparc::Scan::global): Likewise.
13322         (Target_sparc::Relocate::relocate): Likewise.
13323         (Target_sparc::Relocate::relocate_tls): Likewise.
13324
13325         * symtab.cc (Symbol_table::define_default_version): New function,
13326         broken out of add_from_object.
13327         (Symbol_table::add_from_object): Call define_default_version.
13328         (Symbol_table::define_special_symbol): Add resolve_oldsym
13329         parameter.  Change all callers.  If the version for a symbol comes
13330         from a version script, resolve it with the symbol with the same
13331         name with no version.  Also add the symbol without a version if
13332         appropriate.
13333         (do_define_in_output_data): If resolving with oldsym, don't delete
13334         sym.
13335         (do_define_in_output_segment): Likewise.
13336         (do_define_as_constant): Likewise.
13337         * symtab.h (class Symbol_table): Update declarations.
13338
13339 2009-03-13  Ian Lance Taylor  <iant@google.com>
13340
13341         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13342         (Read_symbols::requeue): New function.
13343         (Read_symbols::do_read_symbols): If make_elf_object fails because
13344         the target type is not configured, and the file was searched for,
13345         issue a warning and retry with the next directory.
13346         (Add_symbols::run): If the file has an incompatible format, and
13347         it was searched for, requeue the Read_symbols task.  On error,
13348         release the object.
13349         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13350         dirindex parameter to constructor.  Change all callers.  Declare
13351         incompatible_warning and requeue.
13352         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13353         input_argument_ and input_group_ fields.  Add them to
13354         constructor.  Change all callers.
13355         (class Read_script): Add dirindex_ field.  Add it to constructor.
13356         Change all callers.
13357         * archive.cc (Archive::setup): Remove input_objects parameter.
13358         Change all callers.
13359         (Archive::get_file_and_offset): Likewise.
13360         (Archive::read_all_symbols): Likewise.
13361         (Archive::read_symbols): Likewise.
13362         (Archive::get_elf_object_for_member): Remove input_objects
13363         parameter.  Add punconfigured parameter.  Change all callers.
13364         (Archive::add_symbols): Change return type to bool.  Check return
13365         value of include_member.
13366         (Archive::include_all_members): Likewise.
13367         (Archive::include_member): Change return type to bool.  Return
13368         false if first included object has incompatible target.  Set
13369         included_member_ field.
13370         (Add_archive_symbols::run): If add_symbols returns false, requeue
13371         Read_symbols task.
13372         * archive.h (class Archive): Add included_member_ field.
13373         Initialize it in constructor.  Add input_file and searched_for
13374         methods.  Update declarations.
13375         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13376         input_argument_ fields.  Add them to constructor.  Change all
13377         callers.
13378         * script.cc: Include "target-select.h".
13379         (class Parser_closure): Add skip_on_incompatible_target_ and
13380         found_incompatible_target_ fields.  Add
13381         skip_on_incompatible_target parameter to constructor.  Change all
13382         callers.  Add methods skip_on_incompatible_target,
13383         clear_skip_on_incompatible_target, found_incompatible_target, and
13384         set_found_incompatible_target.
13385         (read_input_script): Add dirindex parameter.  Change all callers.
13386         If parser finds an incompatible target, requeue Read_symbols
13387         task.
13388         (script_set_symbol): Clear skip_on_incompatible_target in
13389         closure.
13390         (script_add_assertion, script_parse_option): Likewise.
13391         (script_start_sections, script_add_phdr): Likewise.
13392         (script_check_output_format): New function.
13393         * script.h (read_input_script): Update declaration.
13394         * script-c.h (script_check_output_format): Declare.
13395         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13396         (ignore_cmd): Remove OUTPUT_FORMAT.
13397         * fileread.cc (Input_file::Input_file): Add explicit this.
13398         (Input_file::will_search_for): New function.
13399         (Input_file::open): Add pindex parameter.  Change all callers.
13400         * fileread.h (class Input_file): Add input_file_argument method.
13401         Declare will_search_for.  Update declarations.
13402         * object.cc (make_elf_object): Add punconfigured parameter.
13403         Change all callers.
13404         * object.h (class Object): Make input_file public.  Add
13405         searched_for method.
13406         (make_elf_object): Update declaration.
13407         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13408         restart search.
13409         * dirsearch.h (class Dirsearch): Update declaration.
13410         * options.h (class General_options): Add --warn-search-mismatch.
13411         * parameters.cc (Parameters::is_compatible_target): New function.
13412         * parameters.h (class Parameters): Declare is_compatible_target.
13413         * workqueue.cc (Workqueue::add_blocker): New function.
13414         * workqueue.h (class Workqueue): Declare add_blocker.
13415
13416         * fileread.cc (Input_file::open): Remove options parameter.
13417         Change all callers.
13418         (Input_file::open_binary): Likewise.
13419         * script.cc (read_input_script): Likewise.
13420         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13421         options parameter from constructor.  Change all callers.
13422         (class Read_script): Likewise.
13423         * fileread.h (class Input_file): Update declarations.
13424         * script.h (read_input_script): Update declaration.
13425
13426 2009-03-10  Nick Clifton  <nickc@redhat.com>
13427
13428         * po/es.po: New Spanish translation.
13429
13430 2009-03-06  Cary Coutant  <ccoutant@google.com>
13431
13432         * options.cc (parse_short_option): Keep dash_z from registering itself.
13433
13434 2009-03-03  Ian Lance Taylor  <iant@google.com>
13435
13436         PR 9918
13437         * target-reloc.h (relocate_section): Pass output_section to
13438         relocate.
13439         * i386.cc (Target_i386::should_apply_static_reloc): Add
13440         output_section parameter.  Change all callers.
13441         (Target_i386::Relocate::relocate): Add output_section parameter.
13442         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13443         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13444         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13445         * testsuite/two_file_shared.sh: New script.
13446         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13447         (check_DATA): Add two_file_shared.dbg.
13448         (two_file_shared.dbg): New target.
13449         * testsuite/Makefile.in: Rebuild.
13450
13451 2009-03-01  Ian Lance Taylor  <iant@google.com>
13452
13453         * configure.ac: Check for byteswap.h.
13454         * configure: Rebuild.
13455         * config.in: Rebuild.
13456
13457 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13458
13459         * layout.cc (Layout::find_or_add_kept_section): New function.
13460         (Layout::add_comdat): Removed.
13461         * layout.h (struct Kept_section): Move out of class Layout.
13462         Remove trailing underscores from field names.  Add group_sections
13463         field.  Rename group_ field to is_group.  Change all uses.
13464         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13465         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13466         comdat_groups_ field.
13467         (Sized_relobj::include_section_group): Use
13468         find_or_add_kept_section and Kept_section::group_sections.
13469         (Sized_relobj::include_linkonce_section): Likewise.
13470         * object.cc (class Sized_relobj): Don't define Comdat_group or
13471         Comdat_group_table.  Remove find_comdat_group and
13472         add_comdat_group.  Remove comdat_groups_ field.
13473         * plugin.cc (include_comdat_group): Use
13474         Layout::find_or_add_kept_section.
13475
13476 2009-02-28  Ian Lance Taylor  <iant@google.com>
13477
13478         * README: --gc-sections and map files are now supported.  Document
13479         some build requirements.
13480
13481         PR 6992
13482         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13483         relocatable link set the value of the section symbol to zero.
13484         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13485         relocatable link don't include the section address in the local
13486         symbol value.
13487
13488 2009-02-27  Ian Lance Taylor  <iant@google.com>
13489
13490         PR 6811
13491         * options.h (class Search_directory): Add is_system_directory.
13492         (class General_options): Declare is_in_system_directory.
13493         * options.cc (get_relative_sysroot): Make static.
13494         (get_default_sysroot): Make static.
13495         (General_optoins::is_in_system_directory): New function.
13496         * fileread.cc (Input_file::is_in_system_directory): New function.
13497         * fileread.h (class Input_file): Declare is_in_system_directory.
13498         * object.h (class Object): Add is_in_system_directory.
13499         (class Input_objects): Remove system_library_directory_ field.
13500         * object.cc (Input_objects::add_object): Don't set
13501         system_library_directory_.
13502         (input_objects::found_in_system_library_directory): Remove.
13503         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13504         parameter.  Change all callers.
13505         (Symbol_table::sized_write_globals): Likewise.
13506         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13507         Call Object::is_in_system_directory.
13508         * symtab.h (class Symbol_table): Update declarations.
13509
13510         PR 5990
13511         * descriptors.h (Open_descriptor): Add is_on_stack field.
13512         * descriptors.cc (Descriptors::open): If the descriptor is on the
13513         top of the stack, remove it.  Initialize is_on_stack field.
13514         (Descriptors::release): Only add pod to stack if it is not on the
13515         stack already.
13516         (Descriptors::close_some_descriptor): Clear stack_next and
13517         is_on_stack fields.
13518
13519         PR 7091
13520         * output.cc (Output_section::find_starting_output_address): Rename
13521         from starting_output_address; add PADDR parameter; change return
13522         type.
13523         * output.h (class Output_section): Declare
13524         find_starting_output_address instead of starting_output_address.
13525         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13526         section symbol for which we can't find a merge section.
13527
13528         PR 9836
13529         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13530         hidden or internal, force the symbol to be local.
13531         * resolve.cc (Symbol::override_visibility): Define.
13532         (Symbol::override_base): Use override_visibility.
13533         (Symbol_table::resolve): Likewise.
13534         (Symbol::override_base_with_special): Likewise.
13535         (Symbol_table::override_with_special): If the visibility is hidden
13536         or internal, force the symbol to be local.
13537         * symtab.h (class Symbol): Add set_visibility and
13538         override_visibility.
13539         * testsuite/ver_test_1.sh: New file.
13540         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13541         (check_DATA): Add ver_test_1.syms.
13542         (ver_test_1.syms): New target.
13543         * testsuite/Makefile.in: Rebuild.
13544
13545 2009-02-25  Cary Coutant  <ccoutant@google.com>
13546
13547         * layout.cc (Layout::choose_output_section): Don't rename sections
13548         when using a linker script that has a SECTIONS clause.
13549         * Makefile.in: Regenerate.
13550
13551         * testsuite/Makefile.am (script_test_5.sh): New test case.
13552         * testsuite/Makefile.in: Regenerate.
13553         * testsuite/script_test_5.cc: New file.
13554         * testsuite/script_test_5.sh: New file.
13555         * testsuite/script_test_5.t: New file.
13556
13557 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13558
13559         * archive.cc (Archive::include_member): Update calls to add_symbols.
13560         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13561         the Layout argument.
13562         * dynobj.h (do_add_symbols): Add the Layout argument.
13563         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13564         Layout argument.
13565         * object.h (Object::add_symbols): Add the Layout argument.
13566         (Object::do_add_symbols): Add the Layout argument.
13567         (Sized_relobj::do_add_symbols): Add the Layout argument.
13568         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13569         Unify the two versions.
13570         (Add_plugin_symbols): Remove.
13571         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13572         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13573         (Add_plugin_symbols): Remove.
13574         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13575         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13576         (Add_symbols::run): Make it work with Pulginobj.
13577
13578 2009-02-06  Ian Lance Taylor  <iant@google.com>
13579
13580         * object.cc (Sized_relobj::do_layout): Make info message start
13581         with lower case letter.
13582
13583 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13584
13585         * binary.cc: Fix file comment.
13586
13587         * options.h (enum Incremental_disposition): Define.
13588         (class General_options): Add new options: --incremental,
13589         --incremental_changed, --incremental_unchanged,
13590         --incremental_unknown.  Add incremental_disposition_ and
13591         implicit_incremental_ fields.
13592         (General_options::incremental_disposition): New function.
13593         (class Position_dependent_options): Add incremental_disposition
13594         option.
13595         (Position_dependent_options::copy_from_options): Set incremental
13596         dispositions.
13597         * options.cc (General_options::parse_incremental_changed): New
13598         function.
13599         (General_options::parse_incremental_unchanged): New function.
13600         (General_options::parse_incremental_unknown): New function.
13601         (General_options::General_options): Initialize new fields
13602         incremental_disposition_ and implicit_incremental_.
13603         (General_options::finalize): Check for uasge of --incremental-*
13604         without --incremental.
13605
13606 2009-02-06  Chris Demetriou  <cgd@google.com>
13607
13608         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13609         pointer and to report location as the file name associated with
13610         the symbol.
13611         (gold_undefined_symbol_at_location): New function to replace the
13612         old gold_undefined_symbol functionality.
13613         * target-reloc.h (relocate_section): Update to use
13614         gold_undefined_symbol_at_location.
13615         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13616         Call gold_undefined_symbol function rather than gold_error.
13617         * errors.h (Errors::undefined_symbol): Take location as a
13618         string, rather than calculating it from a relocation.
13619         * errors.cc (Errors::fatal): Print "fatal error:" before the
13620         formatted message.
13621         (Errors::error, Errors::error_at_location): Print "error: "
13622         before the formatted message.
13623         (Errors::undefined_symbol): Take location as a string, rather
13624         than calculating it from a relocation.
13625         (gold_undefined_symbol_at_location): New function akin to
13626         old gold_undefined_symbol, calculates location from relocation.
13627         (gold_undefined_symbol): Change to take only a Symbol pointer
13628         and to report location as the file name associated with the symbol.
13629         * testsuite/debug_msg.sh: Update for changed error messages.
13630         * testsuite/undef_symbol.sh: Likewise.
13631
13632 2009-02-04  Duncan Sands  <baldrick@free.fr>
13633
13634         PR 9812
13635         * reduced_debug_output.h
13636         (Output_reduced_debug_abbrev_section::failed): Use format for
13637         gold_warning.
13638         (Output_reduced_debug_info_section::faild): Likewise.
13639
13640 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13641
13642         * script.cc (Lazy_demangler): New class.
13643         (Version_script_info::get_symbol_version_helper): Demangle a
13644         symbol only once.
13645
13646 2009-01-29  Cary Coutant  <ccoutant@google.com>
13647
13648         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13649         to __tls_get_addr.
13650         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13651
13652 2009-01-28  Ian Lance Taylor  <iant@google.com>
13653
13654         * version.cc (version_string): Bump to 1.9.
13655
13656         * gold.h: Include <cstring> and <stdint.h>.
13657         * version.cc: Include <cstdio>.
13658         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13659         warning.
13660         * reduced_debug_output.cc (insert_into_vector): Rename from
13661         Insert_into_vector; change all callers.  Use Swap_unaligned to
13662         avoid aliasing issue; remove union since it is unnecessary.
13663
13664 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13665
13666         * Makefile.am (CCFILES): Add gc.cc.
13667         (HFILES): Add gc.h.
13668         * Makefile.in: Regenerate.
13669         * gold.cc (Gc_runner): New class.
13670         (queue_initial_tasks): Call garbage collection related tasks
13671         when corresponding options are invoked.
13672         (queue_middle_gc_tasks): New function.
13673         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13674         processed early before laying out sections during garbage collection.
13675         * gold.h (queue_middle_gc_tasks): New function.
13676         (is_prefix_of): Move from "layout.cc".
13677         * i386.cc (Target_i386::gc_process_relocs): New function.
13678         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13679         * main.cc (main): Create object of class "Garbage_collection".
13680         * object.cc (Relobj::copy_symbols_data): New function.
13681         (Relobj::is_section_name_included): New function.
13682         (Sized_relobj::do_layout): Allow this function to be called twice
13683         during garbage collection and defer layout of section during the
13684         first call.
13685         * object.h (Relobj::get_symbols_data): New function.
13686         (Relobj::is_section_name_included): New function.
13687         (Relobj::copy_symbols_data): New function.
13688         (Relobj::set_symbols_data): New function.
13689         (Relobj::get_relocs_data): New function.
13690         (Relobj::set_relocs_data): New function.
13691         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13692         (Relobj::gc_process_relocs): New function.
13693         (Relobj::do_gc_process_relocs): New pure virtual function.
13694         (Relobj::sd_): New data member.
13695         (Sized_relobj::is_output_section_offset_invalid): New function.
13696         (Sized_relobj::do_gc_process_relocs): New function.
13697         * options.h (General_options::gc_sections): Modify to not be a no-op.
13698         (General_options::print_gc_sections): New option.
13699         * plugin.cc (Plugin_finish::run): Remove function call to
13700         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13701         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13702         * reloc.cc (Read_relocs::run): Add task to process relocs and
13703         determine unreferenced sections when doing garbage collection.
13704         (Gc_process_relocs): New class.
13705         (Sized_relobj::do_gc_process_relocs): New function.
13706         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13707         sections that are garbage collected.
13708         * reloc.h (Gc_process_relocs): New class.
13709         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13710         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13711         symbols whose corresponding sections are garbage collected.
13712         (Symbol_table::Symbol_table): Add new parameter for the garbage
13713         collection object.
13714         (Symbol_table::gc_mark_undef_symbols): New function.
13715         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13716         (Symbol_table::gc_mark_dyn_syms): New function.
13717         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13718         as garbage.
13719         (Symbol_table::add_from_object): Likewise.
13720         (Symbol_table::add_from_relobj): When building shared objects, do not
13721         treat externally visible symbols as garbage.
13722         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13723         table information for static and relocatable links.
13724         * symtab.h (Symbol_table::set_gc): New function.
13725         (Symbol_table::gc): New function.
13726         (Symbol_table::gc_mark_undef_symbols): New function.
13727         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13728         (Symbol_table::gc_mark_dyn_syms): New function.
13729         (Symbol_table::gc_): New data member.
13730         * target.h (Sized_target::gc_process_relocs): New pure virtual
13731         function.
13732         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13733         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13734
13735 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13736
13737         * options.h (General_options::gc_sections): Define as a no-op for now.
13738         (General_options::no_keep_memory): Ditto.
13739         (General_options::Bshareable): Define.
13740         * options.cc (General_options::finalize): Honor -Bshareable.
13741
13742 2009-01-20  Andreas Schwab  <schwab@suse.de>
13743
13744         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13745         read the value in the contents, since we don't use it.  Use the
13746         template endianness when writing.
13747         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13748
13749 2009-01-19  Andreas Schwab  <schwab@suse.de>
13750
13751         * configure.tgt (powerpc64-*): Fix targ_obj.
13752
13753 2009-01-15  Ian Lance Taylor  <iant@google.com>
13754
13755         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13756         local symbols when stripping all symbols.
13757
13758 2009-01-14  Cary Coutant  <ccoutant@google.com>
13759
13760         * output.cc (Output_reloc): Add explicit instantiations.
13761
13762 2009-01-14  Cary Coutant  <ccoutant@google.com>
13763
13764         * archive.cc (Archive::get_elf_object_for_member): Remove call
13765         to File_read::claim_for_plugin.
13766         * descriptors.cc (Descriptors::open): Remove reference to
13767         is_claimed.
13768         (Descriptors::claim_for_plugin): Remove.
13769         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13770         (Descriptors::is_claimed): Remove.
13771         (claim_descriptor_for_plugin): Remove.
13772         * fileread.cc (File_read::claim_for_plugin): Remove.
13773         * fileread.h (File_read::claim_for_plugin): Remove.
13774         (File_read::descriptor): Reopen descriptor if necessary.
13775         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13776         (Plugin_manager::all_symbols_read): Add task parameter. Change
13777         all callers.
13778         (Plugin_manager::get_input_file): New function.
13779         (Plugin_manager::release_input_file): New function.
13780         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13781         corresponding data member.
13782         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13783         and pass to base constructor. Change all callers.
13784         (get_input_file, release_input_file): New functions.
13785         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13786         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13787         (Plugin_manager::all_symbols_read): Add task parameter.
13788         (Plugin_manager::get_input_file): New function.
13789         (Plugin_manager::release_input_file): New function.
13790         (Plugin_manager::task_): New data member.
13791         (Pluginobj::Pluginobj): Add filesize parameter.
13792         (Pluginobj::filename): New function.
13793         (Pluginobj::descriptor): New function.
13794         (Pluginobj::filesize): New function.
13795         (Pluginobj::filesize_): New data member.
13796         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13797         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13798         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13799
13800         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13801         with archive libraries.
13802         * testsuite/Makefile.in: Regenerate.
13803         * testsuite/plugin_test.c (struct sym_info): New type.
13804         (get_input_file, release_input_file): New static variables.
13805         (onload): Capture new transfer vector entries.
13806         (claim_file_hook): Stop reading at end of file according to filesize.
13807         Factor out parsing of readelf output into separate function.
13808         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13809         APIs and get the source file name from the symbol table.  Convert
13810         source file name to corresponding object file name.  Print info
13811         message when adding new input files.
13812         (parse_readelf_line): New function.
13813         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13814         * testsuite/plugin_test_2.sh: Likewise.
13815         * testsuite/plugin_test_3.sh: Likewise.
13816         * testsuite/plugin_test_4.sh: New test case.
13817
13818 2009-01-07  Ian Lance Taylor  <iant@google.com>
13819
13820         * version.cc (version_string): Bump to 1.8.
13821
13822 2008-12-23  Cary Coutant  <ccoutant@google.com>
13823
13824         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13825         * plugin.cc (Plugin_manager::finish): Rename as
13826         layout_deferred_objects.  Move cleanup to separate function.
13827         (Plugin_manager::cleanup): New function.
13828         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13829         separately.
13830         * plugin.h (Plugin_manager::finish): Rename as
13831         layout_deferred_objects.
13832         (Plugin_manager::cleanup): New function.
13833         (Plugin_manager::cleanup_done): New field.
13834
13835 2008-12-23  Cary Coutant  <ccoutant@google.com>
13836
13837         * plugin.cc (is_visible_from_outside): New function.
13838         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13839         so we don't return "IR only" status for exported symbols or -r links.
13840
13841         * testsuite/Makefile.am (plugin_test_3): New test case.
13842         * testsuite/Makefile.in: Regenerate.
13843         * testsuite/plugin_test_3.sh: New file.
13844
13845 2008-12-22  Cary Coutant  <ccoutant@google.com>
13846
13847         * object.cc (Sized_relobj::layout_section): New function.
13848         (Sized_relobj::do_layout): Defer layout of input sections until after
13849         plugin has provided replacement files.
13850         (Sized_relobj::do_layout_deferred_sections): New function.
13851         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13852         (Relobj::layout_deferred_sections): New function.
13853         (Relobj::do_layout_deferred_sections): New function.
13854         (Sized_relobj::do_layout_deferred_sections): New function.
13855         (Sized_relobj::layout_section): New function.
13856         (Sized_relobj::Deferred_layout): New structure.
13857         (Sized_relobj::deferred_layout_): New field.
13858         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13859         Change all callers.  Layout deferred sections.
13860         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13861         references.
13862         (Plugin_hook::run): Move code from do_plugin_hook inline.
13863         (Plugin_hook::do_plugin_hook): Remove.
13864         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13865         (Plugin_manager::finish): Renamed, was cleanup.
13866         (Plugin_manager::should_defer_layout): New function.
13867         (Plugin_manager::add_deferred_layout_object): New function.
13868         (Plugin_manager::Deferred_layout_list): New type.
13869         (Plugin_manager::deferred_layout_objects_): New field.
13870         (Plugin_hook::do_plugin_hook): Remove.
13871
13872 2008-12-17  Ian Lance Taylor  <iant@google.com>
13873
13874         * options.h (class General_options): Add --no case for
13875         --export-dynamic.
13876
13877 2008-12-16  Cary Coutant  <ccoutant@google.com>
13878
13879         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13880         vector.
13881         (Plugin_manager::claim_file): Create plugin object even if
13882         plugin did not call the add_symbols callback.
13883         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13884         asking for more symbols than were added.
13885         * testsuite/Makefile.am (plugin_test_1): Add test case with
13886         no global symbols.
13887         (empty.syms): New target.
13888         * testsuite/Makefile.in: Regenerate.
13889         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13890         message. Don't call add_symbols if no globals.
13891         (all_symbols_read_hook): Don't provide replacement for empty
13892         claimed file.
13893
13894 2008-12-12  Ian Lance Taylor  <iant@google.com>
13895
13896         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13897         r_type == 0 for a local symbol with r_sym == 0.
13898         (scan_relocatable_relocs): Pass r_sym to
13899         local_non_section_strategy.
13900         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13901         r_sym parameter.
13902
13903         * configure.ac: Update test for TLS descriptors: they are
13904         supported as of glibc 2.9.
13905         * configure: Rebuild.
13906
13907 2008-12-11  Ian Lance Taylor  <iant@google.com>
13908
13909         PR 7091
13910         * target-reloc.h (Default_scan_relocatable_relocs): For each
13911         function, map r_type == 0 to RELOC_DISCARD.
13912
13913 2008-12-10  Cary Coutant  <ccoutant@google.com>
13914
13915         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13916         object to override a kept COMDAT group from a plugin object.
13917
13918 2008-12-09  Ian Lance Taylor  <iant@google.com>
13919
13920         PR 7088
13921         * yyscript.y (file_cmd): Handle INPUT.
13922
13923         * testsuite/initpri1.c: Change all declarations to be full
13924         prototypes by adding void, to avoid compiler warnings.
13925
13926 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13927
13928         * options.cc (General_options::parse_plugin_opt): New.
13929         (General_options::add_plugin): The argument now is just the filename.
13930         (General_options::add_plugin_option): New.
13931         * options.h (plugin_opt): New.
13932         (add_plugin): Change argument name.
13933         (add_plugin_option): New.
13934         * plugin.cc (Plugin::load): Don't parse the plugin option.
13935         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13936         (Plugin::add_option): New.
13937         (Plugin::args_): Change type.
13938         (Plugin::filename_): New.
13939         (Plugin_manager::add_plugin_option): New.
13940         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13941         * testsuite/Makefile.in: Regenerate.
13942
13943 2008-12-05  Cary Coutant  <ccoutant@google.com>
13944
13945         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13946         Handle --strip-lto-sections option.
13947         * options.h (strip_lto_sections): New option.
13948
13949 2008-12-01  Cary Coutant  <ccoutant@google.com>
13950
13951         * plugin.cc (ld_plugin_message): Change format parameter to const.
13952         Fix mismatch between new[] and delete.
13953
13954 2008-11-14  Cary Coutant  <ccoutant@google.com>
13955
13956         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13957         instead of -1U.
13958
13959 2008-11-05  Craig Silverstein  <csilvers@google.com>
13960
13961         * options.cc (General_options::parse_dynamic_list): New function.
13962         * options.h (General_options): New flags dynamic_list,
13963         dynamic_list_data, dynamic_list_cpp_new, and
13964         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13965         (General_options::in_dynamic_list): New function.
13966         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13967         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13968         (Lex::can_continue_name): Likewise.
13969         (yylex): Likewise.
13970         (read_script_file): New parameter script_options.
13971         (read_dynamic_list): New function.
13972         (Script_options::define_dynamic_list): New function.
13973         (dynamic_list_keyword_parsecodes): New variable.
13974         (dynamic_list_keywords): New variable.
13975         * script.h (Script_options::define_dynamic_list): New function
13976         prototype.
13977         (read_dynamic_list): New function prototype.
13978         * symtab.cc (strprefix): New macro.
13979         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13980         dynamic_list_data, dynamic_list_cpp_new, and
13981         dynamic_list_cpp_typeinfo.
13982         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13983         (dynamic_list_expr): New rule.
13984         (dynamic_list_nodes): Likewise.
13985         (dynamic_list_node): Likewise.
13986         * testsuite/Makefile.am (dynamic_list): New test.
13987         * testsuite/Makefile.in: Regenerated.
13988         * testsuite/dynamic_list.t: New file.
13989         * testsuite/dynamic_list.sh: New file.
13990
13991 2008-11-05  Craig Silverstein  <csilvers@google.com>
13992
13993         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13994         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13995         (t11_last): Likewise.
13996         * testsuite/ver_test_6.c (main): Likewise.
13997
13998 2008-10-07  Cary Coutant  <ccoutant@google.com>
13999
14000         * options.c (General_options::finalize): Add check for -static and
14001         -shared.
14002         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
14003         is not empty.
14004
14005 2008-10-02  Cary Coutant  <ccoutant@google.com>
14006
14007         * plugin.cc (make_sized_plugin_object): Fix conditional
14008         compilation to work when not all targets are enabled.
14009
14010 2008-09-29  Cary Coutant  <ccoutant@google.com>
14011
14012         * archive.cc (Archive::get_file_and_offset): Use filename instead
14013         of name to get library path.
14014         (Archive::include_member): Unlock external member of a thin archive.
14015
14016         * testsuite/Makefile.am (TEST_AR): New variable.
14017         (thin_archive_test_1): New test.
14018         (thin_archive_test_2): New test.
14019         * testsuite/Makefile.in: Regenerate.
14020         * testsuite/thin_archive_main.cc: New file.
14021         * testsuite/thin_archive_test_1.cc: New file.
14022         * testsuite/thin_archive_test_2.cc: New file.
14023         * testsuite/thin_archive_test_3.cc: New file.
14024         * testsuite/thin_archive_test_4.cc: New file.
14025
14026 2008-09-29  Cary Coutant  <ccoutant@google.com>
14027
14028         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
14029         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
14030         instead of -1U.
14031         (Sized_relobj::do_finalize_local_symbols): Likewise.
14032         (Sized_relobj::map_to_kept_section): Likewise.
14033         * object.h (Sized_relobj::invalid_address): New constant.
14034         (Sized_relobj::do_output_section_offset): Check for invalid_address
14035         and return -1ULL.
14036         * output.cc (Output_reloc::local_section_offset): Use constant
14037         invalid_address instead of -1U.
14038         (Output_reloc::get_address): Likewise.
14039         (Output_section::output_address): Change -1U to -1ULL.
14040         * output.h (Output_reloc::invalid_address): New constant.
14041         * reloc.cc (Sized_relobj::write_sections): Use constant
14042         invalid_address instead of -1U.
14043         (Sized_relobj::relocate_sections): Likewise.
14044         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
14045         values for merge sections.
14046         * target-reloc.h (relocate_for_relocatable): Use constant
14047         invalid_address instead of -1U.
14048
14049 2008-09-19  Cary Coutant  <ccoutant@google.com>
14050
14051         Add plugin functionality for link-time optimization (LTO).
14052         * configure.ac (plugins): Add --enable-plugins option.
14053         * configure: Regenerate.
14054         * config.in: Regenerate.
14055         * Makefile.am (LIBDL): New variable.
14056         (CCFILES): Add plugin.cc.
14057         (HFILES): Add plugin.h.
14058         (ldadd_var): Add LIBDL.
14059         * Makefile.in: Regenerate.
14060
14061         * archive.cc: Include "plugin.h".
14062         (Archive::setup): Don't preread archive symbols when using a plugin.
14063         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14064         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14065         files.
14066         (Archive::include_member): Add symbols from plugin objects.
14067         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14068         * descriptors.cc (Descriptors::open): Check for file descriptors
14069         abandoned by plugins.
14070         (Descriptors::claim_for_plugin): New function.
14071         * descriptors.h (Descriptors::claim_for_plugin): New function.
14072         (Open_descriptor::is_claimed): New field.
14073         (claim_descriptor_for_plugin): New function.
14074         * fileread.cc (File_read::claim_for_plugin): New function.
14075         * fileread.h (File_read::claim_for_plugin): New function.
14076         (File_read::descriptor): New function.
14077         * gold.cc: Include "plugin.h".
14078         (queue_initial_tasks): Add task to call plugin hooks for generating
14079         new object files.
14080         * main.cc: Include "plugin.h".
14081         (main): Load plugin libraries.
14082         * object.h (Pluginobj): Declare.
14083         (Object::pluginobj): New function.
14084         (Object::do_pluginobj): New function.
14085         (Object::set_target): New function.
14086         * options.cc: Include "plugin.h".
14087         (General_options::parse_plugin): New function.
14088         (General_options::General_options): Initialize plugins_ field.
14089         (General_options::add_plugin): New function.
14090         * options.h (Plugin_manager): Declare.
14091         (General_options): Add --plugin option.
14092         (General_options::has_plugins): New function.
14093         (General_options::plugins): New function.
14094         (General_options::add_plugin): New function.
14095         (General_options::plugins_): New field.
14096         * plugin.cc: New file.
14097         * plugin.h: New file.
14098         * readsyms.cc: Include "plugin.h".
14099         (Read_symbols::do_read_symbols): Check for archive before checking
14100         for ELF file.  Call plugin hooks to claim files.
14101         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14102         from a real object file; force override when processing replacement
14103         files.
14104         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14105         (Symbol::init_base_object): Likewise.
14106         (Symbol::init_base_output_data): Likewise.
14107         (Symbol::init_base_output_segment): Likewise.
14108         (Symbol::init_base_constant): Likewise.
14109         (Symbol::init_base_undefined): Likewise.
14110         (Symbol::output_section): Assert that object is not a plugin.
14111         (Symbol_table::add_from_pluginobj): New function.
14112         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14113         undefined.
14114         (Symbol_table::sized_write_globals): Likewise.
14115         (Symbol_table::add_from_pluginobj): Instantiate template.
14116         * symtab.h (Sized_pluginobj): Declare.
14117         (Symbol::in_real_elf): New function.
14118         (Symbol::set_in_real_elf): New function.
14119         (Symbol::in_real_elf_): New field.
14120         (Symbol_table::add_from_pluginobj): New function.
14121
14122         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14123         (LIBDL): New variable.
14124         (LDADD): Add LIBDL.
14125         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14126         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14127         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14128         (MOSTLYCLEANFILES): Likewise.
14129         * testsuite/Makefile.in: Regenerate.
14130         * testsuite/plugin_test.c: New file.
14131         * testsuite/plugin_test_1.sh: New file.
14132         * testsuite/plugin_test_2.sh: New file.
14133
14134 2008-09-16  Ian Lance Taylor  <iant@google.com>
14135
14136         * target-reloc.h (relocate_section): Check whether a symbol is
14137         defined by the ABI before reporting an undefined symbol error.
14138         * target.h (Target::is_defined_by_abi): Make parameter const.
14139         (Target::do_is_defined_by_abi): Likewise.
14140         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14141         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14142         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14143         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14144         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14145         * testsuite/Makefile.in: Rebuild.
14146
14147         * fileread.cc (make_view): Add casts to avoid warning.
14148
14149 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14150
14151         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14152         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14153
14154 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14155
14156         * options.h (General_options::output_is_executable): New.
14157         (General_options::output_is_pie): New.
14158         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14159         for shared libraries.
14160         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14161
14162 2008-09-11  Chris Demetriou  <cgd@google.com>
14163
14164         * options.h (origin): New -z option.
14165         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14166         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14167         in DT_FLAGS_1.
14168
14169 2008-09-05  Cary Coutant  <ccoutant@google.com>
14170
14171         * fileread.cc (File_read::make_view): Add check for attempt to map
14172         beyond end of file.
14173
14174 2008-09-05  Cary Coutant  <ccoutant@google.com>
14175
14176         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14177         explicit instantiations.
14178
14179 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14180
14181         PR gold/6858
14182         * options.cc (General_options::finalize): Allow undefined symbols
14183         in shlibs if linking -shared.
14184
14185         PR gold/6859
14186         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14187         symbols as not needing a dynsym entry.
14188
14189 2008-08-20  Craig Silverstein  <csilvers@google.com>
14190
14191         * fileread.cc (File_read::open): Do not lock the file unless it
14192         was successfully opened.
14193
14194 2008-08-14  Cary Coutant  <ccoutant@google.com>
14195
14196         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14197         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14198         * testsuite/tls_test.cc (struct int128): 128-bit struct
14199         for testing TLS relocs with non-zero addend.
14200         (v12): New TLS variable.
14201         (t12): New test.
14202         (t_last): Add check for v12.
14203         * testsuite/tls_test.h (t12): New function.
14204         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14205
14206 2008-08-13  Ian Lance Taylor  <iant@google.com>
14207
14208         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14209         set tls_segment_ or relro_segment_.
14210         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14211         when appropriate.
14212         * output.h (Output_section::clear_is_relro): New function.
14213         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14214         sections specially even when output_data_ is empty.
14215         (Output_segment::maximum_alignment): When first section is relro,
14216         only force alignment for PT_LOAD segments.
14217         * script.cc (script_data_segment_align): New function.
14218         (script_data_segment_relro_end): New function.
14219         * script-c.h (script_data_segment_align): Declare.
14220         (script_data_segment_relro_end): Declare.
14221         * script-sections.h (class Script_sections): Declare
14222         data_segment_align and data_segment_relro_end.  Add fields
14223         segment_align_index_ and saw_relro_end_.
14224         * script-sections.cc (class Sections_element): Add set_is_relro
14225         virtual function.  Add new bool* parameter to place_orphan_here.
14226         Add get_output_section virtual function.
14227         (class Output_section_definition): Add set_is_relro.  Add new
14228         bool* parameter to place_orphan_here.  Add get_output_section.
14229         Add is_relro_ field.
14230         (Output_section_definition::Output_section_definition): Initialize
14231         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14232         and is_relro_ fields.
14233         (Output_section_definition::place_orphan_here): Add is_relro
14234         parameter.
14235         (Output_section_definition::set_section_addresses): Set relro for
14236         output section.
14237         (Output_section_definition::alternate_constraint): Likewise.
14238         (class Orphan_output_section): Add new bool* parameter to
14239         place_orphan_here.  Add get_output_section.
14240         (Orphan_output_section::place_orphan_here): Add is_relro
14241         parameter.
14242         (Script_sections::Script_sections): Initialize
14243         data_segment_align_index_ and saw_relro_end_.
14244         (Script_sections::data_segment_align): New function.
14245         (Script_sections::data_segment_relro_end): New function.
14246         (Script_sections::place_orphan): Set or clear is_relro.
14247         (Script_sections::set_section_addresses): Force alignment of first
14248         TLS section.
14249         * yyscript.y (exp): Call script_data_segment_align and
14250         script_data_segment_relro_end.
14251         * testsuite/relro_script_test.t: New file.
14252         * testsuite/relro_test.cc (using_script): Declare.
14253         (t1, t2): Test using_script.
14254         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14255         (relro_script_test_SOURCES): Define.
14256         (relro_script_test_DEPENDENCIES): Define.
14257         (relro_script_test_LDFLAGS): Define.
14258         (relro_script_test_LDADD): Define.
14259         (relro_script_test.so): New target.
14260         * testsuite/Makefile.in: Rebuild.
14261
14262 2008-08-06  Cary Coutant <ccoutant@google.com>
14263
14264         * archive.cc (Archive::total_archives, Archive::total_members)
14265         (Archive::total_members_loaded): New variables.
14266         (Archive::setup): Add parameter.  Add option to preread
14267         archive symbols.
14268         (Archive::read_armap): Add counter.
14269         (Archive::get_file_and_offset): New function.
14270         (Archive::get_elf_object_for_member): New function.
14271         (Archive::read_all_symbols): New function.
14272         (Archive::read_symbols): New function.
14273         (Archive::add_symbols): Add counters.
14274         (Archive::include_all_members): Use armap to find members if it's
14275         already built.
14276         (Archive::include_member): Skip reading symbols if already read.
14277         Factored code into Archive::get_file_and_offset and
14278         Archive::get_elf_object_for_member.  Changed call to
14279         Mapfile::report_include_archive_member.
14280         (Archive::print_stats): New function.
14281         * archive.h: Declare Object and Read_symbols_data classes.
14282         (Archive::Archive): Add initializers for new members.
14283         (Archive::setup): Add parameter.
14284         (Archive::print_stats): New function.
14285         (Archive::total_archives, Archive::total_members)
14286         (Archive::total_members_loaded): New variables.
14287         (Archive::get_file_and_offset): New function.
14288         (Archive::get_elf_object_for_member): New function.
14289         (Archive::read_all_symbols): New function.
14290         (Archive::read_symbols): New function.
14291         (Archive::Archive_member): New class.
14292         (Archive::members_): New member.
14293         (Archive::num_members_): New member.
14294         * main.cc: Include archive.h.
14295         (main): Call Archive::print_stats.
14296         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14297         archive parameter; member_name is now the fully-decorated name.
14298         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14299         * options.h: (General_options): Add --preread-archive-symbols option.
14300         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14301         Archive::setup.
14302
14303 2008-08-04  Ian Lance Taylor  <iant@google.com>
14304
14305         * symtab.h (Symbol::use_plt_offset): New function.
14306         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14307         * powerpc.cc (Relocate::relocate): Likewise.
14308         * sparc.cc (Relocate::relocate): Likewise.
14309         * x86_64.cc (Relocate::relocate): Likewise.
14310         * testsuite/weak_plt.sh: New test.
14311         * testsuite/weak_plt_main.cc: New test.
14312         * testsuite/weak_plt_shared.cc: New test.
14313         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14314         (check_PROGRAMS): Add weak_plt.
14315         (check_DATA): Add weak_plt_shared.so.
14316         (weak_plt_main_pic.o, weak_plt): New targets.
14317         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14318         * testsuite/Makefile.in: Rebuild.
14319
14320         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14321         gcctestdir/ld.
14322         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14323         * testsuite/Makefile.in: Rebuild.
14324
14325 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14326
14327         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14328         * Makefile.in: Regenerate.
14329         * po/POTFILES.in: Regenerate.
14330
14331 2008-07-29  Ian Lance Taylor  <iant@google.com>
14332
14333         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14334         symbols before other symbols.
14335         * testsuite/script_test_2.cc (test_addr): Declare.
14336         (test_addr_alias): Declare.
14337         (main): Check that test_addr and test_addr_alias have the right
14338         values.
14339         * testsuite/script_test_2.t: Define test_addr_alias and
14340         test_addr.
14341
14342 2008-07-24  Ian Lance Taylor  <iant@google.com>
14343
14344         PR 5990
14345         * descriptors.cc: New file.
14346         * descriptors.h: New file.
14347         * gold-threads.h (class Hold_optional_lock): New class.
14348         * fileread.cc: Include "descriptors.h".
14349         (File_read::~File_read): Release descriptor rather than closing
14350         it.
14351         (File_read::open) [file]: Call open_descriptor rather than open.
14352         Set is_descriptor_opened_.
14353         (File_read::open) [memory]: Assert that descriptor is not open.
14354         (File_read::reopen_descriptor): New function.
14355         (File_read::release): Release descriptor.
14356         (File_read::do_read): Make non-const.  Reopen descriptor.
14357         (File_read::read): Make non-const.
14358         (File_read::make_view): Reopen descriptor.
14359         (File_read::do_readv): Likewise.
14360         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14361         Update declarations.
14362         * layout.cc: Include "descriptors.h".
14363         (Layout::create_build_id): Use open_descriptor rather than open.
14364         * output.cc: Include "descriptors.h".
14365         (Output_file::open): Use open_descriptor rather than open.
14366         * archive.cc (Archive::const_iterator): Change Archive to be
14367         non-const.
14368         (Archive::begin, Archive::end): Make non-const.
14369         (Archive::count_members): Likewise.
14370         * archive.h (class Archive): Update declarations.
14371         * object.h (Object::read): Make non-const.
14372         * Makefile.am (CCFILES): Add descriptors.cc.
14373         (HFILES): Add descriptors.h.
14374         * Makefile.in: Rebuild.
14375
14376         PR 6716
14377         * gold.h: Always include <clocale>.  Add Solaris workarounds
14378         following code in binutils/sysdep.h.
14379
14380         PR 6048
14381         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14382         this->eh_frame_hdr_ is NULL before using it.
14383
14384         * dynobj.cc (Versions::Versions): Update comment.
14385
14386         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14387         the base version name.
14388
14389         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14390         array size plus one.
14391         (Stringpool_template::set_string_offsets): Subtract one from key
14392         before using it as an array index.
14393         (Stringpool_template::get_offset_with_length): Likewise.
14394         (Stringpool_template::write_to_buffer): Likewise.
14395         * stringpool.h (Stringpool_template::get_offset_from_key):
14396         Likewise.
14397
14398 2008-07-23  Ian Lance Taylor  <iant@google.com>
14399
14400         PR 6658
14401         * object.h (Merged_symbol_value::value): Do our best to handle a
14402         negative addend.
14403
14404         PR 6647
14405         * script.cc (Version_script_info::get_versions): Don't add empty
14406         version tag to return value.
14407         (Version_script_info::get_symbol_version_helper): Change return
14408         type to bool.  Add pversion parameter.  Change all callers.
14409         (script_register_vers_node): Don't require a non-NULL tag.
14410         * script.h (class Version_script_info): Update declarations.
14411         (Version_script_info::get_symbol_version): Change return type to
14412         bool.  Add version parameter.  Change all callers.
14413         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14414         handling.  Handle an empty version from a version script.
14415         (Symbol_table::define_special_symbol): Likewise.
14416         * testsuite/ver_test_10.script: New file.
14417         * testsuite/ver_test_10.sh: New file.
14418         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14419         (check_DATA): Add ver_test_10.syms.
14420         (ver_test_10.syms, ver_test_10.so): New target.
14421         * testsuite/Makefile.in: Rebuild.
14422
14423 2008-07-23  Simon Baldwin  <simonb@google.com>
14424
14425         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14426         to zero for undefined symbols from dynamic libraries.
14427
14428 2008-07-23  Ian Lance Taylor  <iant@google.com>
14429
14430         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14431         Change all callers.
14432         * symtab.h (class Symbol_table): Update declaration.
14433         * testsuite/ver_test_9.cc: New file.
14434         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14435         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14436         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14437         (ver_test_9.so, ver_test_9.o): New targets.
14438         * testsuite/Makefile.in: Rebuild.
14439
14440 2008-07-22  Ian Lance Taylor  <iant@google.com>
14441
14442         * options.h (class General_options): Define --check-sections.
14443         * layout.cc (Layout::set_segment_offsets): Handle
14444         --check-sections.
14445
14446         * options.h (class General_options): Define -n/--nmagic and
14447         -N/--omagic.
14448         * options.cc (General_options::finalize): For -n/--nmagic or
14449         -N/--omagic, set -static.
14450         * layout.cc (Layout::attach_allocated_section_to_segment): If
14451         -N/--omagic, don't put read-only and read-write sections in
14452         different segments.
14453         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14454         finding a read-only segment.
14455         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14456         don't set the minimum segment alignment to the common page size,
14457         and don't set the file offset to the address modulo the page size.
14458         * script-sections.cc (Script_sections::create_segments): If
14459         -n/--omagic, don't put read-only and read-write sections in
14460         different segments.
14461
14462         * cref.cc: New file.
14463         * cref.h: New file.
14464         * options.h (class General_options): Add --print-symbol-counts.
14465         * main.cc (main): Issue defined symbol report if requested.
14466         * archive.cc (Archive::interpret_header): Make into a const member
14467         function.
14468         (Archive::add_symbols): Call Input_objects::archive_start and
14469         archive_stop.
14470         (Archive::const_iterator): Define new class.
14471         (Archive::begin, Archive::end): New functions.
14472         (Archive::include_all_members): Rewrite to use iterator.
14473         (Archive::count_members): New function.
14474         * archive.h (class Archive): Update declarations.
14475         (Archive::filename): New function.
14476         * object.cc: Include "cref.h".
14477         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14478         (Sized_relobj::do_get_global_symbol_counts): New function.
14479         (Input_objects::add_object): Add object to cross-referencer.
14480         (Input_objects::archive_start): New function.
14481         (Input_objects::archive_stop): New function.
14482         (Input_objects::print_symbol_counts): New function.
14483         * object.h: Declare Cref and Archive.
14484         (Object::get_global_symbol_counts): New function.
14485         (Object::do_get_global_symbol_counts): New pure virtual function.
14486         (class Sized_relobj): Add defined_count_ field.  Update
14487         declarations.
14488         (class Input_objects): Add cref_ field.  Update constructor.
14489         Update declarations.
14490         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14491         defined_count_.
14492         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14493         symbol counts.
14494         (Sized_dynobj::do_get_global_symbol_counts): New function.
14495         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14496         defined_count_.  Update declarations.  Define Symbols typedef.
14497         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14498         parameter.  Change all callers.
14499         (Symbol_table::add_from_dynobj): Add sympointers and defined
14500         parameters.  Change all callers.
14501         * symtab.h (class Symbol_table): Update declarations.
14502         * Makefile.am (CCFILES): Add cref.cc.
14503         (HFILES): Add cref.h.
14504         * Makefile.in: Rebuild.
14505
14506 2008-07-22  Simon Baldwin  <simonb@google.com>
14507
14508         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14509         to zero when writing undefined symbols.
14510
14511 2008-07-22  Ian Lance Taylor  <iant@google.com>
14512
14513         * output.cc (Output_section::add_input_section): Don't try to
14514         merge empty merge sections.
14515
14516 2008-07-21  Craig Silverstein  <csilvers@google.com>
14517
14518         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14519         Include symbol version in error message.
14520
14521 2008-07-20  Chris Demetriou  <cgd@google.com>
14522
14523         * configure.ac (gold_cv_c_random_seed): New configured variable.
14524         (RANDOM_SEED_CFLAGS): New substituted variable.
14525         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14526         * configure: Rebuild.
14527         * Makefile.in: Likewise.
14528         * testsuite/Makefile.in: Likewise.
14529
14530 2008-07-18  Ian Lance Taylor  <iant@google.com>
14531
14532         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14533         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14534         * testsuite/ver_test_main.cc (main): Call t4.
14535         (t4, t4_2a): Define.
14536         * testsuite/ver_test_2.cc (t4_2): Define.
14537         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14538         * testsuite/ver_test_4.cc (t4_2a): Define.
14539         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14540         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14541
14542 2008-07-17  Ian Lance Taylor  <iant@google.com>
14543
14544         * dynobj.cc (Versions::add_def): If we give an error about a
14545         missing version, go ahead and create the version anyhow.
14546
14547 2008-07-10  Ian Lance Taylor  <iant@google.com>
14548
14549         Handle output sections with more than 0x7fffffff bytes.
14550         * object.h (class Relobj): Change map_to_output_ to
14551         output_sections_, and just keep a section pointer.  Change all
14552         uses.  Move comdat group support to Sized_relobj.
14553         (Relobj::is_section_specially_mapped): Remove.
14554         (Relobj::output_section): Remove poff parameter.  Change all
14555         callers.
14556         (Relobj::output_section_offset): New function.
14557         (Relobj::set_section_offset): Rewrite.
14558         (Relobj::map_to_output): Remove.
14559         (Relobj::output_sections): New function.
14560         (Relobj::do_output_section_offset): New pure virtual function.
14561         (Relobj::do_set_section_offset): Likewise.
14562         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14563         group support from Relobj.  Update declarations.
14564         (Sized_relobj::get_output_section_offset): New function.
14565         (Sized_relobj::do_output_section_offset): New function.
14566         (Sized_relobj::do_set_section_offset): New function.
14567         * object.cc (Relobj::output_section_address): Remove.
14568         (Sized_relobj::Sized_relobj): Initialize new fields.
14569         (Sized_relobj::include_section_group): Cast find_kept_object to
14570         Sized_relobj.
14571         (Sized_relobj::include_linkonce_section): Likewise.
14572         (Sized_relobj::do_layout): Use separate arrays for output section
14573         and output offset.
14574         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14575         output_sections.
14576         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14577         output_sections and section_offsets.
14578         (Sized_relobj::write_local_symbols): Likewise.
14579         (map_to_kept_section): Compute output address directly.
14580         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14581         output_sections and section_offsets.
14582         (Sized_relobj::write_sections): Likewise.
14583         (Sized_relobj::relocate_sections): Likewise.
14584         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14585         * output.h (class Output_reloc): Update declarations.  Change
14586         u2_.relobj to Sized_relobj*.
14587         (class Output_data_reloc): Change add functions to use
14588         Sized_relobj*.
14589         * output.cc (Output_reloc::Output_reloc): Change relobj to
14590         Sized_relobj*.
14591         (Output_reloc::local_section_offset): Change return type to
14592         Elf_Addr.  Use get_output_section_offset.
14593         (Output_reloc::get_address): Likewise.
14594         (Output_section::is_input_address_mapped): Don't call
14595         is_section_specially_mapped.
14596         (Output_section::output_offset): Likewise.
14597         (Output_section::output_address): Likewise.
14598         (Output_section::starting_output_address): Likewise.
14599         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14600         parameter to Sized_relobj*.
14601         (Copy_relocs::need_copy_reloc): Likewise.
14602         (Copy_relocs::save): Likewise.
14603         * copy-relocs.h (class Copy_relocs): Update declarations.
14604         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14605         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14606         * target-reloc.h (relocate_for_relocatable): Change
14607         offset_in_output_section type to Elf_Addr.  Change code that uses
14608         it as well.
14609         * layout.cc (Layout::layout): Always set *off.
14610         * mapfile.cc (Mapfile::print_input_section): Use
14611         output_section_offset.
14612         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14613         Sized_relobj*.
14614         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14615         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14616         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14617
14618 2008-07-03  Ian Lance Taylor  <iant@google.com>
14619
14620         * layout.cc (Layout::include_section): Do not discard unrecognized
14621         SHT_STRTAB sections.
14622
14623 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14624
14625         * script.cc (Lex::can_continue_name): Make '?' allowable in
14626         version-script names.
14627         * testsuite/version_script.map: Change glob pattern to use '?'
14628
14629 2008-06-30  Manish Singh  <yosh@gimp.org>
14630
14631         PR 6585
14632         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14633         Correct typo.
14634
14635 2008-06-30  Ian Lance Taylor  <iant@google.com>
14636
14637         PR 6660
14638         PR 6682
14639         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14640         versions]: Don't try to read the value in the contents, since we
14641         don't use it.  Use the template endianness when writing.
14642
14643 2008-06-25  Cary Coutant  <ccoutant@google.com>
14644
14645         * fileread.cc (File_read::make_view): Assert on zero-length view.
14646         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14647         symbol table when there are no symbols to read.
14648
14649 2008-06-23  Craig Silverstein  <csilvers@google.com>
14650
14651         * version.cc (version_string): Bump to 1.7
14652
14653 2008-06-18  Craig Silverstein  <csilvers@google.com>
14654
14655         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14656         constant 0xFFFF to type Valtype.
14657         (Powerpc_relocate_functions::rel16_ha): Likewise.
14658
14659 2008-06-17  Ian Lance Taylor  <iant@google.com>
14660
14661         * output.h (Output_section::Input_section): Initialize p2align_ to
14662         zero for Output_section_data constructors.
14663         (Output_section::Input_section::addralign): If not an input
14664         section, return the alignment of the Output_section_data.
14665         * testsuite/copy_test.cc: New file.
14666         * testsuite/copy_test_1.cc: New file.
14667         * testsuite/copy_test_2.cc: New file.
14668         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14669         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14670         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14671         (copy_test_1_pic.o, copy_test_1.so): New targets.
14672         (copy_test_2_pic.o, copy_test_2.so): New targets.
14673         * testsuite/Makefile.in: Rebuild.
14674
14675         * script-sections.cc (Script_sections::place_orphan): Initialize
14676         local variable exact.
14677
14678 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14679
14680         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14681
14682 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14683             David S. Miller  <davem@davemloft.net>
14684
14685         * powerpc.cc: New file.
14686         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14687         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14688         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14689         * Makefile.in: Rebuild.
14690
14691 2008-06-09  Ian Lance Taylor  <iant@google.com>
14692
14693         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14694         <exception>.
14695         (throwing, orig_terminate): New static variables.
14696         (terminate_handler): New static function.
14697         (t2): Set terminate handler.
14698
14699 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14700
14701         PR 6584
14702         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14703         alignment.
14704
14705 2008-05-30  Cary Coutant  <ccoutant@google.com>
14706
14707         * archive.cc (Archive::include_all_members) Correct to step
14708         over symbol table and extended name table in thin archives.
14709
14710 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14711
14712         PR 6407
14713         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14714         calculation.
14715
14716 2008-05-28  Caleb Howe  <cshowe@google.com>
14717
14718         * reduced_debug_output.cc: New file.
14719         * reduced_debug_output.h: New file.
14720         * options.h (class General_options): Add --strip-debug-non-line.
14721         * options.cc (General_options::finalize): Add strip_debug_non_line
14722         to the strip heirarchy.
14723         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14724         fields.
14725         * layout.cc: Include "reduced_debug_output.h".
14726         (Layout::Layout): Initialize new fields.
14727         (line_only_debug_sections): New static array.
14728         (is_lines_only_debug_sections): New static inline function.
14729         (Layout::include_section): Handle --strip-debug-non-line.
14730         (Layout::make_output_section): If --strip-debug-non-line, build
14731         new output sections for .debug_abbrev and .debug_info.
14732         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14733         gold.  Warn about possible overflow.
14734         (read_signed_LEB_128): Likewise.
14735         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14736         (read_signed_LEB_128): Declare.
14737         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14738         (HFILES): Add reduced_debug_output.h.
14739         * Makefile.in: Rebuild.
14740
14741 2008-05-21  Ian Lance Taylor  <iant@google.com>
14742
14743         * mapfile.cc: New file.
14744         * mapfile.h: New file.
14745         * options.h (class General_options): Add -M/--print-map and -Map.
14746         * options.cc (General_options::finalize): Make -M equivalent to
14747         -Map -.
14748         * main.cc: Include <cstdio> and "mapfile.h".
14749         (main): Open mapfile if requested.
14750         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14751         constructor.  Change caller.
14752         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14753         (queue_middle_tasks): Likewise.
14754         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14755         declarations.
14756         * archive.cc: Include "mapfile.h".
14757         (Archive::add_symbols): Add mapfile parameter.  Change all
14758         callers.  Pass mapfile, symbol, and reason to include_member.
14759         (Archive::include_all_members): Add mapfile parameter.  Change all
14760         callers.
14761         (Archive::include_member): Add mapfile, sym, and why parameters.
14762         Change all callers.  Report inclusion to map file.
14763         * archive.h: Include "fileread.h".
14764         (class Archive): Update declarations.
14765         (Archive::file): New const method.
14766         (class Add_archive_symbols): Add mapfile_ field.  Update
14767         constructor.  Change all callers.
14768         * readsyms.h (class Read_symbols): Likewise.
14769         (class Finish_group): Likewise.
14770         (class Read_script): Likewise.
14771         * common.cc: Include "mapfile.h".
14772         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14773         all callers.
14774         (Symbol_table::do_allocate_commons): Likewise.
14775         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14776         symbol allocation to mapfile.
14777         * common.h (class Allocate_commons_task): Add mapfile_ field.
14778         Update constructor.  Change all callers.
14779         * symtab.h (class Symbol_table): Update declarations.
14780         * layout.cc: Include "mapfile.h".
14781         (Layout_task_runner::run): Print information to mapfile.
14782         (Layout::create_gold_note): Change Output_data_fixed_space to
14783         Output_data_zero_fill.
14784         (Layout::create_build_id): Likewise.
14785         (Layout::print_to_mapfile): New function.
14786         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14787         constructor.  Change caller.
14788         (class Layout): Declare print_to_mapfile.
14789         * output.cc (Output_section::Input_section::print_to_mapfile): New
14790         function.
14791         (Output_section::add_input_section): If producing a map, always
14792         add to input_sections_ list.
14793         (Output_section::do_print_to_mapfile): New function.
14794         (Output_segment::print_sections_to_mapfile): New function.
14795         (Output_segment::print_section_list_to_mapfile): New function.
14796         * output.h: Include "mapfile.h".
14797         (Output_data::print_to_mapfile): New function.
14798         (Output_data::do_print_to_mapfile): New virtual function.
14799         (Output_segment_headers::do_print_to_mapfile): New function.
14800         (Output_file_header::do_print_to_mapfile): New function.
14801         (Output_data_const::do_print_to_mapfile): New function.
14802         (class Output_data_const_buffer): Add map_name_ field.  Update
14803         constructor.  Change all callers.  Add do_print_to_mapfile
14804         function.
14805         (class Output_data_fixed_space): Likewise.
14806         (class Output_data_space): Likewise.
14807         (class Output_data_zero_fill): New class.
14808         (Output_data_strtab::do_print_to_mapfile): New function.
14809         (Output_data_reloc_base::do_print_to_mapfile): New function.
14810         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14811         (Output_data_group::do_print_to_mapfile): New function.
14812         (Output_data_got::do_print_to_mapfile): New function.
14813         (Output_data_dynamic::do_print_to_mapfile): New function.
14814         (Output_symtab_xindex::do_print_to_mapfile): New function.
14815         (class Output_section): Declare do_print_to_mapflie.  Declare
14816         print_to_mapfile in Input_section.
14817         (class Output_segment): Declare new functions.
14818         * object.h (Sized_relobj::symbol_count): New function.
14819         * script-sections.cc
14820         (Output_section_element_dot_assignment::set_section_addresses):
14821         Change Output_data_fixed_space to Output_data_zero_fill.
14822         (Output_data_expression::do_print_to_mapfile): New function.
14823         * script.cc (read_input_script): Add mapfile parameter.  Change
14824         all callers.
14825         * script.h (read_input_script): Update declaration.
14826         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14827         (Eh_frame::do_print_to_mapfile): New function.
14828         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14829         (Output_merge_string::do_print_to_mapfile): New function.
14830         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14831         function.
14832         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14833         function.
14834         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14835         function.
14836         * Makefile.am (CCFILES): Add mapfile.cc.
14837         (HFILES): Add mapfile.h.
14838         * Makefile.in: Rebuild.
14839
14840 2008-05-19  Ian Lance Taylor  <iant@google.com>
14841
14842         * options.h (class General_options): Add -z relro.
14843         * layout.cc (Layout::Layout): Initialize relro_segment_.
14844         (Layout::add_output_section_data): Return the output section.
14845         (Layout::make_output_section): Rcognize relro sections and mark
14846         them appropriately.
14847         (Layout::attach_allocated_section_to_segment): Put relro sections
14848         in a PT_GNU_RELRO segment.
14849         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14850         section as relro.
14851         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14852         PT_TLS segments.
14853         (Layout::linkonce_mapping): Map d.rel.ro.local to
14854         .data.rel.ro.local.
14855         (Layout::output_section_name): Us .data.rel.ro.local for any
14856         section which begins with that.
14857         * layout.h (class Layout): Update add_output_section_data
14858         declaration.  Add relro_segment_ field.
14859         * output.cc (Output_section::Output_section): Initialize is_relro_
14860         and is_relro_local_ fields.
14861         (Output_segment::add_output_section): Group relro sections.
14862         (Output_segment::is_first_section_relro): New function.
14863         (Output_segment::maximum_alignment): If there is a relro section,
14864         align the segment to the common page size.
14865         (Output_segment::set_section_addresses): Track whether we are
14866         looking at relro sections.  If the last section is a relro
14867         section, align to the common page size.
14868         (Output_segment::set_section_list_addresses): Add in_relro
14869         parameter.  Change all callers.  Align to the page size when
14870         moving from relro to non-relro section.
14871         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14872         segment.
14873         * output.h (class Output_section): Add is_relro_ and
14874         is_relro_local_ fields.
14875         (Output_section::is_relro): New function.
14876         (Output_section::set_is_relro): New function.
14877         (Output_section::is_relro_local): New function.
14878         (Output_section::set_is_relro_local): New function.
14879         (class Output_segment): Update declarations.
14880         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14881         * sparc.cc (Target_sparc::got_section): Likewise.
14882         * x86_64.cc (Target_x86_64::got_section): Likewise.
14883         * testsuite/relro_test_main.cc: New file.
14884         * testsuite/relro_test.cc: New file.
14885         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14886         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14887         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14888         (relro_test.so, relro_test_pic.o): New targets.
14889         * testsuite/Makefile.in: Rebuild.
14890
14891 2008-05-16  Ian Lance Taylor  <iant@google.com>
14892
14893         * output.cc (Output_segment::add_output_section): Remove front
14894         parameter.
14895         * output.h (class Output_segment): Remove
14896         add_initial_output_section and overloaded add_output_section.
14897         Update declaration of remaining add_output_section.
14898         * layout.cc (Layout::create_interp): Call add_output_section
14899         rather than add_initial_output_section.
14900         (Layout::finish_dynamic_section): Likewise.
14901
14902         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14903         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14904         know the dynamic type.
14905         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14906         field.  Initialize it in constructor.
14907         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14908         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14909         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14910         reloc.
14911
14912         * output.cc (Output_reloc::get_address): Change return type to
14913         Elf_Addr.
14914         * output.h (class Output_reloc): Update get_address declaration.
14915         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14916         for section addresses.
14917
14918 2008-05-09  Ian Lance Taylor  <iant@google.com>
14919
14920         PR 6493
14921         * gold.cc (gold_nomem): Use return value of write.
14922
14923 2008-05-08  Ian Lance Taylor  <iant@google.com>
14924
14925         * symtab.c (Symbol::init_base_output_data): Add version
14926         parameter.  Change all callers.
14927         (Symbol::init_base_output_segment): Likewise.
14928         (Symbol::init_base_constant): Likewise.
14929         (Symbol::init_base_undefined): Likewise.
14930         (Sized_symbol::init_output_data): Likewise.
14931         (Sized_symbol::init_output_segment): Likewise.
14932         (Sized_symbol::init_constant): Likewise.
14933         (Sized_symbol::init_undefined): Likewise.
14934         (Symbol_table::do_define_in_output_data): If the new symbol has a
14935         version, mark it as the default.
14936         (Symbol_table::do_define_in_output_segment): Likewise.
14937         (Symbol_table::do_define_as_constant): Likewise.
14938         * symtab.h (class Symbol): Update declarations.
14939         (class Sized_symbol): Likewise.
14940         * resolve.cc (Symbol::override_version): New function.
14941         (Symbol::override_base): Call override_version.
14942         (Symbol::override_base_with_special): Likewise.
14943         * testsuite/ver_script_8.script: New file.
14944         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14945         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14946         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14947         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14948
14949 2008-05-06  Ian Lance Taylor  <iant@google.com>
14950
14951         PR 6049
14952         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14953         functions.
14954         (class General_options): Remove existing --undefined, and add
14955         --no-undefined instead.  Add new --undefined as synonym for -u.
14956         * archive.cc (Archive::add_symbols): Check whether symbol was
14957         named with -u.
14958         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14959         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14960         all uses.  Add IS_UNDEFINED.  Update declarations to split
14961         different versions of init_base.  Declare init_base_undefined.
14962         (Symbol::is_defined): Handle IS_UNDEFINED.
14963         (Symbol::is_undefined): Likewise.
14964         (Symbol::is_weak_undefined): Call is_undefined.
14965         (Symbol::is_absolute): Handle IS_CONSTANT.
14966         (class Sized_symbol): Update declarations to split different
14967         versions of init.  Declare init_undefined.
14968         (class Symbol_table): Declare new functions.
14969         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14970         Change all callers.
14971         (Symbol::init_base_output_data): Likewise.
14972         (Symbol::init_base_output_segment): Likewise.
14973         (Symbol::init_base_constant): Likewise.
14974         (Symbol::init_base_undefined): New function.
14975         (Sized_symbol::init_object): Rename from init.  Change all
14976         callers.
14977         (Sized_symbol::init_output_data): Likewise.
14978         (Sized_symbol::init_output_segment): Likewise.
14979         (Sized_symbol::init_constant): Likewise.
14980         (Sized_symbol::init_undefined): New function.
14981         (Symbol_table::add_undefined_symbols_from_command_line): New
14982         function.
14983         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14984         function.
14985         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14986         (Symbol::output_section): Likewise.
14987         (Symbol::set_output_section): Likewise.
14988         (Symbol_table::sized_finalize_symbol): Likewise.
14989         (Symbol_table::sized_write_globals): Likewise.
14990         * resolve.cc (Symbol_table::should_override): Likewise.
14991         (Symbol::override_base_with_special): Likewise.
14992
14993         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14994         symbol, change it to have default visibility.
14995         * testsuite/protected_1.cc: New file.
14996         * testsuite/protected_2.cc: New file.
14997         * testsuite/protected_3.cc: New file.
14998         * testsuite/protected_main_1.cc: New file.
14999         * testsuite/protected_main_2.cc: New file.
15000         * testsuite/protected_main_3.cc: New file.
15001         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
15002         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
15003         (protected_1_LDFLAGS, protected_1_LDADD): Define.
15004         (protected_1.so): New target.
15005         (protected_1_pic.o, protected_2_pic.o): New targets.
15006         (protected_3_pic.o): New target.
15007         (check_PROGRAMS): Add protected_2.
15008         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
15009         (protected_2_LDFLAGS, protected_2_LDADD): Define.
15010         * testsuite/Makefile.in: Rebuild.
15011
15012         * options.h (DEFINE_var): Add set_user_set_##varname__.
15013         (DEFINE_bool_alias): New macro.
15014         (class General_options): Define -Bstatic using DEFINE_bool_alias
15015         rather than DEFINE_special.  Add --undefined as an alias for -z
15016         defs.
15017         * options.cc (General_options::parse_Bstatic): Remove.
15018
15019         * options.h (class General_options): Add --fatal-warnings.
15020         * main.cc (main): Implement --fatal-warnings.
15021         * errors.h (Errors::warning_count): New function.
15022
15023         * options.h (class General_options): Add -Bsymbolic-functions.
15024         * symtab.h (Symbol::is_preemptible): Check for
15025         -Bsymbolic-functions.
15026
15027 2008-05-05  Ian Lance Taylor  <iant@google.com>
15028
15029         * options.h (DEFINE_bool): For DASH_Z, create the negative option
15030         as noVARNAME rather than no-VARNAME.
15031         (class General_options): Add option -z combreloc.
15032         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
15033         get_address.
15034         (Output_reloc::sort_before) [SHT_REL]: New function.
15035         (Output_reloc::sort_before) [SHT_RELA]: New function.
15036         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
15037         Sort_relocs_comparison.
15038         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
15039         parameter.  Change all callers.
15040         (Output_data_reloc::Output_data_reloc) [both versions]: Add
15041         sort_relocs parameter.  Change all callers.
15042         * output.cc (Output_reloc::get_address): New function, broken out
15043         of write_rel.
15044         (Output_reloc::write_rel): Call it.
15045         (Output_reloc::compare): New function.
15046         (Output_data_reloc_base::do_write): Optionally sort relocs.
15047
15048         * configure.ac: If targ_extra_obj is set, link it in.
15049         * configure.tgt: Initialize all variables.
15050         (x86_64*): Set targ_extra_obj and targ_extra_size.
15051         * configure: Rebuild.
15052
15053         * object.cc (Sized_relobj::include_section_group): Adjust section
15054         indexes read from group data.  Build vector to pass to
15055         layout_group.
15056         * layout.cc (Layout::layout_group): Add flags and shndxes
15057         parameters.  Remove contents parameter.  Change caller.  Update
15058         explicit instantiations.
15059         * layout.h (class Layout): Update layout_group declaration.
15060         * output.cc (Output_data_group::Output_data_group): Add flags and
15061         input_shndxes parameters.  Remove contents parameter.  Change
15062         caller.
15063         (Output_data_group::do_write): Change input_sections_ to
15064         input_shndxes_.
15065         * output.h (class Output_data_group): Update constructor
15066         declaration.  Rename input_sections_ to input_shndxes_.
15067         * testsuite/many_sections_test.cc: Add template.
15068
15069 2008-04-30  Cary Coutant  <ccoutant@google.com>
15070
15071         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15072
15073         * layout.cc (Layout::include_section): Refactored check for debug
15074         info section.
15075         (Layout::add_comdat): Add new parameters.  Change type
15076         of signature parameter.  Add object and shndx to signatures table.
15077         (Layout::find_kept_object): New function.
15078         * layout.h: Include <cstring>.
15079         (Layout::is_debug_info_section): New function.
15080         (Layout::add_comdat): Add new parameters.
15081         (Layout::find_kept_object): New function.
15082         (Layout::Kept_section): New struct.
15083         (Layout::Signatures): Change type of map range.
15084         * object.cc (Relobj::output_section_address): New function.
15085         (Sized_relobj::include_section_group): Add new parameters.  Change
15086         calls to Layout::add_comdat.  Change to build table of kept comdat
15087         groups and table mapping discarded sections to kept sections.
15088         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15089         (Sized_relobj::do_layout): Change calls to include_section_group and
15090         include_linkonce_section.
15091         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15092         value to zero when section is discarded.
15093         (Sized_relobj::map_to_kept_section): New function.
15094         * object.h (Relobj::output_section_address): New function.
15095         (Relobj::Comdat_group): New type.
15096         (Relobj::find_comdat_group): New function.
15097         (Relobj::Comdat_group_table): New type.
15098         (Relobj::Kept_comdat_section): New type.
15099         (Relobj::Kept_comdat_section_table): New type.
15100         (Relobj::add_comdat_group): New function.
15101         (Relobj::set_kept_comdat_section): New function.
15102         (Relobj::get_kept_comdat_section): New function.
15103         (Relobj::comdat_groups_): New field.
15104         (Relobj::kept_comdat_sections_): New field.
15105         (Symbol_value::input_value): Update comment.
15106         (Sized_relobj::map_to_kept_section) New function.
15107         (Sized_relobj::include_linkonce_section): Add new parameter.
15108         * target-reloc.h (Comdat_behavior): New type.
15109         (get_comdat_behavior): New function.
15110         (relocate_section): Add code to map a discarded section to the
15111         corresponding kept section when applying a relocation.
15112
15113 2008-04-30  Craig Silverstein  <csilvers@google.com>
15114
15115         * dwarf_reader.cc (next_generation_count): New static var.
15116         (Addr2line_cache_entry): New struct.
15117         (addr2line_cache): New static var.
15118         (Dwarf_line_info::one_addr2line): Added caching.
15119         (Dwarf_line_info::clear_addr2line_cache): New function.
15120         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15121         cache-size parameter.
15122         (Dwarf_line_info::one_addr2line_cache): New function.
15123         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15124         new cache-size argument to one_addr2line(), and clear cache.
15125
15126 2008-04-28  Cary Coutant  <ccoutant@google.com>
15127
15128         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15129         R_386_PC8 relocations.
15130
15131 2008-04-23  Ian Lance Taylor  <iant@google.com>
15132
15133         * object.cc (Sized_relobj::include_section_group): Check for
15134         invalid section group.
15135
15136         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15137         header size.
15138
15139         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15140         than read for file header.
15141         * archive.cc (Archive::include_member): Likewise.
15142
15143 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15144
15145         * aclocal.m4: Regenerate.
15146         * configure: Regenerate.
15147
15148 2008-04-19  Ian Lance Taylor  <iant@google.com>
15149
15150         * version.cc (version_string): Bump to 1.6.
15151
15152         * testsuite/Makefile.am (many_sections_r_test): New target.
15153         (many_sections_r_test_SOURCES): Remove.
15154         (many_sections_r_test_DEPENDENCIES): Remove.
15155         (many_sections_r_test_LDFLAGS): Remove.
15156         (many_sections_r_test_LDADD): Remove.
15157
15158         * object.cc (Sized_relobj::do_add_symbols): Always pass
15159         local_symbol_count_ to add_from_relobj.
15160
15161         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15162         every thousand variables.
15163         * testsuite/Makefile.in: Rebuild.
15164
15165         * object.cc (Xindex::initialize_symtab_xindex): New function.
15166         (Xindex::read_symtab_xindex): New function.
15167         (Xindex::sym_xindex_to_shndx): New function.
15168         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15169         available.
15170         (Sized_relobj::do_initialize_xindex): New function.
15171         (Sized_relobj::do_read_symbols): Adjust section links.
15172         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15173         parameter.  Change all callers.
15174         (Sized_relobj::include_section_group): Adjust section links and
15175         symbol section indexes.
15176         (Sized_relobj::do_layout): Adjust section links.
15177         (Sized_relobj::do_count_local_symbols): Adjust section links and
15178         symbol section indexes.
15179         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15180         ordinary and special symbols.
15181         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15182         dynsym_xindex parameters.  Change all callers.  Adjust section
15183         links.  Use SHN_XINDEX when needed.
15184         (Sized_relobj::get_symbol_location_info): Adjust section links.
15185         Don't get fooled by special symbols.
15186         * object.h (class Xindex): Define.
15187         (class Object): Add xindex_ parameter.  Declare virtual functoin
15188         do_initialize_xindex.
15189         (Object::adjust_sym_shndx): New function.
15190         (Object::set_xindex): New protected function.
15191         (class Symbol_value): Add is_ordinary_shndx_ field.
15192         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15193         (Symbol_value::value): Assert ordinary section.
15194         (Symbol_value::initialize_input_to_output_map): Likewise.
15195         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15196         Change all callers.
15197         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15198         all callers.
15199         (class Sized_relobj): Update declarations.
15200         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15201         parameter.  Change all callers.
15202         (Sized_relobj::adjust_shndx): New function.
15203         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15204         field.
15205         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15206         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15207         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15208         (Sized_dynobj::read_dynsym_section): Adjust section links.
15209         (Sized_dynobj::read_dynamic): Likewise.
15210         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15211         section links.
15212         (Sized_dynobj::do_initialize_xindex): New function.
15213         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15214         do_initialize_xindex.
15215         (Sized_dynobj::adjust_shndx): New function.
15216         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15217         dynsym_xindex_ fields.
15218         (Layout::finalize): Add a call to set_section_indexes before
15219         creating the symtab sections.
15220         (Layout::set_section_indexes): Don't do anything if the section
15221         already has a section index.
15222         (Layout::create_symtab_sections): Add shnum parameter.  Change
15223         caller.  Create .symtab_shndx section if needed.
15224         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15225         caller.
15226         (Layout::allocated_output_section_count): New function.
15227         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15228         needed.
15229         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15230         fields.  Update declarations.
15231         (Layout::symtab_xindex): New function.
15232         (Layout::dynsym_xindex): New function.
15233         (class Write_symbols_task): Add layout_ field.
15234         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15235         Change caller.
15236         * output.cc (Output_section_headers::Output_section_headers): Add
15237         shstrtab_section parameter.  Change all callers.
15238         (Output_section_headers::do_sized_write): Store overflow values
15239         for section count and section string table section index in
15240         section header zero.
15241         (Output_file_header::do_sized_write): Check for overflow of
15242         section count and section string table section index.
15243         (Output_symtab_xindex::do_write): New function.
15244         (Output_symtab_xindex::endian_do_write): New function.
15245         * output.h (class Output_section_headers): Add shstrtab_section_.
15246         Update declarations.
15247         (class Output_symtab_xindex): Define.
15248         (Output_section::has_out_shndx): New function.
15249         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15250         field.
15251         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15252         Change all callers.
15253         (Sized_symbol::init): Likewise.
15254         (Symbol::output_section): Check for ordinary symbol.
15255         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15256         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15257         callers.
15258         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15259         Change all callers.  Simplify handling of symbols from sections
15260         not included in the link.
15261         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15262         distinction.
15263         (Weak_alias_sorter::operator()): Assert that symbols are
15264         ordinary.
15265         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15266         distinction.
15267         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15268         parameters.  Change all callers.
15269         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15270         symbol distinction.  Use SHN_XINDEX when needed.
15271         (Symbol_table::write_section_symbol): Add symtab_xindex
15272         parameter.  Change all callers.
15273         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15274         SHN_XINDEX when needed.
15275         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15276         declarations.
15277         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15278         (Symbol::is_defined): Check is_ordinary.
15279         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15280         (Symbol::is_absolute, Symbol::is_common): Likewise.
15281         (class Sized_symbol): Update declarations.
15282         (class Symbol_table): Update declarations.
15283         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15284         parameters.  Change all callers.
15285         (Sized_symbol::override): Likewise.
15286         (Symbol_table::override): Likewise.
15287         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15288         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15289         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15290         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15291         to be in an ordinary section.
15292         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15293         object and is_ordinary parameters.  Change all callers.
15294         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15295         Change all callers.  Don't add undefined or non-ordinary symbols
15296         to reloc_map_.
15297         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15298         Change all callers.
15299         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15300         declarations.
15301         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15302         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15303         (Sized_relobj::relocate_sections): Likewise.
15304         * target-reloc.h (scan_relocs): Adjust section symbol index.
15305         (scan_relocatable_relocs): Likewise.
15306         * i386.cc (Scan::local): Check for ordinary symbols.
15307         * sparc.cc (Scan::local): Likewise.
15308         * x86_64.cc (Scan::local): Likewise.
15309         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15310         to symbol_section_and_value.
15311         * testsuite/many_sections_test.cc: New file.
15312         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15313         (check_PROGRAMS): Add many_sections_test.
15314         (many_sections_test_SOURCES): Define.
15315         (many_sections_test_DEPENDENCIES): Define.
15316         (many_sections_test_LDFLAGS): Define.
15317         (BUILT_SOURCES): Add many_sections_define.h.
15318         (many_sections_define.h): New target.
15319         (BUILT_SOURCES): Add many_sections_check.h.
15320         (many_sections_check.h): New target.
15321         (check_PROGRAMS): Add many_sections_r_test.
15322         (many_sections_r_test_SOURCES): Define.
15323         (many_sections_r_test_DEPENDENCIES): Define.
15324         (many_sections_r_test_LDFLAGS): Define.
15325         (many_sections_r_test_LDADD): Define.
15326         (many_sections_r_test.o): New target.
15327         * testsuite/Makefile.in: Rebuild.
15328
15329 2008-04-17  Cary Coutant  <ccoutant@google.com>
15330
15331         * errors.cc (Errors::info): New function.
15332         (gold_info): New function.
15333         * errors.h (Errors::info): New function.
15334         * gold.h (gold_info): New function.
15335         * object.cc (Input_objects::add_object): Print trace output.
15336         * options.cc (options::parse_set): New function.
15337         (General_options::parse_wrap): Deleted.
15338         (General_options::General_options): Deleted initializer.
15339         * options.h (options::String_set): New typedef.
15340         (options::parse_set): New function.
15341         (DEFINE_set): New macro.
15342         (General_options::wrap): Changed to use DEFINE_set. Changed
15343         callers of any_wrap_symbols and is_wrap_symbol.
15344         (General_options::trace, General_options::trace_symbol):
15345         New options.
15346         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15347         (General_options::wrap_symbols_): Deleted.
15348         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15349
15350 2008-04-17  David S. Miller  <davem@davemloft.net>
15351
15352         * options.cc (General_options::parse_V): New function.
15353         * options.h: Add entries for -V and -Qy.
15354
15355 2008-04-17  Ian Lance Taylor  <iant@google.com>
15356
15357         * common.cc (Symbol_table::allocate_commons): Remove options
15358         parameter.  Change caller.
15359         (Symbol_table::do_allocate_commons): Remove options parameter.
15360         Change caller.  Just call do_allocate_commons_list twice.
15361         (Symbol_table::do_allocate_commons_list): New function, broken out
15362         of do_allocate_commons.
15363         * common.h (class Allocate_commons_task): Remove options_ field.
15364         Update constructor.
15365         * symtab.cc (Symbol_table::Symbol_table): Initialize
15366         tls_commons_.
15367         (Symbol_table::add_from_object): Put TLS common symbols on
15368         tls_commons_ list.
15369         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15370         which are IN_OUTPUT_DATA.
15371         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15372         allocate_commons and do_allocate_commons declarations.  Declare
15373         do_allocate_commons_list.
15374         * gold.cc (queue_middle_tasks): Update creation of
15375         Allocate_commons_task to not pass options.
15376         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15377         (TLS_TEST_C_FLAGS): New variable.
15378         (tls_test_c_pic.o): New target.
15379         (tls_test_shared.so): Link in tls_test_c_pic.o.
15380         (tls_test_c_pic_ie.o): New target.
15381         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15382         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15383         (tls_test_c.o): New target.
15384         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15385         (tls_pic_test_LDADD): Likewise.
15386         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15387         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15388         (tls_test_c_gnu2.o): New target.
15389         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15390         tls_test_c_gnu2.o.
15391         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15392         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15393         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15394         * testsuite/tls_test.cc: Include "config.h".
15395         (t_last): Call t11_last.
15396         * testsuite/tls_test.h (t11, t11_last): Declare.
15397         * testsuite/tls_test_c.c: New file.
15398         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15399         * configure.ac: Check for OpenMP support.
15400         * configure, config.in, Makefile.in: Rebuild.
15401         * testsuite/Makefile.in: Rebuild.
15402
15403 2008-04-16  Cary Coutant  <ccoutant@google.com>
15404
15405         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15406         (Target_i386::tls_base_symbol_defined_): New field.
15407         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15408         (Target_i386::Scan::global): Likewise.
15409         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15410         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15411         (Target_x86_64::tls_base_symbol_defined_): New field.
15412         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15413         (Target_x86_64::Scan::global): Likewise.
15414
15415 2008-04-16  Cary Coutant  <ccoutant@google.com>
15416
15417         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15418         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15419         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15420         building shared libraries.
15421         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15422         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15423         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15424         * testsuite/Makefile.in: Rebuild.
15425         * testsuite/weak_undef.h: New file.
15426         * testsuite/weak_undef_file1.cc: Add extra test cases.
15427         * testsuite/weak_undef_file2.cc: Likewise.
15428         * testsuite/weak_undef_test.cc: Likewise.
15429
15430 2008-04-16  David S. Miller  <davem@davemloft.net>
15431
15432         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15433         Add issued_non_pic_error_ field.  Declare check_non_pic.
15434         (Target_sparc::Scan::check_non_pic): New function.
15435         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15436         (Target_sparc::Scan::global): Likewise.
15437
15438         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15439         * configure: Rebuild.
15440
15441         * options.h (DEFINE_enable): New macro.
15442         (new_dtags): New enable option.
15443         (initfirst, interpose, loadfltr, nodefaultlib,
15444         nodelete, nodlopen, nodump): New -z options.
15445         * layout.cc (Layout:finish_dynamic_section): If new
15446         dtags enabled, emit DT_RUNPATH.  Also, emit a
15447         DT_FLAGS_1 containing any specified -z flags.
15448
15449 2008-04-16  Ian Lance Taylor  <iant@google.com>
15450
15451         * copy-relocs.cc: New file.
15452         * copy-relocs.h: New file.
15453         * reloc.cc: Remove Copy_relocs code.
15454         * reloc.h: Likewise.
15455         * reloc-types.h (struct Reloc_types) [both versions]: Add
15456         get_reloc_addend_noerror.
15457         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15458         variants of add_global which take an addend which must be zero.
15459         * i386.cc: Include "copy-relocs.h".
15460         (class Target_i386): Change type of copy_relocs_ to variable,
15461         update initializer.
15462         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15463         Change all callers.
15464         (Target_i386::do_finalize_sections): Change handling of
15465         copy_relocs_.
15466         * sparc.cc: Include "copy-relocs.h".
15467         (class Target_sparc): Change type of copy_relocs_ to variable,
15468         update initializer.
15469         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15470         Change all callers.
15471         (Target_sparc::do_finalize_sections): Change handling of
15472         copy_relocs_.
15473         * x86_64.cc: Include "copy-relocs.h".
15474         (class Target_x86_64): Change type of copy_relocs_ to variable,
15475         update initializer.
15476         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15477         class.  Change all callers.
15478         (Target_x86_64::do_finalize_sections): Change handling of
15479         copy_relocs_.
15480         * Makefile.am (CCFILES): Add copy-relocs.cc.
15481         (HFILES): Add copy-relocs.h.
15482
15483         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15484
15485         * testsuite/script_test_4.sh: Permit leading zeroes.
15486
15487 2008-04-15  Ian Lance Taylor  <iant@google.com>
15488
15489         * script-sections.cc (Script_sections::create_segments): Use
15490         header_size_adjustment even when there is enough room for the
15491         headers.
15492         * testsuite/script_test_4.sh: New file.
15493         * testsuite/script_test_4.t: New file.
15494         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15495         (check_DATA): Add script_test_4.stdout.
15496         (MOSTLYCLEANFILES): Likewise.
15497         (script_test_4): New target.
15498         (script_test_4.stdout): New target.
15499         * testsuite/Makefile.in: Rebuild.
15500
15501         * sparc.cc: Add definitions for Output_data_plt_sparc class
15502         constants.
15503
15504 2008-04-14  David S. Miller  <davem@davemloft.net>
15505
15506         * sparc.cc: New file.
15507         * Makefile.am (TARGETSOURCES): Add sparc.cc
15508         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15509         * configure.tgt: Document targ_extra_size and
15510         targ_extra_big_endian.  Add entries for sparc-* and
15511         sparc64-*.
15512         * configure.ac: Handle targ_extra_size and
15513         targ_extra_big_endian.
15514         * Makefile.in: Rebuild.
15515         * configure: Likewise.
15516         * po/POTFILES.in: Likewise.
15517         * po/gold.pot: Likewise.
15518
15519 2008-04-14  Ian Lance Taylor  <iant@google.com>
15520
15521         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15522         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15523         in the name/type/flags to section mapping.  Don't call
15524         allocate_output_section.
15525         (Layout::choose_output_section): Change parameter from adjust_name
15526         to is_input_section.  Don't permit input sections after sections
15527         are attached to segments.  Don't call allocate_output_section.
15528         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15529         not write_enable_output_section.
15530         (Layout::make_output_section): Don't push to
15531         unattached_section_list_ nor call attach_to_segment.  Call
15532         attach_section_to_segment if sections are attached.
15533         (Layout::attach_sections_to_segments): New function.
15534         (Layout::attach_section_to_segment): New function.
15535         (Layout::attach_allocated_section_to_segment): Rename from
15536         attach_to_segment.  Remove flags parameter.
15537         (Layout::allocate_output_section): Remove function.
15538         (Layout::write_enable_output_section): Remove function.
15539         * layout.h (class Layout): Update for above changes.  Add new
15540         field sections_are_attached_.
15541         * output.h (Output_section::update_flags_for_input_section): New
15542         function.
15543         * output.cc (Output_section::add_input_section): Call
15544         update_flags_for_input_section.
15545         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15546
15547 2008-04-11  Cary Coutant  <ccoutant@google.com>
15548
15549         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15550         thought unnecessary.
15551         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15552
15553 2008-04-11  Ian Lance Taylor  <iant@google.com>
15554
15555         * output.h (class Output_section_data): Remove inline definition
15556         of set_addralign.
15557         * output.cc (Output_section_data::set_addralign): New function.
15558
15559 2008-04-11  Cary Coutant  <ccoutant@google.com>
15560
15561         Add support for TLS descriptors for i386 and x86_64.
15562         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15563         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15564         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15565         GOT_TYPE_TLS_DESC.
15566         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15567         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15568         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15569         relocations.
15570         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15571         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15572         Fix problem with initial-exec relocations.
15573         (Target_i386::Relocate::relocate_tls): Likewise.
15574         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15575         relaxation.
15576         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15577         support for section-plus-offset dynamic table entries.
15578         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15579         (Output_data_dynamic::Dynamic_entry): Add support for
15580         section-plus-offset dynamic table entries.
15581         (Output_data_dynamic::Classification): Likewise.
15582         (Output_data_dynamic::classification_): Renamed offset_.
15583         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15584         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15585         (Target_x86_64::make_plt_section): New function.
15586         (Target_x86_64::reserve_tlsdesc_entries): New function.
15587         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15588         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15589         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15590         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15591         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15592         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15593         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15594         add extra PLT entry for TLS descriptors.
15595         (Output_data_plt_x86_64::got_): New field.
15596         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15597         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15598         fields.
15599         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15600         descriptors.
15601         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15602         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15603         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15604         R_386_TLS_DESC_CALL relocations.
15605         (Target_x86_64::Scan::global): Likewise.
15606         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15607         for TLS descriptors.
15608         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15609         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15610         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15611         GD-to-IE relaxation.
15612         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15613         and TLS_DESCRIPTORS.
15614         * Makefile.in: Rebuild.
15615         * configure: Rebuild.
15616         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15617         (tls_test_shared2.so): New target.
15618         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15619         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15620         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15621         (tls_shared_gd_to_ie_test_LDADD): New variable.
15622         (tls_shared_gnu2_gd_to_ie_test): New target.
15623         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15624         New targets.
15625         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15626         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15627         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15628         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15629         (tls_shared_gnu2_test): New target.
15630         (tls_test_gnu2_shared.so): New target.
15631         (tls_shared_gnu2_test_SOURCES): New variable.
15632         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15633         (tls_shared_gnu2_test_LDFLAGS): New variable.
15634         (tls_shared_gnu2_test_LDADD): New variable.
15635         * testsuite/Makefile.in: Rebuild.
15636         * testsuite/Makefile.
15637
15638 2008-04-11  Ian Lance Taylor  <iant@google.com>
15639
15640         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15641         justsyms.t.
15642         * testsuite/Makefile.in: Rebuild.
15643
15644         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15645         long.
15646         * testsuite/script_test_2.cc (main): Adjust test.
15647
15648 2008-04-11  David S. Miller  <davem@davemloft.net>
15649             Ian Lance Taylor  <iant@google.com>
15650
15651         * options.h (General_options): Add entries for '-Y' and
15652         '-relax'.
15653         * options.cc (General_options:finalize): If -Y was used, add those
15654         entries to the library path instead of the default "/lib" and
15655         "/usr/lib".
15656
15657 2008-04-11  David S. Miller  <davem@davemloft.net>
15658
15659         * testsuite/justsyms.t: Start at 0x100.
15660         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15661         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15662         long.
15663         * testsuite/script_test_2.cc: Adjust string and section length
15664         checks.
15665
15666 2008-04-09  Ian Lance Taylor  <iant@google.com>
15667
15668         PR gold/5996
15669         * script-sections.cc (Sections_element::allocate_to_segment): Add
15670         orphan parameter.
15671         (Output_section_definition::allocate_to_segment): Likewise.
15672         (Orphan_output_section::allocate_to_segment): Likewise.
15673         (Script_sections::attach_sections_using_phdrs_clause): Don't
15674         propagate non-PT_LOAD segments to orphan sections.
15675         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15676         readelf rather than objdump.
15677         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15678         .interp section and PT_INTERP segment are the same size.
15679         * testsuite/Makefile.in: Rebuild.
15680
15681         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15682         aliases for symbols defined in the same object.
15683         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15684         (weak_alias_test_SOURCES): New variable.
15685         (weak_alias_test_DEPENDENCIES): New variable.
15686         (weak_alias_test_LDFLAGS): New variable.
15687         (weak_alias_test_LDADD): New variable.
15688         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15689         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15690         (weak_alias_test_3.o): New target.
15691         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15692         * testsuite/weak_alias_test_main.cc: New file.
15693         * testsuite/weak_alias_test_1.cc: New file.
15694         * testsuite/weak_alias_test_2.cc: New file.
15695         * testsuite/weak_alias_test_3.cc: New file.
15696
15697 2008-04-08  Ian Lance Taylor  <iant@google.com>
15698
15699         * options.h (class General_options): Add --noinhibit-exec option.
15700         * main.cc (main): Check --noinhibit-exec.
15701
15702         * options.h (class General_options): Define --wrap as a special
15703         option.  Add wrap_symbols_ field.
15704         (General_options::any_wrap_symbols): New function.
15705         (General_options::is_wrap_symbol): New function.
15706         * options.cc (General_options::parse_wrap): New function.
15707         (General_options::General_options): Initialize wrap_symbols_.
15708         * symtab.cc (Symbol_table::wrap_symbol): New function.
15709         (Symbol_table::add_from_object): Handle --wrap.
15710         * symtab.h (class Symbol_table): Declare wrap_symbol.
15711         * target.h (Target::wrap_char): New function.
15712         (Target::Target_info): Add wrap_char field.
15713         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15714         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15715         * testsuite/testfile.cc (Target_test::test_target_info):
15716         Likewise.
15717
15718         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15719         there is one.
15720
15721         * layout.h (class Layout): Add added_eh_frame_data_ field.
15722         * layout.cc (Layout::Layout): Initialize new field.
15723         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15724         output section until we find a section we merged successfully.
15725         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15726         that the size be non-zero.
15727
15728         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15729         qualifier.
15730
15731 2008-04-08  Craig Silverstein  <csilvers@google.com>
15732
15733         * configure.ac: Export new conditional variable HAVE_ZLIB.
15734         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15735         on HAVE_ZLIB.
15736         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15737         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15738
15739 2008-04-07  Ian Lance Taylor  <iant@google.com>
15740
15741         * version.cc (version_string): Set to "1.5".
15742
15743         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15744         Add issued_non_pic_error_ field.  Declare check_non_pic.
15745         (Target_x86_64::Scan::check_non_pic): New function.
15746         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15747         (Target_x86_64::Scan::global): Likewise.
15748
15749         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15750         addend parameter.  Change caller.  Handle merge sections.
15751         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15752         Address to Addend.  Don't add in the result of
15753         local_section_offset, pass down the addend and use the returned
15754         value.
15755         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15756         Update declarations of local_section_offset and symbol_value.
15757         * testsuite/two_file_test_1.cc (t18): New function.
15758         * testsuite/two_file_test_2.cc (f18): New function.
15759         * testsuite/two_file_test_main.cc (main): Call t18.
15760         * testsuite/two_file_test.h (t18, f18): Declare.
15761
15762         * configure.ac: Don't test for objdump, c++filt, or readelf.
15763         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15764         conditionals.
15765         (TEST_READELF): New variable.
15766         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15767         (check_PROGRAMS): Add two_file_strip_test.
15768         (two_file_strip_test): New target.
15769         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15770         (two_file_same_shared_strip_test_SOURCES): New variable.
15771         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15772         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15773         (two_file_same_shared_strip_test_LDADD): New variable.
15774         (two_file_shared_strip.so): New target.
15775         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15776         (ver_test_5.syms, ver_test_7.syms): Likewise.
15777         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15778         (strip_test_3.stdout): Use TEST_OBJDUMP.
15779         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15780
15781 2008-04-04  Cary Coutant  <ccoutant@google.com>
15782
15783         * symtab.h (Symbol::is_weak_undefined): New function.
15784         (Symbol::is_strong_undefined): New function.
15785         (Symbol::is_absolute): New function.
15786         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15787         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15788         absolute symbols.
15789         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15790         (weak_undef_test): New target.
15791         * testsuite/Makefile.in: Rebuild.
15792         * testsuite/weak_undef_file1.cc: New file.
15793         * testsuite/weak_undef_file2.cc: New file.
15794         * testsuite/weak_undef_test.cc: New file.
15795
15796 2008-04-03  Craig Silverstein  <csilvers@google.com>
15797
15798         * compressed_output.h (class Output_compressed_section): Use
15799         unsigned buffer.
15800         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15801         add zlib header.
15802         (zlib_compressed_suffix): Removed.
15803         (Output_compressed_section::set_final_data_size): Use unsigned
15804         buffers.
15805         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15806         Fix linker invocation.
15807         (flagstest_o_specialfile_and_compress_debug_sections):
15808         Likewise.
15809         * testsuite/Makefile.in: Regenerated.
15810
15811 2008-04-02  David S. Miller  <davem@davemloft.net>
15812
15813         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15814         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15815
15816 2008-04-02  Craig Silverstein  <csilvers@google.com>
15817
15818         * TODO: New file.
15819
15820 2008-04-02  Ian Lance Taylor  <iant@google.com>
15821
15822         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15823         parameters.  Update for new key type to views_.  Change all
15824         callers.
15825         (File_read::read): Adjust for byteshift in returned view.
15826         (File_read::add_view): New function, broken out of
15827         find_and_make_view.
15828         (File_read::make_view): New function, broken out of
15829         find_and_make_view.
15830         (File_read::find_or_make_view): Add offset and aligned
15831         parameters.  Rewrite accordingly.  Change all callers.
15832         (File_read::get_view): Add offset and aligned parameters.  Adjust
15833         for byteshift in return value.
15834         (File_read::get_lasting_view): Likewise.
15835         * fileread.h (class File_read): Update declarations.
15836         (class File_read::View): Add byteshift_ field.  Add byteshift to
15837         constructor.  Add byteshift method.
15838         * archive.h (Archive::clear_uncached_views): New function.
15839         (Archive::get_view): Add aligned parameter.  Change all callers.
15840         * object.h (Object::get_view): Add aligned parameter.  Change all
15841         callers.
15842         (Object::get_lasting_view): Likewise.
15843
15844         * fileread.cc (File_read::release): Don't call clear_views if
15845         there are multiple objects.
15846         * fileread.h (File_read::clear_uncached_views): New function.
15847         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15848         on the archive.
15849
15850 2008-03-31  Cary Coutant  <ccoutant@google.com>
15851
15852         Add thin archive support.
15853         * archive.cc (Archive::armagt): New const.
15854         (Archive::setup): Remove task parameter and calls to unlock.
15855         (Archive::unlock_nested_archives): New function.
15856         (Archive::read_header): Add nested_off parameter. Change
15857         all callers.
15858         (Archive::interpret_header): Likewise.
15859         (Archive::include_all_members): Change to handle thin
15860         archives.
15861         (Archive::include_member): Likewise.
15862         * archive.h (Archive::Archive): Add new parameters and
15863         initializers.
15864         (Archive::armagt): New const.
15865         (Archive::setup): Remove task parameter.
15866         (Archive::unlock_nested_archives): New function.
15867         (Archive::read_header): Add nested_off parameter.
15868         (Archive::interpret_header): Likewise.
15869         (Archive::Nested_archive_table): New typedef.
15870         (Archive::is_thin_archive_): New field.
15871         (Archive::nested_archives_): New field.
15872         (Archive::options_): New field.
15873         (Archive::dirpath_): New field.
15874         (Archive::task_): New field.
15875         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15876         for thin archives.  Pass additional parameters to
15877         Archive::Archive.  Unlock the archive file after calling
15878         Archive::setup.
15879
15880 2008-03-29  Ian Lance Taylor  <iant@google.com>
15881
15882         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15883         version symbol to be local.
15884         * testsuite/ver_test_4.sh: New file.
15885         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15886         (check_DATA): Add ver_test_4.syms.
15887         (ver_test_4.syms): New target.
15888         * testsuite/Makefile.in: Rebuild.
15889
15890         * output.cc
15891         (Output_section::Input_section_sort_entry::has_priority): New
15892         function.
15893         (Output_section::Input_section_sort_entry::match_file_name): New
15894         function.
15895         (Output_section::Input_section_sort_entry::match_section_name):
15896         Remove.
15897         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15898         Remove.
15899         (Output_section::Input_section_sort_entry::match_section_file):
15900         Remove.
15901         (Output_section::Input_section_sort_compare::operator()): Rewrite
15902         using new Input_section_sort_entry functions.  Sort crtbegin and
15903         crtend first.  Sort sections with no priority before sections with
15904         a priority.
15905         * testsuite/initpri1.c (d3): Check j != 4.
15906         (cd5): New constructor/destructor function.
15907         (main): Check j != 2.
15908
15909         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15910         new symbol when resolving, don't call set_is_default.
15911         * testsuite/ver_test_7.cc: New file.
15912         * testsuite/ver_test_7.sh: New file.
15913         * testsuite/Makefile.am (ver_test_7.so): New target.
15914         (ver_test_7.o): New target.
15915         (check_SCRIPTS): Add ver_test_7.sh.
15916         (check_DATA): Add ver_test_7.syms.
15917         (ver_test_7.syms): New target.
15918
15919 2008-03-28  Ian Lance Taylor  <iant@google.com>
15920
15921         * layout.cc (Layout::layout): If we see an input section with a
15922         name that needs sorting, set the must_sort flag for the output
15923         section.
15924         (Layout::make_output_section): If the name of the output section
15925         indicates that it might require sorting, set the may_sort flag.
15926         * output.h (Output_section::may_sort_attached_input_sections): New
15927         function.
15928         (Output_section::set_may_sort_attached_input_sections): New
15929         function.
15930         (Output_section::must_sort_attached_input_sections): New
15931         function.
15932         (Output_section::set_must_sort_attached_input_sections): New
15933         function.
15934         (class Output_section): Declare Input_section_sort_entry.  Define
15935         Input_section_sort_compare.  Declare
15936         sort_attached_input_sections.  Add new fields:
15937         may_sort_attached_input_sections_,
15938         must_sort_attached_input_sections_,
15939         attached_input_sections_are_sorted_.
15940         * output.cc (Output_section::Output_section): Initialize new
15941         fields.
15942         (Output_section::add_input_section): Add an entry to
15943         input_sections_ if may_sort or must_sort are true.
15944         (Output_section::set_final_data_size): Call
15945         sort_attached_input_sections if necessary.
15946         (Output_section::Input_section_sort_entry): Define new class.
15947         (Output_section::Input_section_sort_compare::operator()): New
15948         function.
15949         (Output_section::sort_attached_input_sections): New function.
15950         * configure.ac: Check whether the compiler supports constructor
15951         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15952         * testsuite/initpri1.c: New file.
15953         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15954         CONSTRUCTOR_PRIORITY.
15955         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15956         (initpri1_LDFLAGS): New variable.
15957         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15958
15959 2008-03-27  Ian Lance Taylor  <iant@google.com>
15960
15961         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15962         * testsuite/common_test_1.c: New file.
15963         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15964         (common_test_1_SOURCES): New variable.
15965         (common_test_1_DEPENDENCIES): New variable.
15966         (common_test_1_LDFLAGS): New variable.
15967
15968         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15969         and commons_ correctly when NAME/VERSION does not override
15970         NAME/NULL.
15971         * testsuite/ver_test_6.c: New file.
15972         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15973         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15974         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15975
15976 2008-03-26  Ian Lance Taylor  <iant@google.com>
15977
15978         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15979         of an undefined symbol from a version script.
15980         * testsuite/Makefile.am (ver_test_5.so): New target.
15981         (ver_test_5.o): New target.
15982         (check_SCRIPTS): Add ver_test_5.sh.
15983         (check_DATA): Add ver_test_5.syms.
15984         (ver_test_5.syms): New target.
15985         * testsuite/ver_test_5.cc: New file.
15986         * testsuite/ver_test_5.script: New file.
15987         * testsuite/ver_test_5.sh: New file.
15988         * Makefile.in, testsuite/Makefile.in: Rebuild.
15989
15990         PR gold/5986
15991         Fix problems building gold with gcc 4.3.0.
15992         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15993         (gold_error_at_location, gold_warning_at_location): Use it.
15994         * configure.ac: Check whether we can compile and use a template
15995         function with a printf attribute.
15996         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15997         when jumping over bytes.
15998         * object.cc: Instantiate Object::read_section_data.
15999         * debug.h: Include <cstring>
16000         * dwarf_reader.cc: Include <algorithm>
16001         * main.cc: Include <cstring>.
16002         * options.cc: Include <cstring>.
16003         * output.cc: Include <cstring>.
16004         * script.cc: Include <cstring>.
16005         * script.h: Include <string>.
16006         * symtab.cc: Include <cstring> and <algorithm>.
16007         * target-select.cc: Include <cstring>.
16008         * version.cc: Include <string>.
16009         * testsuite/testmain.cc: Include <cstdlib>.
16010         * configure, config.in: Rebuild.
16011
16012 2008-03-25  Ian Lance Taylor  <iant@google.com>
16013
16014         * options.cc: Include "../bfd/bfdver.h".
16015         (options::help): Print bug reporting address.
16016
16017         * version.cc (print_version): Adjust output for current value of
16018         BFD_VERSION_STRING.
16019
16020         * NEWS: New file.
16021
16022         * options.cc (options::help): Print list of supported targets.
16023         * target-select.h: Include <vector>.
16024         (class Target_selector): Make machine_, size_, and is_big_endian_
16025         fields const.  Add bfd_name_ and instantiated_target_ fields.
16026         (Target_selector::Target_selector): Add bfd_name parameter.
16027         (Target_selector::recognize): Make non-virtual, call
16028         do_recognize.
16029         (Target_selector::recognize_by_name): Make non-virtual, call
16030         do_recognize_by_name.
16031         (Target_selector::supported_names): New function.
16032         (Target_selector::bfd_name): New function.
16033         (Target_selector::do_instantiate_target): New pure virtual
16034         function.
16035         (Target_selector::do_recognize): New virtual function.
16036         (Target_selector::do_recognize_by_name): New virtual function.
16037         (Target_selector::instantiate_target): New private function.
16038         (supported_target_names): Declare.
16039         * target-select.cc (Target_selector::Target_selector): Update for
16040         new parameter and fields.
16041         (select_target_by_name): Check that the name matches before
16042         calling recognize_by_name.
16043         (supported_target_names): New function.
16044         * i386.cc (class Target_selector_i386): Update Target_selector
16045         constructor call.  Remove recognize and recognize_by_name.  Add
16046         do_instantiate_target.
16047         * x86_64.cc (class Target_selector_x86_64): Likewise.
16048         * testsuite/testfile.cc (class Target_selector_test): Update for
16049         changes to Target_selector.
16050
16051         * README: Rewrite, with some notes on unsupported features.
16052
16053 2008-03-24  Cary Coutant  <ccoutant@google.com>
16054
16055         * i386.cc (Target_i386::Got_type): New enum declaration.
16056         (Target_i386::Scan::local): Updated callers of Output_data_got
16057         member functions.
16058         (Target_i386::Scan::global): Likewise.
16059         (Target_i386::Relocate::relocate): Likewise.
16060         (Target_i386::Relocate::relocate_tls): Likewise.
16061         * object.h (Got_offset_list): New class.
16062         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16063         (Sized_relobj::local_got_offset): Likewise.
16064         (Sized_relobj::set_local_got_offset): Likewise.
16065         (Sized_relobj::local_has_tls_got_offset): Removed.
16066         (Sized_relobj::local_tls_got_offset): Removed.
16067         (Sized_relobj::set_local_tls_got_offset): Removed.
16068         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16069         * output.cc (Output_data_got::add_global): Added got_type parameter.
16070         (Output_data_got::add_global_with_rel): Likewise.
16071         (Output_data_got::add_global_with_rela): Likewise.
16072         (Output_data_got::add_global_pair_with_rel): New function.
16073         (Output_data_got::add_global_pair_with_rela): New function.
16074         (Output_data_got::add_local): Added got_type parameter.
16075         (Output_data_got::add_local_with_rel): Likewise.
16076         (Output_data_got::add_local_with_rela): Likewise.
16077         (Output_data_got::add_local_pair_with_rel): New function.
16078         (Output_data_got::add_local_pair_with_rela): New function.
16079         (Output_data_got::add_global_tls): Removed.
16080         (Output_data_got::add_global_tls_with_rel): Removed.
16081         (Output_data_got::add_global_tls_with_rela): Removed.
16082         (Output_data_got::add_local_tls): Removed.
16083         (Output_data_got::add_local_tls_with_rel): Removed.
16084         (Output_data_got::add_local_tls_with_rela): Removed.
16085         * output.h (Output_data_got::add_global): Added got_type parameter.
16086         (Output_data_got::add_global_with_rel): Likewise.
16087         (Output_data_got::add_global_with_rela): Likewise.
16088         (Output_data_got::add_global_pair_with_rel): New function.
16089         (Output_data_got::add_global_pair_with_rela): New function.
16090         (Output_data_got::add_local): Added got_type parameter.
16091         (Output_data_got::add_local_with_rel): Likewise.
16092         (Output_data_got::add_local_with_rela): Likewise.
16093         (Output_data_got::add_local_pair_with_rel): New function.
16094         (Output_data_got::add_local_pair_with_rela): New function.
16095         (Output_data_got::add_global_tls): Removed.
16096         (Output_data_got::add_global_tls_with_rel): Removed.
16097         (Output_data_got::add_global_tls_with_rela): Removed.
16098         (Output_data_got::add_local_tls): Removed.
16099         (Output_data_got::add_local_tls_with_rel): Removed.
16100         (Output_data_got::add_local_tls_with_rela): Removed.
16101         * resolve.cc (Symbol::override_base_with_special): Removed
16102         reference to has_got_offset_ field.
16103         * symtab.cc (Symbol::init_fields): Replaced initialization
16104         of got_offset_ with got_offsets_.  Removed initialization
16105         of has_got_offset_
16106         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16107         (Symbol::got_offset): Likewise.
16108         (Symbol::set_got_offset): Likewise.
16109         (Symbol::has_tls_got_offset): Removed.
16110         (Symbol::tls_got_offset): Removed.
16111         (Symbol::set_tls_got_offset): Removed.
16112         (Symbol::got_offset_): Removed.
16113         (Symbol::tls_mod_got_offset_): Removed.
16114         (Symbol::tls_pair_got_offset_): Removed.
16115         (Symbol::got_offsets_): New field.
16116         (Symbol::has_got_offset): Removed.
16117         (Symbol::has_tls_mod_got_offset): Removed.
16118         (Symbol::has_tls_pair_got_offset): Removed.
16119         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16120         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16121         member functions.
16122         (Target_x86_64::Scan::global): Likewise.
16123         (Target_x86_64::Relocate::relocate): Likewise.
16124         (Target_x86_64::Relocate::relocate_tls): Likewise.
16125
16126 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16127
16128         * yyscript.y: Fix spelling error in comment.
16129
16130 2008-03-24  Ian Lance Taylor  <iant@google.com>
16131
16132         * options.h (class General_options): Define build_id option.
16133         * layout.h (class Layout): Declare write_build_id, create_note,
16134         create_build_id.  Add build_id_note_ member.
16135         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16136         "libiberty.h", "md5.h", "sha1.h".
16137         (Layout::Layout): Initialize eh_frame_data_,
16138         eh_frame_hdr_section_, and build_id_note_.
16139         (Layout::finalize): Call create_build_id.
16140         (Layout::create_note): New function, broken out of
16141         Layout::create_gold_note.
16142         (Layout::create_gold_note): Call create_note.
16143         (Layout::create_build_id): New function.
16144         (Layout::write_build_id): New function.
16145         (Close_task_runner::run): Call write_build_id.
16146
16147         * x86_64.cc: Correct license to GPLv3.
16148
16149 2008-03-23  Ian Lance Taylor  <iant@google.com>
16150
16151         * options.cc: Include "demangle.h".
16152         (parse_optional_string): New function.
16153         (parse_long_option): Handle takes_optional_argument.
16154         (parse_short_option): Update dash_z initializer.  Handle
16155         takes_optional_argument.
16156         (General_options::General_options): Initialize do_demangle_.
16157         (General_options::finalize): Set do_demangle_.  Handle demangling
16158         style.
16159         * options.h (parse_optional_string): Declare.
16160         (struct One_option): Add optional_arg field.  Update constructor.
16161         Update call constructor calls.  Add takes_optional_argument
16162         function.
16163         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16164         (DEFINE_optional_string): Define.
16165         (General_options::demangle): Change from DEFINE_bool to
16166         DEFINE_optional_string.
16167         (General_options::no_demangle): New function.
16168         (General_options::do_demangle): New function.
16169         (General_options::set_do_demangle): New function.
16170         (General_options::execstack_status_): Move definition to end of
16171         class definition.
16172         (General_options::static_): Likewise.
16173         (General_options::do_demangle_): New field.
16174         * object.cc (big_endian>::get_symbol_location_info): Call
16175         Options::do_demangle, not Options::demangle.
16176         * symtab.cc (demangle): Likewise.
16177
16178 2008-03-22  Ian Lance Taylor  <iant@google.com>
16179
16180         * gold.h: Include <cstddef> and <sys/types.h>
16181         * options.h: Include <cstring>.
16182
16183 2008-03-21  Ian Lance Taylor  <iant@google.com>
16184
16185         * Added source code to GNU binutils.
16186 \f
16187 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16188
16189 Copying and distribution of this file, with or without modification,
16190 are permitted in any medium without royalty provided the copyright
16191 notice and this notice are preserved.
16192
16193 Local Variables:
16194 mode: change-log
16195 left-margin: 8
16196 fill-column: 74
16197 version-control: never
16198 End: