Fix race condition causing assert in Eh_frame_hdr::do_sized_write().
[external/binutils.git] / gold / ChangeLog
1 2014-09-23  Taiju Tsuiki  <tzik@google.com>
2             Cary Coutant  <ccoutant@google.com>
3
4         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
5         on input_sections_blocker.
6         * layout.cc (Write_sections_task::locks): Unblock
7         input_sections_blocker_.
8         * layout.h (Write_sections_task::Write_sections_task): Add
9         input_sections_blocker.
10         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
11         to DEPENDENCIES.
12         * testsuite/Makefile.in: Regenerate.
13
14 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
15
16         * testsuite/Makefile.am (plugin_test_10): New test.
17         * testsuite/Makefile.in: Regenerate
18         * testsuite/plugin_common_test_2.c (c1): Align to 8.
19         * testsuite/plugin_test_10.sh: New file.
20
21 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
22
23         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
24         * resolve.cc (Symbol_table::resolve): Don't override common symbols
25         during the replacement phase.
26
27 2014-09-17  Han Shen  <shenhan@google.com>
28             Jing Yu  <jingyu@google.com>
29
30         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
31         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
32         * aarch64.cc (Target_aarch64): Add data members
33         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
34         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
35         constructor.
36         (Target_aarch64::do_reloc_symbol_index): New method.
37         (Target_aarch64::do_reloc_addend): New method.
38         (Target_aarch64::add_tlsdesc_info): New method.
39         (Target_aarch64::do_dynsym_value): New method.
40         (Target_aarch64::do_make_data_plt): Add new parameters: got,
41         got_irelative. Pass them to Output_data_plt_aarch64_standard.
42         (Target_aarch64::make_data_plt): Add new parameters: got,
43         got_irelative. Pass them to do_make_data_plt.
44         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
45         (Target_aarch64::Relocate:tls_gd_to_le): New method.
46         (Target_aarch64::Relocate:tls_ie_to_le): New method.
47         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
48         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
49         (Target_aarch64::got_tlsdesc_section): New method.
50         (Target_aarch64::make_local_ifunc_plt_entry): New method.
51         (Target_aarch64::define_tls_base_symbol): New method.
52         (Target_aarch64::reserve_tlsdesc_entries): New method.
53         (Target_aarch64::got_mod_index_entry): New method.
54         (Target_aarch64::rela_tlsdesc_section): New method.
55         (Target_aarch64::rela_irelative_section): New method.
56         (Target_aarch64::Tlsdesc_info): New struct.
57         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
58         relocations and tlsdesc relocations.
59         (Target_aarch64::optimize_tls_reloc): Implement method.
60         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
61         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
62         in constructor.
63         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
64         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
65         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
66         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
67         (Output_data_plt_aarch64::rela_tlsdesc): New method.
68         (Output_data_plt_aarch64::rela_irelative): New method.
69         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
70         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
71         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
72         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
73         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
74         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
75         (Output_data_plt_aarch64_standard): New member variables:
76         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
77         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
78         New parameter: got, got_irelative.
79         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
80         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
81         (Output_data_plt_aarch64::do_write): Replace got_address with
82         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
83         (AArch64_relocate_functions::update_movnz): New method.
84         (AArch64_relocate_functions): Correct format.
85         (AArch64_relocate_functions::movnz): New method.
86         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
87         before the switch. Add new cases to switch.
88         Check ie_to_le relaxation on tlsie relocations. Add code handling 
89         tlsgd tlsdesc cases.
90         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
91         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
92         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
93         Call reloc_name_in_error_message to print unsupported reloc.
94         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
95         make_data_plt.
96         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
97         relocs. Fill in some more dynamic tags.
98         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
99         Skip call tls_get_addr when tlsgd is relaxed.
100         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
101         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
102         tlsdesc->ie relaxation.
103
104 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
105
106         * mips.cc (Target_mips_nacl): New class.
107         (Target_selector_mips_nacl): New class.
108         (target_selector_mips32): Rename from target_selector_mips32be and use
109         Target_selector_mips_nacl instead of Target_selector_mips.
110         (target_selector_mips32el): Rename from target_selector_mips32 and use
111         Target_selector_mips_nacl instead of Target_selector_mips.
112         (target_selector_mips64): Rename from target_selector_mips64be and use
113         Target_selector_mips_nacl instead of Target_selector_mips.
114         (target_selector_mips64el): Rename from target_selector_mips64 and use
115         Target_selector_mips_nacl instead of Target_selector_mips.
116         (Target_mips::mips_info): Add const attribute.
117
118 2014-09-02  Cary Coutant  <ccoutant@google.com>
119
120         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
121         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
122         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
123         (Sized_incr_dynobj::do_section_name): Likewise.
124         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
125         (Sized_incr_dynobj::do_section_name): Likewise.
126         * object.h (Object::section_name): Likewise.
127         (Object::do_section_name): Likewise.
128         (Sized_relobj_file::do_section_name): Likewise.
129         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
130         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
131
132 2014-09-02  Cary Coutant  <ccoutant@google.com>
133
134         PR gold/17005
135         * ehframe.cc (Fde::write): Add output_offset parameter.
136         (Cie::write): Likewise.
137         (Eh_frame::set_final_data_size): Account for offset within output
138         section.
139         (Eh_frame::do_sized_write): Likewise.
140         * ehframe.h (Fde::write): Add output_offset parameter.
141         (Cie::write): Likewise.
142         * output.cc (Output_section::Input_section_sort_entry): Remove
143         section_has_name_; add output_section_name parameter. Use
144         output section name for non-input sections.
145         (Output_section::Input_section_sort_entry::section_has_name): Remove.
146         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
147         (Output_section::Input_section_sort_compare): Remove logic for
148         sections without names.
149         (Output_section::Input_section_sort_init_fini_compare): Likewise.
150         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
151         Likewise.
152         (Output_section::Input_section_sort_section_name_compare): Likewise.
153
154 2014-08-29 Han Shen <shenhan@google.com>
155            Jing Yu <jingyu@google.com>
156
157         * aarch64-reloc-property.cc
158         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
159         reference reloc property in the table.
160         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
161         3 other entries.
162         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
163         2 new overloaded methods.
164         (Output_data_got_aarch64::do_write): Add code to write out
165         static relocs.
166         (class Output_data_got_aarch64::Static_reloc): New class to wrap
167         static relocs.
168         (Output_data_got_aarch64::static_relocs): New vector to
169         hold static relocs.
170         (Target_aarch64::TCB_SIZE): New const static memeber.
171         (Target_aarch64::tcb_size): New method.
172         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
173         (Target_aarch64::Relocate::relocate_tls): New method.
174         (Target_aarch64::Scan::local): Add code handling new reloc types.
175         (Target_aarch64::Scan::global): Add code handling new reloc types.
176
177 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
178
179         * options.h (-no-pie): Add option.
180
181 2014-08-08  Jing Yu  <jingyu@google.com>
182             Han Shen  <shenhan@google.com>
183
184         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
185         (DEFFILES): add aarch64-reloc.def.
186         (TARGETSOURCES): Add aarch64-reloc-property.cc.
187         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
188         * Makefile.in: Regenerate.
189         * aarch64-reloc-property.cc: New file.
190         * aarch64-reloc-property.h: New file.
191         * aarch64-reloc.def: New file.
192         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
193         with tab to make the format consistent.
194         (Output_data_got_aarch64::symbol_table_): New method.
195         (Target_aarch64::do_plt_address_for_global): New method.
196         (Target_aarch64::do_plt_address_for_local): New method.
197         (Target_aarch64::do_select_as_default_target): New method.
198         (Target_aarch64::do_make_data_plt): New method.
199         (Target_aarch64::make_data_plt): New method.
200         (Output_data_plt_aarch64::has_irelative_section): New method.
201         (Output_data_plt_aarch64::address_for_global): New method.
202         (Output_data_plt_aarch64::address_for_local): New method.
203         (Output_data_plt_aarch64::irelative_rel_): New parameter.
204         (Output_data_plt_aarch64::add_entry): Implement contents.
205         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
206         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
207         the got_pov entry to plt0.
208         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
209         Implement contents.
210         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
211         (AArch64_howto): New struct.
212         (aarch64_howto[]): New static const array.
213         (AArch64_relocate_functions): New class.
214         (Target_aarch64::Scan::get_reference_flags): Remove method.
215         (Target_aarch64::Scan::local): Implement to support a few relocations.
216         (Target_aarch64::Scan::global): Implement to support a few relocations.
217         (Target_aarch64::make_plt_section): Implement contents.
218         (Target_aarch64::make_plt_entry): Implement contents.
219         (Target_aarch64::do_finalize_sections): Implement contents.
220         (Target_aarch64::Relocate::relocate): Implement a few relocations.
221         (Target_aarch64::relocate_section): Implement contents.
222
223 2014-08-06  Alan Modra  <amodra@gmail.com>
224
225         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
226
227 2014-08-06  Alan Modra  <amodra@gmail.com>
228
229         PR 13227
230         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
231
232 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
233
234         * object.cc (Relobj::is_section_name_included): Add
235         ".rodata.nptl_version" to not garbage collect this section.
236
237 2014-07-08  Cary Coutant  <ccoutant@google.com>
238
239         * expression.cc (struct Expression::Expression_eval_info): Add
240         new fields type_pointer, vis_pointer, and nonvis_pointer.
241         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
242         nonvis_pointer parameters. Adjust all calls.
243         (Symbol_expression::value): Update type, visibility, and nonvis bits
244         in caller.
245         * script.cc (Symbol_assignment::sized_finalize): Update type,
246         visibility, and remaining st_other bits for new symbol.
247         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
248         vis_pointer, and nonvis_pointer parameters.
249         * symtab.h (Symbol::set_type): New method.
250
251         * testsuite/Makefile.am (defsym_test): New test.
252         * testsuite/Makefile.in: Regenerate.
253         * testsuite/defsym_test.c: New file.
254         * testsuite/defsym_test.sh: New file.
255
256 2014-07-08  Cary Coutant  <ccoutant@google.com>
257
258         PR gold/15639
259         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
260         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
261         (Sized_dynobj::base_read_symbols): ...new method.
262         * object.h (Sized_relobj_file::base_read_symbols): New method.
263         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
264         (Sized_relobj_file::base_read_symbols): ...new method.
265         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
266         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
267         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
268
269 2014-07-04  Alan Modra  <amodra@gmail.com>
270
271         * po/POTFILES.in: Regenerate.
272
273 2014-07-02  Jing Yu  <jingyu@google.com>
274
275         * aarch64.cc: New file
276         * Makefile.am (TARGETSOURCES): Add aarch64.cc
277         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
278         * Makefile.in: Regenerate.
279         * configure.tgt: Add entries for aarch64*.
280         * configure.ac:  Likewise.
281         * configure: Likewise.
282
283 2014-06-27  Alan Modra  <amodra@gmail.com>
284
285         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
286
287 2014-06-24  Cary Coutant  <ccoutant@google.com>
288
289         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
290         sections.
291         (Dwo_file::sized_read_unit_index): Likewise.
292
293 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
294
295         * mips.cc: New file.
296         * Makefile.am (TARGETSOURCES): Add mips.cc
297         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
298         * configure.tgt: Add entries for mips*.
299         * configure.ac: Likewise.
300         * Makefile.in: Regenerate.
301         * configure: Likewise.
302
303 2014-06-09  Cary Coutant  <ccoutant@google.com>
304
305         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
306         unit_length is within section bounds.
307
308 2014-06-09  Cary Coutant  <ccoutant@google.com>
309
310         PR gold/16980
311         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
312         map.
313
314 2014-06-07  Alan Modra  <amodra@gmail.com>
315
316         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
317
318 2014-06-06  Cary Coutant  <ccoutant@google.com>
319
320         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
321         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
322         (Dwarf_pubnames_table::read_header): Likewise.
323         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
324         .debug_gnu_pubtypes.
325
326 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
327
328         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
329         * Makefile.in, configure: Regenerate.
330
331 2014-06-03  Alan Modra  <amodra@gmail.com>
332
333         * powerpc.cc (addis_12_2): Define.
334         (Stub_table::do_write): Support fusion on ELFv2 stubs.
335
336 2014-06-03  Alan Modra  <amodra@gmail.com>
337
338         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
339         st_other output.
340
341 2014-06-02  Alan Modra  <amodra@gmail.com>
342
343         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
344         Only ignore relocs on ELFv1.
345         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
346
347 2014-05-30  Cary Coutant  <ccoutant@google.com>
348
349         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
350         * testsuite/Makefile.in: Regenerate.
351         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
352
353 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
354
355         PR gold/16945
356         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
357         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
358
359 2014-05-15  Alan Modra  <amodra@gmail.com>
360
361         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
362         Compare FDE contents with DW_CFA_nop rather than 0.
363
364 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
365
366         * symtab.h (may_need_copy_reloc): Remove check for position independent
367         code.
368         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
369         position independence before pc absolute may_need_copy_reloc call.
370         Add check for executable output befor pc relative may_need_copy_reloc
371         call.
372         * i386.cc: Ditto.
373         * arm.cc: Ditto.
374         * sparc.cc: Ditto.
375         * tilegx.cc: Ditto.
376         * powerpc.cc: Add check for no position independence before
377         may_need_copy_reloc calls.
378         * testsuite/pie_copyrelocs_test.cc: New file.
379         * testsuite/pie_copyrelocs_shared_test.cc: New file.
380         * Makefile.am (pie_copyrelocs_test): New test.
381         * Makefile.in: Regenerate.
382
383 2014-05-08  Martin Liška  <mliska@suse.cz>
384
385         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
386
387 2014-05-06  Cary Coutant  <ccoutant@google.com>
388
389         PR gold/16900
390         * i386.cc (Output_data_got_plt_i386): New class.
391         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
392         parameter. Change all callers.
393         (Output_data_plt_i386::layout_): Remove.
394         (Output_data_plt_i386::got_plt_): Change type.
395         (Target_i386::got_plt_): Change type. Change all references.
396         (Target_i386::got_section): Create instance of new class.
397         (Output_data_got_plt_i386::do_write): New function.
398         * x86_64.cc (Output_data_got_plt_x86_64): New class.
399         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
400         parameter. Change all callers.
401         (Output_data_plt_x86_64::layout_): Remove.
402         (Output_data_plt_x86_64::got_plt_): Change type.
403         (Target_x86_64::got_plt_): Change type. Change all references.
404         (Target_x86_64::got_section): Create instance of new class.
405         (Output_data_got_plt_x86_64::do_write): New function.
406         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
407         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
408         class.
409
410 2014-05-05  Cary Coutant  <ccoutant@google.com>
411
412         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
413         if we have pubnames/pubtypes.
414
415 2014-05-02  Cary Coutant  <ccoutant@google.com>
416
417         * defstd.cc (in_segment): Define __ehdr_start here...
418         * layout.cc (Layout::finalize): ...Instead of here.  Set the
419         output segment when known.
420         * resolve.cc (Symbol::override_base_with_special): Remember
421         the original binding.
422         * symtab.cc (Symbol::set_output_segment): New function.
423         (Symbol::set_undefined): New function.
424         * symtab.h (Symbol::is_weak_undefined): Check original undef
425         binding.
426         (Symbol::is_strong_undefined): New function.
427         (Symbol::set_output_segment): New function.
428         (Symbol::set_undefined): New function.
429         * target-reloc.h (is_strong_undefined): Remove.
430         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
431         Check for hidden undefs.
432         (relocate_section): Call Symbol::is_strong_undefined.
433
434         * testsuite/Makefile.am (ehdr_start_test_1)
435         (ehdr_start_test_2, ehdr_start_test_3)
436         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
437         * testsuite/Makefile.in: Regenerate.
438         * testsuite/ehdr_start_def.cc: New source file.
439         * testsuite/ehdr_start_test.cc: New source file.
440         * testsuite/ehdr_start_test.t: New linker script.
441         * testsuite/ehdr_start_test_4.sh: New shell script.
442
443 2014-04-23  Cary Coutant  <ccoutant@google.com>
444
445         PR gold/16870
446         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
447
448 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
449
450         * layout.cc (Layout::include_section): Allow a target to decide
451         whether to include a section.
452         * target.h (Target::should_include_section): New function.
453         (Target::do_should_include_section): New function.
454
455 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
456
457         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
458         inline into ...
459         (Copy_relocs::emit): ... here.
460         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
461         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
462         (Copy_reloc_entry::entries_): Change from private to protected.
463
464 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
465
466         * icf.cc (get_section_contents): Replace copies of reloc
467         vectors with const references.
468
469 2014-04-02  Cary Coutant  <ccoutant@google.com>
470
471         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
472         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
473         * configure: Regenerate.
474         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
475         -fno-use-linker-plugin.
476         (LINK1, CXXLINK1): Add it to the link command.
477         * testsuite/Makefile.in: Regenerate.
478
479 2014-03-12  Alan Modra  <amodra@gmail.com>
480
481         * Makefile.in: Regenerate.
482
483 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
484
485         * symtab.h (Symbol::set_nonvis): New function.
486
487 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
488
489         * symtab.cc (Sized_symbol<32>::init_output_data):
490         Instantiate the template.
491         (Sized_symbol<64>::init_output_data): Likewise.
492
493 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
494
495         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
496         adjust dynamic symbol value.
497         * target.h (Target::adjust_dyn_symbol): New function.
498         (Target::do_adjust_dyn_symbol): New function.
499
500 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
501
502         * output.cc (Output_data_dynamic::Dynamic_entry::write):
503         Get the value of DYNAMIC_CUSTOM dynamic entry.
504         * output.h (Output_data_dynamic::add_custom): New function.
505         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
506         dynamic entry.
507         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
508         * target.h (Target::dynamic_tag_custom_value): New function.
509         (Target::do_dynamic_tag_custom_value): New function.
510
511 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
512
513         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
514         dynsym indexes.
515         * target.h (Target::has_custom_set_dynsym_indexes): New function.
516         (Target::do_has_custom_set_dynsym_indexes): New function.
517         (Target::set_dynsym_indexes): New function.
518         (Target::do_set_dynsym_indexes): New function.
519
520 2014-03-07  Alan Modra  <amodra@gmail.com>
521
522         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
523         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
524         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
525         (Powerpc_relocate_functions::has_overflow_bitfield,
526         overflowed): Use the above.
527         (Target_powerpc::Relocate::relocate): Correct overflow checking
528         for a number of relocations.  Modify overflow test for 16-bit
529         fields in instructions to signed/unsigned according to whether
530         the field takes a signed or unsigned value.
531
532 2014-03-05  Alan Modra  <amodra@gmail.com>
533
534         Update copyright years.
535
536 2014-03-05  Alan Modra  <amodra@gmail.com>
537
538         * powerpc.cc (Target_powerpc::Scan::local, global): Support
539         R_PPC64_ADDR64_LOCAL.
540         (Target_powerpc::Relocate::relocate): Likewise.
541
542 2014-03-03  Alan Modra  <amodra@gmail.com>
543
544         * dwp.cc (print_version): Update copyright year to current.
545
546 2014-02-10  Alan Modra  <amodra@gmail.com>
547
548         * po/gold.pot: Regenerate.
549
550 2014-02-06  Cary Coutant  <ccoutant@google.com>
551
552         Fix problem where -u is ignored when a weak undef is seen.
553
554         * archive.cc (Library_base::should_include_member): Reorder
555         code to check for -u option if a weak undef has already been seen.
556         * testsuite/Makefile.am (weak_undef_test_2): New test case.
557         * testsuite/Makefile.in: Regenerate.
558         * testsuite/weak_undef_file3.cc: New file.
559         * testsuite/weak_undef_file4.cc: New file.
560         * testsuite/weak_undef_test_2.cc: New file.
561
562 2014-02-05  Cary Coutant  <ccoutant@google.com>
563
564         Fix issues with gold undefined symbol diagnostics.
565
566         PR binutils/15435
567         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
568         check to here.
569         * target-reloc.h (is_strong_undefined): New function.
570         (relocate_section): Move undef vtable symbol check from here.
571         Check for is_strong_undefined.
572
573 2014-02-05  Cary Coutant  <ccoutant@google.com>
574
575         Fix problems with the --dynamic-list option.
576
577         PR gold/13577
578         * options.cc (General_options::parse_dynamic_list):
579         Set have_dynamic_list_.
580         (General_options::General_options): Initialize have_dynamic_list_.
581         (General_options::finalize): Turn off -Bsymbolic and
582         -Bsymbolic-functions if --dynamic-list provided.
583         * options.h (General_options::have_dynamic_list): New function.
584         (General_options::have_dynamic_list_): New data member.
585         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
586         correctly.
587
588         PR gold/16530
589         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
590         in --dynamic-list, mark it.
591
592         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
593         (dynamic_list_2): New test case.
594         * testsuite/Makefile.in: Regenerate.
595         * testsuite/dynamic_list_2.cc: New file.
596         * testsuite/dynamic_list_2.t: New file.
597         * testsuite/dynamic_list_lib1.cc: New file.
598         * testsuite/dynamic_list_lib2.cc: New file.
599         * testsuite/gc_dynamic_list_test.c: New file.
600         * testsuite/gc_dynamic_list_test.sh: New file.
601         * testsuite/gc_dynamic_list_test.t: New file.
602
603 2014-01-28  Cary Coutant  <ccoutant@google.com>
604
605         Add .gdb_index version 7 support.
606
607         * gold/dwarf_reader.cc: include <utility> (for make_pair).
608         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
609         debug sections.
610         (Dwarf_ranges_table::read_ranges_table): Likewise.
611         (Dwarf_pubnames_table::read_section): Check for GNU-style
612         sections, and for compressed debug sections.
613         (Dwarf_pubnames_table::read_header): Compute end address of table.
614         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
615         for end of list by offset, not by offset == 0.
616         (Dwarf_info_reader::do_read_string_table): Check for compressed
617         debug sections.
618         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
619         Initialize new data members.
620         (Dwarf_pubnames_table::next_name): return flag_byte.
621         (Dwarf_pubnames_table::end_of_table_): New data member.
622         (Dwarf_pubnames_table::is_gnu_style_): New data member.
623         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
624         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
625         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
626         read skeleton type unit DIEs.
627         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
628         (Gdb_index::do_write): Write flag_byte.
629         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
630         (Gdb_index::Cu_vector): Store flags along with cu indexes.
631         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
632         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
633
634 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
635
636         * version.cc (print_version): Update copyright year to 2014.
637
638 2013-12-19  Dimitry Andric  <dimitry@andric.com>
639
640         * stringpool.cc (Stringpool_template::reserve): Add
641         HAVE_UNORDERED_MAP case.
642         * stringpool.cc (Stringpool_template::print_stats): Likewise.
643
644 2013-12-18  Cary Coutant  <ccoutant@google.com>
645
646         * configure.ac: Check for <unordered_set> and <unordered_map>.
647         * config.in: Regenerate.
648         * configure: Regenerate.
649         * system.h: Use <unordered_set> and <unordered_map> if available.
650
651 2013-12-10  Roland McGrath  <mcgrathr@google.com>
652
653         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
654         with $(INSTALL_PROGRAM_ENV).
655         * Makefile.in: Regenerate.
656
657 2013-11-22  Cary Coutant  <ccoutant@google.com>
658
659         * configure.ac: Add check for which library is needed for
660         dlopen.
661         * configure: Regenerate.
662
663 2013-11-22  Cary Coutant  <ccoutant@google.com>
664
665         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
666         assembler.
667         * testsuite/Makefile.in: Regenerate.
668
669 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
670
671         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
672         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
673         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
674         (Target_x86_64<size>::Scan::local): Likewise.
675         (Target_x86_64<size>::Scan::global): Likewise.
676         (Target_x86_64<size>::Relocate::relocate): Likewise.
677         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
678         Likewise.
679         (Target_x86_64<size>::Scan::check_non_pic(): Handle
680         R_X86_64_PC32_BND.
681
682         * testsuite/Makefile.am (check_PROGRAMS): Add
683         exception_x86_64_bnd_test.
684         (exception_x86_64_bnd_test_SOURCES): New macro.
685         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
686         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
687         (exception_x86_64_bnd_test_LDADD): Likewise.
688         (exception_x86_64_bnd_1.o): New rule.
689         (exception_x86_64_bnd_2.o): Likewise.
690         * testsuite/Makefile.in: Regenerated.
691
692 2013-11-15  Alan Modra  <amodra@gmail.com>
693
694         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
695         accessor.
696         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
697         Only call ppc64_local_entry_offset for 64-bit.  Restrict
698         symval_for_branch lookup to ELFv1.
699         (Stub_table::add_plt_call_entry): Use unsigned int off.
700         (Output_data_glink::Address, invalid_address): New.
701         (Output_data_glink::add_eh_frame): Move out of line.  Add
702         support for ELFv2.
703         (Output_data_glink::add_global_entry, find_global_entry,
704         global_entry_address): New functions.
705         (Output_data_glink::global_entry_stubs_, end_branch_table_,
706         ge_size): New variables.
707         (Output_data_glink::set_final_data_size): Add global entry
708         stub sizing.
709         (Output_data_glink::do_write): Write global entry stubs.
710         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
711         parameter.  Return true for ELFv2.  Adjust callers.
712         (Target_powerpc::Scan::local, global): Restrict opd lookup to
713         ELFv1.  Similarly for ifunc and dynamic relocation processing
714         specific to ELFv1.  Recognize that symbols are defined on
715         their plt entries for ELFv2.
716         (Target_powerpc::symval_for_branch): Assert if called for
717         ELFv2 or ppc32.
718         (Target_powerpc::Relocate::relocate): Use global entry plt
719         stub for symbol value if such exists on ELFv2.
720         (Target_powerpc::Relocate::relocate): Don't call
721         symval_for_branch when ELFv2.  Do adjust for local entry
722         offset when ELFv2.
723         (Target_powerpc::do_dynsym_value): Set symbols to global entry
724         plt stub for ELFv2.
725         (Target_powerpc::do_plt_address_for_global): Similarly.
726
727 2013-11-14  Cary Coutant  <ccoutant@google.com>
728
729         Revert patch -- this did not fix the problem, and there is
730         no race there.
731
732         2013-11-14  Cary Coutant  <ccoutant@google.com>
733
734             PR gold/14860
735             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
736             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
737             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
738             updating fde_offsets_.
739             (Eh_frame_hdr::lock_): New data member.
740
741 2013-11-14  Cary Coutant  <ccoutant@google.com>
742
743         * dwp.cc (Dwo_file_entry): New type.
744         (File_list): Use Dwo_file_entry.
745         (Dwo_file::verify): New function.
746         (Dwo_file::verify_dwo_list): New function.
747         (Dwo_file::sized_verify_dwo_list): New function.
748         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
749         list.
750         (Dwp_options): New enum type.
751         (dwp_options): Add --verify-only.
752         (usage): Likewise.
753         (main): Likewise.
754         * dwp.h (gold_info): Add declaration.
755
756 2013-11-14  Cary Coutant  <ccoutant@google.com>
757
758         PR gold/14860
759         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
760         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
761         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
762         updating fde_offsets_.
763         (Eh_frame_hdr::lock_): New data member.
764
765 2013-11-06  Cary Coutant  <ccoutant@google.com>
766
767         PR gold/15758
768         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
769         before reloc sections.
770
771 2013-11-04  Alan Modra  <amodra@gmail.com>
772
773         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
774         (Symbol::needs_dynamic_reloc): Test new flag.
775         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
776         (Target_powerpc::Scan::get_reference_flags): Add target param.
777         Return FUNC_DESC_ABI for 64-bit ELFv1.
778         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
779         call.
780         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
781         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
782
783 2013-10-31  Cary Coutant  <ccoutant@google.com>
784
785         Restore support for dwp v2 DWARF package file format.
786
787         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
788         tu_length parameter.  Adjust all callers.
789         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
790         * dwp.cc: Include dwarf.h.
791         (Section_bounds): New struct type.
792         (Unit_set): New struct type.
793         (Dwo_file::Dwo_file): Initialize new data member.
794         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
795         Combine and rename to...
796         (Dwo_file::read_unit_index): ...this.
797         (Dwo_file::sized_read_compunit_index)
798         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
799         (Dwo_file::sized_read_unit_index): ...this.
800         (Dwo_file::copy_section): Remove section_name, is_str_offsets
801         parameters; add section_id parameter.
802         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
803         (Dwo_file::add_unit_set): ...this.
804         (Dwo_file::shndx_map_): Remove.
805         (Dwo_file::sect_offsets_): New data member.
806         (Dwp_output_file::Dwp_output_file): Initialize new data members.
807         (Dwp_output_file::add_section): Rename to...
808         (Dwp_output_file::add_contribution): ...this.
809         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
810         (Dwp_output_file::add_tu_set): Likewise.
811         (Dwp_output_file::Contribution): New type.
812         (Dwp_output_file::Section::contributions): New data member.
813         (Dwp_output_file::Cu_or_tu_set): Remove.
814         (Dwp_output_file::Section::Section): New ctor.
815         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
816         (Dwp_output_file::Dwp_index::Section_table): New type.
817         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
818         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
819         parameter.
820         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
821         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
822         (Dwp_output_file::Dwp_index::section_table): New member function.
823         (Dwp_output_file::Dwp_index::section_table_end): New member function.
824         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
825         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
826         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
827         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
828         (Dwp_output_file::Dwp_index::section_table_): New data member.
829         (Dwp_output_file::Dwp_index::section_mask_): New data member.
830         (Dwp_output_file::add_output_section): New member function.
831         (Dwp_output_file::write_new_section): New member function.
832         (Dwp_output_file::write_contributions): New member function.
833         (Dwp_output_file::section_id_map_): New data member.
834         (class Dwo_id_info_reader): Remove.
835         (class Unit_reader): New class.
836         (get_dwarf_section_name): New function.
837         (Dwo_file::read_executable): Adjust initializations of class data.
838         (Dwo_file::read): Add support for v2 package file format.
839         (Dwo_file::read_unit_index): Likewise.
840         (Dwo_file::sized_read_unit_index): Likewise.
841         (Dwo_file::copy_section): Likewise.
842         (Dwo_file::add_unit_set): Likewise.
843         (Dwp_output_file::add_output_section): Likewise.
844         (Dwp_output_file::add_contribution): Likewise.
845         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
846         for empty slot.
847         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
848         file format.
849         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
850         slot.
851         (Dwp_output_file::initialize): Remove unused function.
852         (Dwp_output_file::finalize): Add support for v2 package file format.
853         (Dwp_output_file::write_index): Likewise.
854         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
855         function prototype.
856
857 2013-10-31  Cary Coutant  <ccoutant@google.com>
858
859         * configure.ac: Fix check for -fmerge-constants.
860         * configure.ac: Regenerate.
861
862 2013-10-30  Roland McGrath  <mcgrathr@google.com>
863
864         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
865         Correct 9-byte nop sequence to match what the assembler generates.
866
867 2013-10-30  Alan Modra  <amodra@gmail.com>
868
869         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
870         ppc64_local_entry_offset, ppc64_local_entry_offset,
871         do_read_symbols): New functions.
872         (Powerpc_relobj::e_flags_, st_other_): New vars.
873         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
874         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
875         (Powerpc_relobj::e_flags_): New var.
876         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
877         and adjust for ELFv2.
878         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
879         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
880         (Powerpc_dynobj::do_find_special_sections): Likewise.
881         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
882         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
883         to ELFv2 local entry.
884         (Target_powerpc::do_relax): No thread safe barriers needed for
885         ELFv2.
886         (Output_data_plt_powerpc::initial_plt_entry_size_,
887         plt_entry_size): Delete.  Replace all uses with
888         first_plt_entry_offset() and plt_entry_size().
889         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
890         reserved_size parm.  Update callers.
891         (Output_data_plt_powerpc::entry_count): Update.
892         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
893         and use Target_powerpc::first_plt_entry_offset().
894         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
895         rename to plt_entry_size.
896         (Output_data_plt_powerpc::add_ifunc_entry,
897         add_local_ifunc_entry): Adjust reloc for ELFv2.
898         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
899         (glink_eh_frame_fde_64v2): New.
900         (Stub_table::plt_call_size): Support ELFv2 sizing.
901         (Output_data_glink::add_eh_frame): Use the new FDE.
902         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
903         (Stub_table::do_write): Write ELFv2 stubs and glink.
904         (Target_powerpc::Relocate::relocate): Replaces nop after call
905         with ld 2,24(1) and adjust local offset destination for ELFv2.
906
907 2013-10-30  Alan Modra  <amodra@gmail.com>
908
909         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
910         (Target_powerpc::Scan::global, local): Likewise.
911         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
912         on all ppc64 @h and @ha relocs.
913
914 2013-10-14  Alan Modra  <amodra@gmail.com>
915
916         * output.h (Output_data_got::add_constant): Tidy.
917         (Output_data_got::add_constant_pair): New function.
918         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
919         methods used so as to first call reserve_ent().
920
921 2013-10-11  Roland McGrath  <mcgrathr@google.com>
922
923         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
924         add_got_entry and add_got_entry_pair.
925
926         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
927         (HAVE_PUBNAMES): Likewise.
928         * configure: Regenerate.
929
930         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
931         * testsuite/Makefile.in: Regenerate.
932
933         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
934         Remove const from declaration.
935         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
936         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
937         * output.h (Output_file_header): Remove const from member target_
938         and corresponding constructor argument.
939         * output.cc (Output_file_header::Output_file_header): Update prototype.
940         (Output_file_header::do_sized_write): Use this->target_ in place
941         of parameters()->target().
942
943         * testsuite/undef_symbol.cc (Foo::get_a): New method.
944
945         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
946         * configure: Regenerate.
947         * Makefile.in: Regenerate.
948         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
949         * testsuite/merge_string_literals_2.c: Likewise.
950         * testsuite/Makefile.am
951         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
952         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
953         literal -fmerge-constants.
954         * testsuite/Makefile.in: Regenerate.
955
956         * i386.cc (Target_i386): Remove unused member dynbss_.
957         * arm.cc (Target_arm): Likewise.
958         * powerpc.cc (Target_powerpc): Likewise.
959         * sparc.cc (Target_sparc): Likewise.
960         * tilegx.cc (Target_tilegx): Likewise.
961         * x86_64.cc (Target_x86_64): Likewise.
962         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
963         type_signature_, type_offset_.
964         * plugin.h (Plugin_hook): Remove unused member layout_.
965         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
966         mapfile_.
967         (Read_member): Remove unused members input_objects_, symtab_,
968         mapfile_, layout_.
969         (Check_library): Remove unused member symtab_.
970         * archive.h (Lib_group): Remove unused member lib_.
971         * archive.cc (Lib_group::Lib_group): Update initializer.
972         * incremental.h (Incremental_binary): Remove unused member target_.
973         (Incremental_script_entry): Removed unused member script_.
974         * layout.h (Write_symbols_task): Remove unused member input_objects_.
975         * icf.h (Icf): Remove unused member num_tracked_relocs.
976
977         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
978         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
979         its only use.
980         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
981
982         * archive.h: Use struct rather than class for forward declaration
983         of Read_symbols_data.
984
985 2013-10-07  Cary Coutant  <ccoutant@google.com>
986
987         PR gold/16010
988         * testsuite/Makefile.am (icf_test): Fix dependencies.
989         (icf_safe_test): Likewise.
990         (icf_safe_so_test): Likewise.
991         (large_symbol_alignment): Add empty _LDADD rule.
992         * testsuite/Makefile.in: Regenerate.
993
994 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
995
996         PR gold/15927
997         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
998         relocation for R_X86_64_32 on x32.
999
1000 2013-08-27  Roland McGrath  <mcgrathr@google.com>
1001
1002         * output.cc (Output_segment::set_section_addresses): Take new
1003         Target* argument.  If target->isolate_execinstr() and the segment
1004         is executable and starts at a target->abi_pagesize() boundary,
1005         pad its end out to a target->abi_pagesize() boundary with code fill.
1006         * output.h (Output_segment::set_section_addresses): Update decl.
1007         * layout.h (Layout::check_output_data_for_reset_values): Take new
1008         argument RELAX_OUTPUTS.
1009         (Layout): New member relax_output_list_.
1010         (Layout::add_relax_output): New method.
1011         * layout.cc (Layout::Layout): Update constructor.
1012         (Layout::reset_relax_output): New method.
1013         (Layout::clean_up_after_relaxation): Call it.
1014         (Layout::prepare_for_relaxation): Update caller.
1015         (Layout::set_segment_offsets): Update callers of set_section_addresses.
1016         Call reset_relax_output before re-processing segments for
1017         isolate_execinstr case.
1018         (Layout::write_data): Handle relax_output_list_.
1019         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
1020         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
1021
1022 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
1023
1024         PR binutils/15834
1025         * object.h: Fix typos.
1026
1027 2013-08-16  Roland McGrath  <mcgrathr@google.com>
1028
1029         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
1030         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
1031
1032 2013-08-07  Cary Coutant  <ccoutant@google.com>
1033
1034         Revert support for v2 DWP files:
1035
1036         2013-03-01  Cary Coutant  <ccoutant@google.com>
1037
1038             Add dwp support for v2 DWARF package file format.
1039             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1040             tu_length parameter.  Adjust all callers.
1041             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1042             * dwp.cc: Include dwarf.h.
1043             (Section_bounds): New struct type.
1044             (Unit_set): New struct type.
1045             (Dwo_file::Dwo_file): Initialize new data member.
1046             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1047             Combine and rename to...
1048             (Dwo_file::read_unit_index): ...this.
1049             (Dwo_file::sized_read_compunit_index)
1050             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1051             (Dwo_file::sized_read_unit_index): ...this.
1052             (Dwo_file::copy_section): Remove section_name, is_str_offsets
1053             parameters; add section_id parameter.
1054             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1055             (Dwo_file::add_unit_set): ...this.
1056             (Dwo_file::shndx_map_): Remove.
1057             (Dwo_file::sect_offsets_): New data member.
1058             (Dwp_output_file::Dwp_output_file): Initialize new data members.
1059             (Dwp_output_file::add_section): Rename to...
1060             (Dwp_output_file::add_contribution): ...this.
1061             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1062             (Dwp_output_file::add_tu_set): Likewise.
1063             (Dwp_output_file::Contribution): New type.
1064             (Dwp_output_file::Section::contributions): New data member.
1065             (Dwp_output_file::Cu_or_tu_set): Remove.
1066             (Dwp_output_file::Section::Section): New ctor.
1067             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1068             (Dwp_output_file::Dwp_index::Section_table): New type.
1069             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1070             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1071             parameter.
1072             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1073             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1074             (Dwp_output_file::Dwp_index::section_table): New member function.
1075             (Dwp_output_file::Dwp_index::section_table_end): New member function.
1076             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1077             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1078             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1079             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1080             (Dwp_output_file::Dwp_index::section_table_): New data member.
1081             (Dwp_output_file::Dwp_index::section_mask_): New data member.
1082             (Dwp_output_file::add_output_section): New member function.
1083             (Dwp_output_file::write_new_section): New member function.
1084             (Dwp_output_file::write_contributions): New member function.
1085             (Dwp_output_file::section_id_map_): New data member.
1086             (class Dwo_id_info_reader): Remove.
1087             (class Unit_reader): New class.
1088             (get_dwarf_section_name): New function.
1089             (Dwo_file::read_executable): Adjust initializations of class data.
1090             (Dwo_file::read): Add support for v2 package file format.
1091             (Dwo_file::read_unit_index): Likewise.
1092             (Dwo_file::sized_read_unit_index): Likewise.
1093             (Dwo_file::copy_section): Likewise.
1094             (Dwo_file::add_unit_set): Likewise.
1095             (Dwp_output_file::add_output_section): Likewise.
1096             (Dwp_output_file::add_contribution): Likewise.
1097             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1098             for empty slot.
1099             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1100             file format.
1101             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1102             slot.
1103             (Dwp_output_file::initialize): Remove unused function.
1104             (Dwp_output_file::finalize): Add support for v2 package file format.
1105             (Dwp_output_file::write_index): Likewise.
1106             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1107             function prototype.
1108
1109 2013-07-31  Cary Coutant  <ccoutant@google.com>
1110
1111         * object.cc (Sized_relobj::do_output_section_address): New function.
1112         (Sized_relobj): Instantiate explicitly.
1113         * object.h (Object::output_section_address): New function.
1114         (Object::do_output_section_address): New function.
1115         (Sized_relobj::do_output_section_address): New function.
1116         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
1117
1118 2013-07-30  Cary Coutant  <ccoutant@google.com>
1119             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1120
1121         * parameters.cc (Parameters::entry): Return target-specific entry
1122         symbol name.
1123         * target.h (Target::entry_symbol_name): New function.
1124         (Target_info::entry_symbol_name): New data member.
1125
1126         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
1127         * i386.cc (Target_i386::i386_info): Likewise.
1128         (Target_i386_nacl::i386_nacl_info): Likewise.
1129         * sparc.cc (Target_sparc::sparc_info): Likewise.
1130         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
1131         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
1132         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
1133         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
1134
1135 2013-07-22  Sterling Augustine  <saugustine@google.com>
1136
1137         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
1138         Convert parameter shndx to local variable. Add parameters symtab
1139         and symtab_size.  Scan over section names.  Find relocation
1140         section corresponding to current section.  Create and initialize
1141         reloc_mapper_ and reloc_type_.
1142         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
1143         unit_length to off_t.  Initialize member unit_length_.  Fill in field
1144         cu_offset_.
1145         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
1146         Initialize new fields unit_length_ and cu_offset_.
1147         (Dwarf_pubnames_table::read_section): Update prototype.
1148         (Dwarf_pubnames_table::cu_offset): New member function.
1149         (Dwarf_pubnames_table::subsection_size): Likewise.
1150         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
1151         New fields.
1152         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
1153         member functions public.
1154         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
1155         Update comment.  Rework logic.  Move repeated parts to...
1156         (Gdb_index_info_reader::read_pubtable): ...here. New function.
1157         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
1158         pubtypes_table_, and stmt_list_offset.
1159         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1160         Gdb_index::find_pubtype_offset,
1161         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
1162         (Gdb_index::pubnames_read): Update prototype and rework logic.
1163         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
1164         Forward declare.
1165         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
1166         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
1167         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
1168         Gdb_index::map_pubtable_to_dies):
1169         Declare functions.
1170         (Gdb_index::pubnames_read): Update declaration.
1171         (Gdb_index::Pubname_offset_map): New type.
1172         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
1173         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
1174         Gdb_index::stmt_list_offset): Declare.
1175         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
1176         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
1177         Gdb_index::pubtypes_offset_): Remove.
1178
1179 2013-07-19  Roland McGrath  <mcgrathr@google.com>
1180
1181         * options.h (General_options): Add -Trodata-segment option.
1182         * parameters.cc (Parameters::check_rodata_segment): New function.
1183         (Parameters::set_target_once): Call it.
1184         * parameters.h (Parameters): Declare it (private member function).
1185         * layout.cc (load_seg_unusable_for_headers): New function, broken
1186         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
1187         then validate rodata segment rather than text segment.
1188         (relaxation_loop_body): Call that.
1189         (is_text_segment): New function.  Don't admit a non-executable
1190         segment if TARGET->isolate_execinstr().
1191         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
1192
1193 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
1194
1195         PR gold/15070
1196         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
1197         * nacl.h (Sniff_file::View::View): Request aligned view.
1198
1199 2013-07-11  Cary Coutant  <ccoutant@google.com>
1200
1201         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
1202         correct BRLT entry size.
1203
1204 2013-07-03  Alan Modra  <amodra@gmail.com>
1205
1206         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
1207         comment.
1208
1209 2013-07-01  Cary Coutant  <ccoutant@google.com>
1210
1211         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
1212         reloc_type_.
1213         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
1214         (Dwarf_ranges_table::lookup_reloc): New function.
1215         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
1216         reloc_type_.
1217         (Dwarf_ranges_table::lookup_reloc): New function.
1218         (Dwarf_ranges_table::reloc_type_): New data member.
1219
1220 2013-06-27  Jing Yu  <jingyu@google.com>
1221
1222         PR gold/15662
1223         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
1224         function.
1225         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
1226         (Target_powerpc::do_relax): Call the above.
1227
1228 2013-06-27  Cary Coutant  <ccoutant@google.com>
1229
1230         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1231         on garbage collected .opd section.
1232
1233 2013-06-27  Alan Modra  <amodra@gmail.com>
1234
1235         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
1236         is non-zero.
1237         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
1238         (Target_powerpc::do_function_location): Likewise for loc->shndx.
1239
1240 2013-06-14  Cary Coutant  <ccoutant@google.com>
1241
1242         * resolve.cc (Symbol::override_base): Don't override st_type
1243         from plugin placeholder symbols.
1244         (Symbol_table::resolve): Likewise.
1245         (Symbol_table::should_override): Don't complain about TLS mismatch
1246         if the TO symbol is a plugin placeholder.
1247         * testsuite/Makefile.am (plugin_test_tls): New test.
1248         * testsuite/Makefile.in: Regenerate.
1249         * testsuite/plugin_test_tls.sh: New test script.
1250         * testsuite/two_file_test_2_tls.cc: New test source.
1251         * testsuite/two_file_test_tls.cc: New test source.
1252
1253 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1254
1255         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
1256         the maximum segment alignment is larger than the page size.
1257         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
1258         correctly aligns the symbols with large alignemnt.
1259         * testsuite/Makefile.in: Regenerate.
1260         * testsuite/large_symbol_alignment.cc: New file.
1261
1262 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1263             Sriraman Tallam  <tmsriram@google.com>
1264
1265         * options.h (sort_section): New option.
1266         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
1267         Rename from Input_section_sort_section_name_special_ordering_compare.
1268         (Input_section_sort_section_name_compare): New struct.
1269         * output.cc (Output_section::Input_section_sort_section_name_compare::
1270         operator()): New function.
1271         (Output_section::sort_attached_input_sections): Use new sort function
1272         for .text if --sort-section=name is specified.
1273         * layout.cc (Layout::make_output_section):
1274         Add sorting by name when --sort-section=name is specified.
1275         * testsuite/Makefile.am (text_section_grouping): Test option
1276         --sort-section=name.
1277         * testsuite/Makefile.in: Regenerate.
1278         * testsuite/section_sorting_name.cc: New file.
1279         * testsuite/section_sorting_name.sh: New file.
1280
1281 2013-05-21  Cary Coutant  <ccoutant@google.com>
1282
1283         * symtab.h (Symbol::is_cxx_vtable): New function.
1284         * target-reloc.h (relocate_section): Check for vtable symbol.
1285         * testsuite/Makefile.am (missing_key_func.sh): New test case.
1286         * testsuite/Makefile.in: Regenerate.
1287         * testsuite/missing_key_func.cc: New test source.
1288         * testsuite/missing_key_func.sh: New test script.
1289
1290 2013-05-21  Cary Coutant  <ccoutant@google.com>
1291
1292         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
1293         type of enclosing symbol.
1294         (Relocate_info::location): Check symbol type when describing symbol.
1295         * object.h (Symbol_location_info): Remove unused line_number;
1296         add enclosing_symbol_type.
1297         * testsuite/debug_msg.sh: Adjust expected output.
1298
1299 2013-05-13  Cary Coutant  <ccoutant@google.com>
1300
1301         * configure.ac: Export DEFAULT_TARGET.
1302         * configure: Regenerate.
1303         * Makefile.in: Regenerate.
1304         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
1305         * testsuite/Makefile.in: Regenerate.
1306         * testsuite/debug_msg.sh: Delete duplicate tests.
1307         Don't check undef_int error message match for powerpc where the
1308         source file and line number aren't available.
1309
1310 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1311
1312         * options.h (General_options): Add --rosegment-gap option.
1313         * options.cc (finalize): --rosegment-gap implies --rosegment.
1314         * layout.cc (set_segment_offsets): Let user option override
1315         target->rosegment_gap().
1316
1317 2013-05-10  Roland McGrath  <mcgrathr@google.com>
1318
1319         * options.h (General_options): Remove leading space from help
1320         messages for -nostdlib and --rosegment.
1321
1322 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
1323
1324         PR ld/15365
1325         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
1326
1327 2013-05-03  Alan Modra  <amodra@gmail.com>
1328
1329         * merge.cc (Output_merge_string::do_add_input_section): Correct
1330         scan for number of strings.  Rename vars to avoid shadowing.
1331         Include missing terminator in input_size_.
1332
1333 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
1334
1335         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
1336         Restore empty string handling.
1337
1338 2013-05-01  Cary Coutant  <ccoutant@google.com>
1339
1340         * stringpool.cc (Stringpool_template::new_key_offset): Fix
1341         uninitialized warning.
1342
1343 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
1344
1345         * output.cc (Output_section::add_merge_input_section): Allow
1346         to merge sections if the alignment is more than character size.
1347         * merge.h (Output_merge_string::Output_merge_string): Remove
1348         assert.
1349         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
1350         only not-null strings. Check the alignment of strings.
1351         * stringpool.h
1352         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
1353         alignment as the argument.
1354         (Stringpool_template<Stringpool_char>::addralign_): New class member.
1355         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
1356         Align non-zero length strings according to the addralign_.
1357         (Stringpool_template<Stringpool_char>::set_string_offsets):
1358         Updating offsets according to the given alignment.
1359         * testsuite/Makefile.am (text_section_grouping): Test if string
1360         literals are getting merged.
1361         * testsuite/Makefile.in: Regenerate.
1362         * testsuite/merge_string_literals_1.c: New file.
1363         * testsuite/merge_string_literals_2.c: Ditto.
1364         * testsuite/merge_string_literals.sh: Ditto.
1365
1366 2013-04-26  Ian Lance Taylor  <iant@google.com>
1367
1368         * target-reloc.h (relocate_section): If the reloc offset is out of
1369         range, pass VIEW as NULL to relocate.relocate.
1370         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
1371         * i386.cc (Target_i386::Relocate::relocate): Likewise.
1372         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
1373         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
1374         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
1375         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
1376
1377 2013-04-26  Geoff Pike  <gpike@chromium.org>
1378
1379         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
1380         * layout.cc (Hash_task): New class.
1381         (Layout::queue_build_id_tasks): New function.
1382         (Layout::write_build_id): Handle single-thread portion of build ID
1383         computation.  (In some cases, all of it is single-threaded.)  Replace
1384         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
1385         functionality in fewer lines of code.
1386         * layout.h (Layout::queue_build_id_tasks): New function declaration.
1387         * options.h (General_options): make "--build-id" default to tree
1388         rather than sha1.  Add two new options related to --build-id=tree:
1389         --build-id-chunk-size-for-treehash and
1390         --build-id-min-file-size-for-treehash.
1391         * Makefile.am: add testing of --build-id=tree and related new options
1392         (these tests will be invoked by "make check").
1393         * Makefile.in: Regenerate.
1394
1395 2013-04-25  Alan Modra  <amodra@gmail.com>
1396
1397         * configure.tgt: Add powerpcle and powerpc64le.
1398
1399 2013-04-22  Alan Modra  <amodra@gmail.com>
1400
1401         PR gold/15355
1402         * layout.cc (Layout::segment_precedes): Allow more than one
1403         segment with the same type and flags.
1404
1405 2013-04-15  Cary Coutant  <ccoutant@google.com>
1406
1407         * layout.cc (Layout::set_relocatable_section_offsets): Don't
1408         allocate space in file for BSS sections.
1409
1410 2013-04-15  Cary Coutant  <ccoutant@google.com>
1411
1412         * script-sections.cc (Orphan_output_section): Reset address
1413         to zero after each orphaned section for relocatable links.
1414
1415 2013-04-15  Cary Coutant  <ccoutant@google.com>
1416
1417         * symtab.cc (Symbol_table::sized_write_globals): Subtract
1418         section starting address for relocatable link.
1419         * testsuite/Makefile.am (script_test_11): New test.
1420         * testsuite/Makefile.in: Regenerate.
1421         * testsuite/script_test_11.c: New source file.
1422         * testsuite/script_test_11.t: New linker script.
1423
1424 2013-04-13  Alan Modra  <amodra@gmail.com>
1425
1426         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
1427         owner when sections are not adjacent and exceed group size.
1428         (Target_powerpc::group_sections): Handle corner case.
1429         (Target_powerpc::Branch_info::make_stub): Handle case where
1430         stub table doesn't exist due to branches in non-exec sections.
1431         (Target_powerpc::Relocate::relocate): Likewise.
1432
1433 2013-04-11  Alan Modra  <amodra@gmail.com>
1434
1435         PR gold/15354
1436         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
1437         .branch_lt to match bfd ld.  Adjust comments throughout file.
1438
1439 2013-04-04  Ian Lance Taylor  <iant@google.com>
1440
1441         GCC PR c++/56840
1442         * object.cc (do_layout_deferred_sections): Handle .eh_frame
1443         sections before checking whether they are included in the link.
1444
1445 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
1446
1447         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
1448         object before calling the plugin claim_file handler.  Pass the elf
1449         object of the archive to the plugin. Delete the elf object if the
1450         plugin claims the file.
1451
1452 2013-03-21  Alan Modra  <amodra@gmail.com>
1453
1454         * layout.cc (Layout::set_segment_offsets): Accept writable .text
1455         segment when omagic.
1456
1457 2013-03-21  Alan Modra  <amodra@gmail.com>
1458
1459         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
1460         comparison warning.
1461         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
1462         uninitialized" warning.
1463
1464 2013-03-20  Alan Modra  <amodra@gmail.com>
1465
1466         * symtab.h (Symbol::clear_version): New function.
1467         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
1468         is_needed by weak references.  Clear version for symbols defined
1469         in as-needed objects that are not needed.
1470
1471 2013-03-15  Alan Modra  <amodra@gmail.com>
1472
1473         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
1474         static and public.  Add report_err param.  Return false for data refs.
1475         (Target_powerpc::rela_dyn_section): New overloaded function.
1476         (Target_powerpc::plt_, iplt_): Elucidate.
1477         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
1478         (Output_data_plt_powerpc::do_write): Don't write .iplt.
1479         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
1480         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
1481         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
1482         push_branch and make_plt_entry for ifunc syms when
1483         reloc_needs_plt_for_ifunc.
1484         (Target_powerpc::Relocate::relocate): Don't use plt entry value
1485         for ifunc unless reloc_needs_plt_for_ifunc.
1486
1487 2013-03-15  Alan Modra  <amodra@gmail.com>
1488
1489         * gc.h (gc_process_relocs): Don't look through function descriptors.
1490         * icf.cc (get_section_contents): Do so here instead.
1491
1492 2013-03-13  Alan Modra  <amodra@gmail.com>
1493
1494         * powerpc.cc (is_branch_reloc): Forward declare.
1495         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
1496         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
1497         false for 64-bit, true for 32-bit non-branch relocs.
1498         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
1499         * testsuite/Makefile.am (icf_test): Use linker map file instead of
1500         nm output.
1501         (icf_safe_test): Generate linker map file as well as nm output.
1502         (icf_safe_so_test): Likewise.
1503         * testsuite/Makefile.in: Regenerate.
1504         * testsuite/icf_test.sh: Parse linker map file to determine
1505         section folding.
1506         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
1507         * testsuite/icf_safe_so_test.sh: Likewise.
1508         (X86_32_or_ARM_specific_safe_fold): Merge into..
1509         (arch_specific_safe_fold): ..this.
1510         (X86_64_specific_safe_fold): Delete unused function.
1511
1512 2013-03-12  Alan Modra  <amodra@gmail.com>
1513
1514         * gc.h (gc_process_relocs): Look through function descriptors
1515         to determine shndx, symvalue and addend used by ICF.  Tidy
1516         variable duplication.
1517
1518 2013-03-11  Alan Modra  <amodra@gmail.com>
1519
1520         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
1521         * layout.cc (Layout_task_runner::run): ..to here.
1522         * symtab.h (struct Symbol_location): Extract from..
1523         (class Symbol_table): ..here.
1524         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
1525         * target.h (class Target): Add function_location and
1526         do_function_location functions.
1527         (class Sized_target): Add do_function_location.
1528         * object.h (class Sized_relobj_file): Move find_shdr..
1529         (class Object): ..to here.
1530         * object.cc: Likewise.  Update to suit.  Instantiate.
1531         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
1532         * powerpc.cc (class Powerpc_dynobj): New.
1533         (Target_powerpc::do_function_location): New function.
1534         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
1535         (Powerpc_dynobj::do_read_symbols): New function.
1536         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
1537
1538 2013-03-08  Ian Lance Taylor  <iant@google.com>
1539
1540         * options.cc (General_options::string_to_object_format): Accept
1541         "default".
1542
1543 2013-03-08  Alan Modra  <amodra@gmail.com>
1544
1545         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
1546         pointer to Post_fde.
1547         (struct Post_fde): Move definition to here..
1548         * ehframe.cc (struct Post_fde): ..from here.
1549         (Cie::write): Don't alloc Post_fde.
1550         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
1551
1552 2013-03-07  Alan Modra  <amodra@gmail.com>
1553
1554         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
1555         relocation referencing .LC0.
1556         * testsuite/discard_locals_test.sh: Remove FIXMEs.
1557
1558 2013-03-07  Alan Modra  <amodra@gmail.com>
1559
1560         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
1561         always_inline.  Add assembly for powerpc to avoid GOT.
1562
1563 2013-03-07  Alan Modra  <amodra@gmail.com>
1564
1565         * testsuite/script_test_10.sh: Don't test .bss section
1566         header number.
1567
1568 2013-03-06  Alan Modra  <amodra@gmail.com>
1569
1570         * powerpc.cc (class Powerpc_relobj): Move some member functions.
1571         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
1572         all callers.  Handle folded sections.
1573         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
1574         to Powerpc_relobj.
1575         (Global_symbol_visitor_opd::operator()): Likewise.
1576
1577 2013-03-04  Alan Modra  <amodra@gmail.com>
1578
1579         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
1580         * testsuite/Makefile.in: Regenerate.
1581
1582 2013-03-01  Cary Coutant  <ccoutant@google.com>
1583
1584         Add dwp support for v2 DWARF package file format.
1585         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
1586         tu_length parameter.  Adjust all callers.
1587         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
1588         * dwp.cc: Include dwarf.h.
1589         (Section_bounds): New struct type.
1590         (Unit_set): New struct type.
1591         (Dwo_file::Dwo_file): Initialize new data member.
1592         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
1593         Combine and rename to...
1594         (Dwo_file::read_unit_index): ...this.
1595         (Dwo_file::sized_read_compunit_index)
1596         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
1597         (Dwo_file::sized_read_unit_index): ...this.
1598         (Dwo_file::copy_section): Remove section_name, is_str_offsets
1599         parameters; add section_id parameter.
1600         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
1601         (Dwo_file::add_unit_set): ...this.
1602         (Dwo_file::shndx_map_): Remove.
1603         (Dwo_file::sect_offsets_): New data member.
1604         (Dwp_output_file::Dwp_output_file): Initialize new data members.
1605         (Dwp_output_file::add_section): Rename to...
1606         (Dwp_output_file::add_contribution): ...this.
1607         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
1608         (Dwp_output_file::add_tu_set): Likewise.
1609         (Dwp_output_file::Contribution): New type.
1610         (Dwp_output_file::Section::contributions): New data member.
1611         (Dwp_output_file::Cu_or_tu_set): Remove.
1612         (Dwp_output_file::Section::Section): New ctor.
1613         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
1614         (Dwp_output_file::Dwp_index::Section_table): New type.
1615         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
1616         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
1617         parameter.
1618         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
1619         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
1620         (Dwp_output_file::Dwp_index::section_table): New member function.
1621         (Dwp_output_file::Dwp_index::section_table_end): New member function.
1622         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
1623         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
1624         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
1625         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
1626         (Dwp_output_file::Dwp_index::section_table_): New data member.
1627         (Dwp_output_file::Dwp_index::section_mask_): New data member.
1628         (Dwp_output_file::add_output_section): New member function.
1629         (Dwp_output_file::write_new_section): New member function.
1630         (Dwp_output_file::write_contributions): New member function.
1631         (Dwp_output_file::section_id_map_): New data member.
1632         (class Dwo_id_info_reader): Remove.
1633         (class Unit_reader): New class.
1634         (get_dwarf_section_name): New function.
1635         (Dwo_file::read_executable): Adjust initializations of class data.
1636         (Dwo_file::read): Add support for v2 package file format.
1637         (Dwo_file::read_unit_index): Likewise.
1638         (Dwo_file::sized_read_unit_index): Likewise.
1639         (Dwo_file::copy_section): Likewise.
1640         (Dwo_file::add_unit_set): Likewise.
1641         (Dwp_output_file::add_output_section): Likewise.
1642         (Dwp_output_file::add_contribution): Likewise.
1643         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1644         for empty slot.
1645         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1646         file format.
1647         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1648         slot.
1649         (Dwp_output_file::initialize): Remove unused function.
1650         (Dwp_output_file::finalize): Add support for v2 package file format.
1651         (Dwp_output_file::write_index): Likewise.
1652         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1653         function prototype.
1654
1655 2013-03-01  Cary Coutant  <ccoutant@google.com>
1656
1657         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1658         function into class definition in header file.
1659         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1660         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1661         New function.
1662         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1663
1664 2013-02-28  Alan Modra  <amodra@gmail.com>
1665
1666         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1667         * target.cc (Target::do_plt_fde_location): New function.
1668         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1669         accessor function, and constructor param.
1670         (struct Post_fde, Post_fdes): Declare.
1671         (Cie::write): Add post_fdes param.
1672         * ehframe.cc (Fde::write): Use plt_fde_location.
1673         (struct Post_fde): Define.
1674         (Cie::write): Stash FDEs added post merge mapping.
1675         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1676         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1677         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1678         other FDEs.
1679         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1680         (Target_powerpc::has_glink): New function.
1681         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1682         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1683         glink_eh_frame_fde_32, default_fde): New data.
1684         (Stub_table::eh_frame_added_): New var.
1685         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1686         Make const.
1687         (Stub_table::add_eh_frame): New function.
1688         (Output_data_glink::add_eh_frame): New function.
1689         (Target_powerpc::make_glink_section): Call add_eh_frame.
1690
1691 2013-02-15  Ian Lance Taylor  <iant@google.com>
1692
1693         * options.h (DEFINE_uint64_alias): Define.
1694         (class General_options): Add -Ttext-segment as an alias for
1695         -Ttext.
1696
1697 2013-02-15  Alan Modra  <amodra@gmail.com>
1698
1699         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1700         (Stub_table::do_write): ..here, two places.
1701         (Stub_table::plt_call_size): Use it here too.
1702
1703 2013-02-11  Ian Lance Taylor  <iant@google.com>
1704
1705         * descriptors.cc (Descriptors::close_all): New function.
1706         * descriptors.h (class Descriptors): Declare close_all.
1707         (close_all_descriptors): New inline function.
1708         * plugin.cc: Include "descriptors.h".
1709         (Plugin_manager::cleanup): Call close_all_descriptors.
1710
1711 2013-02-06  Alan Modra  <amodra@gmail.com>
1712
1713         * README: Update coding style link.
1714
1715 2013-01-28  Cary Coutant  <ccoutant@google.com>
1716
1717         * dwp.cc (File_list): New typedef.
1718         (Dwo_name_info_reader): New class.
1719         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1720         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1721         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1722         (Dwo_file::read_executable): New function.
1723         (Dwo_file::read): Move common setup code to ...
1724         (Dwo_file::make_object): ... here.
1725         (dwp_options): Add --exec/-e.
1726         (usage): Likewise.
1727         (main): Likewise.
1728
1729 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1730
1731         * layout.cc (Layout::layout): Check for option text_reorder.
1732         (Layout::make_output_section): Ditto.
1733         * options.h (text_reorder): New option.
1734         * output.cc (Input_section_sort_compare): Remove special ordering
1735         of section names.
1736         (Output_section::
1737          Input_section_sort_section_name_special_ordering_compare::
1738          operator()): New function.
1739         (Output_section::sort_attached_input_sections): Use new sort function
1740         for .text.
1741         * output.h (Input_section_sort_section_name_special_ordering_compare):
1742         New struct.
1743         * testsuite/Makefile.am (text_section_grouping): Test option
1744         --no-text-reorder
1745         * testsuite/Makefile.in: Regenerate.
1746         * testsuite/text_section_grouping.sh: Check order of functions without
1747         default text reordering.
1748
1749 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1750
1751         * options.h (General_options): Change default to true for new_dtags.
1752
1753 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1754
1755         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1756         when enable_new_dtags is false.  Only add DT_RUNPATH when
1757         enable_new_dtags is true.
1758
1759 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1760
1761         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1762         used in declaration and definition consistent.
1763         (Target_powerpc::symval_for_branch): Ditto.
1764
1765 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1766
1767         * testsuite/plugin_final_layout.cc: Fix comment.
1768
1769 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1770
1771         * layout.cc (Layout::layout): Do not do default sorting for
1772         text sections when section ordering is specified.
1773         (make_output_section): Ditto.
1774         * testsuite/plugin_final_layout.cc: Name the function sections
1775         to catch reordering issues.
1776
1777 2013-01-15  Alan Modra  <amodra@gmail.com>
1778
1779         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1780         plt-thread-safe.
1781
1782 2013-01-15  Alan Modra  <amodra@gmail.com>
1783
1784         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1785         * testsuite/Makefile.in: Regenerate.
1786
1787 2013-01-14  Alan Modra  <amodra@gmail.com>
1788
1789         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1790         * testsuite/Makefile.in: Regenerate.
1791
1792 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1793
1794         PR bfd/14430
1795         Fix mingw gold build with plugins enabled
1796         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1797         * configure.ac: Export DLOPEN_LIBS and add headers check.
1798         * plugin.cc: Handle non-dlfcn case.
1799         * Makefile.in: Regenerate.
1800         * config.in: Regenerate.
1801         * configure: Regenerate.
1802         * testsuite/Makefile.in: Regenerate.
1803
1804 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1805
1806         * output.h (sort_attached_input_sections): Change to be public.
1807         * script-sections.cc
1808         (Output_section_definition::set_section_addresses): Sort
1809         attached input sections according to section order before linker
1810         script assigns section addresses.
1811         (Orphan_output_section::set_section_addresses): Sort
1812         attached input sections according to section order before linker
1813         script assigns section addresses.
1814         * Makefile.am (final_layout.sh): Use a simple linker script to
1815         check if section ordering still works.
1816         * Makefile.in: Regenerate.
1817
1818 2013-01-09  Ben Cheng  <bccheng@google.com>
1819
1820         * arm.cc (Target_arm::attributes_accept_div): New function.
1821         (Target_arm::attributes_forbid_div): New function.
1822         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1823         attribute using the same new functions as what bfd/elf32_arm.c
1824         does.
1825
1826 2013-01-07  Cary Coutant  <ccoutant@google.com>
1827
1828         PR gold/14993
1829         * output.cc (Output_section::add_input_section): For incremental
1830         updates, don't track input sections that are allocated from patch
1831         space.
1832
1833 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1834             Ian Lance Taylor  <iant@google.com>
1835
1836         PR gold/14897
1837         * configure.ac (--enable-ld): Removed.
1838         (install_as_default): Set to yes only for --enable-gold=default
1839         or --disable-ld.
1840         * configure: Regenerated.
1841
1842 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1843
1844         * options.h (General_options): Add -fuse-ld= for GCC linker
1845         option compatibility.
1846
1847 2013-01-04  Cary Coutant  <ccoutant@google.com>
1848
1849         * configure.ac: Fix typo restoring CXXFLAGS.
1850         * configure: Regenerate.
1851
1852 2013-01-04  Cary Coutant  <ccoutant@google.com>
1853
1854         * testsuite/Makefile.am (CXXLINK_S): New macro.
1855         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1856         * testsuite/Makefile.in: Regenerate.
1857
1858 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1859
1860         * version.cc (print_version): Update copyright year to 2013.
1861
1862 2012-12-20  Ian Lance Taylor  <iant@google.com>
1863
1864         * layout.cc (Layout::special_ordering_of_input_section): New
1865         function.
1866         (Layout::layout): If input section requires special ordering, must
1867         sort input sections.
1868         (Layout::make_output_section): May sort .text input sections.
1869         (Layout::is_section_name_prefix_grouped): Remove.
1870         * layout.h (class Layout): Declare
1871         special_ordering_of_input_section.  Don't declare
1872         is_section_name_prefix_grouped.
1873         * output.cc (Output_section::add_input_section): Revert last
1874         change.
1875         (Output_section::Input_section_sort::match_file_name): Don't crash
1876         if called on output section data.
1877         (Output_section::Input_section_sort_compare): Sort based on
1878         special ordering.
1879         (Output_section::Input_section_sort_section_order_index_compare):
1880         Revert last patch.
1881         (Output_section::sort_attached_input_sections): Likewise.
1882
1883 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1884
1885         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1886         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1887         * output.cc (Output_section::add_input_section): Check if section
1888         name contains special prefix.  Keep input sections to sort such
1889         sections.
1890         (Output_section::Input_section_sort_section_order_index_compare
1891          ::operator()): Group sections according to prefixes.
1892         (Output_section::sort_attached_input_sections): Add condition to
1893         Input_section_entry constructor call.
1894         * testsuite/Makefile.am (text_section_grouping): New test.
1895         * testsuite/Makefile.in: Regenerate.
1896         * testsuite/text_section_grouping.cc: New file.
1897         * testsuite/text_section_grouping.sh: New file.
1898
1899 2012-12-17  Nick Clifton  <nickc@redhat.com>
1900
1901         * Makefile.am: Add copyright notice.
1902         * NEWS: Likewise.
1903         * README: Likewise.
1904         * configure.ac: Likewise.
1905         * ftruncate.c: Likewise.
1906         * Makefile.in: Regenerate.
1907
1908 2012-12-14  Cary Coutant  <ccoutant@google.com>
1909
1910         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1911         --no-as-needed flag.
1912         (exception_separate_shared_12_test): Likewise.
1913         (incremental_copy_test): Likewise.
1914         * testsuite/Makefile.in: Regenerate.
1915
1916 2012-12-14  Cary Coutant  <ccoutant@google.com>
1917
1918         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1919         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1920
1921 2012-12-12  Alan Modra  <amodra@gmail.com>
1922
1923         * powerpc.cc (class Track_tls): New.
1924         (class Relocate, class Scan): Inherit Track_tls.
1925         (Target_powerpc::Scan::local, global): Track tls optimization
1926         and avoid creating plt entry for __tls_get_addr if all uses
1927         are optimized away.
1928         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1929
1930 2012-12-12  Alan Modra  <amodra@gmail.com>
1931
1932         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1933         Replace no_toc_optimize with toc_optimize.
1934         * output.h (Output_section::input_sections): Provide non-const variant.
1935         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1936         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1937         accessors.
1938         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1939         (class Sort_toc_sections): New.
1940         (Target_powerpc::do_finalize_sections): Sort toc sections.
1941         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1942
1943 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1944
1945         * testsuite/binary_unittest.cc (read_all): New function.
1946         (Sized_binary_test): Use it instead of ::read.
1947         * fileread.cc (do_read): Don't assume pread always reads the whole
1948         amount in a single call.
1949
1950 2012-12-10  Alan Modra  <amodra@gmail.com>
1951
1952         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1953         Set EM_PPC64 or EM_PPC here.
1954         (Target_selector_powerpc::do_recognize): Delete.
1955
1956 2012-12-10  Alan Modra  <amodra@gmail.com>
1957
1958         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1959         stub_table_.
1960         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1961
1962 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1963
1964         * testsuite/binary_unittest.cc (Sized_binary_test):
1965         Use open_descriptor rather than ::open.
1966
1967 2012-12-07  Alan Modra  <amodra@gmail.com>
1968
1969         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1970         typedef and invalid_address constant.
1971         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1972         instantiate constants.
1973
1974 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1975
1976         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1977         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1978         * aclocal.m4: Regenerate.
1979         * configure: Regenerate.
1980         * Makefile.in: Regenerate.
1981         * testsuite/Makefile.in: Regenerate.
1982
1983 2012-12-07  Alan Modra  <amodra@gmail.com>
1984
1985         * options.h (General_options): Add no_toc_optimize.
1986         * powerpc.cc (ok_lo_toc_insn): New function.
1987         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1988
1989 2012-12-06  Alan Modra  <amodra@gmail.com>
1990
1991         * options.h (General_options): Add plt_align, plt_static_chain,
1992         plt_thread_safe.  Update stub_group_size help text.
1993         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1994         for new plt_thread_safe_ var.
1995         (use_plt_offset): Correct comments.
1996         (Target_powerpc::do_relax): Look for thread creation symbols to
1997         determine default plt_thread_safe value.  Clear plt call stubs
1998         as well as branch stubs each iteration.
1999         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
2000         insn constants.
2001         (l, hi, ha, write_insn): Move earlier.
2002         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
2003         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
2004         plt stubs too.
2005         (Stub_table::update_size): Adjust.
2006         (Stub_table::prev_size, set_prev_size): Delete.
2007         (Stub_table::stub_align): Let --plt-align affect result.
2008         (Stub_table::plt_call_size): Calculate sizes for various stubs.
2009         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
2010         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
2011         (Stub_table::do_write): Support more stub variants.
2012
2013 2012-12-04  Alan Modra  <amodra@gmail.com>
2014
2015         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
2016         (Target_powerpc::do_define_standard_symbols): New function.
2017
2018 2012-12-03  Alan Modra  <amodra@gmail.com>
2019
2020         * output.h: Formatting, whitespace.
2021
2022 2012-12-03  Alan Modra  <amodra@gmail.com>
2023
2024         * layout.h (Layout::get_executable_sections): Declare.
2025         * layout.cc (Layout::get_executable_sections): New function.
2026         * arm.cc (Target_arm::group_sections): Use it.
2027         (Arm_output_section::group_sections): Delete now redundant test.
2028         * output.cc (Output_reloc::Output_reloc): Add is_relative.
2029         param to handle relative relocs.
2030         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
2031         (Output_data_reloc::add_absolute): Adjust.
2032         (Output_data_reloc::add_relative): New function.
2033         (Output_data::reset_data_size): New function.
2034         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
2035         (Output_section::set_addralign): New function.
2036         (Output_section::checkpoint_set_addralign): New function.
2037         (Output_section::clear_section_offsets_need_adjustment): New function.
2038         (Output_section::input_sections): Make public.
2039         * powerpc.cc (class Output_data_brlt_powerpc): New.
2040         (class Stub_table, class Stub_control): New.
2041         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
2042         stub_table_, set_stub_table, stub_table): New vectors and accessor
2043         functions.
2044         (Target_powerpc::do_may_relax, do_relax, push_branch,
2045         new_stub_table, stub_tables, brlt_section, group_sections,
2046         add_branch_lookup_table, find_branch_lookup_table,
2047         write_branch_lookup_table, make_brlt_section): New functions.
2048         (Target_powerpc::struct Sort_sections, class Branch_info): New.
2049         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
2050         branch_info_): New vars.
2051         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
2052         make call stubs here.
2053         (Output_data_glink): Remove all call stub handling from this class.
2054         (Target_powerpc::Scan::local, global): Save interesting branch
2055         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
2056         (Target_powerpc::do_finalize_sections): Only make reg save/restore
2057         functions on final link.
2058         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
2059         Handle long branch destinations too.
2060         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
2061         do_plt_address_for_local): Adjust lookup of plt call stubs.
2062
2063 2012-11-30  Alan Modra  <amodra@gmail.com>
2064
2065         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
2066         relocs against protected symbols when building 32-bit shared libs.
2067
2068 2012-11-30  Alan Modra  <amodra@gmail.com>
2069
2070         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
2071         param.  Call got_section() to make .got.  Update all callers
2072         and their callers and so on.
2073
2074 2012-11-30  Alan Modra  <amodra@gmail.com>
2075
2076         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
2077         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
2078         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
2079         value if it already exists.
2080
2081 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
2082
2083         PR gold/14858
2084         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
2085
2086 2012-11-14  Roland McGrath  <mcgrathr@google.com>
2087
2088         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
2089         than bfc instruction for data sandboxing.
2090
2091 2012-11-08  Alan Modra  <amodra@gmail.com>
2092
2093         * po/POTFILES.in: Regenerate.
2094
2095 2012-11-05  Alan Modra  <amodra@gmail.com>
2096
2097         * configure.ac: Apply 2012-09-10 change to config.in here.
2098         * configure: Regenerate.
2099
2100 2012-11-05  Alan Modra  <amodra@gmail.com>
2101
2102         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
2103         (struct Opd_ent): Use "Address" rather than "Offset".
2104         (Output_data_got_powerpc::got_base_offset): Return Valtype.
2105         (Target_powerpc::got_section): Make public.
2106         (Target_powerpc::scan_relocs): Move code setting symbols..
2107         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
2108         Create _SDA_BASE_ only when referenced.
2109
2110 2012-11-02  Roland McGrath  <mcgrathr@google.com>
2111
2112         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
2113         from last change.
2114
2115 2012-11-01  Roland McGrath  <mcgrathr@google.com>
2116
2117         * target.h (Sized_target::relocate_relocs): Use Elf_Off
2118         for offset_in_output_section parameter.
2119         (Sized_target::relocate_special_relocatable): Likewise.
2120         * arm.cc (Target_arm::relocate_relocs): Likewise.
2121         (Target_arm::relocate_special_relocatable): Likewise.
2122         * i386.cc (Target_i386::relocate_relocs): Likewise.
2123         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
2124         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
2125         * target-reloc.h (relocate_relocs): Likewise.
2126         * testsuite/testfile.cc (Target_test): Likewise.
2127         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
2128         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
2129
2130         * system.h: Move inclusion of <clocale> to after <libintl.h> in
2131         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
2132
2133         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
2134         parameter, which is unused in the [!F_SETFD] case.
2135
2136         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
2137         SYMNDX to off_t before comparing it to this->data_size().
2138         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
2139         * incremental.cc (Output_section_incremental_inputs::do_write):
2140         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
2141
2142         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
2143
2144 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
2145
2146         * gold.cc (Target_arm::do_adjust_elf_header): Add the
2147         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
2148         in EABI_VER5.
2149
2150 2012-10-29  Cary Coutant  <ccoutant@google.com>
2151
2152         * dwp.cc (usage): Add file and exit status parameters;
2153         add --help and --version options.
2154         (print_version): New function.
2155         (main): Add --help and --version options.
2156
2157 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2158
2159         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
2160         final_layout_sequence.txt.
2161         * testsuite/Makefile.in: Regenerated.
2162
2163 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2164
2165         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
2166         COMPILE generated by automake.
2167         (LINK1): Likewise.
2168         (CXXCOMPILE1): Likewise.
2169         (CXXLINK1): Likewise.
2170         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
2171         (LINK): Likewise.
2172         (CXXCOMPILE): Likewise.
2173         (CXXLINK): Likewise.
2174         * testsuite/Makefile.in: Regenerated.
2175
2176 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2177
2178         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
2179         on bad fwrite return.
2180
2181 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
2182
2183         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
2184         on val.
2185
2186 2012-10-23  Cary Coutant  <ccoutant@google.com>
2187
2188         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
2189         * testsuite/Makefile.in: Regenerate.
2190         * testsuite/dwp_test.h: New source file.
2191         * testsuite/dwp_test_1.cc: New source file.
2192         * testsuite/dwp_test_1.s: New source file.
2193         * testsuite/dwp_test_1.sh: New source file.
2194         * testsuite/dwp_test_1b.cc: New source file.
2195         * testsuite/dwp_test_1b.s: New source file.
2196         * testsuite/dwp_test_2.cc: New source file.
2197         * testsuite/dwp_test_2.s: New source file.
2198         * testsuite/dwp_test_2.sh: New source file.
2199         * testsuite/dwp_test_main.cc: New source file.
2200         * testsuite/dwp_test_main.s: New source file.
2201
2202 2012-10-23  Cary Coutant  <ccoutant@google.com>
2203
2204         * dwp.h: New header file.
2205         * dwp.cc: New source file.
2206         * gold.h: Move shared declarations to system.h.
2207         * system.h: New header file.
2208         * Makefile.am: Add dwp.
2209         * Makefile.in: Regenerate.
2210
2211 2012-10-23  Cary Coutant  <ccoutant@google.com>
2212
2213         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
2214         Dwarf_info_reader::read_from_pointer.
2215         (Dwarf_pubnames_table::read_header): Likewise.
2216         (Dwarf_pubnames_table::next_name): Likewise.
2217         (Dwarf_die::read_attributes): Likewise.
2218         (Dwarf_die::skip_attributes): Likewise.
2219         (Dwarf_info_reader::read_from_pointer): New function template.
2220         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
2221         (Dwarf_pubnames_table): Likewise.
2222         (Dwarf_info_reader::read_from_pointer): New function template.
2223         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
2224         Dwarf_pubnames_table ctor.
2225
2226 2012-10-23  Cary Coutant  <ccoutant@google.com>
2227
2228         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
2229         abbrev_shndx.
2230         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
2231         abbrev_shndx_.
2232         (Dwarf_info_reader::set_abbrev_shndx): New method.
2233         (Dwarf_info_reader::abbrev_shndx_): New data member.
2234
2235 2012-10-23  Cary Coutant  <ccoutant@google.com>
2236
2237         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
2238         from object, not parameters.
2239         (Dwarf_info_reader::parse): Likewise.
2240         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
2241         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
2242         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
2243         methods.
2244
2245 2012-10-23  Cary Coutant  <ccoutant@google.com>
2246
2247         * fileread.cc (Input_file::Input_file): New constructor.
2248         * fileread.h (class Input_file): Add new constructor.
2249
2250 2012-10-18  Alan Modra  <amodra@gmail.com>
2251
2252         PR gold/14727
2253         * object.cc (Relobj::is_section_name_included): Also match
2254         .sdata personality section.
2255
2256 2012-10-18  Alan Modra  <amodra@gmail.com>
2257
2258         * target-reloc.h (class Default_comdat_behavior): New, package up..
2259         (get_comdat_behaviour): ..this.
2260         (relocate_section): Add Relocate_comdat_behavior template arg,
2261         adjust code to suit.
2262         * arm.cc (Target_arm::relocate_section): Adjust to suit.
2263         (Target_arm::scan_reloc_section): Likewise.
2264         * i386.cc (Target_i386::relocate_section): Likewise.
2265         * sparc.cc (Target_sparc::relocate_section): Likewise.
2266         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
2267         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
2268         * powerpc.cc (class Relocate_comdat_behavior): New.
2269         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
2270         gold::relocate_section with new template arg.
2271
2272 2012-10-18  Alan Modra  <amodra@gmail.com>
2273
2274         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
2275         dynamic relocs for GOT_TPREL got entries, without symbol if
2276         resolving locally.
2277         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
2278         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
2279         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
2280
2281 2012-10-17  Alan Modra  <amodra@gmail.com>
2282
2283         PR gold/14726
2284         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
2285
2286 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
2287
2288         * layout.cc (Layout::include_section): Keep sections marked
2289         SHF_EXCLUDE when doing relocatable links.
2290
2291 2012-10-16  Alan Modra  <amodra@gmail.com>
2292
2293         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
2294         (Target_powerpc::do_finalize_sections): Call it.
2295         (Output_data_save_res): New class and supporting functions.
2296         (Target_powerpc::symval_for_branch): Only look up .opd entry for
2297         normal symbols defined in object files.
2298
2299 2012-10-12  Alan Modra  <amodra@gmail.com>
2300
2301         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
2302         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
2303         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
2304         section if scan_opd_relocs not yet called.
2305         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
2306
2307 2012-10-12  Alan Modra  <amodra@gmail.com>
2308
2309         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2310         add_local_ifunc_entry): Revert last change.
2311         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
2312
2313 2012-10-05  Alan Modra  <amodra@gmail.com>
2314
2315         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
2316         do_plt_address_for_global): New functions.
2317         (Output_data_got_powerpc::do_write): Don't segfault when linking
2318         statically.
2319         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
2320         add_local_ifunc_entry): Return true on adding entry..
2321         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
2322         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
2323         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
2324         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
2325         set up symbols here.
2326         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
2327         syms here.  Do so even when no .iplt.  Don't segfault when linking
2328         statically.
2329         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
2330         new variants without reloc param.
2331         (Glink_sym_ent::Glink_sym_ent): Likewise.
2332         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
2333         reloc when refs will resolve to plt call stub.
2334         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
2335         R_PPC_PLTREL24 to resolve locally.
2336         (Target_powerpc::Scan::global): Correct ifunc handling.
2337         (Target_powerpc::Relocate::relocate): Correct local sym glink
2338         lookup.  Don't destroy "value" when we have a plt call stub,
2339         and when checking plt call validity.
2340         (Target_powerpc::do_dynsym_value): Simplify.
2341
2342 2012-10-05  Alan Modra  <amodra@gmail.com>
2343
2344         * i386.cc (Output_data_plt_i386::address_for_global,
2345         address_for_local): Add plt offset to returned value.  Adjust uses.
2346         * sparc.cc (Output_data_plt_sparc::address_for_global,
2347         address_for_local): Likewise.
2348         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
2349         address_for_local): Likewise.
2350         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
2351         address_for_local): Likewise.
2352         * target.h (Target::plt_address_for_global, plt_address_for_local):
2353         Update comment.
2354         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
2355         (Output_data_got::Got_entry::write): Nor here.
2356         * output.h: Comment fix.
2357
2358 2012-10-02  Jiong Wang  <jiwang@tilera.com>
2359
2360         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
2361         global_offset_table_ value for larget got.
2362         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
2363
2364 2012-09-29  Alan Modra  <amodra@gmail.com>
2365
2366         * powerpc.cc (Target_powerpc::iplt_): New output section.
2367         (Target_powerpc::iplt_section, make_iplt_section,
2368         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
2369         (Target_powerpc::make_plt_entry): Handle ifunc syms.
2370         Target_powerpc::plt_entry_count): Count iplt entries too.
2371         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
2372         reloc section in constructor.  New params.
2373         (Target_powerpc::make_plt_section): Create reloc section here instead.
2374         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
2375         functions.
2376         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
2377         (Output_data_glink::add_entry, find_entry): New functions to
2378         deal with local syms.
2379         (Glink_sym_ent): Add support for local syms.
2380         (Output_data_glink::do_write): Handle ifunc plt entries.
2381         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2382         (Target_powerpc::Scan::local, global): Handle ifunc syms.
2383         (Target_powerpc::Relocate::relocate): Likewise.
2384         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
2385
2386 2012-09-25  Alan Modra  <amodra@gmail.com>
2387
2388         * object.h (Sized_relobj_file::adjust_local_symbol,
2389         do_adjust_local_symbol): New functions.
2390         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
2391         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
2392         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
2393         and irregular opd entry spacing.
2394         (Powerpc_relobj::do_read_relocs): Add opd size checks.
2395         (Global_symbol_visitor_opd): New functor.
2396         (Target_powerpc::do_finalize_sections): Omit global symbols defined
2397         on deleted opd entries.
2398
2399 2012-09-15  Jiong Wang  <jiwang@tilera.com>
2400
2401         * tilegx.cc: New file.
2402         * Makefile.am (TARGETSOURCES): Add tilegx.cc
2403         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
2404         * configure.tgt: Add entries for tilegx*.
2405         * configure.ac: Likewise.
2406         * Makefile.in: Rebuild.
2407         * configure: Likewise.
2408         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
2409         tilegx.
2410
2411 2012-09-13  Alan Modra  <amodra@gmail.com>
2412
2413         * target-reloc.h (scan_relocs): Call scan.local for relocs
2414         against symbols in discarded sections.  Pass is_discarded
2415         param.
2416         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
2417         Add is_discarded param.
2418         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
2419         is_discarded to flag opd entry as discarded.  Don't emit dyn
2420         relocs on such entries.
2421         (Target_powerpc::Scan::global): Similarly detect and handle
2422         such opd entries.
2423         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
2424         opd_ent_.  Update all uses.
2425         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
2426         (Target_powerpc::relocate_section): Zero out discarded opd
2427         entry relocs.
2428
2429 2012-09-12  Ian Lance Taylor  <iant@google.com>
2430
2431         PR gold/14570
2432         * output.cc: Rename Output_data_got template parameter from size
2433         to got_size for all functions.  Compile all variants of
2434         Output_data_got.
2435         (Output_data_got::Got_entry::write): Correct use of size for
2436         symbol value.  Use local_is_tls rather than casting to
2437         Sized_relobj_file.
2438         * object.h (class Object): Add local_is_tls and do_local_is_tls.
2439         (class Sized_relobj_file): Add do_local_is_tls.
2440         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
2441
2442 2012-09-11  Alan Modra  <amodra@gmail.com>
2443
2444         PR gold/14566
2445         * layout.cc (Layout::set_segment_offsets): When using
2446         common-page-size alignment, ensure we are on a new max-page-size
2447         page.
2448         * output.cc (Output_segment::set_section_addresses): Use
2449         abi_pagesize, not common_pagesize for relro boundary.
2450         (Output_segment::set_offset): Likewise.
2451
2452 2012-09-11  Alan Modra  <amodra@gmail.com>
2453
2454         * output.h (Output_data_got::add_global_tls, add_local_tls,
2455         add_local_tls_pair): New functions.
2456         (Output_data_got::add_local_pair_with_rel): Remove second
2457         reloc param.  Expand comment.
2458         (Output_data_got::Got_entry): Rename use_plt_offset_ to
2459         use_plt_or_tls_offset_, similarly for constructor param.
2460         (Output_data_got::Got_entry::write): Add got_index param.
2461         * output.cc (Output_data_got::add_global_tls, add_local_tls,
2462         add_local_tls_pair): New functions.
2463         (Output_data_got::Got_entry::write): Handle tls symbols
2464         with use_plt_or_tls_offset_ set specially.
2465         (Output_data_got::add_local_pair_with_rel): Only one reloc.
2466         (Output_data_got::do_write): Replace iterator with index, pass
2467         index to entry write function.
2468         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
2469         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
2470         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
2471         call.
2472         * i386.cc (Target_i386::Scan::local): Likewise.
2473         * sparc.cc (Target_sparc::Scan::local): Likewise.
2474         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
2475         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
2476         do_tls_offset_for_global): New functions.
2477         (Target_powerpc::Scan::local): Correct TLS relocations and got
2478         entry values.
2479         (Target_powerpc::Scan::global): Don't emit unnecessary
2480         dynamic relocations on TLS GOT entries.
2481
2482 2012-09-10  Matthias Klose  <doko@ubuntu.com>
2483
2484         * config.in: Disable sanity check for kfreebsd.
2485
2486 2012-09-10  Sterling Augustine  <saugustine@google.com>
2487
2488         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
2489         (Gdb_index::pubtypes_read): New parameter.
2490         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
2491         to calls.
2492         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
2493         pubtypes_object_.
2494
2495 2012-09-09  Alan Modra  <amodra@gmail.com>
2496
2497         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
2498         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
2499         * gc.h (gc_process_relocs): Call target gc_add_reference.
2500         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
2501         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
2502         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
2503         unnecessary cast.
2504         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
2505         to cater for when we don't need code offset.  Update use.
2506         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
2507         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
2508         set_opd_valid): New functions.
2509         (Target_powerpc::do_gc_add_reference): New function.
2510         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
2511         stashed refs.
2512         (Target_powerpc::do_gc_mark_symbol): New function.
2513
2514 2012-09-06  Cary Coutant  <ccoutant@google.com>
2515
2516         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
2517         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
2518         (Dwarf_die::skip_attributes): Likewise.
2519         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
2520         * testsuite/gdb_index_test.cc (inline_func_1): New function.
2521         (main): Call it.
2522         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
2523
2524 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
2525
2526         * testsuite/script_test_3.t: Add .got.plt output section
2527         statement.
2528         * testsuite/script_test_4.t: Likewise.
2529
2530 2012-09-05  Alan Modra  <amodra@gmail.com>
2531
2532         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
2533         update all uses and lose "enum" when using type.
2534
2535 2012-09-05  Alan Modra  <amodra@gmail.com>
2536
2537         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
2538         * configure: Regenerate.
2539         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
2540         (plugin_final_layout.stdout): Likewise.
2541         (memory_test): Set page sizes to 0x1000.
2542         * testsuite/Makefile.in: Regenerate.
2543         * testsuite/discard_locals_test.sh: Add FIXME comment.
2544         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
2545         * testsuite/pr14265.t: Add .got output section statement.
2546         * testsuite/script_test_2.t: Likewise.
2547         * testsuite/script_test_3.t: Likewise.
2548         * testsuite/script_test_4.t: Likewise.
2549         * testsuite/script_test_5.t: Likewise.
2550         * testsuite/script_test_6.t: Likewise.
2551         * testsuite/script_test_7.t: Likewise.
2552         * testsuite/script_test_9.t: Likewise.
2553
2554 2012-09-05  Alan Modra  <amodra@gmail.com>
2555
2556         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
2557         (Powerpc_relocate_functions::Status): New typedef.
2558         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2559         (Target_powerpc::Scan::local): Handle REL64.
2560         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
2561         for REL32 and REL64.
2562         (Target_powerpc::symval_for_branch): New function, extracted from..
2563         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
2564         checks.  Report overflow errors.
2565
2566 2012-09-05  Alan Modra  <amodra@gmail.com>
2567
2568         * object.h (Sized_relobj_file::emit_relocs): Delete.
2569         (Sized_relobj_file::emit_relocs_reltype): Delete.
2570         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
2571         relocate_relocs for --emit-relocs.
2572         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
2573         * output.h: Update comment.
2574         (Output_segment::first_section): New function.
2575         (Output_segment::first_section_load_address): Use first_section.
2576         * output.cc (Output_segment::first_section): New function extracted..
2577         (Output_segment::first_section_load_address): ..from here.  Delete.
2578         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
2579         * target.h (Sized_target::relocate_for_relocatable): Likewise.
2580         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
2581         adjust call to target.h function.
2582         * i386.cc (Target_i386): Likewise.
2583         * sparc.cc (Target_sparc): Likewise.
2584         * x86_64.cc (Target_x86_64): Likewise.
2585         * powerpc.cc (Target_powerpc): Likewise.
2586         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
2587         first tls section has section symbol for optimised local dynamic
2588         output relocs.
2589         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
2590         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
2591         optimised tls code.
2592         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
2593         Rename to relocate_relocs.  Update error message.
2594
2595 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
2596
2597         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
2598         --just-symbols.
2599
2600 2012-08-31  Alan Modra  <amodra@gmail.com>
2601
2602         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
2603         (Powerpc_relobj::toc_base_offset): New stub function.
2604         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
2605         got_mod_index_offset to tlsld_got_offset.  Update all refs.
2606         (Target_powerpc::Relocate::enum skip_tls): New.
2607         (Target_powerpc::call_tls_get_addr_): New var.
2608         (Target_powerpc::is_branch_reloc): Move to file scope.
2609         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
2610         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
2611         New functions.
2612         (Target_powerpc::enum Got_type): Delete old values, add new ones.
2613         (powerpc_info): Correct common_pagesize for ppc64.
2614         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
2615         (Powerpc_relocate_functions): Add overflow check enums and functions.
2616         Add non-shift version of rela, rela_ua.  Delete all rel public
2617         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
2618         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
2619         addr16_ha3, addr14 functions.
2620         (Output_data_got_powerpc::add_constant_pair): New function.
2621         (Output_data_got_powerpc::got_base_offset): Likewise.
2622         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
2623         (instruction constants): Sort, add some more.
2624         (Output_data_glink::do_write): Add and use Address typedef.  Use
2625         object->toc_base_offset() stub for 64-bit.
2626         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
2627         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
2628         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
2629         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
2630         Always treat .opd relocs as against locally defined symbol.
2631         Correct condition for RELATIVE relocs.
2632         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2633         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2634         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2635         calculations.  Handle TLS relocs, and more.  Add overflow
2636         checking and adjust for Powerpc_relocate_functions changes.
2637         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2638         Reinstate --emit-relocs code with FIXME.
2639
2640 2012-08-30  Alan Modra  <amodra@gmail.com>
2641
2642         * layout.cc (Layout::set_segment_offsets): Set p_align to
2643         abi_pagesize, not common_pagesize.
2644         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2645         to determine whether file header can go in segment.
2646
2647 2012-08-30  Alan Modra  <amodra@gmail.com>
2648
2649         * output.h (Output_reloc::Output_reloc <output section>): Add
2650         is_relative param.  Adjust calls.
2651         (Output_reloc::add_output_section_relative): New functions.
2652         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2653         is_relative.
2654         (Output_reloc::symbol_value): Handle SECTION_CODE.
2655
2656 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2657
2658         * gold.cc (queue_middle_tasks): Call layout again when unique
2659         segments for sections is desired.
2660         * layout.cc (Layout::Layout): Initialize new members.
2661         (Layout::get_output_section_flags): New function.
2662         (Layout::choose_output_section): Call get_output_section_flags.
2663         (Layout::layout): Make output section for mapping to a unique segment.
2664         (Layout::insert_section_segment_map): New function.
2665         (Layout::attach_allocated_section_to_segment): Make unique segment for
2666         output sections marked so.
2667         (Layout::segment_precedes): Check for unique segments when sorting.
2668         * layout.h (Layout::Unique_segment_info): New struct.
2669         (Layout::Section_segment_map): New typedef.
2670         (Layout::insert_section_segment_map): New function.
2671         (Layout::get_output_section_flags): New function.
2672         (Layout::is_unique_segment_for_sections_specified): New function.
2673         (Layout::set_unique_segment_for_sections_specified): New function.
2674         (Layout::unique_segment_for_sections_specified_): New member.
2675         (Layout::section_segment_map_): New member.
2676         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2677         Rename is_gc_pass_one to is_pass_one.
2678         Rename is_gc_pass_two to is_pass_two.
2679         Rename is_gc_or_icf to is_two_pass.
2680         Check for which pass based on whether symbols data is present.
2681         Make it two pass when unique segments for sections is desired.
2682         * output.cc (Output_section::Output_section): Initialize new
2683         members.
2684         * output.h (Output_section::is_unique_segment): New function.
2685         (Output_section::set_is_unique_segment): New function.
2686         (Output_section::is_unique_segment_): New member.
2687         (Output_section::extra_segment_flags): New function.
2688         (Output_section::set_extra_segment_flags): New function.
2689         (Output_section::extra_segment_flags_): New member.
2690         (Output_section::segment_alignment): New function.
2691         (Output_section::set_segment_alignment): New function.
2692         (Output_section::segment_alignment_): New member.
2693         (Output_segment::Output_segment): Initialize is_unique_segment_.
2694         (Output_segment::is_unique_segment): New function.
2695         (Output_segment::set_is_unique_segment): New function.
2696         (Output_segment::is_unique_segment_): New member.
2697         * plugin.cc (allow_unique_segment_for_sections): New function.
2698         (unique_segment_for_sections): New function.
2699         (Plugin::load): Add new functions to transfer vector.
2700         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2701         * Makefile.in: Regenerate.
2702         * testsuite/plugin_final_layout.sh: Check if unique segment
2703         functionality works.
2704         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2705         are available.
2706         (allow_unique_segment_for_sections): New global.
2707         (unique_segment_for_sections): New global.
2708         (claim_file_hook): Call allow_unique_segment_for_sections.
2709         (all_symbols_read_hook): Call unique_segment_for_sections.
2710
2711 2012-08-22  Cary Coutant  <ccoutant@google.com>
2712
2713         * layout.cc (Layout::include_section): Don't assert on GROUP
2714         sections with --emit-relocs.
2715
2716 2012-08-21  Cary Coutant  <ccoutant@google.com>
2717
2718         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2719         if --export-dynamic-symbol names an undef symbol.
2720
2721 2012-08-18  Alan Modra  <amodra@gmail.com>
2722
2723         * powerpc.cc: Formatting and white space.
2724         (Powerpc_relobj): Rename got2_section_ to special_.
2725         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2726         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2727         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2728         (Target_powerpc): Add Address typedef and invalid_address.  Use
2729         throughout.
2730         (Target_powerpc::is_branch_reloc): New function.
2731         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2732         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2733         for dst_mask, value and addend.
2734         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2735         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2736         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2737         uint16_t for 24-bit offset.  Use get_output_section_offset and
2738         check return.
2739         (Target_powerpc::Scan::local): Handle more relocs.
2740         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2741         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2742         Plug in toc restoring insn after plt calls.  Translate branches
2743         to function descriptor symbols to corresponding entry point.
2744         (Target_powerpc::relocate_for_relocatable): Check return from
2745         get_output_section_offset.
2746         * symtab.h: Comment typo.
2747
2748 2012-08-14  Ian Lance Taylor  <iant@google.com>
2749
2750         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2751         unsupported_relocal_local to call unsupported_reloc_global.
2752
2753 2012-08-14  Nick Clifton  <nickc@redhat.com>
2754
2755         PR ld/14265
2756         * script-sections.cc (Sections_element::output_section_name): Add
2757         keep return parameter.
2758         (Output_section_element::match_name): Add keep return parameter.
2759         Return the value of the keep_ member.
2760         * script-sections.h (class Output_section): Update
2761         output_section_name prototype.
2762         * layout.cc (Layout::keep_input_section): New public member
2763         function.
2764         (Layout::choose_output_section): Pass keep parameter to
2765         output_section_name.
2766         * layout.h (class Layout): Add keep_input_section.
2767         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2768         sections.
2769         * testsuite/Makefile.am: Add a test.
2770         * testsuite/Makefile.in: Regenerate.
2771         * testsuite/pr14265.c: Source file for the test.
2772         * testsuite/pr14265.t: Linker script for the test.
2773         * testsuite/pr14265.sh: Shell script for the test.
2774
2775 2012-08-14  Alan Modra  <amodra@gmail.com>
2776
2777         * target.h (Target::output_section_name): New function.
2778         (Target::do_output_section_name): New function.
2779         * layout.cc (Layout::choose_output_section): Call the above.
2780         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2781
2782 2012-08-14  Alan Modra  <amodra@gmail.com>
2783
2784         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2785         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2786         for replace_constant call.
2787         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2788         (Output_data_glink::do_print_to_mapfile): New function.
2789         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2790         (Target_powerpc::Relocate::relocate): Likewise.
2791
2792 2012-08-14  Alan Modra  <amodra@gmail.com>
2793
2794         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2795         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2796         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2797         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2798         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2799         here.
2800         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2801         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2802         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2803         here.
2804         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2805         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2806
2807 2012-08-12  Alan Modra  <amodra@gmail.com>
2808
2809         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2810         (glink insn constants): Use uint32_t.
2811         (Output_data_glink::add_entry): Use insert, not [] operator.
2812
2813 2012-08-11  Alan Modra  <amodra@gmail.com>
2814
2815         * object.h (Sized_relobj_file::find_shdr): New function.
2816         (Sized_relobj_file::find_special_sections): New function.
2817         * object.cc (Sized_relobj_file::find_shdr): New function.
2818         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2819         (Sized_relobj_file::find_special_sections): New function, split out..
2820         (Sized_relobj_file::do_read_symbols): ..from here.
2821         * output.h (Output_data_got::replace_constant): New function.
2822         (Output_data_got::num_entries): New function.
2823         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2824         (Output_data_got::got_offset): Protected rather than private.
2825         (Output_data_got::replace_got_entry): New function.
2826         * output.cc (Output_data_got::replace_got_entry): New function.
2827         * powerpc.cc (class Powerpc_relobj): New.
2828         (class Powerpc_relocate_functions): Delete all psymval variants or
2829         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2830         Implement _ha functions using corresponding _hi function.
2831         (Powerpc_relobj::find_special_sections): New function.
2832         (Target_powerpc::do_make_elf_object): New function.
2833         (class Output_data_got_powerpc): New.
2834         (class Output_data_glink): New.
2835         (class Powerpc_scan_relocatable_reloc): New.
2836         Many more changes througout file.
2837
2838 2012-08-09  Nick Clifton  <nickc@redhat.com>
2839
2840         * po/vi.po: Updated Vietnamese translation.
2841
2842 2012-08-07  Ian Lance Taylor  <iant@google.com>
2843
2844         * layout.cc (Layout::add_target_dynamic_tags): If
2845         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2846         plt_rel.
2847
2848 2012-07-30  Nick Clifton  <nickc@redhat.com>
2849
2850         * po/gold.pot: Updated template.
2851         * po/es.po: Updated Spanish translation.
2852
2853 2012-07-18  Cary Coutant  <ccoutant@google.com>
2854
2855         PR gold/14344
2856         * configure.ac: Add check for -gpubnames support.
2857         * configure: Regenerate.
2858         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2859         support; force -gno-pubnames.
2860         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2861         support.
2862         (gdb_index_test_4): New test.
2863         * testsuite/Makefile.in: Regenerate.
2864         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2865         * testsuite/gdb_index_test_2.sh: Likewise.
2866         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2867         * testsuite/gdb_index_test_4.sh: New script.
2868         * testsuite/gdb_index_test_comm.sh: New script with common code;
2869         don't look for space after colon.
2870
2871 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2872
2873         * gold.cc (queue_middle_tasks): Update function order only after
2874         deferred objects due to plugins are processed.
2875
2876 2012-07-11  Ian Lance Taylor  <iant@google.com>
2877
2878         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2879         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2880         (Target_arm::scan_reloc_for_stub): Likewise.
2881         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2882         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2883         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2884         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2885         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2886
2887 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2888             Ian Lance Taylor  <iant@google.com>
2889
2890         PR gold/14309
2891         * configure.ac: Test whether std::tr1::hash<off_t> works.
2892         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2893         needed.
2894         * output.h (class Output_fill): Add virtual destructor.
2895         * configure, config.in: Rebuild.
2896
2897 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2898
2899         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2900
2901 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2902
2903         * plugin.cc (Plugin::load): Handle position independent executables.
2904
2905 2012-06-06  Cary Coutant  <ccoutant@google.com>
2906
2907         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2908         add .debug_macro.
2909         (lines_only_debug_sections): Likewise.
2910         (gdb_fast_lookup_sections): New static array.
2911         (is_gdb_debug_section): Rename formal parameter.
2912         (is_lines_only_debug_section): Likewise.
2913         (is_gdb_fast_lookup_section): New function.
2914         (Layout::include_section): Check for ".zdebug_" prefix; pass
2915         section name suffix to is_gdb_debug_section, et al.; check for
2916         fast-lookup sections when building .gdb_index.
2917         * options.h (--strip-debug-gdb): Update GDB version number.
2918
2919 2012-06-06  Cary Coutant  <ccoutant@google.com>
2920
2921         * configure.ac: Add check for fallocate.
2922         * configure: Regenerate.
2923         * config.in: Regenerate.
2924
2925         * options.h (class General_options): Add --mmap-output-file and
2926         --posix-fallocate options.
2927         * output.cc: (posix_fallocate): Remove; replace with...
2928         (gold_fallocate): New function.
2929         (Output_file::map_no_anonymous): Call gold_fallocate.
2930         (Output_file::map): Check --mmap-output-file option.
2931
2932 2012-06-05  Jing Yu  <jingyu@google.com>
2933
2934         * gold.h (textdomain): Add do {} to empty while(0).
2935         (bindtextdomain): Likewise.
2936
2937 2012-06-04  Cary Coutant  <ccoutant@google.com>
2938
2939         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2940         has_dynsym_index.
2941
2942 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2943
2944         * symtab.cc (Symbol_table::define_special_symbol):
2945         Initialize *poldsym to prevent uninitialized variable errors.
2946
2947 2012-05-23  Cary Coutant  <ccoutant@google.com>
2948
2949         * layout.cc (Layout::section_name_mapping): Add rules to handle
2950         exact match on .data.rel.ro.local or .data.rel.ro.
2951         (Layout::output_section_name): Check for exact matches.
2952
2953 2012-05-23  Cary Coutant  <ccoutant@google.com>
2954
2955         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2956         more carefully.
2957
2958 2012-05-22  Cary Coutant  <ccoutant@google.com>
2959
2960         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2961         object before exporting symbol.
2962
2963 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2964
2965         * testsuite/tls_test.cc: Include "config.h" first.
2966         * testsuite/tls_test_c.c: Likewise.
2967
2968 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2969             Nick Clifton  <nickc@redhat.com>
2970
2971         PR 14072
2972         * configure.in: Add check that sysdep.h has been included before
2973         any system header files.
2974         * configure: Regenerate.
2975         * config.in: Regenerate.
2976
2977 2012-05-14  Cary Coutant  <ccoutant@google.com>
2978
2979         * layout.cc (Layout::make_output_section): Mark .tdata section
2980         as RELRO.
2981         * testsuite/relro_test.cc: Add a TLS variable.
2982
2983 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2984
2985         PR gold/14091
2986         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2987         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2988         R_X86_64_64.
2989
2990 2012-05-08  Cary Coutant  <ccoutant@google.com>
2991
2992         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2993         (lines_only_debug_sections): Likewise.
2994
2995 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2996
2997         * nacl.cc: New file.
2998         * nacl.h: New file.
2999         * Makefile.am (CCFILES, HFILES): Add them.
3000         * Makefile.in: Regenerate.
3001         * i386.cc (Output_data_plt_i386_nacl): New class.
3002         (Output_data_plt_i386_nacl_exec): New class.
3003         (Output_data_plt_i386_nacl_dyn): New class.
3004         (Target_i386_nacl): New class.
3005         (Target_selector_i386_nacl): New class.
3006         (target_selector_i386): Use it instead of Target_selector_i386.
3007         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
3008         (Target_x86_64_nacl): New class.
3009         (Target_selector_x86_64_nacl): New class.
3010         (target_selector_x86_64, target_selector_x32): Use it instead of
3011         Target_selector_x86_64.
3012         * arm.cc (Output_data_plt_arm_nacl): New class.
3013         (Target_arm_nacl): New class.
3014         (Target_selector_arm_nacl): New class.
3015         (target_selector_arm, target_selector_armbe): Use it instead of
3016         Target_selector_arm.
3017
3018         * target-select.cc (select_target): Take new Input_file* and off_t
3019         arguments, pass them on to recognize method of selector.
3020         * object.cc (make_elf_sized_object): Update caller.
3021         * parameters.cc (parameters_force_valid_target): Likewise.
3022         * incremental.cc (make_sized_incremental_binary): Likewise.
3023         * target-select.h: Update decl.
3024         (Target_selector::recognize): Take new Input_file* argument,
3025         pass it on to do_recognize.
3026         (Target_selector::do_recognize): Take new Input_file* argument.
3027         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
3028         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
3029         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
3030         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
3031
3032         * target.h (Target::Target_info): New members isolate_execinstr
3033         and rosegment_gap.
3034         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
3035         * arm.cc (Target_arm::arm_info): Update initializer.
3036         * i386.cc (Target_i386::i386_info): Likewise.
3037         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
3038         * sparc.cc (Target_sparc::sparc_info): Likewise.
3039         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
3040         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
3041         * layout.cc (Layout::attach_allocated_section_to_segment):
3042         Take new const Target* argument.  If target->isolate_execinstr(), act
3043         like --rosegment.
3044         (Layout::find_first_load_seg): Take new const Target* argument;
3045         if target->isolate_execinstr(), reject PF_X segments.
3046         (Layout::relaxation_loop_body): Update caller.
3047         (Layout::set_segment_offsets): If target->isolate_execinstr(),
3048         reset file offset to zero when we hit LOAD_SEG, and then do a second
3049         loop over the segments before LOAD_SEG to reassign offsets after
3050         addresses have been determined.  Handle target->rosegment_gap().
3051         (Layout::attach_section_to_segment): Take new const Target* argument;
3052         pass it to attach_allocated_section_to_segment.
3053         (Layout::make_output_section): Update caller.
3054         (Layout::attach_sections_to_segments): Take new const Target* argument;
3055         pass it to attach_section_to_segment.
3056         * gold.cc (queue_middle_tasks): Update caller.
3057         * layout.h (Layout): Update method decls with new arguments.
3058
3059         * arm.cc (Target_arm::Target_arm): Take optional argument for the
3060         Target_info pointer to use.
3061         (Target_arm::do_make_data_plt): New virtual method.
3062         (Target_arm::make_data_plt): New method that calls it.
3063         (Target_arm::make_plt_entry): Use it.
3064         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
3065         for the section alignment.
3066         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
3067         method.
3068         (Output_data_plt_arm::first_plt_entry_offset): Call it.
3069         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
3070         method.
3071         (Output_data_plt_arm::get_plt_entry_size): Call it.
3072         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
3073         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
3074         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
3075         method.
3076         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
3077         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
3078         method instead of sizeof(plt_entry).
3079         (Output_data_plt_arm::add_entry): Likewise.
3080         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
3081         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
3082         than static method.
3083         (Target_arm::plt_entry_size): Likewise.
3084         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
3085         Move to ...
3086         (Output_data_plt_arm_standard): ... here, new class.
3087         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
3088         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
3089         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
3090
3091         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
3092         Take additional argument for the PLT entry size.
3093         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
3094         Use get_plt_entry_size method rather than plt_entry_size variable.
3095         (Output_data_plt_x86_64::reserve_slot): Likewise.
3096         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
3097         (Output_data_plt_x86_64::add_entry): Likewise.
3098         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
3099         (Output_data_plt_x86_64::address_for_global): Likewise.
3100         (Output_data_plt_x86_64::address_for_local): Likewise.
3101         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3102         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
3103         Make method non-static.
3104         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
3105         method.
3106         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
3107         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
3108         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
3109         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
3110         virtual method.
3111         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
3112         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
3113         virtual method.
3114         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
3115         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
3116         virtual method.
3117         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
3118         (Output_data_plt_x86_64::plt_entry_size)
3119         (Output_data_plt_x86_64::first_plt_entry)
3120         (Output_data_plt_x86_64::plt_entry)
3121         (Output_data_plt_x86_64::tlsdesc_plt_entry)
3122         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
3123         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
3124         (Output_data_plt_x86_64_standard): ... here, new class.
3125         (Target_x86_64::Target_x86_64): Take optional argument for the
3126         Target_info pointer to use.
3127         (Target_x86_64::do_make_data_plt): New virtual method.
3128         (Target_x86_64::make_data_plt): New method to call it.
3129         (Target_x86_64::init_got_plt_for_update): Use that.
3130         Call this->plt_->add_eh_frame method here.
3131         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
3132         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
3133         rather than static method.
3134         (Target_x86_64::plt_entry_size): Likewise.
3135         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
3136         rather than plt_entry_size variable.  Move guts of PLT filling to...
3137         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
3138         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
3139         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
3140
3141         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
3142         additional argument for the section alignment.
3143         Don't do add_eh_frame_for_plt here.
3144         (Output_data_plt_i386::first_plt_entry_offset): Make the method
3145         non-static.  Use get_plt_entry_size method rather than plt_entry_size
3146         variable.
3147         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
3148         method.
3149         (Output_data_plt_i386::get_plt_entry_size): Call it.
3150         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
3151         (Output_data_plt_i386::add_eh_frame): New method to call it.
3152         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
3153         method.
3154         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
3155         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
3156         method.
3157         (Output_data_plt_i386::fill_plt_entry): New method to call it.
3158         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
3159         method instead of plt_entry_size.
3160         (Output_data_plt_i386::plt_entry_size)
3161         (Output_data_plt_i386::plt_eh_frame_fde_size)
3162         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
3163         (Output_data_plt_i386_standard): ... here, new class.
3164         (Output_data_plt_i386_exec): New class.
3165         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
3166         (Output_data_plt_i386_exec::first_plt_entry): ... here.
3167         (Output_data_plt_i386::exec_plt_entry): Move to ...
3168         (Output_data_plt_i386_exec::plt_entry): ... here.
3169         (Output_data_plt_i386_dyn): New class.
3170         (Output_data_plt_i386::first_plt_entry): Move to ...
3171         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
3172         (Output_data_plt_i386::dyn_plt_entry): Move to ...
3173         (Output_data_plt_i386_dyn::plt_entry): ... here.
3174         (Target_i386::Target_i386): Take optional argument for the Target_info
3175         pointer to use.
3176         (Target_i386::do_make_data_plt): New virtual method.
3177         (Target_i386::make_data_plt): New method to call it.
3178         (Target_i386::make_plt_section): Use that.
3179         Call this->plt_->add_eh_frame method here.
3180         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
3181         rather than plt_entry_size variable.
3182         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
3183         (Output_data_plt_i386::address_for_local): Likewise.
3184         (Output_data_plt_i386::do_write): Likewise.
3185         Move guts of PLT filling to...
3186         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
3187         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
3188         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
3189         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
3190
3191 2012-05-01  Cary Coutant  <ccoutant@google.com>
3192
3193         * dwarf_reader.cc (Dwarf_die::read_attributes)
3194         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
3195         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
3196         * reduced_debug_output.cc
3197         (Output_reduced_debug_info_section::get_die_end): Remove
3198         DW_FORM_GNU_ref_index.  Add default case.
3199
3200 2012-04-26  Mark Wielaard  <mjw@redhat.com>
3201
3202         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
3203         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
3204         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
3205         DW_AT_high_pc as offset from DW_AT_low_pc.
3206
3207         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
3208         * testsuite/Makefile.in: Regenerate.
3209         * testsuite/gdb_index_test_3.c: New test source file.
3210         * testsuite/gdb_index_test_3.sh: New test source file.
3211
3212 2012-04-25  Ian Lance Taylor  <iant@google.com>
3213
3214         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
3215         pointer.
3216         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
3217         as a class, not a struct.
3218         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
3219         (Target_arm::apply_cortex_a8_workaround): Likewise.
3220         * gc.h: Declare Reloc_types as a struct, not a class.
3221         * object.h: Declare Symbols_data as a struct.
3222         * reloc.h: Declare Read_relocs_data as a struct.
3223         * target.h: Declare Relocate_info as a struct.
3224
3225 2012-04-24  David S. Miller  <davem@davemloft.net>
3226
3227         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
3228         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
3229         and R_SPARC_WPLT30.
3230
3231 2012-04-24  Cary Coutant  <ccoutant@google.com>
3232
3233         * incremental-dump.cc (find_input_containing_global): Replace
3234         magic number with symbolic constant.
3235         (dump_incremental_inputs): Update version number.
3236         * incremental.cc (Output_section_incremental_inputs): Update version
3237         number; import symbolic constants from Incremental_inputs_reader.
3238         (Incremental_inputs::create_data_sections): Align relocations
3239         section correctly for 64-bit targets.
3240         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
3241         constants; add padding.
3242         (Output_section_incremental_inputs::write_header): Add assert for
3243         header_size.
3244         (Output_section_incremental_inputs::write_input_files): Add assert
3245         for input_entry_size.
3246         (Output_section_incremental_inputs::write_info_blocks): Add padding;
3247         add assert for object_info_size, input_section_entry_size,
3248         global_sym_entry_size.
3249         * incremental.h (Incremental_inputs_reader): Add symbolic constants
3250         for data structure sizes; use them.
3251         (Incremental_input_entry_reader): Import symbolic constants from
3252         Incremental_inputs_reader; use them.
3253
3254 2012-04-23  David S. Miller  <davem@davemloft.net>
3255
3256         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
3257         and elf_flags_set_.
3258         (Target_sparc::Target_sparc): Initialize new fields.
3259         (Target_sparc::do_make_elf_object): New function.
3260         (Target_sparc::do_adjust_elf_header): New function.
3261
3262 2012-04-23  Cary Coutant  <ccoutant@google.com>
3263
3264         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
3265         CU range table of gdb index.
3266
3267 2012-04-20  David S. Miller  <davem@davemloft.net>
3268
3269         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
3270         instead of false.
3271
3272 2012-04-16  David S. Miller  <davem@davemloft.net>
3273
3274         * sparc.cc (Target_sparc::got_address): New function.
3275         (Sparc_relocate_functions::gdop_hix22): New function.
3276         (Sparc_relocate_functions::gdop_lox10): New function.
3277         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
3278         relocs.
3279         (Target_sparc::Scan::local): Likewise if the global symbol is not
3280         preemptible and is not IFUNC.
3281         (Target_sparc::Relocate::relocate): Perform GOTDATA code
3282         transformations for local and non-preemptible non-IFUNC global
3283         symbols.
3284
3285         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
3286         writing out 64-bit part of ranges.
3287
3288         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
3289         -fpic and -fpie respectively.
3290         * Makefile.in: Regenerate.
3291
3292         * sparc.cc (class Target_sparc): Add rela_ifunc_.
3293         (Target_sparc::Target_sparc): Initialize new field.
3294         (Target_sparc::do_plt_section_for_global): New function.
3295         (Target_sparc::do_plt_section_for_local): New function.
3296         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
3297         (Target_sparc::make_plt_section): New function, broken out of
3298         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
3299         (Target_sparc::make_plt_entry): Call make_plt_section.
3300         (Target_sparc::make_local_ifunc_plt_entry): New function.
3301         (Target_sparc::rela_ifunc_section): New function.
3302         (Target_sparc::plt_section): Remove const.
3303         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
3304         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
3305         and ifunc_count_ fields.
3306         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
3307         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
3308         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
3309         (Output_data_plt_sparc::rela_ifunc): New function.
3310         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
3311         (Output_data_plt_sparc::has_ifunc_section): New function.
3312         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
3313         (Output_data_plt_sparc::address_for_global): New function.
3314         (Output_data_plt_sparc::address_for_local): New function.
3315         (Output_data_plt_sparc::plt_index_to_offset): New function.
3316         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
3317         and entry_count.
3318         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
3319         entry_count.
3320         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
3321         R_SPARC_JMP_IREL to switch.
3322         (Target_sparc::Scan::check_non_pic): Likewise.
3323         (Target_sparc::Scan::local): Handle IFUNC symbols.
3324         (Target_sparc::Scan::local): Likewise.
3325         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
3326         and plt_address_for_local.
3327         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
3328         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
3329
3330         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
3331         (class Output_data_reloc): Adjust calls to Output_reloc_type.
3332         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
3333         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
3334         global relocs too.
3335         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
3336         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
3337         calls.
3338         * sparc.cc (Target_sparc::Scan::global): Likewise.
3339         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3340
3341 2012-04-16  Cary Coutant  <ccoutant@google.com>
3342
3343         * archive.cc (Library_base::should_include_member): Check for
3344         --export-dynamic-symbol.
3345         * options.h (class General_options): Add --export-dynamic-symbol.
3346         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
3347         --export-dynamic-symbol.
3348         (Symbol_table::gc_mark_undef_symbols): Likewise.
3349         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
3350
3351 2012-04-12  David S. Miller  <davem@davemloft.net>
3352
3353         * sparc.cc (Reloc::wdisp10): New relocation method.
3354         (Reloc::h34): Likewise.
3355         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
3356         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
3357         R_SPARC_WDISP10.
3358         (Target_sparc::Scan::local): Likewise.
3359         (Target_sparc::Scan::global): Likewise.
3360         (Target_sparc::Relocate::relocate): Likewise.
3361
3362 2012-04-09  Cary Coutant  <ccoutant@google.com>
3363
3364         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
3365         low_pc == 0.
3366
3367 2012-04-06  Ian Lance Taylor  <iant@google.com>
3368
3369         * timer.cc: #include <unistd.h>.
3370
3371 2012-04-06  Roland McGrath  <mcgrathr@google.com>
3372
3373         * configure.in (AC_CHECK_HEADERS): Add locale.h.
3374         * config.in: Regenerate.
3375         * configure: Regenerate.
3376
3377 2012-04-05  Nick Clifton  <nickc@redhat.com>
3378
3379         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
3380         (AM_LC_MESSAGES): Add.
3381         * aclocal.m4: Regenerate.
3382         * config.in: Regenerate.
3383         * configure: Regenerate.
3384
3385 2012-03-21  Cary Coutant  <ccoutant@google.com>
3386
3387         * Makefile.am: Add gdb-index.cc, gdb-index.h.
3388         * Makefile.in: Regenerate.
3389         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
3390         (Sized_elf_reloc_mapper::symbol_section): New function.
3391         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
3392         (make_elf_reloc_mapper): New function.
3393         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
3394         (Dwarf_abbrev_table::do_read_abbrevs): New function.
3395         (Dwarf_abbrev_table::do_get_abbrev): New function.
3396         (Dwarf_ranges_table::read_ranges_table): New function.
3397         (Dwarf_ranges_table::read_range_list): New function.
3398         (Dwarf_pubnames_table::read_section): New function.
3399         (Dwarf_pubnames_table::read_header): New function.
3400         (Dwarf_pubnames_table::next_name): New function.
3401         (Dwarf_die::Dwarf_die): New function.
3402         (Dwarf_die::read_attributes): New function.
3403         (Dwarf_die::skip_attributes): New function.
3404         (Dwarf_die::set_name): New function.
3405         (Dwarf_die::set_linkage_name): New function.
3406         (Dwarf_die::attribute): New function.
3407         (Dwarf_die::string_attribute): New function.
3408         (Dwarf_die::int_attribute): New function.
3409         (Dwarf_die::uint_attribute): New function.
3410         (Dwarf_die::ref_attribute): New function.
3411         (Dwarf_die::child_offset): New function.
3412         (Dwarf_die::sibling_offset): New function.
3413         (Dwarf_info_reader::check_buffer): New function.
3414         (Dwarf_info_reader::parse): New function.
3415         (Dwarf_info_reader::do_parse): New function.
3416         (Dwarf_info_reader::do_read_string_table): New function.
3417         (Dwarf_info_reader::lookup_reloc): New function.
3418         (Dwarf_info_reader::get_string): New function.
3419         (Dwarf_info_reader::visit_compilation_unit): New function.
3420         (Dwarf_info_reader::visit_type_unit): New function.
3421         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
3422         Sized_elf_reloc_mapper.
3423         (Sized_dwarf_line_info::symbol_section): Remove function.
3424         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
3425         (Sized_dwarf_line_info::read_line_mappings): Remove object
3426         parameter, adjust callers.
3427         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
3428         * dwarf_reader.h: Include <sys/types.h>.
3429         (class Track_relocs): Remove forward declaration.
3430         (class Elf_reloc_mapper): New class.
3431         (class Sized_elf_reloc_mapper): New class.
3432         (class Dwarf_abbrev_table): New class.
3433         (class Dwarf_range_list): New class.
3434         (class Dwarf_ranges_table): New class.
3435         (class Dwarf_pubnames_table): New class.
3436         (class Dwarf_die): New class.
3437         (class Dwarf_info_reader): New class.
3438         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
3439         (Sized_dwarf_line_info::symbol_section): Remove member function.
3440         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
3441         base class.
3442         * gdb-index.cc: New source file.
3443         * gdb-index.h: New source file.
3444         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
3445         and .debug_types sections, call Layout::add_to_gdb_index.
3446         (Sized_relobj_incr::do_section_name): Implement.
3447         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
3448         return type; Implement.
3449         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
3450         return type.
3451         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
3452         parameter list and return type.
3453         (Sized_incr_dynobj::do_section_contents): Likewise.
3454         * layout.cc: Include gdb-index.h.
3455         (Layout::Layout): Initialize gdb_index_data_.
3456         (Layout::init_fixed_output_section): Check for .gdb_index section.
3457         (Layout::add_to_gdb_index): New function. Instantiate.
3458         * layout.h: Add forward declaration for class Gdb_index.
3459         (Layout::add_to_gdb_index): New member function.
3460         (Layout::gdb_index_data_): New data member.
3461         * main.cc: Include gdb-index.h.
3462         (main): Print statistics for gdb index.
3463         * object.cc (Object::section_contents): Move code into
3464         do_section_contents.
3465         (need_decompressed_section): Check for sections needed when building
3466         gdb index.
3467         (build_compressed_section_map): Likewise.
3468         (Sized_relobj_file::do_read_symbols): Need local symbols when building
3469         gdb index.
3470         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
3471         sections; call Layout::add_to_gdb_index.
3472         (Sized_relobj_file::do_decompressed_section_contents): Call
3473         do_section_contents directly.
3474         * object.h (Object::do_section_contents): Adjust parameter list and
3475         return type.
3476         (Object::do_decompressed_section_contents): Call do_section_contents
3477         directly.
3478         (Sized_relobj_file::do_section_contents): Adjust parameter list and
3479         return type.
3480         * options.h (class General_options): Add --gdb-index option.
3481         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
3482         list and return type.
3483         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
3484         * reloc.h (Track_relocs::checkpoint): New function.
3485         (Track_relocs::reset): New function.
3486
3487         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
3488         New test cases.
3489         * testsuite/Makefile.in: Regenerate.
3490         * testsuite/gdb_index_test.cc: New test source file.
3491         * testsuite/gdb_index_test_1.sh: New test source file.
3492         * testsuite/gdb_index_test_2.sh: New test source file.
3493
3494 2012-03-19  Doug Kwan  <dougkwan@google.com>
3495
3496         * arm.cc (Target_arm::do_define_standard_symbols): New method.
3497         (Target_arm::do_finalize_sections): Remove code which defines
3498         __exidx_start and __exidx_end.  Make symbol table parameter
3499         anonymous as it is not used.
3500         * gold.cc (queue_middle_tasks): Call target hook to define any
3501         target-specific symbols.
3502         * target.h (Target::define_standard_symbols): New method.
3503         (Target::do_define_standard_symbols): Same.
3504         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
3505         * testsuite/Makefile.in: Regenerate.
3506         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
3507         and __exidx_end.
3508         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
3509         relocations are generated for __exidx_start and __exidx_end.
3510
3511 2012-03-16  Doug Kwan  <dougkwan@google.com>
3512
3513         * testsuite/Makefile.am: Disable test initpri3b.
3514         * testsuite/Makefile.in: Regenerate.
3515
3516 2012-03-15  Doug Kwan  <dougkwan@google.com>
3517
3518         * arm.cc (Target_arm::got_section): Make .got section read-only
3519         if -z now is given.
3520
3521 2012-03-15  Ian Lance Taylor  <iant@google.com>
3522
3523         PR gold/13850
3524         * layout.cc (Layout::make_output_section): Correctly mark
3525         SHT_INIT_ARRAY, et. al., as relro.
3526
3527 2012-03-14  Doug Kwan  <dougkwan@google.com>
3528
3529         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
3530         dynamic relocations for protected symbols in shared objects.
3531
3532 2012-03-13  Ian Lance Taylor  <iant@google.com>
3533
3534         * resolve.cc (Symbol_table::resolve): When merging common symbols,
3535         keep the larger alignment.
3536
3537 2012-03-12  Cary Coutant  <ccoutant@google.com>
3538
3539         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
3540         handling of DW_LNE_define_file.
3541
3542 2012-03-12  Cary Coutant  <ccoutant@google.com>
3543
3544         * reduced_debug_output.cc
3545         (Output_reduced_debug_info_section::get_die_end): Add new FORM
3546         codes to switch.
3547
3548 2012-02-29  Cary Coutant  <ccoutant@google.com>
3549
3550         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
3551
3552 2012-02-29  Cary Coutant  <ccoutant@google.com>
3553
3554         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
3555         Call Object::decompressed_section_contents.
3556         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
3557         New dtor.
3558         (Sized_dwarf_line_info::buffer_start_): New data member.
3559         * merge.cc (Output_merge_data::do_add_input_section): Call
3560         Object::decompressed_section_contents.
3561         (Output_merge_string::do_add_input_section): Likewise.
3562         * object.cc (need_decompressed_section): New function.
3563         (build_compressed_section_map): Decompress sections needed later.
3564         (Sized_relobj_file::do_decompressed_section_contents): New function.
3565         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3566         * object.h (Object::decompressed_section_contents): New function.
3567         (Object::discard_decompressed_sections): New function.
3568         (Object::do_decompressed_section_contents): New function.
3569         (Object::do_discard_decompressed_sections): New function.
3570         (Compressed_section_info): New type.
3571         (Compressed_section_map): Include decompressed section contents.
3572         (Sized_relobj_file::do_decompressed_section_contents): New function.
3573         (Sized_relobj_file::do_discard_decompressed_sections): New function.
3574
3575 2012-02-16  Cary Coutant  <ccoutant@google.com>
3576
3577         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
3578         * testsuite/Makefile.in: Regenerate.
3579
3580 2012-02-14  Cary Coutant  <ccoutant@google.com>
3581
3582         * options.cc (General_options::finalize): Disallow -pie and -static.
3583
3584 2012-02-03  Doug Kwan  <dougkwan@google.com>
3585
3586         * arm.cc (Arm_relocate_functions::abs8,
3587         Arm_relocate_functions::abs16): Use
3588         Bits::has_signed_unsigned_overflow32.
3589         (Arm_relocate_functions::thm_abs8): Correct range of
3590         overflow check.
3591         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
3592         in assertions.
3593
3594 2012-02-02  Doug Kwan  <dougkwan@google.com>
3595
3596         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
3597         position independent outputs, not just shared objects.
3598
3599 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
3600
3601         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
3602         * configure: Regenerated.
3603
3604 2012-01-27  Ian Lance Taylor  <iant@google.com>
3605
3606         * reloc.h (Bits): New class with static functions, copied from
3607         namespace utils in arm.cc.
3608         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
3609         instead.
3610
3611 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3612
3613         * incremental.cc (write_info_blocks): Correct relocation offset.
3614
3615 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3616
3617         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
3618         (Relocate::tls_gd_to_le): Likewise.
3619
3620 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3621
3622         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
3623
3624 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
3625
3626         * configure.ac: Check if -mcmodel=medium works.
3627         * configure: Regenerated.
3628
3629 2012-01-24  Cary Coutant  <ccoutant@google.com>
3630
3631         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
3632         definition and ...
3633         (read_unsigned_LEB_128_x): ... this new function.
3634         (read_signed_LEB_128): Replaced with inline definition and ...
3635         (read_signed_LEB_128_x): ... this new function.
3636         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3637         (read_unsigned_LEB_128): Add inline definition.
3638         (read_signed_LEB_128_x): New function.
3639         (read_signed_LEB_128): Add inline definition.
3640         * testsuite/Makefile.am (leb128_unittest): New unit test.
3641         * testsuite/Makefile.in: Regenerate.
3642         * testsuite/leb128_unittest.cc: New unit test.
3643
3644 2012-01-23  Ian Lance Taylor  <iant@google.com>
3645
3646         PR gold/13617
3647         * i386.cc (Target_i386::do_code_fill): When using a jmp
3648         instruction, pad with nop instructions.
3649         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3650
3651 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3652
3653         * x86_64.cc (gc_process_relocs): Add typename on types used in
3654         template.
3655         (scan_relocs): Likewise.
3656         (relocate_section): Likewise.
3657         (apply_relocation): Likewise.
3658
3659 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3660
3661         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3662         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3663         under x32.
3664
3665 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3666
3667         * x86_64.cc: Initial support for x32.
3668
3669 2012-01-03  Cary Coutant  <ccoutant@google.com>
3670
3671         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3672         Use abstract base class for GOT.
3673         * gold/output.h (class Output_data_got_base): New abstract base class.
3674         (class Output_data_got): Derive from new base class, adjust ctors.
3675         (Output_data_got::reserve_slot): Make virtual; rename to
3676         do_reserve_slot; Adjust callers.
3677         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3678         pointer to abstract base class.
3679         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3680
3681 2011-12-18  Ian Lance Taylor  <iant@google.com>
3682
3683         * object.h (Relobj::local_symbol_value): New function.
3684         (Relobj::local_plt_offset): New function.
3685         (Relobj::local_has_got_offset): New function.
3686         (Relobj::local_got_offset): New function.
3687         (Relobj::set_local_got_offset): New function.
3688         (Relobj::do_local_symbol_value): New pure virtual function.
3689         (Relobj::do_local_plt_offset): Likewise.
3690         (Relobj::do_local_has_got_offset): Likewise.
3691         (Relobj::do_local_got_offset): Likewise.
3692         (Relobj::do_set_local_got_offset): Likewise.
3693         (Sized_relobj::do_local_has_got_offset): Rename from
3694         local_has_got_offset.
3695         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3696         (Sized_relobj::do_set_local_got_offset): Rename from
3697         set_local_got_offset.
3698         (Sized_relobj_file::do_local_plt_offset): Rename from
3699         local_plt_offset.
3700         (Sized_relobj_file::do_local_symbol_value): New function.
3701         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3702         local_plt_offset.
3703         * output.cc (Output_data_got::Got_entry::write): Change object to
3704         Relobj.  Use local_symbol_value.
3705         (Output_data_got::add_global_with_rel): Change rel_dyn to
3706         Output_data_reloc_generic*.  Use add_global_generic.
3707         (Output_data_got::add_global_with_rela): Remove.  Change all
3708         callers to use add_global_with_rel.
3709         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3710         Output_data_reloc_generic*.  Use add_global_generic.
3711         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3712         callers to use add_global_pair_with_rel.
3713         (Output_data_got::add_local): Change object to Relobj*.
3714         (Output_data_got::add_local_plt): Likewise.
3715         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3716         change rel_dyn to Output_data_reloc_generic*.  Use
3717         add_local_generic.
3718         (Output_data_got::add_local_with_rela): Remove.  Change all
3719         callers to use all_local_with_rel.
3720         (Output_data_got::add_local_pair_with_rel): Change object to
3721         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3722         add_output_section_generic.
3723         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3724         callers to use add_local_pair_with_rel.
3725         (Output_data_got::reserve_local): Change object to Relobj*.
3726         * output.h: (class Output_data_reloc_generic): Add pure virtual
3727         declarations for add_global_generic, add_local_generic,
3728         add_output_section_generic.
3729         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3730         functions for Output_data_reloc_generic.  Update declarations for
3731         changes listed in output.cc.
3732         (class Output_data_got): Change template parameter to got_size.
3733         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3734         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3735         function.
3736         (Sized_relobj_incr::do_local_plt_offset): New function.
3737         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3738         add_global_generic.
3739
3740 2011-12-17  Cary Coutant  <ccoutant@google.com>
3741
3742         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3743         * resolve.cc (Symbol_table::resolve): Likewise.
3744         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3745         arrays.
3746         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3747
3748 2011-12-16  Ian Lance Taylor  <iant@google.com>
3749
3750         * output.h (Output_data_reloc_generic::add): Only call
3751         add_dynamic_reloc if this is a dynamic reloc section.
3752
3753 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3754
3755         PR gold/13505
3756         * target-reloc.h (apply_relocation): Replace <64, false> with
3757         <size, big_endian>.
3758
3759 2011-11-25  Nick Clifton  <nickc@redhat.com>
3760
3761         * po/it.po: New Italian translation.
3762
3763 2011-11-17  Sterling Augustine  <saugustine@google.com>
3764
3765         * script.cc (script_include_directive): Implement.
3766         (read_script_file): New local variables name and search_path. Update
3767         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3768         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3769         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3770
3771 2011-11-11  Sterling Augustine  <saugustine@google.com>
3772
3773         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3774         (file_or_sections_cmd): Likewise.
3775
3776 2011-11-11  Doug Kwan  <dougkwan@google.com>
3777
3778         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3779         if --just-symbols is given.
3780
3781 2011-11-10  Doug Kwan  <dougkwan@google.com>
3782
3783         PR gold/13362
3784         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3785         when processing data relocs.
3786         * reloc.h (Relocate_functions::rel_unaligned): New method.
3787         (Relocate_functions::pcrel_unaligned): Ditto.
3788         (Relocate_functions::rel32_unaligned): Ditto.
3789         (Relocate_functions::pcrel32_unaligned): Ditto.
3790
3791 2011-11-09  Doug Kwan  <dougkwan@google.com>
3792
3793         PR gold/13362
3794         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3795         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3796         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3797         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3798         (Relocate_functions::rel_unaligned): New.
3799         (Relocate_functions::rel32_unaligned): New.
3800         * target-reloc.h (relocate_for_relocatable): Add code to handle
3801         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3802         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3803         arm_unaligned_reloc_r): New targets.
3804         * testsuite/Makefile.in: Regenerate.
3805         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3806         linking.
3807
3808 2011-11-02  Ian Lance Taylor  <iant@google.com>
3809
3810         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3811         NATIVE_LINKER.
3812         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3813         * options.cc (General_options::finalize): Use library search path
3814         from configure script if specified.  If not native and no sysroot,
3815         only search TOOLLIBDIR.
3816         * options.h (Search_directory::Search_directory): Change name to
3817         const std::string&.
3818         (General_options::add_to_library_path_with_sysroot): Change arg to
3819         const std::string&.
3820         * configure, Makefile.in, config.in: Rebuild.
3821
3822 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3823
3824         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3825         we are working around the ARM1176 Erratum.
3826         * options.h (General_options::fix_arm1176): Add option.
3827         * testsuite/Makefile.am: Add testcases, and keep current ones
3828         working.
3829         * testsuite/Makefile.in: Regenerate.
3830         * testsuite/arm_fix_1176.s: New file.
3831         * testsuite/arm_fix_1176.sh: Likewise.
3832
3833 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3834
3835         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3836         may_use_blx_.
3837         (Target_arm::may_use_blx): Remove method.
3838         (Target_arm::set_may_use_blx): Likewise.
3839         (Target_arm::may_use_v4t_interworking): New method.
3840         (Target_arm::may_use_v5t_interworking): Likewise.
3841         (Target_arm::may_use_blx_): Remove member variable.
3842         (Arm_relocate_functions::arm_branch_common): Check for v5T
3843         interworking.
3844         (Arm_relocate_functions::thumb_branch_common): Likewise.
3845         (Reloc_stub::stub_type_for_reloc): Likewise.
3846         (Target_arm::do_finalize_sections): Correct interworking checks.
3847         * testsuite/Makefile.am: Add new tests.
3848         * testsuite/Makefile.in: Regenerate.
3849         * testsuite/arm_farcall_arm_arm.s: New test.
3850         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3851         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3852         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3853         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3854         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3855         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3856         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3857
3858 2011-10-31  Cary Coutant  <ccoutant@google.com>
3859
3860         PR gold/13023
3861         * expression.cc (Expression::eval_with_dot): Add
3862         is_section_dot_assignment parameter.
3863         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3864         absolute and assigning to dot within a section.
3865         * script-sections.cc
3866         (Output_section_element_assignment::set_section_addresses): Pass
3867         dot_section to set_if_absolute.
3868         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3869         as is_section_dot_assignment flag to eval_with_dot.
3870         (Output_section_element_dot_assignment::set_section_addresses):
3871         Likewise.
3872         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3873         parameter.  Also set value if relative to dot_section; set the
3874         symbol's output_section.
3875         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3876         parameter.  Adjust all callers.
3877         (Expression::eval_maybe_dot): Likewise.
3878         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3879         Adjust all callers.
3880         * testsuite/script_test_2.t: Test assignment of an absolute value
3881         to dot within an output section element.
3882
3883 2011-10-31  Cary Coutant  <ccoutant@google.com>
3884
3885         * options.h (class General_options): Add --[no-]gnu-unique options.
3886         * symtab.cc (Symbol_table::sized_write_globals): Convert
3887         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3888
3889 2011-10-31  Cary Coutant  <ccoutant@google.com>
3890
3891         PR gold/13359
3892         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3893         unnecessary assertion.
3894         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3895
3896 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3897
3898         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3899         gc_mark_symbol.
3900         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3901         gc_mark_symbol.
3902         Change to just keep the section associated with symbol.
3903         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3904         they are externally visible and --export-dynamic is turned on.
3905         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3906
3907 2011-10-19  Ian Lance Taylor  <iant@google.com>
3908
3909         PR gold/13163
3910         * script-sections.cc
3911         (Output_section_element_dot_assignment::needs_output_section): New
3912         function.
3913
3914 2011-10-19  Ian Lance Taylor  <iant@google.com>
3915
3916         PR gold/13204
3917         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3918         --section-start option was seen.
3919         * options.h (General_options::any_section_start): New function.
3920
3921 2011-10-18  David S. Miller  <davem@davemloft.net>
3922
3923         PR binutils/13301
3924         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3925         member to track relocation locations that have moved during TLS
3926         reloc optimizations.
3927         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3928         (Target_sparc::Relocate::relocate): Adjust view down by 4
3929         bytes if it matches reloc_adjust_addr_.
3930         (Target_sparc::Relocate::relocate_tls): Always move the
3931         __tls_get_addr call delay slot instruction forward 4 bytes when
3932         performing relaxation.
3933
3934 2011-10-18  Cary Coutant  <ccoutant@google.com>
3935
3936         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3937         (Output_file::map_no_anonymous): Check for non-zero
3938         return code from posix_fallocate.
3939
3940 2011-10-17  Cary Coutant  <ccoutant@google.com>
3941
3942         PR gold/13245
3943         * plugin.cc (is_visible_from_outside): Check for symbols
3944         referenced from dynamic objects.
3945         * resolve.cc (Symbol_table::resolve): Don't count references
3946         from dynamic objects as references from real ELF files.
3947         * testsuite/plugin_test_2.sh: Adjust expected result.
3948
3949 2011-10-17  Cary Coutant  <ccoutant@google.com>
3950
3951         * gold.cc: Include timer.h.
3952         (queue_middle_tasks): Stamp time.
3953         (queue_final_tasks): Likewise.
3954         * main.cc (main): Store timer in parameters.  Print timers
3955         for each pass.
3956         * parameters.cc (Parameters::Parameters): Initialize timer_.
3957         (Parameters::set_timer): New function.
3958         (set_parameters_timer): New function.
3959         * parameters.h (Parameters::set_timer): New function.
3960         (Parameters::timer): New function.
3961         (Parameters::timer_): New data member.
3962         (set_parameters_timer): New function.
3963         * timer.cc (Timer::stamp): New function.
3964         (Timer::get_pass_time): New function.
3965         * timer.h (Timer::stamp): New function.
3966         (Timer::get_pass_time): New function.
3967         (Timer::pass_times_): New data member.
3968
3969 2011-10-17  Cary Coutant  <ccoutant@google.com>
3970
3971         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3972         task for members of lib groups.
3973
3974 2011-10-17  Cary Coutant  <ccoutant@google.com>
3975
3976         PR gold/13288
3977         * fileread.cc (File_read::find_view): Add assert.
3978         (File_read::make_view): Move bounds check (replace with assert)...
3979         (File_read::find_or_make_view): ... to here.
3980
3981 2011-10-12  Cary Coutant  <ccoutant@google.com>
3982
3983         * output.cc (Output_file::open_base_file): Handle case where
3984         ::read returns less than requested size.
3985
3986 2011-10-10  Cary Coutant  <ccoutant@google.com>
3987
3988         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3989         Initialize defined_count_.
3990         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3991         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3992         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3993         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3994         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3995         * incremental.h (Sized_relobj_incr::defined_count_): New data
3996         member.
3997         (Sized_incr_dynobj::defined_count_): New data member.
3998         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3999         Return zeroes instead of internal error.
4000
4001 2011-10-10  Cary Coutant  <ccoutant@google.com>
4002
4003         PR gold/13249
4004         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
4005         (Output_reloc::symbol_value): Return PLT offset if flag is set.
4006         * output.h (class Output_reloc): Add use_plt_offset flag.
4007         (Output_reloc::type_): Adjust size of bit field.
4008         (Output_reloc::use_plt_offset_): New bit field.
4009         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
4010         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
4011         flag.  Adjust all callers.
4012         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
4013         creating RELATIVE relocations.
4014
4015 2011-10-10  Nick Clifton  <nickc@redhat.com>
4016
4017         * po/es.po: Updated Spanish translation.
4018         * po/fi.po: Updated Finnish translation.
4019
4020 2011-10-03   Diego Novillo  <dnovillo@google.com>
4021
4022         * options.cc (parse_uint): Fix dereference of RETVAL.
4023
4024 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
4025
4026         * layout.h (section_order_map_): New member.
4027         (get_section_order_map): New member function.
4028         * output.cc (Output_section::add_input_section): Check for patterns
4029         only when --section-ordering-file is specified.
4030         * gold.cc (queue_middle_tasks): Delay updating order of sections till
4031         output_sections have been formed.
4032         * layout.cc (Layout_Layout): Initialize section_order_map_.
4033         * plugin.cc (update_section_order): Store order in order_map. Do not
4034         update the order.
4035         * testsuite/Makefile.am: Add test case for plugin_final_layout.
4036         * testsuite/Makefile.in: Regenerate.
4037         * testsuite/plugin_section_order.c: New file.
4038         * testsuite/plugin_final_layout.cc: New file.
4039         * testsuite/plugin_final_layout.sh: New file.
4040
4041 2011-09-29  Cary Coutant  <ccoutant@google.com>
4042
4043         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4044         Check for NULL.
4045         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
4046         symbols during incremental update.
4047         (Symbol_table::add_from_dynobj): Likewise.
4048
4049 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
4050             Ian Lance Taylor  <iant@google.com>
4051
4052         * symtab.cc (Symbol_table::define_special_symbol): Always
4053         canonicalize version string.
4054
4055 2011-09-26  Cary Coutant  <ccoutant@google.com>
4056
4057         * gold.cc (queue_initial_tasks): Move option checks ...
4058         * options.cc (General_options::finalize): ... to here. Disable
4059         some options; make others fatal.
4060
4061 2011-09-26  Cary Coutant  <ccoutant@google.com>
4062
4063         gcc PR lto/47247
4064         * plugin.cc (get_symbols_v2): New function.
4065         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
4066         (is_referenced_from_outside): New function.
4067         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
4068         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
4069         (get_symbols): Pass version parameter.
4070         (get_symbols_v2): New function.
4071         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
4072         parameter.
4073         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
4074         (onload): Add LDPT_GET_SYMBOLS_V2.
4075         (all_symbols_read_hook): Use get_symbols_v2; check for
4076         LDPR_PREVAILING_DEF_IRONLY_EXP.
4077         * testsuite/plugin_test_3.sh: Update expected results.
4078
4079 2011-09-23  Simon Baldwin  <simonb@google.com>
4080
4081         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
4082         configuration options.
4083         * configure: Regenerate.
4084         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
4085         * Makefile.in: Regenerate.
4086         * testsuite/Makefile.in: Regenerate.
4087
4088 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
4089
4090         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
4091
4092 2011-09-19  Cary Coutant  <ccoutant@google.com>
4093
4094         * incremental.cc (can_incremental_update): Fix typo in comment.
4095         * incremental.h (can_incremental_update): Likewise.
4096
4097 2011-09-18  Cary Coutant  <ccoutant@google.com>
4098
4099         * incremental.cc (can_incremental_update): New function.
4100         * incremental.h (can_incremental_update): New function.
4101         * layout.cc (Layout::init_fixed_output_section): Call it.
4102         (Layout::make_output_section): Don't allow patch space in .eh_frame.
4103         * object.cc (Sized_relobj_file::do_layout): Call
4104         can_incremental_update.
4105
4106 2011-09-13  Cary Coutant  <ccoutant@google.com>
4107
4108         * configure.ac: Check for glibc support for gnu_indirect_function
4109         support with static linking, setting automake conditional
4110         IFUNC_STATIC.
4111         * Makefile.in: Regenerate.
4112         * configure: Regenerate.
4113
4114         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
4115         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
4116         for IFUNC_STATIC.
4117         * testsuite/Makefile.in: Regenerate.
4118
4119 2011-09-13  Cary Coutant  <ccoutant@google.com>
4120
4121         * incremental.cc (Sized_relobj_incr::do_layout): Call
4122         report_comdat_group for kept comdat sections.
4123         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
4124         * testsuite/Makefile.in: Regenerate.
4125         * testsuite/incr_comdat_test_1.cc: New source file.
4126         * testsuite/incr_comdat_test_2_v1.cc: New source file.
4127         * testsuite/incr_comdat_test_2_v2.cc: New source file.
4128         * testsuite/incr_comdat_test_2_v3.cc: New source file.
4129
4130 2011-09-13  Ian Lance Taylor  <iant@google.com>
4131
4132         * object.cc (Sized_relobj_file::do_layout): Remove unused local
4133         variable external_symbols_offset.
4134
4135 2011-09-12  Ian Lance Taylor  <iant@google.com>
4136
4137         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
4138         triggered if object has no symbols.
4139
4140 2011-09-09  David S. Miller  <davem@davemloft.net>
4141
4142         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
4143         (Output_fill_debug_line::do_write): Likewise.
4144
4145 2011-08-29  Cary Coutant  <ccoutant@google.com>
4146
4147         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
4148         casts to match formatting specs.
4149         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
4150
4151 2011-08-26  Cary Coutant  <ccoutant@google.com>
4152
4153         * layout.cc (Free_list::allocate): Provide guarantee of minimum
4154         remaining hole size when allocating.
4155         (Layout::make_output_section): Set fill methods for debug sections.
4156         * layout.h (Free_list::Free_list_node): Move from private to
4157         public.
4158         (Free_list::set_min_hole_size): New function.
4159         (Free_list::begin, Free_list::end): New functions.
4160         (Free_list::min_hole_): New data member.
4161         * output.cc: Include dwarf.h.
4162         (Output_fill_debug_info::do_minimum_hole_size): New function.
4163         (Output_fill_debug_info::do_write): New function.
4164         (Output_fill_debug_line::do_minimum_hole_size): New function.
4165         (Output_fill_debug_line::do_write): New function.
4166         (Output_section::Output_section): Initialize new data member.
4167         (Output_section::set_final_data_size): Ensure patch space is larger
4168         than minimum hole size.
4169         (Output_section::do_write): Fill holes in debug sections.
4170         * output.h (Output_fill): New class.
4171         (Output_fill_debug_info): New class.
4172         (Output_fill_debug_line): New class.
4173         (Output_section::set_free_space_fill): New function.
4174         (Output_section::free_space_fill_): New data member.
4175         * testsuite/Makefile.am (incremental_test_3): Add
4176         --incremental-patch option.
4177         (incremental_test_4): Likewise.
4178         (incremental_test_5): Likewise.
4179         (incremental_test_6): Likewise.
4180         (incremental_copy_test): Likewise.
4181         (incremental_common_test_1): Likewise.
4182         * testsuite/Makefile.in: Regenerate.
4183
4184 2011-08-26  Nick Clifton  <nickc@redhat.com>
4185
4186         * po/es.po: Updated Spanish translation.
4187
4188 2011-08-01  Cary Coutant  <ccoutant@google.com>
4189
4190         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
4191         * gold/testsuite/Makefile.in: Regenerate.
4192         * gold/testsuite/justsyms_exec.c: New source file.
4193         * gold/testsuite/justsyms_lib.c: New source file.
4194
4195 2011-08-01  Cary Coutant  <ccoutant@google.com>
4196
4197         * layout.cc (Layout::set_segment_offsets): Don't realign text
4198         segment if -Ttext was specified.
4199         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
4200         file type.
4201         * object.h (Sized_relobj_file::e_type): New function.
4202         (Sized_relobj_file::e_type_): New data member.
4203         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
4204         base address for ET_EXEC files.
4205         * target.cc (Target::do_make_elf_object_implementation): Allow
4206         ET_EXEC files with --just-symbols option.
4207
4208 2011-07-28  Cary Coutant  <ccoutant@google.com>
4209
4210         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
4211         Add thread_number parameter.
4212         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
4213         * workqueue-threads.cc
4214         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
4215         current thread if its thread number is greater than desired thread
4216         count.
4217         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
4218         Add thread_number parameter.
4219         (Workqueue::should_cancel_thread): Likewise.
4220         (Workqueue::find_runnable_or_wait): Pass thread_number to
4221         should_cancel_thread.
4222         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
4223         parameter.
4224
4225 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
4226
4227         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
4228         only after checking if it cannot be forced local.
4229         * symtab.h (is_externally_visible): Check if the symbol is not forced
4230         local.
4231
4232 2011-07-15  Ian Lance Taylor  <iant@google.com>
4233
4234         * options.h (class General_options): Add --print-output-format.
4235         Move -EL next to -EB, for  better --help output.
4236         * target-select.cc: Include <cstdio>, "options.h", and
4237         "parameters.h".
4238         (Target_selector::do_target_bfd_name): New function.
4239         (print_output_format): New function.
4240         * target-select.h (class Target_selector): Update declarations.
4241         (Target_selector::target_bfd_name): New function.
4242         (print_output_format): Declare.
4243         * main.cc: Include "target-select.h".
4244         (main): Handle --print-output-format.
4245         * gold.cc: Include "target-select.h".
4246         (queue_initial_tasks): Handle --print-output-format when there are
4247         no input files.
4248         * parameters.cc (parameters_force_valid_target): Give a better
4249         error message if -EB/-EL does not match target.
4250         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
4251         function.
4252
4253 2011-07-15  Ian Lance Taylor  <iant@google.com>
4254
4255         * i386.cc (class Output_data_plt_i386): Add layout_ field.
4256         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
4257         (Output_data_plt_i386::do_write): Write address of .dynamic
4258         section to first entry in .got.plt section.
4259         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
4260         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4261         Initialize layout_.
4262         (Output_data_plt_x86_64::do_write): Write address of .dynamic
4263         section to first entry in .got.plt section.
4264         * layout.h (Layout::dynamic_section): New function.
4265
4266 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
4267
4268         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
4269         to claim_file call.
4270         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
4271         input_section_position_, and input_section_glob_.
4272         (read_layout_from_file): Call function section_ordering_specified.
4273         * layout.h (is_section_ordering_specified): New function.
4274         (section_ordering_specified): New function.
4275         (section_ordering_specified_): New boolean member.
4276         * main.cc(main): Call load_plugins after layout object is defined.
4277         * output.cc (Output_section::add_input_section): Use
4278         function section_ordering_specified to check if section ordering is
4279         needed.
4280         * output.cc (Output_section::add_relaxed_input_section): Use
4281         function section_ordering_specified to check if section ordering is
4282         needed.
4283         (Output_section::update_section_layout): New function.
4284         (Output_section::sort_attached_input_sections): Check if input section
4285         must be reordered.
4286         * output.h (Output_section::update_section_layout): New function.
4287         * plugin.cc (get_section_count): New function.
4288         (get_section_type): New function.
4289         (get_section_name): New function.
4290         (get_section_contents): New function.
4291         (update_section_order): New function.
4292         (allow_section_ordering): New function.
4293         (Plugin::load): Add the new interfaces to the transfer vector.
4294         (Plugin_manager::load_plugins): New parameter.
4295         (Plugin_manager::all_symbols_read): New parameter.
4296         (Plugin_manager::claim_file): New parameter. Save the elf object for
4297         unclaimed objects.
4298         (Plugin_manager::get_elf_object): New function.
4299         (Plugin_manager::get_view): Change to directly use the bool to check
4300         if get_view is called from claim_file_hook.
4301         * plugin.h (input_objects): New function
4302         (Plugin__manager::load_plugins): New parameter.
4303         (Plugin_manager::claim_file): New parameter.
4304         (Plugin_manager::get_elf_object): New function.
4305         (Plugin_manager::in_claim_file_handler): New function.
4306         (Plugin_manager::in_claim_file_handler_): New member.
4307         (layout): New function.
4308         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
4309         handler with an extra parameter. Make the elf object before calling
4310         claim_file handler.
4311         * testsuite/plugin_test.c (get_section_count): New function pointer.
4312         (get_section_type): New function pointer.
4313         (get_section_name): New function pointer.
4314         (get_section_contents): New function pointer.
4315         (update_section_order): New function pointer.
4316         (allow_section_ordering): New function pointer.
4317         (onload): Check if the new interfaces exist.
4318
4319 2011-07-13  Ian Lance Taylor  <iant@google.com>
4320
4321         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
4322         relro section.
4323         * x86_64.cc (Target_x86_64::got_section): Likewise.
4324         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
4325         (relro_now_test_SOURCES): New variable.
4326         (relro_now_test_DEPENDENCIES): New variable.
4327         (relro_now_test_LDFLAGS): New variable.
4328         (relro_now_test_LDADD): New variable.
4329         (relro_now_test.so): New target.
4330         * testsuite/Makefile.in: Rebuild.
4331
4332 2011-07-12  Ian Lance Taylor  <iant@google.com>
4333
4334         PR gold/12980
4335         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
4336         GLOB_DAT relocation rather than a RELATIVE relocation for a
4337         protected symbol when creating a shared library.
4338         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4339         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
4340         * testsuite/protected_main_1.cc (main): Test that protected
4341         function has same address.
4342
4343 2011-07-11  Ian Lance Taylor  <iant@google.com>
4344
4345         PR gold/12979
4346         * options.h (class General_options): Add -Bgroup.
4347         * options.cc (General_options::finalize): If -Bgroup is set,
4348         default to --unresolved-symbols=report-all.
4349         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
4350         * target-reloc.h (issue_undefined_symbol_error): Handle
4351         --unresolved-symbols=report-all.
4352
4353 2011-07-08  Ian Lance Taylor  <iant@google.com>
4354
4355         PR gold/11985
4356         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
4357         if linker script discards key sections.
4358         (Layout::create_dynamic_symtab): Likewise.
4359         (Layout::assign_local_dynsym_offsets): Likewise.
4360         (Layout::sized_create_version_sections): Likewise.
4361         (Layout::create_interp): Likewise.
4362         (Layout::finish_dynamic_section): Likewise.
4363         (Layout::set_dynamic_symbol_size): Likewise.
4364
4365 2011-07-08  Ian Lance Taylor  <iant@google.com>
4366
4367         PR gold/12386
4368         * options.h (class General_options): Add --unresolved-symbols.
4369         * target-reloc.h (issue_undefined_symbol_error): Check
4370         --unresolved-symbols.  Add comments.
4371
4372 2011-07-08  Ian Lance Taylor  <iant@google.com>
4373
4374         * testsuite/odr_violation2.cc (Ordering::operator()): Make
4375         expression more complex.
4376
4377 2011-07-08  Ian Lance Taylor  <iant@google.com>
4378
4379         PR gold/11317
4380         * target-reloc.h (issue_undefined_symbol_error): New inline
4381         function, broken out of relocate_section.
4382         (relocate_section): Call issue_undefined_symbol_error.
4383         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4384         there is no TLS segment if we are about to issue an undefined
4385         symbol error.
4386         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4387
4388 2011-07-08  Ian Lance Taylor  <iant@google.com>
4389
4390         PR gold/12279
4391         * resolve.cc (Symbol_table::should_override): Add fromtype
4392         parameter.  Change all callers.  Give error when linking together
4393         TLS and non-TLS symbol.
4394         (Symbol_table::should_override_with_special): Add fromtype
4395         parameter.  Change all callers.
4396         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
4397         there is no TLS segment if we have reported some errors.
4398         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
4399
4400 2011-07-08  Ian Lance Taylor  <iant@google.com>
4401
4402         PR gold/12372
4403         * target.h (Target::plt_address_for_global): New function.
4404         (Target::plt_address_for_local): New function.
4405         (Target::plt_section_for_global): Remove.
4406         (Target::plt_section_for_local): Remove.
4407         (Target::do_plt_address_for_global): New virtual function.
4408         (Target::do_plt_address_for_local): New virtual function.
4409         (Target::do_plt_section_for_global): Remove.
4410         (Target::do_plt_section_for_local): Remove.
4411         (Target::register_global_plt_entry): Add Symbol_table and Layout
4412         parameters.
4413         * output.cc (Output_data_got::Got_entry::write): Use
4414         plt_address_for_global and plt_address_for_local.
4415         * layout.cc (Layout::add_target_dynamic_tags): Use size and
4416         address of output section.
4417         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
4418         got_irelative_, and irelative_count_ fields.  Update
4419         declarations.
4420         (Output_data_plt_i386::has_irelative_section): New function.
4421         (Output_data_plt_i386::entry_count): Add irelative_count_.
4422         (Output_data_plt_i386::set_final_data_size): Likewise.
4423         (class Target_i386): Add got_irelative_ and rel_irelative_
4424         fields.  Update declarations.
4425         (Target_i386::Target_i386): Initialize new fields.
4426         (Target_i386::do_plt_address_for_global): New function replacing
4427         do_plt_section_for_global.
4428         (Target_i386::do_plt_address_for_local): New function replacing
4429         do_plt_section_for_local.
4430         (Target_i386::got_section): Create got_irelative_.
4431         (Target_i386::rel_irelative_section): New function.
4432         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
4433         fields.  Don't define __rel_iplt_{start,end}.
4434         (Output_data_plt_i386::add_entry): Add symtab and layout
4435         parameters.  Change all callers.  Use different PLT and GOT for
4436         IFUNC symbols.
4437         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
4438         layout parameters.  Change all callers.  Use different PLT and
4439         GOT.
4440         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
4441         (Output_data_plt_i386::rel_irelative): New function.
4442         (Output_data_plt_i386::address_for_global): New function.
4443         (Output_data_plt_i386::address_for_local): New function.
4444         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
4445         IRELATIVE GOT when changing IFUNC GOT entries.
4446         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
4447         reloc.
4448         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
4449         if we didn't create an IRELATIVE GOT.
4450         (Target_i386::Relocate::relocate): Use plt_address_for_global and
4451         plt_address_for_local.
4452         (Target_i386::do_dynsym_value): Use plt_address_for_global.
4453         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
4454         got_irelative_, and irelative_count_ fields.  Update
4455         declarations.
4456         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
4457         Initialize new fields.  Remove symtab parameter.  Change all
4458         callers.
4459         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
4460         irelative_count_.
4461         (Output_data_plt_x86_64::has_irelative_section): New function.
4462         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
4463         (class Target_x86_64): Add got_irelative_ and rel_irelative_
4464         fields.  Update declarations.
4465         (Target_x86_64::Target_x86_64): Initialize new fields.
4466         (Target_x86_64::do_plt_address_for_global): New function replacing
4467         do_plt_section_for_global.
4468         (Target_x86_64::do_plt_address_for_local): New function replacing
4469         do_plt_section_for_local.
4470         (Target_x86_64::got_section): Create got_irelative_.
4471         (Target_x86_64::rela_irelative_section): New function.
4472         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
4473         all callers.  Don't create __rel_iplt_{start,end}.
4474         (Output_data_plt_x86_64::add_entry): Add symtab and layout
4475         parameters.  Change all callers.  Use different PLT and GOT for
4476         IFUNC symbols.
4477         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
4478         layout parameters.  Change all callers.  Use different PLT and
4479         GOT.
4480         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
4481         parameters.  Change all callers.  Use different PLT and GOT for
4482         IFUNC symbols.
4483         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
4484         (Output_data_plt_x86_64::rela_irelative): New function.
4485         (Output_data_plt_x86_64::address_for_global): New function.
4486         (Output_data_plt_x86_64::address_for_local): New function.
4487         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4488         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
4489         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
4490         (Target_x86_64::register_global_plt_entry): Add symtab and layout
4491         parameters.
4492         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
4493         reloc.
4494         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
4495         symbols if we didn't create an IRELATIVE GOT.
4496         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
4497         plt_address_for_local.
4498         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
4499         * testsuite/ifuncvar1.c: New test file.
4500         * testsuite/ifuncvar2.c: New test file.
4501         * testsuite/ifuncvar3.c: New test file.
4502         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
4503         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
4504         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
4505         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
4506         * testsuite/Makefile.in: Rebuild.
4507
4508 2011-07-07  Cary Coutant  <ccoutant@google.com>
4509
4510         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
4511         (two_file_test_1_ndebug.o): Likewise.
4512         (two_file_test_1b_ndebug.o): Likewise.
4513         (two_file_test_2_ndebug.o): Likewise.
4514         (two_file_test_main_ndebug.o): Likewise.
4515         (incremental_test_2): Link with no-debug versions.
4516
4517 2011-07-06  Cary Coutant  <ccoutant@google.com>
4518
4519         * gold/incremental.cc
4520         (Output_section_incremental_inputs::write_info_blocks): Check for
4521         hidden and internal symbols.
4522
4523 2011-07-06  Cary Coutant  <ccoutant@google.com>
4524
4525         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
4526         Check disposition for startup file.
4527         (Incremental_inputs::report_command_line): Ignore
4528         --incremental-startup-unchanged option.
4529         * options.cc (General_options::parse_incremental_startup_unchanged):
4530         New function.
4531         (General_options::General_options): Initialize new data member.
4532         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
4533         (General_options): Add --incremental-startup-unchanged option.
4534         (General_options::incremental_startup_disposition): New function.
4535         (General_options::incremental_startup_disposition_): New data member.
4536
4537 2011-07-06  Cary Coutant  <ccoutant@google.com>
4538
4539         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
4540         input file index to Script_info ctor.
4541         (Sized_incremental_binary::do_file_has_changed): Find the
4542         command-line argument for files named in scripts.
4543         * incremental.h (Script_info::Script_info): New ctor
4544         with input file index.
4545         (Script_info::input_file_index): New function.
4546         (Script_info::input_file_index_): New data member.
4547         (Incremental_binary::get_library): Add const.
4548         (Incremental_binary::get_script_info): Add const.
4549         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
4550         * testsuite/Makefile.am (incremental_test_5): New test case.
4551         (incremental_test_6): New test case.
4552         * testsuite/Makefile.in: Regenerate.
4553
4554 2011-07-06  Cary Coutant  <ccoutant@google.com>
4555
4556         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
4557         debug output when command lines differ.
4558
4559 2011-07-06  Cary Coutant  <ccoutant@google.com>
4560
4561         * incremental.cc (Incremental_inputs::report_command_line): Ignore
4562         --incremental-patch option.
4563         * layout.cc (Free_list::allocate): Extend allocation beyond original
4564         end if enabled.
4565         (Layout::make_output_section): Mark sections that should get
4566         patch space.
4567         * options.cc (parse_percent): New function.
4568         * options.h (parse_percent): New function.
4569         (DEFINE_percent): New macro.
4570         (General_options): Add --incremental-patch option.
4571         * output.cc (Output_section::Output_section): Initialize new data
4572         members.
4573         (Output_section::add_input_section): Print section name when out
4574         of patch space.
4575         (Output_section::add_output_section_data): Likewise.
4576         (Output_section::set_final_data_size): Add patch space when
4577         doing --incremental-full.
4578         (Output_section::do_reset_address_and_file_offset): Remove patch
4579         space.
4580         (Output_segment::set_section_list_addresses): Print debug output
4581         only if --incremental-update.
4582         * output.h (Output_section::set_is_patch_space_allowed): New function.
4583         (Output_section::is_patch_space_allowed_): New data member.
4584         (Output_section::patch_space_): New data member.
4585         * parameters.cc (Parameters::incremental_full): New function.
4586         * parameters.h (Parameters::incremental_full): New function
4587         * testsuite/Makefile.am (incremental_test_2): Add test for
4588         --incremental-patch option.
4589         * testsuite/Makefile.in: Regenerate.
4590         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
4591         (t18): Remove function body.
4592
4593 2011-07-05  Doug Kwan  <dougkwan@google.com>
4594
4595         PR gold/12771
4596         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
4597         Arm_Address type for relocation result.
4598         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
4599         overflow check.
4600         (Arm_relocate_functions::abs32): Use unaligned access.
4601         (Arm_relocate_functions::rel32): Ditto.
4602         (Arm_relocate_functions::prel31): Ditto.
4603         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
4604         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
4605         static data relocations.
4606         * testsuite/Makefile.in: Regnerate.
4607         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
4608
4609 2011-07-05  Ian Lance Taylor  <iant@google.com>
4610
4611         PR gold/12392
4612         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
4613         symbols if necessary.
4614         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
4615
4616 2011-07-05  Ian Lance Taylor  <iant@google.com>
4617
4618         PR gold/12952
4619         * resolve.cc (Symbol::override_base_with_special): Simply override
4620         version with special symbol version, ignoring previous version.
4621
4622 2011-07-05  Ian Lance Taylor  <iant@google.com>
4623
4624         * object.cc (Sized_relobj_file::include_section_group): Add
4625         information to comment about signature location.
4626
4627 2011-07-02  Ian Lance Taylor  <iant@google.com>
4628
4629         PR gold/12957
4630         * options.h (class General_options): Add -f and -F.
4631         * options.cc (General_options::finalize): Fatal error if -f/-F
4632         are used without -shared.
4633         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4634
4635 2011-07-02  Ian Lance Taylor  <iant@google.com>
4636
4637         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4638
4639 2011-07-01  Ian Lance Taylor  <iant@google.com>
4640
4641         PR gold/12525
4642         PR gold/12952
4643         * resolve.cc (Symbol::override_base_with_special): Don't override
4644         the version if the overriding symbol has a different name.
4645         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4646         all callers.  If we give an error about an undefined version,
4647         define the base version if necessary.
4648         * dynobj.h (class Versions): Update declaration.
4649         * testsuite/weak_alias_test_5.cc: New file.
4650         * testsuite/weak_alias_test.script: New file.
4651         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4652         and versioned_alias have the right value, and call t2.
4653         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4654         weak_alias_test_5.so.
4655         (weak_alias_test_LDADD): Likewise.
4656         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4657         * testsuite/Makefile.in: Rebuild.
4658
4659 2011-07-01  Ian Lance Taylor  <iant@google.com>
4660
4661         PR gold/12525
4662         * options.h (class General_options): Support -z notext.
4663         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4664         -Wl,-z,notext.
4665         (two_file_shared_nonpic.so): Likewise.
4666         (two_file_shared_mixed.so): Likewise.
4667         (two_file_shared_mixed_1.so): Likewise.
4668         (weak_undef_lib_nonpic.so): Likewise.
4669         (alt/weak_undef_lib_nonpic.so): Likewise.
4670         (tls_test_shared_nonpic.so): Likewise.
4671         * testsuite/Makefile.in: Rebuild.
4672
4673 2011-07-01  Ian Lance Taylor  <iant@google.com>
4674
4675         PR gold/12525
4676         * configure.ac: Test whether static linking works, setting
4677         the automake conditional HAVE_STATIC.
4678         * testsuite/Makefile.am: Disable tests using -static if
4679         HAVE_STATIC is not true.
4680         * configure, testsuite/Makefile.in: Rebuild.
4681
4682 2011-07-01  Ian Lance Taylor  <iant@google.com>
4683
4684         PR gold/12525
4685         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4686         Assert if we see DW_EH_PE_indirect.
4687         * target.h (Target::ehframe_datarel_base): New function.
4688         (Target::do_ehframe_datarel_base): New target function.
4689         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4690         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4691         function.
4692
4693 2011-07-01  Ian Lance Taylor  <iant@google.com>
4694
4695         PR gold/12571
4696         * options.h (class General_options): Add
4697         --ld-generated-unwind-info.
4698         * ehframe.cc (Fde::write): Add address parameter.  Change all
4699         callers.  If associated with PLT, fill in address and size.
4700         (Cie::set_output_offset): Only add merge mapping if there is an
4701         object.
4702         (Cie::write): Add address parameter.  Change all callers.
4703         (Eh_frame::add_ehframe_for_plt): New function.
4704         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4705         input_offset_ fields into union u_, with new plt field.
4706         (Fde::Fde): Adjust for new union field.
4707         (Fde::Fde) [Output_data version]: New constructor.
4708         (Fde::add_mapping): Only add merge mapping if there is an object.
4709         (class Cie): Update declarations.
4710         (class Eh_frame): Declare add_ehframe_for_plt.
4711         * layout.cc (Layout::layout_eh_frame): Break out code into
4712         make_eh_frame_section, and call it.
4713         (Layout::make_eh_frame_section): New function.
4714         (Layout::add_eh_frame_for_plt): New function.
4715         * layout.h (class Layout): Update declarations.
4716         * merge.cc (Merge_map::add_mapping): Add assertion.
4717         * i386.cc: Include "dwarf.h".
4718         (class Output_data_plt_i386): Make first_plt_entry,
4719         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4720         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4721         and plt_eh_frame_fde.
4722         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4723         boundary.  Call add_eh_frame_for_plt if appropriate.
4724         * x86_64.cc: Include "dwarf.h".
4725         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4726         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4727         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4728         and plt_eh_frame_fde.
4729         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4730         appropriate.
4731
4732 2011-06-29  Ian Lance Taylor  <iant@google.com>
4733
4734         PR gold/12629
4735         * object.cc (Sized_relobj_file::layout_section): Change shdr
4736         parameter to be const.
4737         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4738         out of do_layout.
4739         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4740         appropriate.  Call layout_eh_frame_section.
4741         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4742         sections.
4743         * object.h (class Sized_relobj_file): Update declarations.
4744
4745 2011-06-29  Ian Lance Taylor  <iant@google.com>
4746
4747         PR gold/12652
4748         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4749         modifier.
4750         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4751
4752 2011-06-29  Ian Lance Taylor  <iant@google.com>
4753
4754         PR gold/12675
4755         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4756         SHT_X86_64_UNWIND.
4757         * layout.cc (Layout::layout_eh_frame): Likewise.
4758
4759 2011-06-29  Ian Lance Taylor  <iant@google.com>
4760
4761         PR gold/12695
4762         * layout.cc (Layout::symtab_section_shndx): New function.
4763         * layout.h (class Layout): Declare symtab_section_shndx.
4764         * output.cc (Output_section::write_header): Call it.
4765
4766 2011-06-29  Ian Lance Taylor  <iant@google.com>
4767
4768         PR gold/12818
4769         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4770         symbols which are not used in a relocation.
4771
4772 2011-06-28  Ian Lance Taylor  <iant@google.com>
4773
4774         PR gold/12898
4775         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4776         script create indistinguishable segments.
4777         (Layout::set_segment_offsets): Use stable_sort when sorting
4778         segments.  Pass this to Compare_segments constructor.
4779         * layout.h (class Layout): Make segment_precedes non-static.
4780         (class Compare_segments): Change from struct to class.  Add
4781         layout_ field.  Add constructor.
4782         * script-sections.cc
4783         (Script_sections::attach_sections_using_phdrs_clause): Rename
4784         local orphan to is_orphan.  Don't report failure to put empty
4785         section in segment.  On attachment failure, report name of
4786         section, and attach to first PT_LOAD segment.
4787
4788 2011-06-28  Ian Lance Taylor  <iant@google.com>
4789
4790         PR gold/12934
4791         * target-select.cc (Target_selector::Target_selector): Add
4792         emulation parameter.  Change all callers.
4793         (select_target_by_bfd_name): Rename from select_target_by_name.
4794         Change all callers.
4795         (select_target_by_emulation): New function.
4796         (supported_emulation_names): New function.
4797         * target-select.h (class Target_selector): Add emulation_ field.
4798         Update declarations.
4799         (Target_selector::recognize_by_bfd_name): Rename from
4800         recognize_by_name.  Change all callers.
4801         (Target_selector::supported_bfd_names): Rename from
4802         supported_names.  Change all callers.
4803         (Target_selector::recognize_by_emulation): New function.
4804         (Target_selector::supported_emulations): New function.
4805         (Target_selector::emulation): New function.
4806         (Target_selector::do_recognize_by_bfd_name): Rename from
4807         do_recognize_by_name.  Change all callers.
4808         (Target_selector::do_supported_bfd_names): Rename from
4809         do_supported_names.  Change all callers.
4810         (Target_selector::do_recognize_by_emulation): New function.
4811         (Target_selector::do_supported_emulations): New function.
4812         (select_target_by_bfd_name): Change name in declaration.
4813         (select_target_by_emulation): Declare.
4814         (supported_emulation_names): Declare.
4815         * parameters.cc (parameters_force_valid_target): Try to find
4816         target based on emulation from -m option.
4817         * options.h (class General_options): Change doc string for -m.
4818         * options.cc (help): Print emulations.
4819         (General_options::parse_V): Likewise.
4820         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4821         Add emulation parameter.  Change all callers.
4822
4823 2011-06-28  Ian Lance Taylor  <iant@google.com>
4824
4825         * target.h (class Target): Add osabi_ field.
4826         (Target::osabi): New function.
4827         (Target::set_osabi): New function.
4828         (Target::Target): Initialize osabi_.
4829         (Target::do_adjust_elf_header): Make pure virtual.
4830         (Sized_target::do_adjust_elf_header): Declare.
4831         * target.cc (Sized_target::do_adjust_elf_header): New function.
4832         (class Sized_target): Instantiate all versions.
4833         * freebsd.h (class Target_freebsd): Remove.
4834         (Target_selector_freebsd::do_recognize): Call set_osabi on
4835         Target.
4836         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4837         (Target_selector_freebsd::set_osabi): Remove.
4838         * i386.cc (class Target_i386): Inherit from Sized_target rather
4839         than Target_freebsd.
4840         * x86_64.cc (class Target_x86_64): Likewise.
4841
4842 2011-06-28  Ian Lance Taylor  <iant@google.com>
4843
4844         * target.h (Target::can_check_for_function_pointers): Rewrite.
4845         Make non-virtual.
4846         (Target::can_icf_inline_merge_sections): Likewise.
4847         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4848         (Target::Target_info): Add can_icf_inline_merge_sections field.
4849         (Target::do_can_check_for_function_pointers): New virtual
4850         function.
4851         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4852         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4853         from can_check_for_function_pointers, move in file.
4854         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4855         section_may_have_icf_unsafe_poineters, move in file.
4856         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4857         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4858         Rename from can_check_for_function_pointers, move in file.
4859         (Target_i386::can_icf_inline_merge_sections): Remove.
4860         (Target_i386::i386_info): Initialize
4861         can_icf_inline_merge_sections.
4862         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4863         Initialize can_icf_inline_merge_sections.
4864         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4865         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4866         Rename from can_check_for_function_pointers, move in file.
4867         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4868         (Target_x86_64::x86_64_info): Initialize
4869         can_icf_inline_merge_sections.
4870         * testsuite/testfile.cc (Target_test::test_target_info):
4871         Likewise.
4872         * icf.cc (get_section_contents): Correct formatting.
4873
4874 2011-06-27  Ian Lance Taylor  <iant@google.com>
4875
4876         * symtab.cc (Symbol::versioned_name): New function.
4877         (Symbol_table::add_to_final_symtab): Use versioned_name when
4878         appropriate.
4879         (Symbol_table::sized_write_symbol): Likewise.
4880         * symtab.h (class Symbol): Declare versioned_name.
4881         * stringpool.h (class Stringpool_template): Add variant of add
4882         which takes a std::basic_string.
4883         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4884         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4885         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4886         (ver_test_12.o): New target.
4887         * testsuite/Makefile.in: Rebuild.
4888
4889 2011-06-27  Doug Kwan  <dougkwan@google.com>
4890
4891         * arm.cc (Arm_relocate_functions::thm_jump8,
4892         Arm_relocate_functions::thm_jump11): Use a wider signed
4893         type to compute offset.
4894         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4895         arm_thm_jump8.
4896         * testsuite/Makefile.in: Regenerate.
4897         * testsuite/arm_branch_in_range.sh: Check test results of
4898         arm_thm_jump11 and arm_thm_jump8.
4899         * testsuite/arm_thm_jump11.s: New test source file.
4900         * testsuite/arm_thm_jump11.t: New linker script.
4901         * testsuite/arm_thm_jump8.s: New test source file.
4902         * testsuite/arm_thm_jump8.t: New linker script.
4903
4904 2011-06-24  Ian Lance Taylor  <iant@google.com>
4905
4906         * layout.cc: Include "object.h".
4907         (ctors_sections_in_init_array): New static variable.
4908         (Layout::is_ctors_in_init_array): New function.
4909         (Layout::layout): Add entry to ctors_sections_in_init_array if
4910         appropriate.
4911         * layout.h (class Layout): Declare is_ctors_in_init_array.
4912         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4913         is_ctors_reverse_view is set.
4914         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4915         all callers.  Set is_ctors_reverse_view field of View_size.
4916         (Sized_relobj_file::reverse_words): New function.
4917         * object.h (Sized_relobj_file::View_size): Add
4918         is_ctors_reverse_view field.
4919         (class Sized_relobj_file): Update declarations.
4920         * testsuite/initpri3.c: New test.
4921         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4922         initpri3b.
4923         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4924         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4925         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4926         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4927         * testsuite/Makefile.in: Rebuild.
4928
4929 2011-06-24  Cary Coutant  <ccoutant@google.com>
4930
4931         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4932         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4933         (debug_msg_cdebug.err): New targets.
4934         * testsuite/Makefile.in: Regenerate.
4935         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4936         Fix checks for link with shared library.
4937
4938 2011-06-24  Doug Kwan  <dougkwan@google.com>
4939
4940         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4941         skip empty text sections.
4942         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4943
4944 2011-06-22  Ian Lance Taylor  <iant@google.com>
4945
4946         PR gold/12910
4947         * options.h (class General_options): Add --ctors-in-init-array.
4948         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4949         friends as SHT_PROGBITS for merging sections.
4950         (Layout::layout): Remove special handling of .init_array and
4951         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4952         and .dtors if ctors_in_init_array.
4953         (Layout::make_output_section): Force correct section types for
4954         .init_array and friends.  Don't sort if doing relocatable link,
4955         Don't sort .ctors and .dtors if ctors_in_init_array.
4956         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4957         (Layout::output_section_name): Add relobj parameter.  Change all
4958         callers.  Handle .ctors. and .dtors. in code rather than table.
4959         Handle .ctors and .dtors if ctors_in_init_array.
4960         (Layout::match_file_name): New function, moved from output.cc.
4961         * layout.h (class Layout): Update declarations.
4962         * output.cc: Include "layout.h".
4963         (Input_section_sort_entry::get_priority): New function.
4964         (Input_section_sort_entry::match_file_name): Just call
4965         Layout::match_file_name.
4966         (Output_section::Input_section_sort_init_fini_compare::operator()):
4967         Handle .ctors and .dtors.  Sort by explicit priority rather than
4968         by name.
4969         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4970         * testsuite/initpri2.c: New test.
4971         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4972         (check_PROGRAMS): Add initpri2.
4973         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4974         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4975         * configure, testsuite/Makefile.in: Rebuild.
4976
4977 2011-06-19  Ian Lance Taylor  <iant@google.com>
4978
4979         PR gold/12880
4980         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4981         .interp section to a PT_INTERP segment even if we have seen a
4982         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4983         clause in a linker script.
4984         (Layout::finalize): Don't create a .interp section if we've
4985         already create a PT_INTERP segment.
4986         (Layout::create_interp): Always call choose_output_section (revert
4987         patch of 2011-06-17).  Don't create PT_INTERP segment.
4988         * script-sections.cc
4989         (Script_sections::create_note_and_tls_segments): Add a .interp
4990         section to a PT_INTERP segment even if we have seen a
4991         --dynamic-linker option.
4992
4993 2011-06-18  Ian Lance Taylor  <iant@google.com>
4994
4995         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4996         merely because a non-PT_LOAD segment has a dynamic reloc.
4997
4998 2011-06-18  Ian Lance Taylor  <iant@google.com>
4999
5000         * layout.cc (Layout::finish_dynamic_section): Don't create
5001         DT_FLAGS entry if not needed.
5002
5003 2011-06-18  Ian Lance Taylor  <iant@google.com>
5004
5005         PR gold/12745
5006         * layout.cc (Layout::layout_eh_frame): Correct handling of
5007         writable .eh_frame section.
5008
5009 2011-06-17  Ian Lance Taylor  <iant@google.com>
5010
5011         PR gold/12893
5012         * resolve.cc (Symbol_table::resolve): Don't give an error if a
5013         symbol is redefined with the exact same object and value.
5014
5015 2011-06-17  Ian Lance Taylor  <iant@google.com>
5016
5017         PR gold/12880
5018         * layout.h (class Layout): Add interp_segment_ field.
5019         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
5020         (Layout::attach_allocated_section_to_segment): If making shared
5021         library, put .interp section in PT_INTERP segment.
5022         (Layout::finalize): Also call create_interp if -dynamic-linker
5023         option was used.
5024         (Layout::create_interp): Assert that there is no PT_INTERP
5025         segment.  If not using a SECTIONS clause, use make_output_section.
5026         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
5027         * script-sections.cc
5028         (Script_sections::create_note_and_tls_segments): If making shared
5029         library, put .interp section in PT_INTERP segment.
5030
5031 2011-06-17  Ian Lance Taylor  <iant@google.com>
5032
5033         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
5034         when making a shared library.
5035
5036 2011-06-17  Ian Lance Taylor  <iant@google.com>
5037
5038         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
5039         parameter.  Change all callers.  Don't issue warning about PC32
5040         against locally defined symbol.
5041
5042 2011-06-16  Ian Lance Taylor  <iant@google.com>
5043
5044         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
5045         occurs in same object.
5046
5047 2011-06-14  Alan Modra  <amodra@gmail.com>
5048
5049         * po/POTFILES.in: Regenerate.
5050
5051 2011-06-09  Ian Lance Taylor  <iant@google.com>
5052
5053         * script-sections.cc
5054         (Orphan_output_section::set_section_addresses): For a relocatable
5055         link set address to 0.
5056
5057 2011-06-09  Cary Coutant  <ccoutant@google.com>
5058
5059         PR gold/12804
5060         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
5061         used with --compress-debug-sections.
5062         * gold/object.cc (Sized_relobj_file::do_layout): Report
5063         uncompressed size of compressed input sections.
5064
5065 2011-06-08  Cary Coutant  <ccoutant@google.com>
5066
5067         PR gold/12804
5068         * testsuite/two_file_test_2_v1.cc: Change initialization of
5069         v2 to keep it in .data.
5070
5071 2011-06-07  Cary Coutant  <ccoutant@google.com>
5072
5073         * common.cc (Symbol_table::do_allocate_commons_list): Call
5074         gold_fallback.
5075         * errors.cc (Errors::fatal): Adjust call to gold_exit.
5076         (Errors::fallback): New function.
5077         (gold_fallback): New function.
5078         * errors.h (Errors::fallback): New function.
5079         * gold.cc (gold_exit): Change status parameter to enum; adjust
5080         all callers.
5081         (queue_initial_tasks): Call gold_fallback.
5082         * gold.h: Include cstdlib.
5083         (Exit_status): New enum type.
5084         (gold_exit): Change status parameter to enum.
5085         (gold_fallback): New function.
5086         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
5087         (Layout::create_symtab_sections): Likewise.
5088         (Layout::create_shdrs): Likewise.
5089         * main.cc (main): Adjust call to gold_exit.
5090         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
5091         (Output_data_got::add_got_entry_pair): Likewise.
5092         (Output_section::add_input_section): Likewise.
5093         (Output_section::add_output_section_data): Likewise.
5094         (Output_segment::set_section_list_addresses): Likewise.
5095         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
5096
5097 2011-06-07  Cary Coutant  <ccoutant@google.com>
5098
5099         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
5100         for incremental links.
5101         * output.cc (Output_segment::set_section_list_addresses): Remove
5102         FIXME and test for TLS or BSS.
5103
5104 2011-06-07  Cary Coutant  <ccoutant@google.com>
5105
5106         * testsuite/Makefile.am: Add incremental_copy_test,
5107         incremental_common_test_1.
5108         * testsuite/Makefile.in: Regenerate.
5109         * testsuite/common_test_1_v1.c: New source file.
5110         * testsuite/common_test_1_v2.c: New source file.
5111         * testsuite/copy_test_v1.cc: New source file.
5112
5113 2011-06-07  Cary Coutant  <ccoutant@google.com>
5114
5115         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
5116         update, allocate common from bss section's free list.
5117         * incremental-dump.cc (dump_incremental_inputs): Print flag for
5118         linker-defined symbols.
5119         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5120         Skip GOT and PLT entries that are no longer referenced.
5121         (Output_section_incremental_inputs::write_info_blocks): Mark
5122         linker-defined symbols.
5123         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
5124         * output.cc (Output_section::allocate): New function.
5125         * output.h (Output_section::allocate): New function.
5126         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
5127         linker-defined symbols.
5128         (Symbol::override_base_with_special): Copy is_predefined_ flag.
5129         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
5130         (Symbol::init_base_output_data): Likewise.
5131         (Symbol::init_base_output_segment): Likewise.
5132         (Symbol::init_base_constant): Likewise.
5133         (Sized_symbol::init_output_data): Likewise.
5134         (Sized_symbol::init_output_segment): Likewise.
5135         (Sized_symbol::init_constant): Likewise.
5136         (Symbol_table::do_define_in_output_data): Likewise.
5137         (Symbol_table::do_define_in_output_segment): Likewise.
5138         (Symbol_table::do_define_as_constant): Likewise.
5139         * symtab.h (Symbol::is_predefined): New function.
5140         (Symbol::init_base_output_data): Add is_predefined parameter.
5141         (Symbol::init_base_output_segment): Likewise.
5142         (Symbol::init_base_constant): Likewise.
5143         (Symbol::is_predefined_): New data member.
5144         (Sized_symbol::init_output_data): Add is_predefined parameter.
5145         (Sized_symbol::init_output_segment): Likewise.
5146         (Sized_symbol::init_constant): Likewise.
5147         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
5148
5149 2011-06-07  Cary Coutant  <ccoutant@google.com>
5150
5151         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
5152         instead of emit_copy_reloc.
5153         (Copy_relocs::emit_copy_reloc): Refactor.
5154         (Copy_relocs::make_copy_reloc): New function.
5155         (Copy_relocs::add_copy_reloc): Remove.
5156         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
5157         section.
5158         (Copy_relocs::make_copy_reloc): New function.
5159         (Copy_relocs::add_copy_reloc): Remove.
5160         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
5161         unchanged input files.
5162         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
5163         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
5164         Reserve BSS space for COPY relocations.
5165         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5166         (Output_section_incremental_inputs::write_info_blocks): Record
5167         whether a symbol is copied from a shared object.
5168         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
5169         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
5170         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
5171         (Incremental_input_entry_reader::get_output_symbol_index): Add
5172         is_copy parameter.
5173         (Incremental_binary::emit_copy_relocs): New function.
5174         (Incremental_binary::do_emit_copy_relocs): New function.
5175         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5176         new data member.
5177         (Sized_incremental_binary::add_copy_reloc): New function.
5178         (Sized_incremental_binary::do_emit_copy_relocs): New function.
5179         (Sized_incremental_binary::Copy_reloc): New struct.
5180         (Sized_incremental_binary::Copy_relocs): New typedef.
5181         (Sized_incremental_binary::copy_relocs_): New data member.
5182         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
5183         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
5184         * target.h (Sized_target::emit_copy_reloc): New function.
5185         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
5186
5187 2011-06-02  Cary Coutant  <ccoutant@google.com>
5188
5189         PR gold/12163
5190         * gold/archive.cc (Archive::Archive): Initialize new data member.
5191         (Archive::include_all_members): Return if archive has already been
5192         included.
5193         * gold/archive.h (Archive::include_all_members_): New data member.
5194
5195 2011-06-02  Nick Clifton  <nickc@redhat.com>
5196
5197         * dynobj.h: Fix spelling mistake in comment.
5198         * output.cc: Likewise.
5199
5200 2011-05-31  Doug Kwan  <dougkwan@google.com>
5201             Asier Llano
5202
5203         PR gold/12826
5204         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
5205         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
5206         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
5207         redundant arm_exidx_test.so.
5208         * testsuite/Makefile.in: Regenerate.
5209         (check_SCRIPTS): Add pr12826.sh
5210         (check_DATA): Add pr12826.stdout
5211         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
5212         * testsuite/pr12826.sh: New file.
5213         * testsuite/pr12826_1.s: Ditto.
5214         * testsuite/pr12826_1.s: Ditto.
5215
5216 2011-05-30  Ian Lance Taylor  <iant@google.com>
5217
5218         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
5219         sections.
5220
5221 2011-05-29  Ian Lance Taylor  <iant@google.com>
5222
5223         PR gold/12804
5224         * testsuite/Makefile.am: Use different file name for two_file_test
5225         temporary file for each incremental test.
5226         * testsuite/Makefile.in: Rebuild.
5227
5228 2011-05-29  Ian Lance Taylor  <iant@google.com>
5229
5230         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
5231         binary input file is empty.
5232
5233 2011-05-27  Ian Lance Taylor  <iant@google.com>
5234
5235         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
5236         (ver_test_9.so): Likewise.
5237         * testsuite/Makefile.in: Rebuild.
5238
5239 2011-05-26 Cary Coutant  <ccoutant@google.com>
5240
5241         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
5242         * incremental.cc (Incremental_inputs::report_input_section): Fix
5243         comment, indentation.
5244         (Incremental_inputs::report_comdat_group): New function.
5245         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5246         of data for incremental input file entry.
5247         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
5248         group count, COMDAT group signatures.
5249         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
5250         an unchanged input file.
5251         * incremental.h (Incremental_object_entry::Incremental_object_entry):
5252         Initialize new data member.
5253         (Incremental_object_entry::add_comdat_group): New function.
5254         (Incremental_object_entry::get_comdat_group_count): New function.
5255         (Incremental_object_entry::get_comdat_signature_key): New function.
5256         (Incremental_object_entry::groups_): New data member.
5257         (Incremental_inputs::report_comdat_group): New function.
5258         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
5259         data for incremental input file entry.
5260         (Incremental_input_entry_reader::get_comdat_group_count): New function.
5261         (Incremental_input_entry_reader::get_input_section): Adjust size of
5262         data for incremental input file entry.
5263         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
5264         (Incremental_input_entry_reader::get_comdat_group_signature): New
5265         function.
5266         * object.cc (Sized_relobj::include_section_group): Report kept
5267         COMDAT groups for incremental links.
5268
5269 2011-05-24  David Meyer  <pdox@google.com>
5270
5271         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
5272         with name parameter.  Add found_name parameter.
5273         * fileread.cc (Input_file::find_file): Adjust code accordingly.
5274         * dirsearch.h (class Dirsearch): Update declaration.
5275
5276 2011-05-24  Ian Lance Taylor  <iant@google.com>
5277
5278         * archive.cc (Library_base::should_include_member): Pull in object
5279         from archive if it defines the entry symbol.
5280         * parameters.cc (Parameters::entry): New function.
5281         * parameters.h (class Parameters): Declare entry.
5282         * output.h (class Output_file_header): Remove entry_ field.
5283         * output.cc (Output_file_header::Output_file_header): Remove entry
5284         parameter.  Change all callers.
5285         (Output_file_header::entry): Use parameters->entry.
5286         * gold.cc (queue_middle_tasks): Likewise.
5287         * plugin.cc (Plugin_hook::run): Likewise.
5288
5289 2011-05-24 Cary Coutant  <ccoutant@google.com>
5290
5291         * gold.cc (queue_initial_tasks): Pass incremental base filename
5292         to Output_file::open_base_file; don't print error message.
5293         * incremental-dump.cc (main): Adjust call to
5294         Output_file::open_for_modification.
5295         * incremental-dump.cc (main): Likewise.
5296         * incremental.cc (Incremental_inputs::report_command_line):
5297         Ignore --incremental-base option when comparing command lines.
5298         Ignore parameter when given as separate argument.
5299         * options.h (class General_options): Add --incremental-base.
5300         * output.cc (Output_file::Output_file):
5301         (Output_file::open_base_file): Add base_name and writable parameters;
5302         read base file into new file; print error message here.
5303         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5304         callers.
5305         * output.h (Output_file::open_for_modification): Rename to...
5306         (Output_file::open_base_file): ...this; add base_name and
5307         writable parameters; adjust all callers.
5308         (Output_file::map_no_anonymous): Add writable parameter; adjust all
5309         callers.
5310         * testsuite/Makefile.am (incremental_test_4): Test
5311         --incremental-base.
5312         * testsuite/Makefile.in: Regenerate.
5313
5314 2011-05-24 Cary Coutant  <ccoutant@google.com>
5315
5316         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
5317         incremental_test_4.
5318         * testsuite/Makefile.in: Regenerate.
5319         * testsuite/two_file_test_1_v1.cc: New test source file.
5320         * testsuite/two_file_test_1b_v1.cc: New test source file.
5321         * testsuite/two_file_test_2_v1.cc: New test source file.
5322
5323 2011-05-24 Cary Coutant  <ccoutant@google.com>
5324
5325         * dynobj.h (Dynobj::do_dynobj): New function.
5326         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
5327         flag and soname for shared objects.
5328         * incremental.cc (Incremental_inputs::report_object): Make
5329         either Incremental_object_entry or Incremental_dynobj_entry; add
5330         soname to string table.
5331         (Incremental_inputs::report_input_section): Add assertion.
5332         (Output_section_incremental_inputs::set_final_data_size): Adjust
5333         type of input file entry for shared libraries; adjust size of
5334         shared library info entry.
5335         (Output_section_incremental_inputs::write_input_files): Write
5336         as_needed flag for shared libraries.
5337         (Output_section_incremental_inputs::write_info_blocks): Adjust type
5338         of input file entry for shared libraries; write soname.
5339         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
5340         soname from incremental info.
5341         * incremental.h (enum Incremental_input_flags): Add
5342         INCREMENTAL_INPUT_AS_NEEDED.
5343         (Incremental_input_entry::Incremental_input_entry): Initialize new
5344         data member.
5345         (Incremental_input_entry::set_as_needed): New function.
5346         (Incremental_input_entry::as_needed): New function.
5347         (Incremental_input_entry::do_dynobj_entry): New function.
5348         (Incremental_input_entry::as_needed_): New data member.
5349         (Incremental_object_entry::Incremental_object_entry): Don't check
5350         for shared library.
5351         (Incremental_object_entry::do_type): Likewise.
5352         (class Incremental_dynobj_entry): New class.
5353         (Incremental_input_entry_reader::as_needed): New function.
5354         (Incremental_input_entry_reader::get_soname): New function.
5355         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
5356         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
5357         size of shared library info entry.
5358         * layout.cc (Layout::finish_dynamic_section): Don't test for
5359         incremental link when adding DT_NEEDED entries.
5360         * object.h (Object::Object): Initialize new data member.
5361         (Object::dynobj): New function.
5362         (Object::set_as_needed): New function.
5363         (Object::as_needed): New function.
5364         (Object::do_dynobj): New function.
5365         (Object::as_needed_): New data member.
5366
5367 2011-05-24 Cary Coutant  <ccoutant@google.com>
5368
5369         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
5370         info; adjust display of GOT entries.
5371         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5372         vector of input objects; remove file_status_.
5373         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
5374         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
5375         got_plt reader; call target hooks to reserve GOT entries.
5376         (Output_section_incremental_inputs::set_final_data_size): Adjust size
5377         of input file info header and GOT info entry.
5378         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
5379         relocation info.
5380         (Got_plt_view_info::got_descriptor): Remove.
5381         (Got_plt_view_info::sym_index): New data member.
5382         (Got_plt_view_info::input_index): New data member.
5383         (Local_got_offset_visitor::visit): Write input file index.
5384         (Global_got_offset_visitor::visit): Write 0 for input file index.
5385         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
5386         with sym_index and input_index.
5387         (Output_section_incremental_inputs::write_got_plt): Adjust size of
5388         incremental info GOT entry; replace got_descriptor with input_index.
5389         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
5390         map from input file index to object.
5391         (Sized_relobj_incr::do_layout): Replace direct data member reference
5392         with accessor function.
5393         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
5394         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
5395         Adjust size of input file info header.
5396         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
5397         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
5398         (Incremental_input_entry_reader::get_input_section): Adjust size of
5399         input file info header.
5400         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
5401         of incremental info GOT entry.
5402         (Incremental_got_plt_reader::get_got_desc): Remove.
5403         (Incremental_got_plt_reader::get_got_symndx): New function.
5404         (Incremental_got_plt_reader::get_got_input_index): New function.
5405         (Sized_incremental_binary::Sized_incremental_binary): Remove
5406         file_status_; add input_objects_.
5407         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
5408         (Sized_incremental_binary::set_file_is_unchanged): Remove.
5409         (Sized_incremental_binary::file_is_unchanged): Remove.
5410         (Sized_incremental_binary::set_input_object): New function.
5411         (Sized_incremental_binary::input_object): New function.
5412         (Sized_incremental_binary::file_status_): Remove.
5413         (Sized_incremental_binary::input_objects_): New data member.
5414         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
5415         references.
5416         (Sized_relobj_incr::invalid_address): Move to base class.
5417         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
5418         class.
5419         (Sized_relobj_incr::do_output_section_offset): Likewise.
5420         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
5421         (Sized_relobj_incr::section_offsets_): Likewise.
5422         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
5423         function.
5424         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
5425         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
5426         with accessor function.
5427         (Sized_relobj_file::do_layout): Likewise.
5428         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
5429         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
5430         (Sized_relobj_file::compute_final_local_value): Replace refs to
5431         section_offsets_ with accessor function.
5432         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
5433         * object.h (Relobj::Relobj): Initialize new data members.
5434         (Relobj::add_dyn_reloc): New function.
5435         (Relobj::first_dyn_reloc): New function.
5436         (Relobj::dyn_reloc_count): New function.
5437         (Relobj::first_dyn_reloc_): New data member.
5438         (Relobj::dyn_reloc_count_): New data member.
5439         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
5440         references.
5441         (Sized_relobj::Address): New typedef.
5442         (Sized_relobj::invalid_address): Move here from child class.
5443         (Sized_relobj::Sized_relobj): Initialize new data members.
5444         (Sized_relobj::sized_relobj): New function.
5445         (Sized_relobj::is_output_section_offset_invalid): Move here from
5446         child class.
5447         (Sized_relobj::get_output_section_offset): Likewise.
5448         (Sized_relobj::local_has_got_offset): Likewise.
5449         (Sized_relobj::local_got_offset): Likewise.
5450         (Sized_relobj::set_local_got_offset): Likewise.
5451         (Sized_relobj::do_for_all_local_got_entries): Likewise.
5452         (Sized_relobj::clear_got_offsets): New function.
5453         (Sized_relobj::section_offsets): Move here from child class.
5454         (Sized_relobj::do_output_section_offset): Likewise.
5455         (Sized_relobj::do_set_section_offset): Likewise.
5456         (Sized_relobj::Local_got_offsets): Likewise.
5457         (Sized_relobj::local_got_offsets_): Likewise.
5458         (Sized_relobj::section_offsets_): Likewise.
5459         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
5460         references.
5461         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
5462         class.
5463         (Sized_relobj_file::sized_relobj): New function
5464         (Sized_relobj_file::local_has_got_offset): Move to base class.
5465         (Sized_relobj_file::local_got_offset): Likewise.
5466         (Sized_relobj_file::set_local_got_offset): Likewise.
5467         (Sized_relobj_file::get_output_section_offset): Likewise.
5468         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
5469         (Sized_relobj_file::do_output_section_offset): Likewise.
5470         (Sized_relobj_file::do_set_section_offset): Likewise.
5471         (Sized_relobj_file::Local_got_offsets): Likewise.
5472         (Sized_relobj_file::local_got_offsets_): Likewise.
5473         (Sized_relobj_file::section_offsets_): Likewise.
5474         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
5475         (all constructors).
5476         (set_needs_dynsym_index): Convert relobj to derived class pointer.
5477         (Output_reloc::get_symbol_index): Likewise.
5478         (Output_reloc::local_section_offset): Likewise.
5479         (Output_reloc::get_address): Likewise.
5480         (Output_reloc::symbol_value): Likewise.
5481         (Output_data_got::reserve_slot): Move to class definition.
5482         (Output_data_got::reserve_local): New function.
5483         (Output_data_got::reserve_slot_for_global): Remove.
5484         (Output_data_got::reserve_global): New function.
5485         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
5486         (all constructors, two instantiations).
5487         (Output_reloc::get_relobj): New function (two instantiations).
5488         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
5489         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
5490         (Output_data_reloc::add_global): Adjust type of relobj.
5491         (Output_data_reloc::add_global_relative): Likewise.
5492         (Output_data_reloc::add_symbolless_global_addend): Likewise.
5493         (Output_data_reloc::add_local): Likewise.
5494         (Output_data_reloc::add_local_relative): Likewise.
5495         (Output_data_reloc::add_symbolless_local_addend): Likewise.
5496         (Output_data_reloc::add_local_section): Likewise.
5497         (Output_data_reloc::add_output_section): Likewise.
5498         (Output_data_reloc::add_absolute): Likewise.
5499         (Output_data_reloc::add_target_specific): Likewise.
5500         (Output_data_got::reserve_slot): Move definition here.
5501         (Output_data_got::reserve_local): New function.
5502         (Output_data_got::reserve_global): New function.
5503         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
5504         section_offsets_ with accessor function.
5505         (Sized_relobj_file::write_sections): Likewise.
5506         (Sized_relobj_file::do_relocate_sections): Likewise.
5507         * target.h (Sized_target::reserve_local_got_entry): New function.
5508         (Sized_target::reserve_global_got_entry): New function.
5509         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
5510         (Target_x86_64::reserve_global_got_entry): New function.
5511         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
5512
5513 2011-05-23 Cary Coutant  <ccoutant@google.com>
5514
5515         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
5516         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
5517         bit when checking got_type.
5518         * incremental.cc (Sized_incremental_binary::setup_readers):
5519         Store symbol table and string table locations; initialize bit vector
5520         of file status flags.
5521         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
5522         unchanged files.
5523         (Sized_incremental_binary::do_process_got_plt): New function.
5524         (Sized_incremental_binary::get_symtab_view): Use stored locations.
5525         (Output_section_incremental_inputs::set_final_data_size): Record
5526         file index for each input file.
5527         (Output_section_incremental_inputs::write_got_plt): Store file index
5528         instead of input entry offset for each GOT entry.
5529         * incremental.h
5530         (Incremental_input_entry::Incremental_input_entry): Initialize new
5531         data member.
5532         (Incremental_input_entry::set_offset): Store file index.
5533         (Incremental_input_entry::get_file_index): New function.
5534         (Incremental_input_entry::file_index_): New data member.
5535         (Incremental_binary::process_got_plt): New function.
5536         (Incremental_binary::do_process_got_plt): New function.
5537         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5538         data members.
5539         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
5540         (Sized_incremental_binary::set_file_is_unchanged): New function.
5541         (Sized_incremental_binary::file_is_unchanged): New function.
5542         (Sized_incremental_binary::do_process_got_plt): New function.
5543         (Sized_incremental_binary::file_status_): New data member.
5544         (Sized_incremental_binary::main_symtab_loc_): New data member.
5545         (Sized_incremental_binary::main_strtab_loc_): New data member.
5546         * output.cc (Output_data_got::Got_entry::write): Add case
5547         RESERVED_CODE.
5548         (Output_data_got::add_global): Call add_got_entry.
5549         (Output_data_got::add_global_plt): Likewise.
5550         (Output_data_got::add_global_with_rel): Likewise.
5551         (Output_data_got::add_global_with_rela): Likewise.
5552         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
5553         (Output_data_got::add_global_pair_with_rela): Likewise.
5554         (Output_data_got::add_local): Call add_got_entry.
5555         (Output_data_got::add_local_plt): Likewise.
5556         (Output_data_got::add_local_with_rel): Likewise.
5557         (Output_data_got::add_local_with_rela): Likewise.
5558         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
5559         (Output_data_got::add_local_pair_with_rela): Likewise.
5560         (Output_data_got::reserve_slot): New function.
5561         (Output_data_got::reserve_slot_for_global): New function.
5562         (Output_data_got::add_got_entry): New function.
5563         (Output_data_got::add_got_entry_pair): New function.
5564         (Output_section::add_output_section_data): Edit FIXME.
5565         * output.h
5566         (Output_section_data_build::Output_section_data_build): New
5567         constructor with size parameter.
5568         (Output_data_space::Output_data_space): Likewise.
5569         (Output_data_got::Output_data_got): Initialize new data member; new
5570         constructor with size parameter.
5571         (Output_data_got::add_constant): Call add_got_entry.
5572         (Output_data_got::reserve_slot): New function.
5573         (Output_data_got::reserve_slot_for_global): New function.
5574         (class Output_data_got::Got_entry): Add RESERVED_CODE.
5575         (Output_data_got::add_got_entry): New function.
5576         (Output_data_got::add_got_entry_pair): New function.
5577         (Output_data_got::free_list_): New data member.
5578         * target.h (Sized_target::init_got_plt_for_update): New function.
5579         (Sized_target::register_global_plt_entry): New function.
5580         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
5581         Initialize new data member; call init; add constructor with PLT count.
5582         (Output_data_plt_x86_64::init): New function.
5583         (Output_data_plt_x86_64::add_relocation): New function.
5584         (Output_data_plt_x86_64::reserve_slot): New function.
5585         (Output_data_plt_x86_64::free_list_): New data member.
5586         (Target_x86_64::init_got_plt_for_update): New function.
5587         (Target_x86_64::register_global_plt_entry): New function.
5588         (Output_data_plt_x86_64::add_entry): Allocate from free list for
5589         incremental updates.
5590         (Output_data_plt_x86_64::add_relocation): New function.
5591         * testsuite/object_unittest.cc (Object_test): Set default options.
5592
5593 2011-05-16  Ian Lance Taylor  <iant@google.com>
5594
5595         * options.h (class General_options): Make -i a synonym for -r.
5596
5597 2011-05-16  Ian Lance Taylor  <iant@google.com>
5598
5599         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
5600
5601 2011-05-10 Cary Coutant  <ccoutant@google.com>
5602
5603         * object.cc (Sized_relobj::do_count_local_symbols): Check for
5604         strip_all (-s).
5605
5606 2011-05-06  Ian Lance Taylor  <iant@google.com>
5607
5608         * layout.cc (Layout::layout): If the output section flags change,
5609         update the ordering.
5610
5611 2011-04-25 Cary Coutant  <ccoutant@google.com>
5612
5613         * incremental-dump.cc (dump_incremental_inputs): Print local
5614         symbol info for each input file.
5615         * incremental.cc
5616         (Output_section_incremental_inputs::set_final_data_size): Add local
5617         symbol info to input file entries in incremental info.
5618         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5619         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
5620         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
5621         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
5622         implementation.
5623         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
5624         (Sized_incr_relobj::do_relocate): Write the local symbols.
5625         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
5626         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
5627         Adjust size of input file header.
5628         (Incremental_inputs_reader::get_local_symbol_offset): New function.
5629         (Incremental_inputs_reader::get_local_symbol_count): New function.
5630         (Incremental_inputs_reader::get_input_section): Adjust size of input
5631         file header.
5632         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5633         (Sized_incr_relobj::This): New typedef.
5634         (Sized_incr_relobj::sym_size): New const data member.
5635         (Sized_incr_relobj::Local_symbol): New struct.
5636         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5637         (Sized_incr_relobj::do_local_symbol_offset): New function.
5638         (Sized_incr_relobj::local_symbol_count_): New data member.
5639         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5640         (Sized_incr_relobj::local_symbol_index_): New data member.
5641         (Sized_incr_relobj::local_symbol_offset_): New data member.
5642         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5643         (Sized_incr_relobj::local_symbols_): New data member.
5644         * object.h (Relobj::output_local_symbol_count): New function.
5645         (Relobj::local_symbol_offset): New function.
5646         (Relobj::do_output_local_symbol_count): New function.
5647         (Relobj::do_local_symbol_offset): New function.
5648         (Sized_relobj::do_output_local_symbol_count): New function.
5649         (Sized_relobj::do_local_symbol_offset): New function.
5650
5651 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5652
5653         * descriptors.cc (set_close_on_exec): New function.
5654         (Descriptors::open): Use set_close_on_exec.
5655         * output.cc (S_ISLNK): Define if not defined.
5656
5657 2011-04-22 Cary Coutant  <ccoutant@google.com>
5658
5659         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5660         global symbol map.
5661         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5662         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5663         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5664         relocations.
5665         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5666         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5667         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5668         * incremental.h
5669         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5670         function.
5671         (Incremental_binary::apply_incremental_relocs): New function.
5672         (Incremental_binary::do_apply_incremental_relocs): New function.
5673         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5674         data member.
5675         (Sized_incremental_binary::add_global_symbol): New function.
5676         (Sized_incremental_binary::global_symbol): New function.
5677         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5678         (Sized_incremental_binary::symbol_map_): New data member.
5679         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5680         * target.h (Sized_target::apply_relocation): New function.
5681         * target-reloc.h (apply_relocation): New function.
5682         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5683
5684 2011-04-22  Doug Kwan  <dougkwan@google.com>
5685
5686         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5687         flag of a SHT_ARM_EXIDX section.
5688         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5689         * testsuite/Makefile.in: Regenerate.
5690         * testsuite/arm_exidx_test.s: New file.
5691         * testsuite/arm_exidx_test.sh: Same.
5692
5693 2011-04-20 Cary Coutant  <ccoutant@google.com>
5694
5695         PR gold/12689
5696         * archive.h (Incremental_archive_entry::Archive_member):
5697         Initialize arg_serial_ (second constructor).
5698
5699 2011-04-17  Ian Lance Taylor  <iant@google.com>
5700
5701         * object.cc (Relocate_info::location): Simplify location string.
5702         * errors.cc (Errors::error_at_location): Don't print program
5703         name.
5704         (Errors::warning_at_location): Likewise.
5705         (Errors::undefined_symbol): Likewise.
5706         * testsuite/debug_msg.sh: Update accordingly.
5707
5708 2011-04-14 Cary Coutant  <ccoutant@google.com>
5709
5710         * gold/layout.cc (Layout::symtab_section_offset): New function.
5711         * gold/layout.h (Layout::symtab_section_offset): New function.
5712         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5713
5714 2011-04-12  Ian Lance Taylor  <iant@google.com>
5715
5716         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5717         with MREMAP_MAYMOVE.
5718         * output.h (class Output_file): Add map_is_allocated_ field.
5719         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5720         not available, provide stubs.  If mremap is not available, #define
5721         it to gold_mremap.
5722         (MREMAP_MAYMOVE): Define if not defined.
5723         (Output_file::Output_file): Initialize map_is_allocated_.
5724         (Output_file::resize): Check map_is_allocated_.
5725         (Output_file::map_anonymous): If mmap fails, use malloc.
5726         (Output_file::unmap): Don't do anything for an anonymous map.
5727         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5728         is not available, provide stubs.
5729         (File_read::View::~View): Use free rather than delete[].
5730         (File_read::make_view): Use malloc rather than new[].  If mmap
5731         fails, use malloc.
5732         (File_read::find_or_make_view): Use malloc rather than new[].
5733         * gold.h: Remove HAVE_REMAP code.
5734         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5735         exists.  Rename mremap to gold_mremap.  If mmap is not available
5736         don't do anything.
5737         * configure, config.in: Rebuild.
5738
5739 2011-04-11  Ian Lance Taylor  <iant@google.com>
5740
5741         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5742         initialize local variable v.
5743
5744 2011-04-11  Cary Coutant  <ccoutant@google.com>
5745
5746         * archive.cc (Archive::include_member): Adjust call to
5747         report_object.
5748         (Add_archive_symbols::run): Track argument serial numbers.
5749         (Lib_group::include_member): Likewise.
5750         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5751         * archive.h (Incremental_archive_entry::Archive_member):
5752         Initialize arg_serial_.
5753         (Archive_member::arg_serial_): New data member.
5754         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5755         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5756         incremental link.
5757         (Sized_dynobj::do_for_all_local_got_entries): New function.
5758         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5759         function.
5760         * fileread.cc (get_mtime): New function.
5761         * fileread.h (get_mtime): New function.
5762         * gold.cc (queue_initial_tasks): Check for incremental update.
5763         (process_incremental_input): New function.
5764         (queue_middle_tasks): Don't force valid target for incremental
5765         update.
5766         * incremental-dump.cc (find_input_containing_global): Adjust
5767         size of symbol info entry.
5768         (dump_incremental_inputs): Dump argument serial number and
5769         in_system_directory flag; bias shndx by 1; print symbol names
5770         when dumping per-file symbol lists; use new symbol info readers.
5771         * incremental.cc
5772         (Output_section_incremental_inputs:update_data_size): New function.
5773         (Sized_incremental_binary::setup_readers): Setup input readers
5774         for each input file; build maps for files added from libraries
5775         and scripts.
5776         (Sized_incremental_binary::check_input_args): New function.
5777         (Sized_incremental_binary::do_check_inputs): Build map of argument
5778         serial numbers to input arguments.
5779         (Sized_incremental_binary::do_file_has_changed): Rename
5780         do_file_is_unchanged to this; compare file modification times.
5781         (Sized_incremental_binary::do_init_layout): New function.
5782         (Sized_incremental_binary::do_reserve_layout): New function.
5783         (Sized_incremental_binary::do_get_input_reader): Remove.
5784         (Sized_incremental_binary::get_symtab_view): New function.
5785         (Incremental_checker::can_incrementally_link_output_file): Remove.
5786         (Incremental_inputs::report_command_line): Exclude --debug options.
5787         (Incremental_inputs::report_archive_begin): Add parameter; track
5788         argument serial numbers; don't put input file entry for archive
5789         before archive members.
5790         (Incremental_inputs::report_archive_end): Put input file entry
5791         for archive after archive members.
5792         (Incremental_inputs::report_object): Add parameter; track argument
5793         serial numbers and in_system_directory flag.
5794         (Incremental_inputs::report_script): Add parameter; track argument
5795         serial numbers.
5796         (Output_section_incremental_inputs::set_final_data_size): Adjust
5797         size of symbol info entry; check for forwarding symbols.
5798         (Output_section_incremental_inputs::write_input_files): Write
5799         in_system_directory flag and argument serial number.
5800         (Output_section_incremental_inputs::write_info_blocks): Map section
5801         indices between incremental info and original input file; store
5802         input section index for each symbol.
5803         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5804         change operator() to visit().
5805         (class Global_got_offset_visitor): Likewise.
5806         (class Global_symbol_visitor_got_plt):
5807         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5808         classes.
5809         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5810         (Sized_incr_relobj::do_read_symbols): New function.
5811         (Sized_incr_relobj::do_layout): New function.
5812         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5813         (Sized_incr_relobj::do_add_symbols): New function.
5814         (Sized_incr_relobj::do_should_include_member): New function.
5815         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5816         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5817         (Sized_incr_relobj::do_section_size): New function.
5818         (Sized_incr_relobj::do_section_name): New function.
5819         (Sized_incr_relobj::do_section_contents): New function.
5820         (Sized_incr_relobj::do_section_flags): New function.
5821         (Sized_incr_relobj::do_section_entsize): New function.
5822         (Sized_incr_relobj::do_section_address): New function.
5823         (Sized_incr_relobj::do_section_type): New function.
5824         (Sized_incr_relobj::do_section_link): New function.
5825         (Sized_incr_relobj::do_section_info): New function.
5826         (Sized_incr_relobj::do_section_addralign): New function.
5827         (Sized_incr_relobj::do_initialize_xindex): New function.
5828         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5829         (Sized_incr_relobj::do_read_relocs): New function.
5830         (Sized_incr_relobj::do_gc_process_relocs): New function.
5831         (Sized_incr_relobj::do_scan_relocs): New function.
5832         (Sized_incr_relobj::do_count_local_symbols): New function.
5833         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5834         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5835         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5836         (Sized_incr_relobj::do_relocate): New function.
5837         (Sized_incr_relobj::do_set_section_offset): New function.
5838         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5839         (Sized_incr_dynobj::do_read_symbols): New function.
5840         (Sized_incr_dynobj::do_layout): New function.
5841         (Sized_incr_dynobj::do_add_symbols): New function.
5842         (Sized_incr_dynobj::do_should_include_member): New function.
5843         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5844         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5845         (Sized_incr_dynobj::do_section_size): New function.
5846         (Sized_incr_dynobj::do_section_name): New function.
5847         (Sized_incr_dynobj::do_section_contents): New function.
5848         (Sized_incr_dynobj::do_section_flags): New function.
5849         (Sized_incr_dynobj::do_section_entsize): New function.
5850         (Sized_incr_dynobj::do_section_address): New function.
5851         (Sized_incr_dynobj::do_section_type): New function.
5852         (Sized_incr_dynobj::do_section_link): New function.
5853         (Sized_incr_dynobj::do_section_info): New function.
5854         (Sized_incr_dynobj::do_section_addralign): New function.
5855         (Sized_incr_dynobj::do_initialize_xindex): New function.
5856         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5857         (make_sized_incremental_object): New function.
5858         (Incremental_library::copy_unused_symbols): New function.
5859         (Incremental_library::do_for_all_unused_symbols): New function.
5860         * incremental.h (enum Incremental_input_flags): New type.
5861         (class Incremental_checker): Remove.
5862         (Incremental_input_entry::Incremental_input_entry): Add argument
5863         serial number.
5864         (Incremental_input_entry::arg_serial): New function.
5865         (Incremental_input_entry::set_is_in_system_directory): New function.
5866         (Incremental_input_entry::is_in_system_directory): New function.
5867         (Incremental_input_entry::arg_serial_): New data member.
5868         (Incremental_input_entry::is_in_system_directory_): New data member.
5869         (class Script_info): Move here from script.h.
5870         (Script_info::Script_info): Add filename parameter.
5871         (Script_info::filename): New function.
5872         (Script_info::filename_): New data member.
5873         (Incremental_script_entry::Incremental_script_entry): Add argument
5874         serial number.
5875         (Incremental_object_entry::Incremental_object_entry): Likewise.
5876         (Incremental_object_entry::add_input_section): Build list of input
5877         sections with map to original shndx.
5878         (Incremental_object_entry::get_input_section_index): New function.
5879         (Incremental_object_entry::shndx_): New data member.
5880         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5881         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5882         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5883         serial number.
5884         (Incremental_inputs::report_archive_begin): Likewise.
5885         (Incremental_inputs::report_object): Likewise.
5886         (Incremental_inputs::report_script): Likewise.
5887         (class Incremental_global_symbol_reader): New class.
5888         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5889         and store flags and input file type.
5890         (Incremental_input_entry_reader::arg_serial): New function.
5891         (Incremental_input_entry_reader::type): Extract type from flags.
5892         (Incremental_input_entry_reader::is_in_system_directory): New function.
5893         (Incremental_input_entry_reader::get_input_section_count): Call
5894         accessor function for type.
5895         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5896         function for type; adjust size of global symbol entry.
5897         (Incremental_input_entry_reader::get_global_symbol_count): Call
5898         accessor function for type.
5899         (Incremental_input_entry_reader::get_object_count): Likewise.
5900         (Incremental_input_entry_reader::get_object_offset): Likewise.
5901         (Incremental_input_entry_reader::get_member_count): Likewise.
5902         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5903         (Incremental_input_entry_reader::get_member_offset): Likewise.
5904         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5905         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5906         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5907         (Incremental_input_entry_reader::get_global_symbol_reader): New
5908         function.
5909         (Incremental_input_entry_reader::get_output_symbol_index): New
5910         function.
5911         (Incremental_input_entry_reader::type_): Remove.
5912         (Incremental_input_entry_reader::flags_): New data member.
5913         (Incremental_inputs_reader::input_file_offset): New function.
5914         (Incremental_inputs_reader::input_file_index): New function.
5915         (Incremental_inputs_reader::input_file): Call input_file_offset.
5916         (Incremental_inputs_reader::input_file_at_offset): New function.
5917         (Incremental_relocs_reader::get_r_type): Reformat.
5918         (Incremental_relocs_reader::get_r_shndx): Reformat.
5919         (Incremental_relocs_reader::get_r_offset): Reformat.
5920         (Incremental_relocs_reader::data): New function.
5921         (Incremental_binary::Incremental_binary): Initialize new data members.
5922         (Incremental_binary::check_inputs): Add cmdline parameter.
5923         (Incremental_binary::file_is_unchanged): Remove.
5924         (Input_reader::arg_serial): New function.
5925         (Input_reader::get_unused_symbol_count): New function.
5926         (Input_reader::get_unused_symbol): New function.
5927         (Input_reader::do_arg_serial): New function.
5928         (Input_reader::do_get_unused_symbol_count): New function.
5929         (Input_reader::do_get_unused_symbol): New function.
5930         (Incremental_binary::input_file_count): New function.
5931         (Incremental_binary::get_input_reader): Change signature to use
5932         index instead of filename.
5933         (Incremental_binary::file_has_changed): New function.
5934         (Incremental_binary::get_input_argument): New function.
5935         (Incremental_binary::get_library): New function.
5936         (Incremental_binary::get_script_info): New function.
5937         (Incremental_binary::init_layout): New function.
5938         (Incremental_binary::reserve_layout): New function.
5939         (Incremental_binary::output_file): New function.
5940         (Incremental_binary::do_check_inputs): New function.
5941         (Incremental_binary::do_file_is_unchanged): Remove.
5942         (Incremental_binary::do_file_has_changed): New function.
5943         (Incremental_binary::do_init_layout): New function.
5944         (Incremental_binary::do_reserve_layout): New function.
5945         (Incremental_binary::do_input_file_count): New function.
5946         (Incremental_binary::do_get_input_reader): Change signature.
5947         (Incremental_binary::input_args_map_): New data member.
5948         (Incremental_binary::library_map_): New data member.
5949         (Incremental_binary::script_map_): New data member.
5950         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5951         new data members.
5952         (Sized_incremental_binary::output_section): New function.
5953         (Sized_incremental_binary::inputs_reader): Add const.
5954         (Sized_incremental_binary::symtab_reader): Add const.
5955         (Sized_incremental_binary::relocs_reader): Add const.
5956         (Sized_incremental_binary::got_plt_reader): Add const.
5957         (Sized_incremental_binary::get_symtab_view): New function.
5958         (Sized_incremental_binary::Inputs_reader): New typedef.
5959         (Sized_incremental_binary::Input_entry_reader): New typedef.
5960         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5961         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5962         (Sized_incremental_binary::do_file_has_changed): New function.
5963         (Sized_incremental_binary::do_init_layout): New function.
5964         (Sized_incremental_binary::do_reserve_layout): New function.
5965         (Sized_input_reader::Inputs_reader): Remove.
5966         (Sized_input_reader::Input_entry_reader): Remove.
5967         (Sized_input_reader::do_arg_serial): New function.
5968         (Sized_input_reader::do_get_unused_symbol_count): New function.
5969         (Sized_input_reader::do_get_unused_symbol): New function.
5970         (Sized_incremental_binary::do_input_file_count): New function.
5971         (Sized_incremental_binary::do_get_input_reader): Change signature;
5972         use index instead of filename.
5973         (Sized_incremental_binary::section_map_): New data member.
5974         (Sized_incremental_binary::input_entry_readers_): New data member.
5975         (class Sized_incr_relobj): New class.
5976         (class Sized_incr_dynobj): New class.
5977         (make_sized_incremental_object): New function.
5978         (class Incremental_library): New class.
5979         * layout.cc (Free_list::num_lists): New static data member.
5980         (Free_list::num_nodes): New static data member.
5981         (Free_list::num_removes): New static data member.
5982         (Free_list::num_remove_visits): New static data member.
5983         (Free_list::num_allocates): New static data member.
5984         (Free_list::num_allocate_visits): New static data member.
5985         (Free_list::init): New function.
5986         (Free_list::remove): New function.
5987         (Free_list::allocate): New function.
5988         (Free_list::dump): New function.
5989         (Free_list::print_stats): New function.
5990         (Layout_task_runner::run): Resize output file for incremental updates.
5991         (Layout::Layout): Initialize new data members.
5992         (Layout::set_incremental_base): New function.
5993         (Layout::init_fixed_output_section): New function.
5994         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5995         incremental updates.
5996         (Layout::create_gold_note): Do not create gold note section for
5997         incremental updates.
5998         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5999         for incremental updates.
6000         (Layout::set_section_offsets): For incremental updates, allocate space
6001         from free list.
6002         (Layout::create_symtab_sections): Layout with offsets relative to
6003         start of section; for incremental updates, allocate space from free
6004         list.
6005         (Layout::create_shdrs): For incremental updates, allocate space from
6006         free list.
6007         (Layout::finish_dynamic_section): For incremental updates, do not
6008         check --as-needed (fixed in subsequent patch).
6009         * layout.h (class Free_list): New class.
6010         (Layout::set_incremental_base): New function.
6011         (Layout::incremental_base): New function.
6012         (Layout::init_fixed_output_section): New function.
6013         (Layout::allocate): New function.
6014         (Layout::incremental_base_): New data member.
6015         (Layout::free_list_): New data member.
6016         * main.cc (main): Print Free_list statistics.
6017         * object.cc (Relobj::finalize_incremental_relocs): Add
6018         clear_counts parameter; clear counts only when clear_counts is set.
6019         (Sized_relobj::Sized_relobj): Initialize new base class.
6020         (Sized_relobj::do_layout): Don't report special sections.
6021         (Sized_relobj::do_for_all_local_got_entries): New function.
6022         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
6023         symtab_off to all symbol table offsets.
6024         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
6025         * object.h (class Got_offset_list): Move to top of file.
6026         (Object::Object): Allow case where input_file == NULL.
6027         (Object::~Object): Likewise.
6028         (Object::input_file): Assert that input_file != NULL.
6029         (Object::lock): Allow case where input_file == NULL.
6030         (Object::unlock): Likewise.
6031         (Object::is_locked): Likewise.
6032         (Object::token): Likewise.
6033         (Object::release): Likewise.
6034         (Object::is_incremental): New function.
6035         (Object::get_mtime): New function.
6036         (Object::for_all_local_got_entries): New function.
6037         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
6038         (Object::set_is_in_system_directory): New function.
6039         (Object::is_in_system_directory): New function.
6040         (Object::do_is_incremental): New function.
6041         (Object::do_get_mtime): New function.
6042         (Object::do_for_all_local_got_entries): New function.
6043         (Object::is_in_system_directory_): New data member.
6044         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
6045         (class Sized_relobj_base): New class.
6046         (class Sized_relobj): Derive from Sized_relobj_base.
6047         (class Sized_relobj::Symbols): Redeclare from base class.
6048         (class Sized_relobj::local_got_offset_list): Remove.
6049         (class Sized_relobj::Output_sections): Redeclare from base class.
6050         (class Sized_relobj::do_for_all_local_got_entries): New function.
6051         (class Sized_relobj::write_local_symbols): Add offset parameter.
6052         (class Sized_relobj::local_symbol_offset_): Update comment.
6053         (class Sized_relobj::local_dynsym_offset_): Update comment.
6054         * options.cc (Input_arguments::add_file): Remove const.
6055         * options.h (Input_file_argument::Input_file_argument):
6056         Initialize arg_serial_ (all constructors).
6057         (Input_file_argument::set_arg_serial): New function.
6058         (Input_file_argument::arg_serial): New function.
6059         (Input_file_argument::arg_serial_): New data member.
6060         (Input_arguments::Input_arguments): Initialize file_count_.
6061         (Input_arguments::add_file): Remove const.
6062         (Input_arguments::number_of_input_files): New function.
6063         (Input_arguments::file_count_): New data member.
6064         (Command_line::number_of_input_files): Call
6065         Input_arguments::number_of_input_files.
6066         * output.cc (Output_segment_headers::Output_segment_headers):
6067         Set current size.
6068         (Output_section::Input_section::current_data_size): New function.
6069         (Output_section::Output_section): Initialize new data members.
6070         (Output_section::add_input_section): Don't do merge sections for
6071         an incremental link; allocate space from free list for an
6072         incremental update.
6073         (Output_section::add_output_section_data): Allocate space from
6074         free list for an incremental update.
6075         (Output_section::update_data_size): New function.
6076         (Output_section::set_fixed_layout): New function.
6077         (Output_section::reserve): New function.
6078         (Output_segment::set_section_addresses): Remove const.
6079         (Output_segment::set_section_list_addresses): Remove const; allocate
6080         space from free list for an incremental update.
6081         (Output_segment::set_offset): Adjust size of RELRO segment for an
6082         incremental update.
6083         * output.h (Output_data::current_data_size): Move here from
6084         child classes.
6085         (Output_data::pre_finalize_data_size): New function.
6086         (Output_data::update_data_size): New function.
6087         (Output_section_headers::update_data_size): new function.
6088         (Output_section_data_build::current_data_size): Move to Output_data.
6089         (Output_data_strtab::update_data_size): New function.
6090         (Output_section::current_data_size): Move to Output_data.
6091         (Output_section::set_fixed_layout): New function.
6092         (Output_section::has_fixed_layout): New function.
6093         (Output_section::reserve): New function.
6094         (Output_section::update_data_size): New function.
6095         (Output_section::has_fixed_layout_): New data member.
6096         (Output_section::free_list_): New data member.
6097         (Output_segment::set_section_addresses): Remove const.
6098         (Output_segment::set_section_list_addresses): Remove const.
6099         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
6100         New function.
6101         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
6102         New function.
6103         * readsyms.cc (Read_symbols::do_read_symbols): Add library
6104         parameter when calling Add_symbols constructor; store argument
6105         serial number for members of a lib group.
6106         (Add_symbols::locks): Allow case where token == NULL.
6107         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
6108         (Read_member::~Read_member): New function.
6109         (Read_member::is_runnable): New function.
6110         (Read_member::locks): New function.
6111         (Read_member::run): New function.
6112         (Check_script::~Check_script): New function.
6113         (Check_script::is_runnable): New function.
6114         (Check_script::locks): New function.
6115         (Check_script::run): New function.
6116         (Check_library::~Check_library): New function.
6117         (Check_library::is_runnable): New function.
6118         (Check_library::locks): New function.
6119         (Check_library::run): New function.
6120         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
6121         (Add_symbols::library_): New data member.
6122         (class Read_member): New class.
6123         (class Check_script): New class.
6124         (class Check_library): New class.
6125         * reloc.cc (Read_relocs::is_runnable): Allow case where
6126         token == NULL.
6127         (Read_relocs::locks): Likewise.
6128         (Scan_relocs::locks): Likewise.
6129         (Relocate_task::locks): Likewise.
6130         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
6131         to clear counters.
6132         (Sized_relobj::incremental_relocs_scan): Fix comment.
6133         (Sized_relobj::do_relocate): Pass output file offset to
6134         write_local_symbols.
6135         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
6136         from class declaration.
6137         * script.cc (read_input_script): Allocate Script_info; pass
6138         argument serial number to report_script.
6139         * script.h (class Script_info): Move to incremental.h.
6140         * symtab.cc (Symbol_table::add_from_incrobj): New function.
6141         * symtab.h (Symbol_table::add_from_incrobj): New function.
6142         (Symbol_table::set_file_offset): New function.
6143
6144 2011-04-05  Cary Coutant  <ccoutant@google.com>
6145
6146         * incremental-dump.cc (dump_incremental_inputs): Change signature
6147         to take a Sized_incremental_binary; change caller.  Use readers
6148         in Sized_incremental_binary.
6149         * incremental.cc
6150         (Sized_incremental_binary::find_incremental_inputs_sections):
6151         Rename do_find_incremental_inputs_sections to this.
6152         (Sized_incremental_binary::setup_readers): New function.
6153         (Sized_incremental_binary::do_check_inputs): Check
6154         has_incremental_info_ flag; move setup code to setup_readers;
6155         use input readers.
6156         (Sized_incremental_binary::do_file_is_unchanged): New function.
6157         (Sized_incremental_binary::do_get_input_reader): New function.
6158         * incremental.h (class Incremental_binary): Move to end of file.
6159         (Incremental_binary::file_is_unchanged): New function.
6160         (Incremental_binary::do_file_is_unchanged): New function.
6161         (Incremental_binary::Input_reader): New class.
6162         (Incremental_binary::get_input_reader): New function.
6163         (class Sized_incremental_binary): Move to end of file.
6164         (Sized_incremental_binary::Sized_incremental_binary): Setup the
6165         input section reader classes.
6166         (Sized_incremental_binary::has_incremental_info): New function.
6167         (Sized_incremental_binary::inputs_reader): New function.
6168         (Sized_incremental_binary::symtab_reader): New function.
6169         (Sized_incremental_binary::relocs_reader): New function.
6170         (Sized_incremental_binary::got_plt_reader): New function.
6171         (Sized_incremental_binary::do_file_is_unchanged): New function.
6172         (Sized_incremental_binary::Sized_input_reader): New class.
6173         (Sized_incremental_binary::get_input_reader): New function.
6174         (Sized_incremental_binary::find_incremental_inputs_sections):
6175         Rename do_find_incremental_inputs_sections to this.
6176         (Sized_incremental_binary::setup_readers): New function.
6177         (Sized_incremental_binary::has_incremental_info_): New data member.
6178         (Sized_incremental_binary::inputs_reader_): New data member.
6179         (Sized_incremental_binary::symtab_reader_): New data member.
6180         (Sized_incremental_binary::relocs_reader_): New data member.
6181         (Sized_incremental_binary::got_plt_reader_): New data member.
6182         (Sized_incremental_binary::current_input_file_): New data member.
6183
6184 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
6185
6186         PR gold/12640
6187         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
6188         violation.
6189
6190 2011-03-30  Cary Coutant  <ccoutant@google.com>
6191
6192         * archive.cc (Archive::include_member): Adjust call to report_object.
6193         (Add_archive_symbols::run): Add script_info to call to
6194         report_archive_begin.
6195         (Lib_group::include_member): Adjust call to report_object.
6196         (Add_lib_group_symbols::run): Adjust call to report_object.
6197         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
6198         blocks.  Add object count for script input files.
6199         * incremental.cc (Incremental_inputs::report_archive_begin): Add
6200         script_info parameter; change all callers.
6201         (Incremental_inputs::report_object): Add script_info parameter;
6202         change all callers.
6203         (Incremental_inputs::report_script): Store backpointer to
6204         incremental info entry.
6205         (Output_section_incremental_inputs::set_final_data_size): Record
6206         additional information for scripts.
6207         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6208         * incremental.h (Incremental_script_entry::add_object): New function.
6209         (Incremental_script_entry::get_object_count): New function.
6210         (Incremental_script_entry::get_object): New function.
6211         (Incremental_script_entry::objects_): New data member; adjust
6212         constructor.
6213         (Incremental_inputs::report_archive_begin): Add script_info parameter.
6214         (Incremental_inputs::report_object): Add script_info parameter.
6215         (Incremental_inputs_reader::get_object_count): New function.
6216         (Incremental_inputs_reader::get_object_offset): New function.
6217         * options.cc (Input_arguments::add_file): Return reference to
6218         new input argument.
6219         * options.h (Input_argument::set_script_info): New function.
6220         (Input_argument::script_info): New function.
6221         (Input_argument::script_info_): New data member; adjust all
6222         constructors.
6223         (Input_file_group::add_file): Return reference to new input argument.
6224         (Input_file_lib::add_file): Likewise.
6225         (Input_arguments::add_file): Likewise.
6226         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
6227         * script.cc (Parser_closure::Parser_closure): Add script_info
6228         parameter; adjust all callers.
6229         (Parser_closure::script_info): New function.
6230         (Parser_closure::script_info_): New data member.
6231         (read_input_script): Report scripts earlier to incremental info.
6232         (script_add_file): Set script_info in Input_argument.
6233         (script_add_library): Likewise.
6234         * script.h (Script_options::Script_info): Rewrite class.
6235
6236 2011-03-29  Cary Coutant  <ccoutant@google.com>
6237
6238         * archive.cc (Library_base::should_include_member): Move
6239         method here from class Archive.
6240         (Archive::Archive): Initialize base class.
6241         (Archive::should_include_member): Move to base class.
6242         (Archive::do_for_all_unused_symbols): New function.
6243         (Add_archive_symbols::run): Remove redundant access to
6244         incremental_inputs.
6245         (Lib_group::Lib_group): Initialize base class.
6246         (Lib_group::do_filename): New function.
6247         (Lib_group::include_member): Pass pointer to Lib_group to
6248         report_object.
6249         (Lib_group::do_for_all_unused_symbols): New function.
6250         (Add_lib_group_symbols::run): Report archive information for
6251         incremental links.
6252         * archive.h (class Library_base): New base class.
6253         (class Archive): Derive from Library_base.
6254         (Archive::filename): Move to base class.
6255         (Archive::set_incremental_info): Likewise.
6256         (Archive::incremental_info): Likewise.
6257         (Archive::Should_include): Likewise.
6258         (Archive::should_include_member): Likewise.
6259         (Archive::Armap_entry): Remove.
6260         (Archive::Unused_symbol_iterator): Remove.
6261         (Archive::unused_symbols_begin): Remove.
6262         (Archive::unused_symbols_end): Remove.
6263         (Archive::do_filename): New function.
6264         (Archive::do_get_mtime): New function.
6265         (Archive::do_for_all_unused_symbols): New function.
6266         (Archive::task_): Move to base class.
6267         (Archive::incremental_info_): Likewise.
6268         (class Lib_group): Derive from Library_base.
6269         (Lib_group::do_filename): New function.
6270         (Lib_group::do_get_mtime): New function.
6271         (Lib_group::do_for_all_unused_symbols): New function.
6272         (Lib_group::task_): Move to base class.
6273         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
6274         function.
6275         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
6276         function.
6277         * incremental.cc (Incremental_inputs::report_archive_begin):
6278         Use Library_base; call library's get_mtime; add incremental inputs
6279         entry before members.
6280         (class Unused_symbol_visitor): New class.
6281         (Incremental_inputs::report_archive_end): Use Library_base; use
6282         visitor class to record unused symbols; don't add incremental inputs
6283         entry after members.
6284         (Incremental_inputs::report_object): Use Library_base.
6285         * incremental.h
6286         (Incremental_archive_entry::Incremental_archive_entry): Remove
6287         unused Archive parameter.
6288         (Incremental_inputs::report_archive_begin): Use Library_base.
6289         (Incremental_inputs::report_archive_end): Likewise.
6290         (Incremental_inputs::report_object): Likewise.
6291         * object.cc (Sized_relobj::do_for_all_global_symbols): New
6292         function.
6293         * object.h (Object::for_all_global_symbols): New function.
6294         (Object::do_for_all_global_symbols): New function.
6295         (Sized_relobj::do_for_all_global_symbols): New function.
6296         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
6297         function.
6298         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
6299         function.
6300
6301 2011-03-27  Ian Lance Taylor  <iant@google.com>
6302
6303         * archive.cc (Archive::interpret_header): Return -1 if something
6304         goes wrong.  Change callers accordingly.
6305
6306 2011-03-25  Cary Coutant  <ccoutant@google.com>
6307
6308         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
6309         * testsuite/Makefile.in: Regenerate.
6310
6311 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
6312
6313         * plugin.cc (get_view): New.
6314         (Plugin::load): Pass get_view to the plugin.
6315         (Plugin_manager::get_view): New.
6316
6317 2011-03-21  Ian Lance Taylor  <iant@google.com>
6318
6319         * testsuite/final_layout.sh: Rewrite to not use dc.
6320         * testsuite/relro_test.sh: Fail if dc is not present.
6321
6322 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
6323
6324         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
6325         Change == to -eq.
6326         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
6327         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
6328         Change == to -eq.
6329         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
6330         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
6331
6332 2011-03-14  Ian Lance Taylor  <iant@google.com>
6333
6334         * script-sections.cc (Sort_output_sections::script_compare):
6335         Rename from is_before, change return type.
6336         (Sort_output_sections::operator()): Adjust accordingly.
6337
6338 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
6339
6340         PR gold/12572
6341         * testsuite/odr_violation2.cc: Add comment to make all error line
6342         numbers double digits.
6343         * testsuite/debug_msg.sh: Adjust expected errors.
6344
6345 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
6346
6347         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
6348         but mark earlier ones as non-canonical
6349         (offset_to_iterator): Update search target and example
6350         (do_addr2line): Return extra lines in a vector*
6351         (format_file_lineno): Extract from do_addr2line
6352         (one_addr2line): Add vector* out-param
6353         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
6354         when a lineno entry appeared last for its instruction
6355         (Dwarf_line_info): Add vector* out-param
6356         * object.cc (Relocate_info): Pass NULL for the vector* out-param
6357         * symtab.cc (Odr_violation_compare): Include the lineno in the
6358         comparison again.
6359         (linenos_from_loc): New. Combine the canonical line for an
6360         address with its other lines.
6361         (True_if_intersect): New. Helper functor to make
6362         std::set_intersection a query.
6363         (detect_odr_violations): Compare sets of lines instead of just
6364         one line for each function. This became less deterministic, but
6365         has fewer false positives.
6366         * symtab.h: Declarations.
6367         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
6368         mix an optimized and non-optimized object in the same binary
6369         (odr_violation2.so): Same.
6370         * testsuite/Makefile.in: Regenerate from Makefile.am.
6371         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
6372         * testsuite/debug_msg.sh: Update line numbers and add
6373         assertions.
6374         * testsuite/odr_violation1.cc: Use OdrDerived, in a
6375         non-optimized context.
6376         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
6377         isn't inlined, and use OdrDerived in an optimized context.
6378         * testsuite/odr_header1.h: Defines OdrDerived, where
6379         optimization will change the
6380         first-instruction-in-the-destructor's file and line number.
6381         * testsuite/odr_header2.h: Defines OdrBase.
6382
6383 2011-03-09  Ian Lance Taylor  <iant@google.com>
6384
6385         * fileread.cc (File_read::clear_views): Don't delete the whole
6386         file view.
6387
6388 2011-03-08  Ian Lance Taylor  <iant@google.com>
6389
6390         PR gold/12525
6391         * fileread.cc: #include <climits>.
6392         (GOLD_IOV_MAX): Define.
6393         (File_read::read_multiple): Limit number of entries by iov_max.
6394         * fileread.h (class File_read): Always set max_readv_entries to
6395         128.
6396
6397 2011-03-07  Ian Lance Taylor  <iant@google.com>
6398
6399         PR gold/12525
6400         * options.h (class General_options): Add -dy and -dn.
6401
6402 2011-03-02  Cary Coutant  <ccoutant@google.com>
6403
6404         * testsuite/script_test_9.t: Add TLS segment.
6405
6406 2011-03-02  Simon Baldwin  <simonb@google.com>
6407
6408         * configure.ac: Add check for gnu_indirect_function support in
6409         the toolchain building binutils.
6410         * configure: Rebuild.
6411
6412 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
6413
6414         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
6415         plugin only symbols.
6416         (Symbol_table::sized_finalize_symbol) Mark symbol only present
6417         in plugin files as not needed in the symbol table.
6418
6419 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
6420
6421         * output.cc (Output_section::add_input_section): Delay fill
6422         generation for section ordering.
6423
6424 2011-02-09  Ian Lance Taylor  <iant@google.com>
6425
6426         PR gold/12316
6427         * object.h (class Sized_relobj): Remove clear_local_symbols.
6428         * reloc.cc (Sized_relobj::do_relocate): Don't call
6429         clear_local_symbols.
6430
6431 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
6432
6433         * plugin.cc (is_visible_from_outside): Return true for symbols
6434         in the -u option.
6435
6436 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
6437
6438         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
6439         filename.
6440
6441 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
6442
6443         * icf.h (is_section_foldable_candidate): Change type of parameter
6444         to std::string.
6445         * icf.cc (Icf::find_identical_sections): Change type of local variable
6446         section_name to be std::string.
6447         (is_function_ctor_or_dtor): Change type of parameter to std::string.
6448
6449 2011-01-25  Ian Lance Taylor  <iant@google.com>
6450
6451         * script.cc (script_add_extern): Rewrite to use
6452         add_symbol_reference.
6453
6454 2011-01-25  Doug Kwan  <dougkwan@google.com>
6455
6456         * icf.cc (get_section_contents): Always lock section's object.
6457
6458 2011-01-24  Ian Lance Taylor  <iant@google.com>
6459
6460         * options.h (class General_options): Accept
6461         --no-detect-odr-violations.
6462
6463 2011-01-24  Ian Lance Taylor  <iant@google.com>
6464
6465         * version.cc (version_string): Bump to 1.11.
6466
6467 2011-01-24  Ian Lance Taylor  <iant@google.com>
6468
6469         * plugin.cc (class Plugin_rescan): Define new class.
6470         (Plugin_manager::claim_file): Set any_claimed_.
6471         (Plugin_manager::save_archive): New function.
6472         (Plugin_manager::save_input_group): New function.
6473         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
6474         necessary.
6475         (Plugin_manager::new_undefined_symbol): New function.
6476         (Plugin_manager::rescan): New function.
6477         (Plugin_manager::rescannable_defines): New function.
6478         (Plugin_manager::add_input_file): Set any_added_.
6479         * plugin.h (class Plugin_manager): define new fields rescannable_,
6480         undefined_symbols_, any_claimed_, and any_added_.  Declare
6481         Plugin_rescan as friend.  Declare new functions.
6482         (Plugin_manager::Rescannable): Define type.
6483         (Plugin_manager::Rescannable_list): Define type.
6484         (Plugin_manager::Undefined_symbol_list): Define type.
6485         (Plugin_manager::Plugin_manager): Initialize new fields.
6486         * archive.cc (Archive::defines_symbol): New function.
6487         (Add_archive_symbols::run): Pass archive to plugins if any.
6488         * archive.h (class Archive): Declare defines_symbol.
6489         * readsyms.cc (Input_group::~Input_group): New function.
6490         (Finish_group::run): Pass input_group to plugins if any.
6491         * readsyms.h (class Input_group): Declare destructor.
6492         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
6493         any.
6494
6495 2011-01-10  Ian Lance Taylor  <iant@google.com>
6496
6497         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
6498         section as relro.
6499         (Layout::set_segment_offsets): Reset increase_relro before calling
6500         set_section_addresses a second time.
6501
6502 2011-01-04  Cary Coutant  <ccoutant@google.com>
6503
6504         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
6505         sections before NOBITS sections.
6506
6507 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
6508
6509         * version.cc (print_version): Update copyright to 2011.
6510
6511 2010-12-23  Cary Coutant  <ccoutant@google.com>
6512
6513         * output.h (Output_data_reloc::add_output_section): Pass OD instead
6514         of OS to this->add.  Add OD parameter to second form of the function.
6515
6516 2010-12-20  Ian Lance Taylor  <iant@google.com>
6517
6518         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
6519         second of two consecutive entries with same offset.
6520
6521 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6522
6523         * testsuite/Makefile.am (ifuncmain2static_LDADD)
6524         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
6525         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
6526         to avoid unneeded links against $(LDADD).
6527         * testsuite/Makefile.in: Regenerate.
6528
6529 2010-12-15  Ian Lance Taylor  <iant@google.com>
6530
6531         PR gold/12324
6532         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
6533         for R_X86_64_32 and R_X86_64_PC32.
6534         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
6535         ver_matching_def_pic.o.
6536         (ver_matching_def_pic.o): New target.
6537
6538 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6539
6540         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
6541         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
6542         Move definition before File_read::View member definitions.
6543         (File_read::View::~View): Initialize and hold lock before
6544         updating current_mapped_bytes.
6545
6546 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6547
6548         * dwarf_reader.cc: Remove outdated comment.
6549         * gold-threads.cc: Fix typo in error message.
6550         * archive.cc: Fix typos in comments.
6551         * archive.h: Likewise.
6552         * arm-reloc-property.cc: Likewise.
6553         * arm-reloc-property.h: Likewise.
6554         * arm-reloc.def: Likewise.
6555         * arm.cc: Likewise.
6556         * attributes.h: Likewise.
6557         * cref.cc: Likewise.
6558         * ehframe.cc: Likewise.
6559         * fileread.h: Likewise.
6560         * gold.h: Likewise.
6561         * i386.cc: Likewise.
6562         * icf.cc: Likewise.
6563         * incremental.h: Likewise.
6564         * int_encoding.cc: Likewise.
6565         * layout.h: Likewise.
6566         * main.cc: Likewise.
6567         * merge.h: Likewise.
6568         * object.cc: Likewise.
6569         * object.h: Likewise.
6570         * options.cc: Likewise.
6571         * readsyms.cc: Likewise.
6572         * reduced_debug_output.cc: Likewise.
6573         * reloc.cc: Likewise.
6574         * script-sections.cc: Likewise.
6575         * sparc.cc: Likewise.
6576         * symtab.h: Likewise.
6577         * target-reloc.h: Likewise.
6578         * target.cc: Likewise.
6579         * target.h: Likewise.
6580         * timer.cc: Likewise.
6581         * timer.h: Likewise.
6582         * x86_64.cc: Likewise.
6583
6584 2010-12-09  Cary Coutant  <ccoutant@google.com>
6585
6586         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
6587         stack.
6588         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
6589         parameter; change all callers.
6590         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
6591         * options.h (warn_execstack): New option.
6592
6593 2010-12-07  Doug Kwan  <dougkwan@google.com>
6594
6595         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
6596         like function call relocations.
6597
6598 2010-12-07  Ian Lance Taylor  <iant@google.com>
6599
6600         * archive.cc (Archive::get_elf_object_for_member): Permit
6601         punconfigured to be NULL.
6602         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
6603         (Archive::include_member): Pass NULL to get_elf_object_for_member
6604         if we searched for the archive and this is the first included
6605         object.
6606
6607 2010-12-01  Ian Lance Taylor  <iant@google.com>
6608
6609         * dwarf_reader.h (class Sized_dwarf_line_info): Add
6610         track_relocs_type_ field.
6611         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6612         Set track_relocs_type_.
6613         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
6614         contents when using RELA relocs.
6615         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
6616         reloc_map_.
6617         * reloc.cc (Track_relocs::next_addend): New function.
6618         * reloc.h (class Track_relocs): Declare next_addend.
6619
6620 2010-12-01  Ian Lance Taylor  <iant@google.com>
6621
6622         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
6623         virtual destructor.
6624
6625 2010-12-01  Ian Lance Taylor  <iant@google.com>
6626
6627         * README: Update compilers known to work and fail.
6628
6629 2010-11-23  Matthias Klose  <doko@ubuntu.com>
6630
6631         * configure.in: For --enable-gold, handle value `default' instead of
6632         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6633         not the default.
6634         * configure: Regenerate.
6635
6636 2010-11-18  Doug Kwan  <dougkwan@google.com>
6637
6638         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6639         and right_alignment to be zero.  Store result alignment only if it is
6640         greater than existing alignment.
6641
6642 2010-11-16  Cary Coutant  <ccoutant@google.com>
6643
6644         PR gold/12220
6645         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6646         Check for ".zdebug_line".
6647
6648 2010-11-16  Doug Kwan  <dougkwan@google.com>
6649             Cary Coutant  <ccoutant@google.com>
6650
6651         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6652         by reference; adjust all callers.
6653         * output.cc (Output_segment::set_section_addresses): Adjust references
6654         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6655         list is empty.
6656         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6657         end at page boundary.
6658
6659 2010-11-16  Cary Coutant  <ccoutant@google.com>
6660
6661         PR gold/12220
6662         * layout.cc (Layout::choose_output_section): Transform names of
6663         compressed sections even when using a script with a SECTIONS clause.
6664         (Layout::output_section_name): Remove code to transform
6665         compressed debug section names.
6666         * output.cc (Output_section::add_input_section): Use uncompressed
6667         section size when tracking input sections.
6668
6669 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6670
6671         * symtab.h (Symbol::NON_PIC_REF): Remove.
6672         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6673         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6674         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6675         (Symbol::use_plt_offset): Take a flags argument and pass it
6676         directly to needs_dynamic_reloc.  Restrict check for undefined
6677         weak symbols to function calls.
6678         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6679         (Target_arm::Scan::global): Use it.
6680         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6681         (Target_arm::Relocate::relocate): Likewise.
6682         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6683         parameter with an r_type parameter.  Use get_reference_flags
6684         to get the flags.
6685         (Target_arm::Relocate::relocate): Update accordingly.
6686         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6687         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6688         (Target_i386::Scan::global): Likewise.
6689         (Target_i386::Relocate::relocate): Likewise.
6690         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6691         parameter with an r_type parameter.  Use get_reference_flags
6692         to get the flags.
6693         (Target_i386::Relocate::relocate): Update accordingly.
6694         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6695         (Target_powerpc::Scan::global): Use it.
6696         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6697         (Target_powerpc::Relocate::relocate): Likewise.
6698         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6699         (Target_sparc::Scan::global): Use it.
6700         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6701         (Target_sparc::Relocate::relocate): Likewise.
6702         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6703         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6704         (Target_x86_64::Scan::global): Likewise.
6705         (Target_x86_64::Relocate::relocate): Likewise.
6706
6707 2010-11-08  Doug Kwan  <dougkwan@google.com>
6708             Cary Coutant  <ccoutant@google.com>
6709
6710         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6711         (Arm_exidx_merge_section::section_contents_): New data member.
6712         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6713         (Arm_input_section::~Arm_input_section): De-allocate memory.
6714         (Arm_input_section::original_contents_): New data member.
6715         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6716         in parameters instead of calling Object::section_contents without
6717         locking.
6718         (Arm_output_section::group_section): New parameter TASK.  Pass it
6719         to callees that need locking objects.
6720         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6721         to lock EXIDX input sections.  Fix a formatting issue.  Call
6722         Arm_exidx_merged_section::build_contents to create merged section
6723         contents.
6724         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6725         to lock object of stub table owner.
6726         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6727         TEXT_SIZE to initialize data member TEXT_SIZE_.
6728         (Arm_exidx_input_section::addralign): Fix typo in comment.
6729         (Arm_exidx_input_section::text_size): New method.
6730         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6731         that require locking objects.  Lock objects before scanning for stubs
6732         and updating local symbols.
6733         (Arm_input_section<big_endian>::init): Copy contents of original
6734         input section.
6735         (Arm_input_section<big_endian>::do_write): Use saved contents of
6736         original input section instead of calling Object::section_contents
6737         without locking.
6738         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6739         size without calling Object::section_size().
6740         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6741         for size.  Allocate a buffer for merged EXIDX entries.
6742         (Arm_exidx_merged_section::build_contents): New method.
6743         (Arm_exidx_merged_section::do_write): Move merge section contents
6744         building code to Arm_exidx_merged_section::build_contetns.  Write
6745         out contetns in buffer instead of building it on the fly.
6746         (Arm_relobj::make_exidx_input_section): Also pass text section size
6747         to Arm_exidx_input_section constructor.
6748         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6749         (Arm_dynobj::do_read_symbols): Fix memory leak.
6750         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6751         * target.h: (class Task): Add forward declaration.
6752         (Target::relax): Add new parameter TASK and pass it to
6753         Target::do_relax().
6754         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6755
6756 2010-11-05  Cary Coutant  <ccoutant@google.com>
6757
6758         PR gold/10708
6759         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6760         object when reading from the file.
6761         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6762         second layout pass.
6763         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6764         when reading section contents.
6765         (get_section_contents): Likewise.
6766         (icf::find_identical_sections): Likewise.
6767         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6768         object when reading from the file.
6769         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6770         the object when doing deferred section layout.
6771
6772 2010-11-03  Nick Clifton  <nickc@redhat.com>
6773
6774         PR gold/12001
6775         * script.h (class Symbol_assignment: name): New member.  Returns
6776         the name of the symbol.
6777         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6778         Returns true if the given symbol name is on the list of
6779         assignments wating to be processed.
6780         * archive.cc (should_incldue_member): If the symbol is undefined,
6781         check to see if it is on the list of symbols pending assignment.
6782
6783 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6784
6785         * script-sections.cc (Script_sections::find_memory_region): Check
6786         for a NULL output section pointer.
6787
6788 2010-10-29  Doug Kwan  <dougkwan@google.com>
6789
6790         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6791         Output_section::add_relaxed_input_section.
6792         * output.cc (Output_section::add_relaxed_input_section): Add new
6793         arguments LAYOUT and NAME.  Set section order index.
6794         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6795         Copy section order index.
6796         * output.h (Output_section::add_relaxed_input_section): Add new
6797         arguments LAYOUT and NAME.
6798
6799 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6800
6801         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6802         NATIVE_OR_CROSS_LINKER.
6803         * testsuite/Makefile.in: Regenerate.
6804
6805 2010-10-20  Doug Kwan  <dougkwan@google.com>
6806
6807         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6808         without SHF_LINK_ORDER flags.
6809         * layout.cc (Layout::choose_output_section): Do not filter
6810         SHF_LINK_ORDER flag in a relocatable link.
6811
6812 2010-10-17  Cary Coutant  <ccoutant@google.com>
6813
6814         * output.h (Output_segment::set_section_addresses): Change function
6815         signature.  Update all callers.
6816         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6817         sections.
6818         (Output_segment::set_section_addresses): Align after last TLS
6819         section.  Add padding before last relro section instead of after.
6820
6821 2010-10-17  Doug Kwan  <dougkwan@google.com>
6822
6823         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6824         GOT output section to be writable.
6825
6826 2010-10-14  Cary Coutant  <ccoutant@google.com>
6827
6828         * debug.h (DEBUG_INCREMENTAL): New flag.
6829         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6830         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6831         mode.
6832         * incremental.cc (report_command_line): Ignore all forms of
6833         --incremental.
6834         * layout.cc (Layout::Layout): Check parameters for incremental link
6835         mode.
6836         * options.cc (General_options::parse_incremental): New function.
6837         (General_options::parse_no_incremental): New function.
6838         (General_options::parse_incremental_full): New function.
6839         (General_options::parse_incremental_update): New function.
6840         (General_options::incremental_mode_): New data member.
6841         (General_options::finalize): Check incremental_mode_.
6842         * options.h (General_options): Update help text for --incremental.
6843         Add --no-incremental, --incremental-full, --incremental-update.
6844         (General_options::Incremental_mode): New enum type.
6845         (General_options::incremental_mode): New function.
6846         (General_options::incremental_mode_): New data member.
6847         * parameters.cc (Parameters::incremental_mode_): New data member.
6848         (Parameters::set_options): Set incremental_mode_.
6849         (Parameters::set_incremental_full): New function.
6850         (Parameters::incremental): New function.
6851         (Parameters::incremental_update): New function.
6852         (set_parameters_incremental_full): New function.
6853         * parameters.h (Parameters::set_incremental_full): New function.
6854         (Parameters::incremental): New function.
6855         (Parameters::incremental_update): New function.
6856         (Parameters::incremental_mode_): New data member.
6857         (set_parameters_incremental_full): New function.
6858         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6859         incremental link mode.
6860         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6861         (Sized_relobj::do_relocate_sections): Likewise.
6862         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6863         option.
6864         * testsuite/Makefile.in: Regenerate.
6865         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6866
6867 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6868
6869         * script-sections.h (class Script_sections): Make
6870         Sections_elements typedef public.
6871         * script-sections.cc (class Sort_output_sections): Add elements_
6872         field.  Add constructor which sets it; change all callers.
6873         (Sort_output_sections::is_before): New function.
6874         (Sort_output_sections::operator()): Call is_before.
6875         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6876         conditional.
6877         * testsuite/script_test_10.sh: New test. Test script section
6878         order.
6879         * testsuite/script_test_10.t: Likewise.
6880         * testsuite/script_test_10.s: Likewise.
6881         * testsuite/Makefile.am: Wrap the cross linker tests and the
6882         common tests into NATIVE_OR_CROSS_LINKER.
6883         (check_SCRIPTS): Add script_test_10.sh.
6884         (check_DATA): Add script_test_10.stdout.
6885         (script_test_10.o, script_test_10): New targets.
6886         (script_test_10.stdout): New target.
6887         * configure, testsuite/Makefile.in: Regenerate.
6888
6889 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6890
6891         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6892         error for the deprecated relocations.
6893         (Target_arm::Scan::global): Likewise.
6894         (Target_arm::Relocate::relocate): Likewise.
6895
6896 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6897
6898         * fileread.cc (Input_file::find_file): Initialize *found_name
6899         and *namep when using the fallback search for case 4.
6900
6901 2010-10-11  Cary Coutant  <ccoutant@google.com>
6902
6903         * options.h (class General_options): Redefine -z lazy as an alias for
6904         the negation of -z now.
6905
6906 2010-10-11  Ian Lance Taylor  <iant@google.com>
6907
6908         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6909         binding.
6910
6911 2010-10-06  Nick Clifton  <nickc@redhat.com>
6912
6913         * script-sections.cc(class Memory_region): Remove
6914         current_lma_offset_ field.  Rename current_vma_offset_ to
6915         current_offset_.  Add last_section_ field.
6916         (Memory_region::get_current_vma_address): Rename to
6917         get_current_address.
6918         (Memory_region::get_current_lma_address): Delete.
6919         (Memory_region::increment_vma_offset): Rename to
6920         increment_offset.
6921         (Memory_region::increment_lma_offset): Delete.
6922         (Memory_region::attributes_compatible): New method.  Returns
6923         true if the provided section is compatible with the region.
6924         (Memory_region::get_last_section): New method.  Returns the last
6925         section to use the region.
6926         (Memory_region::set_last_section): New method.  Stores the last
6927         section to use the region.
6928         (Script_sections::block_in_region): New method.  Returns true if
6929         a block of memory is contained within a region.
6930         (Script_sections::find_memory_region): New method.  Locates a
6931         memory region to be used to set a VMA or LMA address.
6932         (Output_section_definition::set_section_addresses): Add code to
6933         check for addresses set by memory regions.
6934         (Output_segment::set_section_addresses): Remove memory region
6935         walking code.
6936         (Script_sections::create_segment): Add a warning if a header
6937         segment is created outside of any region.
6938         * script-sections.h (class Script_sections): Add prototypes for
6939         find_memory_region and block_in_region methods.
6940         * testsuite/memory_test.s: Use .long instead of .word.
6941         * testsuite/memory_test.t: Add some more output sections.
6942         * testsuite/memory_test.sh: Update expected output.
6943
6944 2010-10-02  Doug Kwan  <dougkwan@google.com>
6945
6946         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6947         defintion to symtab.h
6948         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6949         declaration to defintion.
6950
6951 2010-10-01  Nick Clifton  <nickc@redhat.com>
6952
6953         * expression.cc (eval): Replace dummy argument with NULL.
6954         (eval_maybe_dot): Check for a NULL result section pointer.
6955         (Symbol_expression::value): Likewise.
6956         (Dot_expression::value): Likewise.
6957         (BINARY_EXPRESSION): Likewise.
6958         (Max_expression::value): Likewise.
6959         (Min_expression::value): Likewise.
6960         (Absolute_expression::value): Likewise.
6961         (Addr_expression::value_from_output_section): Likewise.
6962         (Loaddddr_expression::value_from_output_section): Likewise.
6963         (Segment_start_expression::value): Likewise.
6964         * script-sections.cc
6965         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6966         argument with NULL.
6967         (Sections_elememt_dot_assignment::set_section_addresses):
6968         Likewise.
6969         (Output_data_expression::do_write_to_buffer): Likewise.
6970         (Output_section_definition::finalize_symbols): Likewise.
6971         (Output_section_definition::set_section_addresses): Likewise.
6972
6973 2010-09-30  Doug Kwan  <dougkwan@google.com>
6974
6975         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6976
6977 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6978
6979         * target.h (Target::can_icf_inline_merge_sections): New virtual
6980         function.
6981         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6982         virtual function.
6983         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6984         virtual function.
6985         * icf.cc (get_section_contents): Inline merge sections only when
6986         target allows it.
6987
6988 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6989
6990         * configure: Regenerate.
6991
6992 2010-09-17  Ian Lance Taylor  <iant@google.com>
6993
6994         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6995         * testsuite/Makefile.am (memory_test.o): New target.
6996         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6997         memory_test.t.
6998         * testsuite/Makefile.in: Rebuild.
6999
7000 2010-09-17  Doug Kwan  <dougkwan@google.com>
7001
7002         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
7003         defintion if relocation uses GOT entries of the symbol.
7004         * testsuite/icf_safe_test.sh: Fix test.
7005         * testsuite/icf_safe_so_test.sh: Fix test.
7006
7007 2010-09-16  Cary Coutant  <ccoutant@google.com>
7008
7009         * script_sections.cc (class Memory_region): Remove "NULL" from
7010         vector initializations.
7011
7012 2010-09-15  Cary Coutant  <ccoutant@google.com>
7013
7014         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
7015         Resolve forwarding symbols.
7016
7017 2010-09-15  Doug Kwan  <dougkwan@google.com>
7018
7019         * gold/testsuite/script_test_3.t: Add ARM special sections.
7020         * gold/testsuite/script_test_4.t: Same.
7021         * gold/testsuite/script_test_5.t: Same.
7022         * gold/testsuite/script_test_6.t: Same.
7023         * gold/testsuite/script_test_7.t: Same.
7024         * gold/testsuite/script_test_7.t: Same.
7025         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
7026
7027 2010-09-14  Cary Coutant  <ccoutant@google.com>
7028
7029         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
7030         (Target_x86_64::Relocate::relocate_tls): Replace check for
7031         saw_tls_block_reloc_ with test for executable section.
7032
7033 2010-09-12  Cary Coutant  <ccoutant@google.com>
7034
7035         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
7036         position-independent executables to shared libraries need dynamic
7037         relocations.
7038         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
7039         position-independent executables.
7040         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
7041         * testsuite/Makefile.in: Regenerate.
7042
7043 2010-09-10  Nick Clifton  <nickc@redhat.com>
7044
7045         PR gold/11997
7046         * testsuite/memory_test.t: Discard any sections that are not
7047         needed.
7048
7049 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
7050
7051         PR gold/11996
7052         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
7053         "This::" to work around a bug in gcc 4.2.
7054
7055         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
7056
7057 2010-09-09  Rafael Espindola  <espindola@google.com>
7058
7059         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
7060         sections with different PF_X flags in the same segment.
7061         (Layout::find_first_load_seg): Search all segments to find the first
7062         one.
7063         * options.h (rosegment): New.
7064
7065 2010-09-08  Rafael Espindola  <espindola@google.com>
7066
7067         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
7068
7069 2010-09-08  Doug Kwan  <dougkwan@google.com>
7070
7071         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
7072         (Arm_relobj::do_relocate_sections): Add new parameter for output
7073         file to match the parent.
7074         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
7075         of local symbols instead of input values.  Update code to track
7076         changes in gold::relocate_section.
7077         * object.cc (Sized_relobj::compute_final_local_value): New methods.
7078         (Sized_relobj::compute_final_local_value_internal): New methods.
7079         (Sized_relobj::do_finalize_local_symbols): Move code from loop
7080         body into private version of Sized_relobj::compute_final_local_value.
7081         Call the inline method.
7082         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
7083         merged symbol value if there is one.
7084         (Symbol_value::has_output_value): New method defintiion.
7085         (Sized_relobj::Compute_final_local_value_status): New enum type.
7086         (Sized_relobj::compute_final_local_value): New methods.
7087         (Sized_relobj::compute_final_local_value_internal): New methods.
7088         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
7089         and arm_cortex_a8.sh.
7090         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
7091         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
7092         New tests.
7093         * Makefile.in: Regenerate.
7094         * testsuite/arm_bl_out_of_range.s: Update test.
7095         * testsuite/thumb_bl_out_of_range.s: Ditto.
7096         * testsuite/thumb_blx_out_of_range.s: Ditto.
7097         * testsuite/arm_branch_out_of_range.sh: New file.
7098         * testsuite/arm_cortex_a8.sh: Ditto.
7099         * testsuite/arm_cortex_a8_b.s: Ditto.
7100         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
7101         * testsuite/arm_cortex_a8_b_local.s: Ditto.
7102         * testsuite/arm_cortex_a8_bl.s: Ditto.
7103         * testsuite/arm_cortex_a8_blx.s: Ditto.
7104         * testsuite/arm_cortex_a8_local.s: Ditto.
7105         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
7106         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
7107
7108 2010-09-08  Rafael Espindola  <espindola@google.com>
7109
7110         * Makefile.am (memory_test.stdout): Run readelf with -W.
7111         * Makefile.in: Regenerate.
7112         * testsuite/memory_test.sh: Make the regexps accept both 32 and
7113         64 bit output.
7114
7115 2010-09-08  Rafael Espindola  <espindola@google.com>
7116
7117         * script-sections.cc (Script_sections::add_memory_region): Convert
7118         field precision to int.
7119         * script.cc (script_set_section_region, script_set_section_region):
7120         Convert field precision to int.
7121
7122 2010-09-08  Rafael Espindola  <espindola@google.com>
7123
7124         * arm.cc (do_finalize_sections): Create the __exidx_start and
7125         __exdix_end symbols even when the section is missing.
7126
7127 2010-09-08  Nick Clifton  <nickc@redhat.com>
7128
7129         * README: Remove claim that MEMORY is not supported.
7130         * expression.cc (script_exp_function_origin)
7131         (script_exp_function_length): Move from here to ...
7132         * script.cc: ... here.
7133         (script_set_section_region, script_add_memory)
7134         (script_parse_memory_attr, script_include_directive): New
7135         functions.
7136         * script-sections.cc
7137         (class Memory_region): New class.
7138         (class Output_section_definition): Add set_memory_region,
7139         set_section_vma, set_section_lma and get_section_name methods.
7140         (class Script_Sections): Add add_memory_region,
7141         find_memory_region, find_memory_region_origin,
7142         find_memory_region_length and set_memory_region methods.
7143         Have set_section_addresses method walk the list of set memory
7144         regions.
7145         Extend the print methos to display memory regions.
7146         * script-sections.h: Add prototypes for new methods.
7147         Add enum for MEMORY region attributes.
7148         * yyscript.y: Add support for parsing MEMORY regions.
7149         * script-c.h: Add prototypes for new functions.
7150         * testsuite/Makefile.am: Add test of MEMORY region functionality.
7151         * testsuite/Makefile.in: Regenerate.
7152         * testsuite/memory_test.sh: New script.
7153         * testsuite/memory_test.s: New assembler source file.
7154         * testsuite/memory_test.t: New linker script.
7155
7156 2010-08-27  Doug Kwan  <dougkwan@google.com>
7157
7158         * gold/resolve.cc (Symbol_table::should_override): Let a weak
7159         reference override an existing dynamic weak reference.
7160         * testsuite/Makefile.am: Add new test dyn_weak_ref.
7161         * testsuite/Makefile.in: Regenerate.
7162         * testsuite/dyn_weak_ref.sh: New file.
7163         * testsuite/dyn_weak_ref_1.c: Ditto.
7164         * testsuite/dyn_weak_ref_2.c: Ditto.
7165
7166 2010-08-27  Ian Lance Taylor  <iant@google.com>
7167
7168         * incremental.h (class Incremental_input_entry): Add virtual
7169         destructor.
7170
7171 2010-08-27  Ian Lance Taylor  <iant@google.com>
7172
7173         * testsuite/start_lib_test_3.c: Mark t3 as used.
7174
7175 2010-08-27  Nick Clifton  <nickc@redhat.com>
7176
7177         * options.cc (version_script): Fix small typo in previous
7178         whitespace tidyup.
7179
7180 2010-08-25  Nick Clifton  <nickc@redhat.com>
7181
7182         * archive.cc: Formatting fixes: Remove whitespace between
7183         typename and following asterisk.  Remove whitespace between
7184         function name and opening parenthesis.
7185         * archive.h: Likewise.
7186         * arm.cc: Likewise.
7187         * attributes.cc: Likewise.
7188         * attributes.h: Likewise.
7189         * common.cc: Likewise.
7190         * copy-relocs.cc: Likewise.
7191         * dirsearch.h: Likewise.
7192         * dynobj.cc: Likewise.
7193         * ehframe.cc: Likewise.
7194         * ehframe.h: Likewise.
7195         * expression.cc: Likewise.
7196         * fileread.cc: Likewise.
7197         * fileread.h: Likewise.
7198         * gc.h: Likewise.
7199         * gold-threads.cc: Likewise.
7200         * gold.cc: Likewise.
7201         * i386.cc: Likewise.
7202         * icf.h: Likewise.
7203         * incremental-dump.cc: Likewise.
7204         * incremental.cc: Likewise.
7205         * layout.cc: Likewise.
7206         * layout.h: Likewise.
7207         * main.cc: Likewise.
7208         * merge.cc: Likewise.
7209         * merge.h: Likewise.
7210         * object.cc: Likewise.
7211         * object.h: Likewise.
7212         * options.cc: Likewise.
7213         * options.h: Likewise.
7214         * output.cc: Likewise.
7215         * output.h: Likewise.
7216         * plugin.cc: Likewise.
7217         * plugin.h: Likewise.
7218         * powerpc.cc: Likewise.
7219         * reloc.cc: Likewise.
7220         * script-c.h: Likewise.
7221         * script-sections.cc: Likewise.
7222         * script.cc: Likewise.
7223         * stringpool.cc: Likewise.
7224         * symtab.cc: Likewise.
7225         * symtab.h: Likewise.
7226         * target.cc: Likewise.
7227         * timer.cc: Likewise.
7228         * timer.h: Likewise.
7229         * version.cc: Likewise.
7230         * x86_64.cc: Likewise.
7231
7232 2010-08-24  Nick Clifton  <nickc@redhat.com>
7233
7234         PR 11899
7235         * layout.cc (segment_precedes): Sort segments by their physical
7236         addresses, if they have been set.
7237
7238 2010-08-23  Cary Coutant  <ccoutant@google.com>
7239
7240         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
7241         symbols data.
7242         (Lib_group::include_member): Unlock object after deleting its
7243         symbols data.
7244         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
7245         the bug fixed here.
7246
7247 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
7248             Cary Coutant  <ccoutant@google.com>
7249
7250         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
7251         constructor, and set_blocker.
7252         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
7253         readsyms_blocker_.
7254         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
7255         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
7256         * testsuite/Makefile.am (start_lib_test): New test case.
7257         * testsuite/Makefile.in: Regenerate.
7258         * testsuite/start_lib_test_main.c: New file.
7259         * testsuite/start_lib_test_1.c: New file.
7260         * testsuite/start_lib_test_2.c: New file.
7261         * testsuite/start_lib_test_3.c: New file.
7262
7263 2010-08-19  Ian Lance Taylor  <iant@google.com>
7264
7265         * Makefile.in: Rebuild with automake 1.11.1.
7266         * aclocal.m4: Likewise.
7267         * testsuite/Makefile.in: Likewise.
7268
7269 2010-08-19  Ian Lance Taylor  <iant@google.com>
7270
7271         PR 10893
7272         * i386.cc (class Output_data_plt_i386): Update declarations.
7273         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
7274         local_ifuncs_ fields.
7275         (Target_i386::do_plt_section_for_global): New function.
7276         (Target_i386::do_plt_section_for_local): New function.
7277         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
7278         parameter; change all callers.  Initialize global_ifuncs_ and
7279         local_ifuncs_.  If doing a static link define __rel_iplt_start and
7280         __rel_iplt_end.
7281         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
7282         (Output_data_plt_i386::add_local_ifunc_entry): New function.
7283         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
7284         symbols.
7285         (Target_i386::make_plt_section): New function, broken out of
7286         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
7287         (Target_i386::make_plt_entry): Call make_plt_section.
7288         (Target_i386::make_local_ifunc_plt_entry): New function.
7289         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
7290         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
7291         R_386_IRELATIVE to switch.
7292         (Target_i386::Scan::global): Likewise.
7293         (Target_i386::Relocate::relocate): Likewise.
7294         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
7295         switch.
7296         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
7297         (Target_x86_64::do_plt_section_for_global): New function.
7298         (Target_x86_64::do_plt_section_for_local): New function.
7299         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
7300         parameter; change all callers.  If doing a static link define
7301         __rela_iplt_start and __rela_iplt_end.
7302         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
7303         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
7304         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
7305         to point to .plt.
7306         (Target_x86_64::make_local_ifunc_plt_entry): New function.
7307         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
7308         switch.
7309         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
7310         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
7311         R_X86_64_IRELATIVE to switch.
7312         (Target_x86_64::Scan::global): Likewise.
7313         (Target_x86_64::Relocate::relocate): Likewise.
7314         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
7315         switch.
7316         * target.h (class Target): Add plt_section_for_global and
7317         plt_section_for_local functions.  Add do_plt_section_for_global
7318         and do_plt_section_for_local virtual functions.
7319         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
7320         clarifying comments.
7321         (Symbol::use_plt_offset): Handle IFUNC symbol.
7322         * object.cc (Sized_relobj::Sized_relobj): Initialize
7323         local_plt_offsets_.
7324         (Sized_relobj::local_has_plt_offset): New function.
7325         (Sized_relobj::local_plt_offset): New function.
7326         (Sized_relobj::set_local_plt_offset): New function.
7327         (Sized_relobj::do_count): Handle IFUNC symbol.
7328         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
7329         a bit away from input_shndx_ field.  Add set_is_func_symbol and
7330         is_ifunc_symbol functions.
7331         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
7332         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
7333         local_plt_offsets_ field.
7334         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
7335         * output.h (class Output_section_data): Add non-const
7336         output_section function.
7337         (class Output_data_got): Update declarations.
7338         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
7339         Add use_plt_offset parameter to global and local constructors.
7340         Change all callers.  Change local_sym_index_ field to 31 bits.
7341         Change GSYM_CODE and CONSTANT_CODE accordingly.
7342         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
7343         doing a static link don't set sh_link field.
7344         (Output_data_got::Got_entry::write): Use PLT offset if
7345         appropriate.
7346         (Output_data_got::add_global_plt): New function.
7347         (Output_data_got::add_local_plt): New function.
7348         * target-reloc.h (relocate_section): Handle IFUNC symbol.
7349         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
7350         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
7351         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
7352         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
7353         IFUNC conditional.
7354         * testsuite/ifunc-sel.h: New file.
7355         * testsuite/ifuncmain1.c: New file.
7356         * testsuite/ifuncmain1vis.c: New file.
7357         * testsuite/ifuncmod1.c: New file.
7358         * testsuite/ifuncdep2.c: New file.
7359         * testsuite/ifuncmain2.c: New file.
7360         * testsuite/ifuncmain3.c: New file.
7361         * testsuite/ifuncmod3.c: New file.
7362         * testsuite/ifuncmain4.c: New file.
7363         * testsuite/ifuncmain5.c: New file.
7364         * testsuite/ifuncmod5.c: New file.
7365         * testsuite/ifuncmain6pie.c: New file.
7366         * testsuite/ifuncmod6.c: New file.
7367         * testsuite/ifuncmain7.c: New file.
7368         * configure, testsuite/Makefile.in: Rebuild.
7369
7370 2010-08-18  Ian Lance Taylor  <iant@google.com>
7371
7372         * incremental.cc
7373         (Output_section_incremental_inputs::write_input_files): Add cast
7374         to avoid signed/unsigned comparison warning.
7375         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7376
7377 2010-08-12  Cary Coutant  <ccoutant@google.com>
7378
7379         * common.cc (Sort_commons::operator()): Remove unnecessary code.
7380
7381 2010-08-13  Ian Lance Taylor  <iant@google.com>
7382
7383         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
7384
7385 2010-08-12  Cary Coutant  <ccoutant@google.com>
7386             Doug Kwan  <dougkwan@google.com>
7387
7388         * resolve.cc (Symbol_table::should_override): When a weak dynamic
7389         defintion overrides non-weak undef, remember that the original undef
7390         is not weak.
7391         * symtab.cc (Symbol_table::sized_write_global): For undef without
7392         an original weak binding, set binding to global in output.
7393         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
7394         * testsuite/Makefile.in: Regenerate.
7395         * testsuite/strong_ref_weak_def.sh: New file.
7396         * testsuite/strong_ref_weak_def_1.c: Ditto.
7397         * testsuite/strong_ref_weak_def_2.c: Ditto.
7398
7399 2010-08-12  Cary Coutant  <ccoutant@google.com>
7400
7401         * testsuite/incremental_test.sh: Rewrite.
7402         * testsuite/incremental_test_1.c: Rewrite.
7403         * testsuite/incremental_test_2.c: Rewrite.
7404
7405 2010-08-12  Cary Coutant  <ccoutant@google.com>
7406
7407         * arm.cc (Target_arm::got_size): Add const.
7408         (Target_arm::got_entry_count): New function.
7409         (Target_arm::plt_entry_count): New function.
7410         (Target_arm::first_plt_entry_offset): New function.
7411         (Target_arm::plt_entry_size): New function.
7412         (Output_data_plt_arm::entry_count): New function.
7413         (Output_data_plt_arm::first_plt_entry_offset): New function.
7414         (Output_data_plt_arm::get_plt_entry_size): New function.
7415         * i386.cc (Target_i386::got_size): Add const.
7416         (Target_i386::got_entry_count): New function.
7417         (Target_i386::plt_entry_count): New function.
7418         (Target_i386::first_plt_entry_offset): New function.
7419         (Target_i386::plt_entry_size): New function.
7420         (Output_data_plt_i386::entry_count): New function.
7421         (Output_data_plt_i386::first_plt_entry_offset): New function.
7422         (Output_data_plt_i386::get_plt_entry_size): New function.
7423         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
7424         find_incremental_inputs_sections.  Dump incremental_got_plt section.
7425         * incremental.cc: Include target.h.
7426         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
7427         parameter.  Adjust all callers.  Find incremental_got_plt section.
7428         (Incremental_inputs::create_data_sections): Create incremental_got_plt
7429         section.
7430         (Output_section_incremental_inputs::set_final_data_size): Calculate
7431         size of incremental_got_plt section.
7432         (Output_section_incremental_inputs::do_write): Write the
7433         incremental_got_plt section.
7434         (Got_plt_view_info): New struct.
7435         (Local_got_offset_visitor): New class.
7436         (Global_got_offset_visitor): New class.
7437         (Global_symbol_visitor_got_plt): New class.
7438         (Output_section_incremental_inputs::write_got_plt): New function.
7439         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
7440         Add parameter.  Adjust all callers.
7441         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7442         (Incremental_inputs::got_plt_section): New function.
7443         (Incremental_inputs::got_plt_section_): New data member.
7444         (Incremental_got_plt_reader): New class.
7445         * layout.cc (Layout::create_incremental_info_sections): Add the
7446         incremental_got_plt section.
7447         * object.h (Got_offset_list::get_list): New function.
7448         (Got offset_list::for_all_got_offsets): New function.
7449         (Sized_relobj::local_got_offset_list): New function.
7450         * powerpc.cc (Target_powerpc::got_size): Add const.
7451         (Target_powerpc::got_entry_count): New function.
7452         (Target_powerpc::plt_entry_count): New function.
7453         (Target_powerpc::first_plt_entry_offset): New function.
7454         (Target_powerpc::plt_entry_size): New function.
7455         (Output_data_plt_powerpc::entry_count): New function.
7456         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
7457         (Output_data_plt_powerpc::get_plt_entry_size): New function.
7458         * sparc.cc (Target_sparc::got_size): Add const.
7459         (Target_sparc::got_entry_count): New function.
7460         (Target_sparc::plt_entry_count): New function.
7461         (Target_sparc::first_plt_entry_offset): New function.
7462         (Target_sparc::plt_entry_size): New function.
7463         (Output_data_plt_sparc::entry_count): New function.
7464         (Output_data_plt_sparc::first_plt_entry_offset): New function.
7465         (Output_data_plt_sparc::get_plt_entry_size): New function.
7466         * symtab.h (Symbol::got_offset_list): New function.
7467         (Symbol_table::for_all_symbols): New function.
7468         * target.h (Sized_target::got_entry_count): New function.
7469         (Sized_target::plt_entry_count): New function.
7470         (Sized_target::plt_entry_size): New function.
7471         * x86_64.cc (Target_x86_64::got_size): Add const.
7472         (Target_x86_64::got_entry_count): New function.
7473         (Target_x86_64::plt_entry_count): New function.
7474         (Target_x86_64::first_plt_entry_offset): New function.
7475         (Target_x86_64::plt_entry_size): New function.
7476         (Output_data_plt_x86_64::entry_count): New function.
7477         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
7478         (Output_data_plt_x86_64::get_plt_entry_size): New function.
7479
7480 2010-08-12  Cary Coutant  <ccoutant@google.com>
7481
7482         * archive.cc: Include incremental.h.
7483         (Archive::Archive): Initialize incremental_info_.
7484         (Archive::include_member): Record archive members in incremental info.
7485         (Add_archive_symbols::run): Record begin and end of an archive in
7486         incremental info.
7487         (Lib_group::include_member): Record objects in incremental info.
7488         * archive.h (Incremental_archive_entry): Forward declaration.
7489         (Archive::set_incremental_info): New member function.
7490         (Archive::incremental_info): New member function.
7491         (Archive::Unused_symbol_iterator): New class.
7492         (Archive::unused_symbols_begin): New member function.
7493         (Archive::unused_symbols_end): New member function.
7494         (Archive::incremental_info_): New data member.
7495         * incremental-dump.cc (find_input_containing_global): New function.
7496         (dump_incremental_inputs): Dump new incremental info sections.
7497         * incremental.cc: Include symtab.h.
7498         (Output_section_incremental_inputs): New class.
7499         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
7500         new incremental info sections.
7501         (Sized_incremental_binary::do_check_inputs): Likewise.
7502         (Incremental_inputs::report_archive): Remove.
7503         (Incremental_inputs::report_archive_begin): New function.
7504         (Incremental_inputs::report_archive_end): New function.
7505         (Incremental_inputs::report_object): New function.
7506         (Incremental_inputs::finalize_inputs): Remove.
7507         (Incremental_inputs::report_input_section): New function.
7508         (Incremental_inputs::report_script): Rewrite.
7509         (Incremental_inputs::finalize): Do nothing but finalize string table.
7510         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7511         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7512         (Incremental_inputs::create_data_sections): New function.
7513         (Incremental_inputs::relocs_entsize): New function.
7514         (Output_section_incremental_inputs::set_final_data_size): New function.
7515         (Output_section_incremental_inputs::do_write): New function.
7516         (Output_section_incremental_inputs::write_header): New function.
7517         (Output_section_incremental_inputs::write_input_files): New function.
7518         (Output_section_incremental_inputs::write_info_blocks): New function.
7519         (Output_section_incremental_inputs::write_symtab): New function.
7520         * incremental.h (Incremental_script_entry): Forward declaration.
7521         (Incremental_object_entry): Forward declaration.
7522         (Incremental_archive_entry): Forward declaration.
7523         (Incremental_inputs): Forward declaration.
7524         (Incremental_inputs_header_data): Remove.
7525         (Incremental_inputs_header): Remove.
7526         (Incremental_inputs_header_write): Remove.
7527         (Incremental_inputs_entry_data): Remove.
7528         (Incremental_inputs_entry): Remove.
7529         (Incremental_inputs_entry_write): Remove.
7530         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
7531         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
7532         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
7533         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
7534         Likewise.
7535         (Incremental_input_entry): New class.
7536         (Incremental_script_entry): New class.
7537         (Incremental_object_entry): New class.
7538         (Incremental_archive_entry): New class.
7539         (Incremental_inputs::Incremental_inputs): Initialize new data members.
7540         (Incremental_inputs::report_inputs): Remove.
7541         (Incremental_inputs::report_archive): Remove.
7542         (Incremental_inputs::report_archive_begin): New function.
7543         (Incremental_inputs::report_archive_end): New function.
7544         (Incremental_inputs::report_object): Change prototype.
7545         (Incremental_inputs::report_input_section): New function.
7546         (Incremental_inputs::report_script): Change prototype.
7547         (Incremental_inputs::get_reloc_count): New function.
7548         (Incremental_inputs::set_reloc_count): New function.
7549         (Incremental_inputs::create_data_sections): New function.
7550         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
7551         (Incremental_inputs::inputs_section): New function.
7552         (Incremental_inputs::symtab_section): New function.
7553         (Incremental_inputs::relocs_section): New function.
7554         (Incremental_inputs::get_stringpool): Add const.
7555         (Incremental_inputs::command_line): Add const.
7556         (Incremental_inputs::inputs): Remove.
7557         (Incremental_inputs::command_line_key): New function.
7558         (Incremental_inputs::input_file_count): New function.
7559         (Incremental_inputs::input_files): New function.
7560         (Incremental_inputs::relocs_entsize): New function.
7561         (Incremental_inputs::sized_create_inputs_section_data): Remove.
7562         (Incremental_inputs::finalize_inputs): Remove.
7563         (Incremental_inputs::Input_info): Remove.
7564         (Incremental_inputs::lock_): Remove.
7565         (Incremental_inputs::inputs_): Change type.
7566         (Incremental_inputs::inputs_map_): Remove.
7567         (Incremental_inputs::current_object_entry_): New data member.
7568         (Incremental_inputs::inputs_section_): New data member.
7569         (Incremental_inputs::symtab_section_): New data member.
7570         (Incremental_inputs::relocs_section_): New data member.
7571         (Incremental_inputs::reloc_count_): New data member.
7572         (Incremental_inputs_reader): New class.
7573         (Incremental_symtab_reader): New class.
7574         (Incremental_relocs_reader): New class.
7575         * layout.cc (Layout::finalize): Move finalization of incremental info
7576         and creation of incremental info sections to follow finalization of
7577         symbol table.  Set offsets for postprocessing sections.
7578         (Layout::create_incremental_info_sections): Call
7579         Incremental_inputs::create_data_sections.  Add incremental symtab
7580         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
7581         sections to layout after input sections.
7582         * layout.h (struct Timespec): Forward declaration.
7583         (Layout::incremental_inputs): Add const.
7584         (Layout::create_incremental_info_sections): Add parameter.
7585         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
7586         * object.cc: Include incremental.h.
7587         (Relobj::finalize_incremental_relocs): New function.
7588         (Sized_relobj::do_layout): Record input sections in incremental info.
7589         * object.h (Object::output_section): New function.
7590         (Object::output_section_offset): Moved from Relobj.
7591         (Object::get_incremental_reloc_base): New function.
7592         (Object::get_incremental_reloc_count): New function.
7593         (Object::do_output_section): New function.
7594         (Object::do_output_section_offset): Moved from Relobj.
7595         (Object::do_get_incremental_reloc_base): New function.
7596         (Object::do_get_incremental_reloc_count): New function.
7597         (Object::Object): Initialize new data members.
7598         (Relobj::output_section): Renamed do_output_section and moved to
7599         protected.
7600         (Relobj::output_section_offset): Moved to Object.
7601         (Relobj::do_get_incremental_reloc_base): New function.
7602         (Relobj::do_get_incremental_reloc_count): New function.
7603         (Relobj::allocate_incremental_reloc_counts): New function.
7604         (Relobj::count_incremental_reloc): New function.
7605         (Relobj::finalize_incremental_relocs): New function.
7606         (Relobj::next_incremental_reloc_index): New function.
7607         (Relobj::reloc_counts_): New data member.
7608         (Relobj::reloc_bases_): New data member.
7609         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
7610         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
7611         (Sized_relobj::incremental_relocs_scan): New function.
7612         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7613         (Sized_relobj::incremental_relocs_write): New function.
7614         (Sized_relobj::incremental_relocs_write_reltype): New function.
7615         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
7616         incremental link.
7617         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
7618         archives and object files elsewhere.
7619         (Add_symbols::run): Report object files here.
7620         (Finish_group::run): Report end of archive at end of group.
7621         * reloc.cc: Include layout.h, incremental.h.
7622         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
7623         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
7624         (Sized_relobj::incremental_relocs_scan): New function.
7625         (Sized_relobj::incremental_relocs_scan_reltype): New function.
7626         (Sized_relobj::do_relocate_sections): Write incremental relocations.
7627         (Sized_relobj::incremental_relocs_write): New function.
7628         (Sized_relobj::incremental_relocs_write_reltype): New function.
7629         * script.cc (read_input_script): Rewrite test for incremental link.
7630         Change call to Incremental_inputs::report_script.
7631         * symtab.h (Symbol_table::first_global_index): New function.
7632         (Symbol_table::output_count): New function.
7633
7634 2010-08-12  Doug Kwan  <dougkwan@google.com>
7635
7636         * arm.cc (Target_arm::merge_object_attributes): Check command line
7637         options --no-wchar-size-warning and --no-enum-size-warning.
7638         * options.h (General_options): Add ld-compatible options
7639         --no-enum-size-warning and --no-wchar-size-warning.
7640
7641 2010-08-04  Ian Lance Taylor  <iant@google.com>
7642
7643         * x86_64.cc (Target_x86_64::Scan::local): Use
7644         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7645         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7646         (Target_x86_64::Scan::global): Likewise.
7647         (Target_x86_64::Relocate::relocate): Likewise.
7648         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7649         Likewise.
7650
7651 2010-08-03  Cary Coutant  <ccoutant@google.com>
7652
7653         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7654         to reserve space in merged_strings vector. Keep total input size
7655         for stats.
7656         (Output_merge_string::do_print_merge_stats): Print total input size.
7657         * merge.h (Output_merge_string): Add input_size_ field.
7658         * stringpool.cc (Stringpool_template::string_length): Move
7659         implementations out of Stringpool_template class and place in
7660         stringpool.h.
7661         * stringpool.h (string_length): Move out of Stringpool_template.
7662
7663 2010-08-03  Ian Lance Taylor  <iant@google.com>
7664
7665         PR 11712
7666         * layout.cc (relaxation_loop_body): If address of load segment is
7667         set, adjust address to include headers if possible.
7668
7669 2010-08-03  Ian Lance Taylor  <iant@google.com>
7670
7671         * version.cc (version_string): Bump to 1.10.
7672
7673 2010-08-03  Ian Lance Taylor  <iant@google.com>
7674
7675         PR 11805
7676         * layout.h (enum Output_section_order): Define.
7677         (class Layout): Update declarations.
7678         * layout.cc (Layout::get_output_section): Add order parameter.
7679         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7680         is_first_non_relro parameters.  Change all callers.
7681         (Layout::choose_output_section): Likewise.
7682         (Layout::add_output_section_data): Likewise.
7683         (Layout::make_output_section): Likewise.  Set order.
7684         (Layout::default_section_order): New function.
7685         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7686         * output.cc (Output_section::Output_section): Initialize order_.
7687         Don't initialize deleted fields.
7688         (Output_segment::Output_segment): Don't initialize deleted
7689         fields.
7690         (Output_segment::add_output_section_to_load): New function
7691         replacing add_output_section.  Change all callers to call this or
7692         add_output_section_to_nonload.
7693         (Output_segment::add_output_section_to_nonload): New function.
7694         (Output_segment::remove_output_section): Rewrite.
7695         (Output_segment::add_initial_output_data): Likewise.
7696         (Output_segment::has_any_data_sections): Likewise.
7697         (Output_segment::is_first_section_relro): Likewise.
7698         (Output_segment::maximum_alignment): Likewise.
7699         (Output_segment::has_dynamic_reloc): New function replacing
7700         dynamic_reloc_count.  Change all callers.
7701         (Output_segment::has_dynamic_reloc_list): New function replacing
7702         dynamic_reloc_count_list.  Change all callers.
7703         (Output_segment::set_section_addresses): Rewrite.
7704         (Output_segment::set_offset): Rewrite.
7705         (Output_segment::find_first_and_last_list): Remove.
7706         (Output_segment::set_tls_offsets): Rewrite.
7707         (Output_segment::first_section_load_address): Likewise.
7708         (Output_segment::output_section_count): Likewise.
7709         (Output_segment::section_with_lowest_load_address): Likewise.
7710         (Output_segment::write_section_headers): Likewise.
7711         (Output_segment::print_sections_to_map): Likewise.
7712         * output.h (class Output_data): Remove dynamic_reloc_count_
7713         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7714         (Output_data::add_dynamic_reloc): Rewrite.
7715         (Output_data::has_dynamic_reloc): New function.
7716         (Output_data::dynamic_reloc_count): Remove.
7717         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7718         is_last_relro_, is_first_non_relro_, is_interp_,
7719         is_dynamic_linker_section_ fields.  Add order and set_order
7720         functions.  Remove is_relro_local, set_is_relro_local,
7721         is_last_relro, set_is_last_relro, is_first_non_relro,
7722         set_is_first_non_relro functions, is_interp, set_is_interp,
7723         is_dynamic_linker_section, and set_is_dynamic_linker_section
7724         functions.
7725         (class Output_segment): Change Output_data_list from std::list to
7726         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7727         output_bss_ fields.  Update declarations.
7728
7729 2010-08-02  Ian Lance Taylor  <iant@google.com>
7730
7731         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7732         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7733         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7734
7735 2010-08-02  Ian Lance Taylor  <iant@google.com>
7736
7737         PR 11855
7738         * script.cc (Script_options::Script_options): Initialize
7739         symbol_definitions_ and symbol_references_.
7740         (Script_options::add_symbol_assignment): Update
7741         symbol_definitions_ and symbol_references_.
7742         (Script_options::add_symbol_reference): New function.
7743         (script_symbol): New function.
7744         * script.h (class Script_options): Add symbol_definitions_ and
7745         symbol_references_ fields.
7746         (Script_options::referenced_const_iterator): New type.
7747         (Script_options::referenced_begin): New function.
7748         (Script_options::referenced_end): New function.
7749         (Script_options::is_referenced): New function.
7750         (Script_options::any_unreferenced): New function.
7751         * script-c.h (script_symbol): Declare.
7752         * yyscript.y (exp): Call script_symbol.
7753         * symtab.cc: Include "script.h".
7754         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7755         Change all callers.  Check symbols referenced by scripts.
7756         (Symbol_table::add_undefined_symbols_from_command_line): Add
7757         layout parameter.  Change all callers.
7758         (Symbol_table::do_add_undefined_symbols_from_command_line):
7759         Likewise.  Break out loop body.  Check symbols referenced by
7760         scripts.
7761         (Symbol_table::add_undefined_symbol_from_command_line): New
7762         function broken out of
7763         do_add_undefined_symbols_from_command_line.
7764         * symtab.h (class Symbol_table): Update declarations.
7765         * archive.cc: Include "layout.h".
7766         (Archive::should_include_member): Add layout parameter.  Change
7767         all callers.  Check for symbol mentioned in expression.
7768         * archive.h (class Archive): Update declaration.
7769         * object.cc (Sized_relobj::do_should_include_member): Add layout
7770         parameter.
7771         * object.h (Object::should_include_member): Add layout parameter.
7772         Change all callers.
7773         (Object::do_should_include_member): Add layout parameter.
7774         (class Sized_relobj): Update declaration.
7775         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7776         parameter.
7777         * dynobj.h (class Sized_dynobj): Update declaration.
7778         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7779         layout parameter.
7780         * plugin.h (class Sized_pluginobj): Update declaration.
7781
7782 2010-08-02  Ian Lance Taylor  <iant@google.com>
7783
7784         PR 11866
7785         * output.cc (Output_segment::set_offset): Search for the first and
7786         last sections rather than assuming that the list is in order.
7787         (Output_segment::find_first_and_last_list): New function.
7788         * output.h (class Output_segment): Update declarations.
7789         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7790         (relro_strip_test_SOURCES): New variable.
7791         (relro_strip_test_DEPENDENCIES): New variable.
7792         (relro_strip_test_LDFLAGS): New variable.
7793         (relro_strip_test_LDADD): New variable.
7794         (relro_strip_test.so): New target.
7795
7796 2010-08-02  Ian Lance Taylor  <iant@google.com>
7797
7798         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7799         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7800         (Target_i386::got_tlsdesc_section): New function.
7801         (Target_i386::got_section): Create space for GOT entries for
7802         TLSDESC relocations.
7803         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7804         R_386_TLS_GOTDESC.
7805         (Target_i386::Scan::global): Likewise.
7806         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7807         using TLSDESC GOT.
7808         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7809         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7810         (Target_x86_64::got_tlsdesc_section): New function.
7811         (Target_x86_64::got_section): Create space for GOT entries for
7812         TLSDESC relocations.
7813         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7814         R_386_TLS_GOTDESC.
7815         (Target_x86_64::Scan::global): Likewise.
7816         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7817         using TLSDESC GOT.
7818
7819 2010-08-02  Ian Lance Taylor  <iant@google.com>
7820
7821         * testsuite/final_layout.sh: Use dc to convert from hex to
7822         decimal.
7823
7824 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7825
7826         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7827         paramter to the call to gold::gc_process_relocs.
7828         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7829         paramter to the call to gold::gc_process_relocs.
7830         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7831         parameter to the call to gold::gc_process_relocs.
7832         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7833         template parameter to the call to gold::gc_process_relocs.
7834         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7835         paramter to the call to gold::gc_process_relocs.
7836         * gc.h (get_embedded_addend_size): New function.
7837         (gc_process_relocs): Save the size of the reloc for use by ICF.
7838         * icf.cc (get_section_contents): Get the addend from the text section
7839         for SHT_REL relocation sections.
7840         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7841         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7842         * int_encoding.h (read_from_pointer): New overloaded function.
7843         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7844         * testsuite/icf_sht_rel_addend_test.sh: New file.
7845         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7846         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7847
7848 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7849
7850         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7851         * Makefile.in: Regenerate.
7852         * testsuite/Makefile.in: Regenerate.
7853
7854 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7855
7856         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7857         * gold/testsuite/debug_msg.cc: Likewise.
7858         * gold/testsuite/odr_violation1.cc
7859         * gold/testsuite/odr_violation2.cc
7860
7861 2010-07-21  Cary Coutant  <ccoutant@google.com>
7862
7863         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7864         string, and length fields.
7865         (Output_merge_string::Merged_strings_list): New type.
7866         (Output_merge_string::Merged_strings_lists): New typedef.
7867         (Output_merge_string): Replace merged_strings_ with
7868         merged_strings_lists_.
7869         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7870         Merged_strings_list per input object and section.  Don't store pointer
7871         to the string.  Don't store length with each merged string entry.
7872         (Output_merge_string::finalize_merged_data): Loop over list of merged
7873         strings lists.  Recompute length of each merged string.
7874
7875 2010-07-15  Cary Coutant  <ccoutant@google.com>
7876
7877         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7878         here.
7879
7880 2010-07-14  Ian Lance Taylor  <iant@google.com>
7881
7882         * descriptors.cc (Descriptors::open): Report correct name in error
7883         message.
7884
7885 2010-07-13  Doug Kwan  <dougkwan@google.com>
7886
7887         * arm.cc (Arm_input_section::Arm_input_section): For a
7888         SHT_ARM_EXIDX section, always keeps the input sections.
7889         (Arm_input_section::set_exidx_section_link): New method.
7890         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7891         has_errors_ to false.
7892         (Arm_exidx_input_section::has_errors,
7893         Arm_exidx_input_section::set_has_errors): New methods.
7894         (Arm_exidx_input_section::has_errors_): New data member.
7895         (Arm_relobj::get_exidx_shndx_list): New method.
7896         (Arm_output_section::append_text_sections_to_list): Do not skip
7897         section without SHF_EXECINSTR.
7898         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7899         errors.
7900         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7901         section header.  Make error messages more verbose.  Check for
7902         a non-executable section linked to an EXIDX section.
7903         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7904         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7905         check that there is no deferred EXIDX section if we exit early.
7906         Instead of not making an EXIDX section in case of an error, make one
7907         and set the has_errors flag of it.
7908         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7909         in a relocatable link.
7910         (Target_arm::do_relax): Look for the EXIDX output section instead of
7911         assuming that it is called .ARM.exidx.
7912         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7913         section list.  Do not check for SHF_EXECINSTR section flags but
7914         skip any input section with errors.
7915         * output.cc (Output_section::Output_section): Initialize
7916         always_keeps_input_sections_ to false.
7917         (Output_section::add_input_section): Check for
7918         always_keeps_input_sections_.
7919         *  output.h (Output_section::always_keeps_input_sections,
7920         Output_section::set_always_keeps_input_sections): New methods.
7921         (Output_section::always_keeps_input_sections): New data member.
7922
7923 2010-07-13  Rafael Espindola  <espindola@google.com>
7924
7925         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7926         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7927
7928 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7929             Ian Lance Taylor  <iant@google.com>
7930
7931         * output.h (Output_section_lookup_maps::add_merge_section):
7932         Correct check of whether value was inserted.
7933         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7934         (Output_section_lookup_maps::add_relaxed_input_section):
7935         Likewise.
7936         * arm.cc (Target_arm::got_section): Remove used local os.
7937         * i386.cc (Target_i386::got_section): Likewise.
7938         * x86_64.cc (Target_x86_64::got_section): Likewise.
7939         * sparc.cc (Target_sparc::got_section): Likewise.
7940         (Target_sparc::relocate): Remove unused local have_got_offset.
7941         * powerpc.cc (Target_powerpc::relocate): Likewise.
7942
7943 2010-07-13  Ian Lance Taylor  <iant@google.com>
7944
7945         * compressed_output.cc (zlib_decompress): Fix signature in
7946         !HAVE_ZLIB_H case.
7947
7948         * archive.cc (Archive::include_member): Unlock an external member
7949         of a thin archive.  Don't bother to delete an object we know is
7950         NULL.
7951
7952 2010-07-12  Cary Coutant  <ccoutant@google.com>
7953
7954         * compressed_output.cc (zlib_decompress): New function.
7955         (get_uncompressed_size): New function.
7956         (decompress_input_section): New function.
7957         * compressed_output.h (get_uncompressed_size): New function.
7958         (decompress_input_section): New function.
7959         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7960         Handle compressed debug sections.
7961         * layout.cc (is_compressed_debug_section): New function.
7962         (Layout::output_section_name): Map compressed section names to
7963         canonical names.
7964         * layout.h (is_compressed_debug_section): New function.
7965         (is_debug_info_section): Recognize compressed debug sections.
7966         * merge.cc: Include compressed_output.h.
7967         (Output_merge_data::do_add_input_section): Handle compressed
7968         debug sections.
7969         (Output_merge_string::do_add_input_section): Handle compressed
7970         debug sections.
7971         * object.cc: Include compressed_output.h.
7972         (Sized_relobj::Sized_relobj): Initialize new data members.
7973         (build_compressed_section_map): New function.
7974         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7975         * object.h (Object::section_is_compressed): New method.
7976         (Object::do_section_is_compressed): New method.
7977         (Sized_relobj::Compressed_section_map): New type.
7978         (Sized_relobj::do_section_is_compressed): New method.
7979         (Sized_relobj::compressed_sections_): New data member.
7980         * output.cc (Output_section::add_input_section): Handle compressed
7981         debug sections.
7982         * reloc.cc: Include compressed_output.h.
7983         (Sized_relobj::write_sections): Handle compressed debug sections.
7984
7985 2010-07-08  Cary Coutant  <ccoutant@google.com>
7986
7987         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7988         weak when resolving to a dynamic def.
7989         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7990         for weak undef/dynamic def cases. Adjust callers.
7991         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7992         undef_binding_weak_.
7993         (Symbol_table::sized_write_globals): Adjust symbol binding.
7994         (Symbol_table::sized_write_symbol): Add binding parameter.
7995         * symtab.h (Symbol::set_undef_binding): New method.
7996         (Symbol::is_undef_binding_weak): New method.
7997         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7998         (Symbol_table::should_override): Add new parameter.
7999         (Symbol_table::sized_write_symbol): Add new parameter.
8000
8001         * testsuite/weak_undef_file1.cc: Add new test case.
8002         * testsuite/weak_undef_file2.cc: Fix header comment.
8003         * testsuite/weak_undef_test.cc: Add new test case.
8004
8005 2010-06-29  Doug Kwan  <dougkwan@google.com>
8006
8007         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
8008         Initialize USE_SYMBOL_.
8009         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
8010         definition.
8011         (Arm_reloc_property::uses_symbol_): New data member declaration.
8012         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
8013         uses symbol value and symbol is undefined but not weakly undefined.
8014
8015 2010-06-28  Rafael Espindola  <espindola@google.com>
8016
8017         * plugin.cc (Plugin::load): Use dlerror.
8018
8019 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
8020
8021         * symtab.cc (detect_odr_violations): When reporting an ODR
8022         violation, report an object where the symbol is defined.
8023
8024 2010-06-25  Doug Kwan  <dougkwan@google.com>
8025
8026         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
8027         (Target_arm::section_may_have_icf_unsafe_pointers): New method
8028         definition.
8029         (Target_arm::Scan::local_reloc_may_be_function_pointer,
8030         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
8031         target hook to detect function points.
8032         (Target_arm::Scan::possible_function_pointer_reloc): New method.
8033         * icf.h (Icf::check_section_for_function_pointers): Change type of
8034         parameter SECTION_NAME to const reference to std::string.  Use
8035         target hook to determine if section may have unsafe pointers.
8036         * target.h (Target::section_may_have_icf_unsafe_pointers): New
8037         method definition.
8038
8039 2010-06-21  Rafael Espindola  <espindola@google.com>
8040
8041         * fileread.cc (Input_file::find_fie): New
8042         (Input_file::open): Use Input_file::find_fie.
8043         * fileread.h (Input_file::find_fie): New
8044         * plugin.cc (set_extra_library_path): New.
8045         (Plugin::load): Add set_extra_library_path to the transfer vector.
8046         (Plugin_manager::set_extra_library_path): New.
8047         (Plugin_manager::add_input_file): Use the extra search path if set.
8048         (set_extra_library_path(): New.
8049         * plugin.h (Plugin_manager): Add set_extra_library_path and
8050         extra_search_path_.
8051
8052 2010-06-19  Cary Coutant  <ccoutant@google.com>
8053
8054         * layout.cc (gdb_sections): Add .debug_types.
8055         (lines_only_debug_sections): Likewise.
8056
8057 2010-06-18  Rafael Espindola  <espindola@google.com>
8058
8059         * plugin.cc (add_input_file,add_input_library)
8060         (Plugin_manager::add_input_file): Make filename arguments const.
8061         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
8062         const.
8063
8064 2010-06-16  Doug Kwan  <dougkwan@google.com>
8065
8066         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
8067         .ARM.attributes section if we have not merged any input
8068         attributes sections.
8069
8070 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8071
8072         * arm.cc: Allow combining objects with no EABI version
8073         information.
8074
8075 2010-06-15  Rafael Espindola  <espindola@google.com>
8076
8077         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
8078
8079 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8080
8081         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
8082         (struct iovec): Correct !HAVE_READV definition.
8083
8084 2010-06-10  Cary Coutant  <ccoutant@google.com>
8085
8086         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
8087         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
8088         reloc sections.
8089         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
8090
8091         PR 11683
8092         * symtab.h (Symbol::is_placeholder): New member function.
8093         * target-reloc.h (relocate_section): Check for placeholder symbols.
8094
8095         * testsuite/Makefile.am (plugin_test_8): New test.
8096         (plugin_test_9): New test.
8097         * testsuite/Makefile.in: Regenerate.
8098
8099 2010-06-09  Nick Clifton  <nickc@redhat.com>
8100
8101         * yyscript.y (input_list_element): Allow strings prefixed with
8102         the '-' character.  Treat these as libraries.
8103         * script.cc (script_add_library): New function.  Adds a library
8104         specified by "-l<name>" found in an input script.
8105         * script-c.h: Add prototype for script_add_library.
8106
8107 2010-06-07  Doug Kwan  <dougkwan@google.com>
8108
8109         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
8110         Restrict stub-group size to be within long conditional branch
8111         range when working around cortex-A8 erratum.
8112
8113 2010-06-07  Damien Diederen  <dd@crosstwine.com>
8114
8115         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
8116         #ifdef typo.
8117
8118 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
8119
8120         PR gold/11658
8121         * output.cc
8122         (Output_section::Input_section_sort_entry::compare_section_ordering):
8123         Change to return non-zero correctly.
8124         (Output_section::Input_section_sort_section_order_index_compare
8125         ::operator()): Change to fix ambiguity in comparisons.
8126
8127 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
8128
8129         * gold.h (is_wildcard_string): New function.
8130         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
8131         (Layout::layout_eh_frame): Ditto.
8132         (Layout::find_section_order_index): New method.
8133         (Layout::read_layout_from_file): New method.
8134         * layout.h (Layout::find_section_order_index): New method.
8135         (Layout::read_layout_from_file): New method.
8136         (Layout::input_section_position_): New private member.
8137         (Layout::input_section_glob_): New private member.
8138         * main.cc (main): Call read_layout_from_file here.
8139         * options.h (--section-ordering-file): New option.
8140         * output.cc (Output_section::input_section_order_specified_): New
8141         member.
8142         (Output_section::Output_section): Initialize new member.
8143         (Output_section::add_input_section): Add new parameter.
8144         Keep input sections when --section-ordering-file is used.
8145         (Output_section::set_final_data_size): Sort input sections when
8146         section ordering file is specified.
8147         (Output_section::Input_section_sort_entry): Add new parameter.
8148         Check sorting type.
8149         (Output_section::Input_section_sort_entry::compare_section_ordering):
8150         New method.
8151         (Output_section::Input_section_sort_compare::operator()): Change to
8152         consider section_order_index.
8153         (Output_section::Input_section_sort_init_fini_compare::operator()):
8154         Change to consider section_order_index.
8155         (Output_section::Input_section_sort_section_order_index_compare
8156         ::operator()): New method.
8157         (Output_section::sort_attached_input_sections): Change to sort
8158         according to section order when specified.
8159         (Output_section::add_input_section<32, true>): Add new parameter.
8160         (Output_section::add_input_section<64, true>): Add new parameter.
8161         (Output_section::add_input_section<32, false>): Add new parameter.
8162         (Output_section::add_input_section<64, false>): Add new parameter.
8163         * output.h (Output_section::add_input_section): Add new parameter.
8164         (Output_section::input_section_order_specified): New
8165         method.
8166         (Output_section::set_input_section_order_specified): New method.
8167         (Input_section::Input_section): Initialize section_order_index_.
8168         (Input_section::section_order_index): New method.
8169         (Input_section::set_section_order_index): New method.
8170         (Input_section::section_order_index_): New member.
8171         (Input_section::Input_section_sort_section_order_index_compare): New
8172         struct.
8173         (Output_section::input_section_order_specified_): New member.
8174         * script-sections.cc (is_wildcard_string): Delete and move modified
8175         method to gold.h.
8176         (Output_section_element_input::Output_section_element_input): Modify
8177         call to is_wildcard_string.
8178         (Output_section_element_input::Input_section_pattern
8179         ::Input_section_pattern): Ditto.
8180         (Output_section_element_input::Output_section_element_input): Ditto.
8181         * testsuite/Makefile.am (final_layout): New test case.
8182         * testsuite/Makefile.in: Regenerate.
8183         * testsuite/final_layout.cc: New file.
8184         * testsuite/final_layout.sh: New file.
8185
8186 2010-06-01  Rafael Espindola  <espindola@google.com>
8187
8188         * plugin.cc (Plugin::load): Pass the output name to the plugin.
8189
8190 2010-06-01  Rafael Espindola  <espindola@google.com>
8191
8192         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
8193         visibility of symbols.
8194
8195 2010-05-27  Doug Kwan  <dougkwan@google.com>
8196
8197         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
8198         from start of output section instead of address for a local symbol
8199         in a merged or relaxed section when doing a relocatable link.
8200
8201 2010-05-26  Rafael Espindola  <espindola@google.com>
8202
8203         PR 11604
8204         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
8205         adding sections the garbage collector removed.
8206         * gold/testsuite/Makefile.am: Add test.
8207         * gold/testsuite/Makefile.in: Regenerate.
8208         * gold/testsuite/plugin_test_7.sh: New.
8209         * gold/testsuite/plugin_test_7_1.c: New.
8210         * gold/testsuite/plugin_test_7_2.c: New.
8211
8212 2010-05-26  Rafael Espindola  <espindola@google.com>
8213
8214         * script-sections.cc (Output_section_definition::set_section_addresses):
8215         Check for --section-start.
8216
8217 2010-05-26  Doug Kwan  <dougkwan@google.com>
8218
8219         * arm.cc (Arm_scan_relocatable_relocs): New class.
8220         (Target_arm::relocate_special_relocatable): New method.
8221         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
8222         (Arm_relocate_functions::thumb_branch_common): Same.
8223         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
8224         instead of Default_scan_relocatable_relocs.
8225         * target-reloc.h (relocate_for_relocatable): Let target handle
8226         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
8227         * target.h (Sized_target::relocate_special_relocatable): New method.
8228
8229 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8230
8231         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
8232
8233 2010-05-23  Doug Kwan  <dougkwan@google.com>
8234
8235         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
8236         instead of a cast.
8237         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
8238         with a direct branch, not a conditional branch, to a stub.
8239         * merge.cc (Output_merge_base::record_input_section): New method
8240         defintion.
8241         (Output_merge_data::do_add_input_section): Record input section if
8242         keeps-input-sections flag is set.
8243         (Output_merge_string::do_add_input_section): Ditto.
8244         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
8245         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
8246         INPUT_SECTIONS_.
8247         (Output_merge_base::keeps_input_sections,
8248         Output_merge_base::set_keeps_input_sections,
8249         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
8250         method definitions.
8251         (Output_merge_base::Input_sections): New type declaration.
8252         (Output_merge_base::input_sections_begin,
8253         Output_merge_base::input_sections_end,
8254         Output_merge_base::do_set_keeps_input_sections): New method definitions.
8255         (Output_merge_base::bool keeps_input_sections_,
8256         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
8257         Output_merge_base::input_sections_): New data members.
8258         (Output_merge_data::do_set_keeps_input_sections): New method
8259         defintion.
8260         (Output_merge_string::do_set_keeps_input_sections): Ditto.
8261         * output.cc (Output_section::Input_section::relobj): Move method
8262         defintion from class declaration to here and handle merge sections.
8263         (Output_section::Input_section::shndx): Ditto.
8264         (Output_section::Output_section): Remove initializations of removed
8265         data members and initialize new data member LOOKUP_MAPS_.
8266         (Output_section::add_input_section): Set keeps-input-sections flag
8267         for a newly created merge output section as appropriate.  Adjust code
8268         to use Output_section_lookup_maps class.
8269         (Output_section::add_relaxed_input_section): Adjst code for lookup
8270         maps code refactoring.
8271         (Output_section::add_merge_input_section): Add a new parameter
8272         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
8273         class.  If adding input section to a newly created merge output
8274         section fails, remove the new merge section.
8275         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
8276         Adjust code for use of the Output_section_lookup_maps class.
8277         (Output_section::find_merge_section): Ditto.
8278         (Output_section::build_lookup_maps): New method defintion.
8279         (Output_section::find_relaxed_input_section): Adjust code to use
8280         Output_section_lookup_maps class.
8281         (Output_section::get_input_sections): Export merge sections.  Adjust
8282         code to use Output_section_lookup_maps class.
8283         (Output_section:::add_script_input_section): Adjust code to use
8284         Output_section_lookup_maps class.  Update lookup maps for merge
8285         sections also.
8286         (Output_section::discard_states): Use Output_section_lookup_maps.
8287         (Output_section::restore_states): Same.
8288         * output.h (Merge_section_properties): Move class defintion out of
8289         Output_section.
8290         (Output_section_lookup_maps): New class.
8291         (Output_section::Input_section::is_merge_section): New method
8292         defintion.
8293         (Output_section::Input_section::relobj): Move defintion out of class
8294         defintion.  Declare method only.
8295         (Output_section::Input_section::shndx): Ditto.
8296         (Output_section::Input_section::output_merge_base): New method defintion.
8297         (Output_section::Input_section::u2_.pomb): New union field.
8298         (Output_section::Merge_section_by_properties_map,
8299         Output_section::Output_section_data_by_input_section_map,
8300         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
8301         Remove types.
8302         (Output_section::add_merge_input_section): Add new parameter
8303         KEEPS_INPUT_SECTIONS.
8304         (Output_section::build_lookup_maps): New method declaration.
8305         (Output_section::merge_section_map_,
8306         Output_section::merge_section_by_properties_map_,
8307         Output_section::relaxed_input_section_map_,
8308         Output_section::is_relaxed_input_section_map_valid_): Remove data
8309         members.
8310         (Output_section::lookup_maps_): New data member.
8311
8312 2010-05-21  Doug Kwan  <dougkwan@google.com>
8313
8314         PR gold/11619
8315         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
8316         avoid a compilation error.
8317
8318 2010-05-19  Rafael Espindola  <espindola@google.com>
8319
8320         * script-sections.cc (Output_section_definition::allocate_to_segment):
8321         Update the phdrs_list even when the output section is NULL.
8322         * testsuite/Makefile.am: Add test.
8323         * testsuite/Makefile.in: Regenerate.
8324         * testsuite/script_test_9.cc: New.
8325         * testsuite/script_test_9.sh: New.
8326         * testsuite/script_test_9.t: New.
8327
8328 2010-05-19  Doug Kwan  <dougkwan@google.com>
8329
8330         * arm.cc (Arm_input_section::original_size): New method.
8331         (Arm_input_section::do_addralign): Add a cast.
8332         (Arm_input_section::do_output_offset): Remove static cast.
8333         (Arm_input_section::original_addralign,
8334          Arm_input_section::original_size_): Change type to uint32_t.
8335         (Arm_input_section::init): Add safe casts for section alignment
8336         and size.
8337         (Arm_input_section::set_final_data_size): Do not set address and
8338         offset of stub table.
8339         (Arm_output_section::fix_exidx_coverage): Change use of of
8340         Output_section::Simple_input_section to that of
8341         Output_section::Input_section.
8342         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
8343         except for the first pass.
8344         * output.cc (Output_section::get_input_sections): Change type of
8345         input_sections to std::list<Input_section>.
8346         (Output_section::add_script_input_section): Rename from
8347         Output_section::add_simple_input_section.  Change type of SIS
8348         parameter from Simple_input_section to Input_section.
8349         * output.h (Output_section::Simple_input_section): Remove class.
8350         (Output_section::Input_section): Change class visibility to public.
8351         (Output_section::Input_section::addralign): Use stored alignments
8352         for special input sections if set.
8353         (Output_section::Input_section::set_addralign): New method.
8354         (Output_section::get_input_sections): Change parameter type from
8355         list of Simple_input_section to list of Input_section.
8356         (Output_section::add_script_input_section): Rename from
8357         Output_section::add_simple_input_section. Change first parameter's
8358         type from Simple_input_section to Input_section and remove the
8359         second and third parameters.
8360         * script-sections.cc (Input_section::Input_section_list): Change
8361         type to list of Output_section::Input_section/
8362         (Input_section_info::Input_section_info): Change parameter type of
8363         INPUT_SECTION to Output_section::Input_section.
8364         (Input_section_info::input_section): Change return type.
8365         (Input_section_info::input_section_): Change type to
8366         Output_section::Input_section.
8367         (Output_section_element_input::set_section_addresses): Adjust code
8368         to use Output_section::Input_section instead of
8369         Output_section::Simple_input_section.  Adjust code for renaming
8370         of Output_section::add_simple_input_section.
8371         (Orphan_output_section::set_section_addresses): Ditto.
8372
8373 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8374
8375         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
8376         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
8377
8378 2010-05-18  Rafael Espindola  <espindola@google.com>
8379
8380         * options.cc (General_options::finalize): Handle -nostdlib.
8381         * options.h (nostdlib): New option.
8382         * script.cc (script_add_search_dir): Handle -nostdlib.
8383
8384 2010-05-12  Doug Kwan  <dougkwan@google.com>
8385
8386         * arm.cc (Target_arm::do_finalize_sections): Create an empty
8387         attributes section only if there no attributes section after merging.
8388         (Target_arm::merge_object_attributes): Move value of
8389         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
8390         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
8391         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
8392         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
8393         and arm_attr_merge_7.stdout.
8394         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
8395         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
8396         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
8397         arm_attr_merge_7b.o): New rules.
8398         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
8399         arm_attr_merge_7
8400         * testsuite/Makefile.in: Regenerate.
8401         * testsuite/arm_attr_merge.sh: New file.
8402         * testsuite/arm_attr_merge_[67][ab].s: Same.
8403
8404 2010-05-05  Nick Clifton  <nickc@redhat.com>
8405
8406         * po/es.po: Updated Spanish translation.
8407
8408 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8409
8410         * Makefile.am (install-exec-local): Properly install gold as
8411         default cross linker.
8412         * Makefile.in: Regenerated.
8413
8414 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
8415             Nick Clifton  <nickc@redhat.com>
8416
8417         * configure.ac (install_as_default): Define and set to false
8418         unless --enable-gold or --enable-gold=both/gold has been
8419         specified.
8420         * configure: Regenerate.
8421
8422         * Makefile.am (install-exec-local): Install the executable as
8423         'ld.gold'.  If install_as_default is true then also install it as
8424         'ld'.
8425         * Makefile.in: Regenerated.
8426
8427 2010-04-24  Ian Lance Taylor  <iant@google.com>
8428
8429         * layout.cc (Layout::layout_reloc): In relocatable link don't
8430         combine reloc sections for grouped sections.
8431
8432 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
8433
8434         * gc.h (gc_process_relocs): Pass information on relocs pointing to
8435         sections that are not ordinary to icf.
8436         * icf.cc (get_section_contents): Handle relocation pointing to section
8437         with no object or shndx information.
8438         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
8439         * testsuite/Makefile.in: Regenerate.
8440         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
8441         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
8442
8443 2010-04-22  Ian Lance Taylor  <iant@google.com>
8444
8445         * expression.cc (Expression::Expression_eval_info): Add
8446         result_alignment_pointer field.
8447         (Expression::eval_with_dot): Add result_alignment_pointer
8448         parameter.  Change all callers.
8449         (Expression::eval_maybe_dot): Likewise.
8450         (class Binary_expression): Add alignment_pointer parameter to
8451         left_value and right_value.  Change all callers.
8452         (BINARY_EXPRESSION): Set result alignment.
8453         (class Trinary_expression): Add alignment_pointer parameter to
8454         arg2_value and arg3_value.  Change all callers.
8455         (Trinary_cond::value): Set result alignment.
8456         (Max_expression::value, Min_expression::value): Likewise.
8457         (Align_expression::value): Likewise.
8458         * script-sections.cc (class Sections_element): Add dot_alignment
8459         parameter to set_section_addresses virtual function.  Update
8460         instantiations.
8461         (class Output_section_element): Likewise.
8462         (Script_sections::create_segments): Add dot_alignment parameter.
8463         Change all callers.
8464         (Script_sections::create_segments_from_phdrs_clause): Likewise.
8465         (Script_sections::set_phdrs_clause_addresses): Likewise.
8466         * script-sections.h: Update declarations.
8467         * script.h: Update declarations.
8468         * output.h (Output_segment::set_minimum_p_align): Don't decrease
8469         min_p_align.
8470         * testsuite/script_test_3.t: Set large alignment.
8471         * testsuite/script_test_3.sh: Make sure that at least one LOAD
8472         segment has expected alignment.
8473
8474 2010-04-22  Nick Clifton  <nickc@redhat.com>
8475
8476         * po/gold.pot: Updated by the Translation project.
8477         * po/vi.po: Updated Vietnamese translation.
8478
8479 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
8480
8481         * testsuite/Makefile.am (check_PROGRAMS): Add
8482         icf_virtual_function_folding_test.
8483         * testsuite/Makefile.in: Regenerated.
8484
8485 2010-04-15  Andrew Haley  <aph@redhat.com>
8486
8487         * options.h (merge_exidx_entries): New option.
8488         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
8489         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
8490         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
8491         (Target_arm::merge_exidx_entries): New function.
8492         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
8493         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
8494         to Arm_exidx_fixup constructor.
8495         Add new arg, merge_exidx_entries.
8496         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
8497         Arm_output_section::fix_exidx_coverage.
8498
8499 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
8500
8501         * icf.cc (get_section_contents): Check for preemptible functions.
8502         Ignore addend when appropriate.
8503         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
8504         section folded.
8505         (add_from_relobj): Check for section folded.
8506         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
8507         * symtab.h (should_add_dynsym_entry): Add new parameter.
8508         * target-reloc.h (scan_relocs): Check for section folded.
8509         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
8510         Check reloc types for function pointers in shared objects.
8511         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
8512         case.
8513         (icf_preemptible_functions_test): New test case.
8514         (icf_string_merge_test): New test case.
8515         * testsuite.Makefile.in: Regenerate.
8516         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
8517         bar_glob.  Refactor code.
8518         * testsuite/icf_preemptible_functions_test.cc: New file.
8519         * testsuite/icf_preemptible_functions_test.sh: New file.
8520         * testsuite/icf_string_merge_test.cc: New file.
8521         * testsuite/icf_string_merge_test.sh: New file.
8522         * testsuite/icf_virtual_function_folding_test.cc: New file.
8523         * testsuite/icf_virtual_function_folding_test.sh: New file.
8524
8525 2010-04-14  Doug Kwan  <dougkwan@google.com>
8526
8527         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
8528         for local symbol recounting if we remove a section due to ICF.
8529         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
8530         there are no regular objects in input.
8531
8532 2010-04-13  Doug Kwan  <dougkwan@google.com>
8533
8534         * arm.cc (Arm_input_section::set_final_data_size): Compute
8535         accurate final data size instead of using current data size.
8536
8537 2010-04-09  Doug Kwan  <dougkwan@google.com>
8538
8539         * layout.cc (Layout::choose_output_section): Handle script section
8540         types.
8541         (Layout::make_output_section_for_script): Add section type parameter.
8542         Handle script section types.
8543         * layout.h (Layout::make_output_section_for_script): Add section
8544         type parameter.
8545         * output.cc (Output_section::Output_section): Initialize data member
8546         is_noload_.
8547         (Output_section::do_reset_address_and_file_offset): Do not set address
8548         to 0 if section is a NOLOAD section.
8549         * output.h (Output_section::is_noload): New method.
8550         (Output_section::set_is_noload): Ditto.
8551         (Output_section::is_noload_): New data member.
8552         * script-c.h (Script_section_type): New enum type.
8553         (struct Parser_output_section_header): Add new file section_type.
8554         * script-sections.cc (Sections_element::output_section_name): Add
8555         parameter for returning script section type.
8556         (Output_section_definition::output_section_name): Ditto.
8557         (Output_section_definition::section_type)P; New method.
8558         (Output_section_definiton::script_section_type_name): Ditto.
8559         (Output_section_definition::script_section_type_): New data member.
8560         (Output_section_definition::Output_section_definition): Initialize
8561         data member Output_section_definition::script_section_type_.
8562         (Output_section_definition::create_sections): Pass script section type
8563         to Layout::make_output_section_for_script.
8564         (Output_section_definition::output_section_name): Return script
8565         section type to caller.
8566         (Output_section_definition::set_section_address): Do not advance
8567         dot value and load address if section type is NOLOAD.  Set address
8568         of NOLOAD sections regardless of section flags.
8569         (Output_section_definition::print): Print section type if it is
8570         not SCRIPT_SECTION_TYPE_NONE.
8571         (Output_section_definition::section_type): New method.
8572         (Output_section_definition::script_section_type_name): Ditto.
8573         (Script_sections::output_section_name): Add new parameter
8574         PSECTION_TYPE for returning script section type.  Pass it to
8575         section elements.  Handle discard sections.
8576         (Sort_output_sections::operator()): Handle NOLOAD sections.
8577         * script-sections.h (Script_sections::Section_type): New enum type.
8578         (Script_sections::output_section_name): Add a new parameter for
8579         returning script section type.
8580         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
8581         INFO and NOLOAD.
8582         * yyscript.y (union): Add new field SECTION_TYPE.
8583         (COPY, DSECT, INFO, NOLOAD): New tokens.
8584         (opt_address_and_section_type): Change type to output_section_header.
8585         (section_type): New non-terminal
8586         (section_header): Handle section type.
8587         (opt_address_and_section_type): Return section type value.
8588
8589 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
8590
8591         * testsuite/plugin_common_test_1.c (foo): Add prototype.
8592         * testsuite/plugin_common_test_2.c (foo): Likewise.
8593
8594 2010-04-08  Doug Kwan  <dougkwan@google.com>
8595
8596         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
8597         Output_merge_data.
8598         * output.cc (Output_section::add_merge_input_section): Simplify
8599         code and return status of Output_merge_base::add_input_section.
8600         Update merge section map only if Output_merge_base::add_input_section
8601         returns true.
8602
8603 2010-04-07  Doug Kwan  <dougkwan@google.com>
8604
8605         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
8606         if section is marked as containing instructions but has no mapping
8607         symbols.
8608         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
8609         correct section index.
8610         (Arm_relobj::find_linked_text_section): Ditto.
8611
8612 2010-04-07  Cary Coutant  <ccoutant@google.com>
8613
8614         * archive.cc (include_member): Destroy Read_symbols_data object before
8615         releasing file.
8616         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
8617         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
8618         (Read_symbols_data::~Read_symbols_data) New destructor.
8619         (Section_relocs::Section_relocs) New constructor.
8620         (Section_relocs::~Section_relocs) New destructor.
8621         (Read_relocs_data::Read_relocs_data) New constructor.
8622         (Read_relocs_data::~Read_relocs_data) New destructor.
8623         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
8624         pointers to NULL after deleting.
8625
8626 2010-04-07  Doug Kwan  <dougkwan@google.com>
8627
8628         * arm.cc: Replace "endianity" with "endianness" in comments.
8629         (Arm_exidx_cantunwind): Ditto.
8630         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
8631         (Arm_relobj::merge_flags_and_attributes): New method.
8632         (Arm_relobj::merge_flags_and_attributes_): New data member.
8633         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8634         (Arm_relobj::scan_sections_for_stubs): Ditto.
8635         (Arm_relobj::do_read_symbols): Check to see if we really want to
8636         merge processor-specific flags and attributes.  Exit early if
8637         an object is empty except for section names and the undefined symbol.
8638         (Target_arm::do_finalize_sections): Move check for ELF format to
8639         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8640         attributes from a regular object only when we have determined that
8641         it is aapropriate.  Do not create an .ARM.attributes section in
8642         output if there is no regular input object.
8643         (Target_arm::merge_processor_specific_flags): Check
8644         --warn-mismatch before printing any error.
8645         (Target_arm::merge_object_attributes): Ditto.
8646         * gold.cc (queue_middle_tasks): Handle the case in which there is
8647         no regular object in input.
8648         * options.cc (General_options::parse_EB): New method.
8649         (General_options::parse_EL): Same.
8650         (General_options::General_options): Initialize endianness_.
8651         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8652         New options.
8653         (General_options::Endianness): New enum.
8654         (General_options::endianness): New method.
8655         (General_options::endianness_): New data member.
8656         * parameters.cc (Parameters::set_options): Check target endianness.
8657         (Parameters::set_target_once): Ditto.
8658         (Parameters::check_target_endianness): New method.
8659         (parameters_force_valid_target): If either -EL or -EB is specified,
8660         use it to define endianness of default target.
8661         * parameters.h (Parameters::check_target_endianness): New method
8662         declaration.
8663         * target.h (class Target): Change "endianity" to "endianness"
8664         in comments.
8665
8666 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8667
8668         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8669         * configure: Regenerate.
8670         * Makefile.in: Regenerate.
8671         * testsuite/Makefile.in: Regenerate.
8672
8673 2010-04-06  Cary Coutant  <ccoutant@google.com>
8674
8675         gcc PR lto/42757
8676         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8677         prevailing definitions of common symbols.
8678         * testsuite/plugin_test_6.sh: New test case.
8679         * testsuite/plugin_common_test_1.c: New test case.
8680         * testsuite/plugin_common_test_2.c: New test case.
8681         * testsuite/Makefile.am (plugin_test_6): New test case.
8682         * testsuite/Makefile.in: Regenerate.
8683
8684 2010-04-06  Nick Clifton  <nickc@redhat.com>
8685
8686         * po/vi.po: New Vietnamese translation.
8687
8688 2010-03-30  Doug Kwan  <dougkwan@google.com>
8689
8690         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8691
8692 2010-03-25  Doug Kwan  <dougkwan@google.com>
8693
8694         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8695         to avoid a conversion warning on a 32-bit host.
8696
8697 2010-03-24  Ian Lance Taylor  <iant@google.com>
8698
8699         * testsuite/script_test_3.t: Add a TLS segment.
8700         * testsuite/Makefile.am (check_PROGRAMS): Add
8701         tls_phdrs_script_test.
8702         (tls_phdrs_script_test_SOURCES): Define.
8703         (tls_phdrs_script_test_DEPENDENCIES): Define.
8704         (tls_phdrs_script_test_LDFLAGS): Define.
8705         (tls_phdrs_script_test_LDADD): Define.
8706         * testsuite/Makefile.in: Rebuild.
8707
8708 2010-03-23  Cary Coutant  <ccoutant@google.com>
8709
8710         * fileread.cc (find_or_make_view): Fix comment.
8711
8712 2010-03-23  Ian Lance Taylor  <iant@google.com>
8713
8714         * script-sections.cc (class Orphan_section_placement): Define
8715         PLACE_TLS and PLACE_TLS_BSS.
8716         (Orphan_section_placement::Orphan_section_placement): Initialize
8717         new places.
8718         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8719         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8720         (tls_script_test_SOURCES): Define.
8721         (tls_script_test_DEPENDENCIES): Define.
8722         (tls_script_test_LDFLAGS): Define.
8723         (tls_script_test_LDADD): Define.
8724         * testsuite/Makefile.in: Rebuild.
8725
8726 2010-03-22  Doug Kwan  <dougkwan@google.com>
8727
8728         * arm.cc (Arm_relocate_functions::abs8,
8729         Arm_relocate_functions::abs16): Use correct check for overflow
8730         specified in the ARM ELF specs.
8731         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8732         target of a BLX instruction specially.
8733         (Reloc_stub::stub_type_for_reloc): Ditto.
8734         (Relocate::relocate): Use symbolic names instead of numeric relocation
8735         codes to report error.
8736         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8737         workaround.
8738         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8739         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8740         thumb2_blx_out_of_range.stdout
8741         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8742         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8743         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8744         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8745         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8746         thumb2_blx_in_range, thumb2_blx_in_range.o,
8747         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8748         thumb2_blx_out_of_range.o): New rules.
8749         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8750         thumb2_blx_in_range and thumb2_blx_out_of_range.
8751         * testsuite/Makefile.in: Regenerate.
8752         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8753         * testsuite/thumb_blx_in_range.s: New file.
8754         * testsuite/thumb_blx_out_of_range.s: New file.
8755
8756 2010-03-22  Rafael Espindola  <espindola@google.com>
8757
8758         * archive.cc (Should_include): Move to archive.h.
8759         (should_include_member): Make it a member of Archive.
8760         (Lib_group): New.
8761         (Add_lib_group_symbols): New.
8762         * archive.h: Include options.h.
8763         (Archive_member): Moved from Archive.
8764         (Should_include): Moved from archive.cc.
8765         (Lib_group): New.
8766         (Add_lib_group_symbols): New.
8767         * dynobj.cc (do_should_include_member): New.
8768         * dynobj.h (do_should_include_member): New.
8769         * gold.cc (queue_initial_tasks): Update call to queue.
8770         * main.cc (main): Print lib group stats.
8771         * object.cc (do_should_include_member): New.
8772         * object.h: Include archive.h.
8773         (Object::should_include_member): New.
8774         (Object::do_should_include_member): New.
8775         (Sized_relobj::do_should_include_member): New.
8776         * options.cc (General_options::parse_start_lib): New.
8777         (General_options::parse_end_lib): New.
8778         (Input_arguments::add_file): Handle lib groups.
8779         (Input_arguments::start_group): Check we are not in a lib.
8780         (Input_arguments::start_lib): New.
8781         (Input_arguments::end_lib): New.
8782         * options.h (General_options): Add start_lib and end_lib.
8783         (Input_argument::lib_): New.
8784         (Input_argument::lib): New.
8785         (Input_argument::is_lib): New.
8786         (Input_file_lib): New.
8787         (Input_arguments::in_lib_): New.
8788         (Input_arguments::in_lib): New.
8789         (Input_arguments::start_lib): New.
8790         (Input_arguments::end_lib_): New.
8791         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8792         in unused members as preempted.
8793         (Sized_pluginobj::do_should_include_member): New.
8794         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8795         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8796         return the blocker.
8797         (Read_symbols::do_whole_lib_group): New.
8798         (Read_symbols::do_lib_group): New.
8799         (Read_symbols::do_read_symbols): Handle lib groups.
8800         (Read_symbols::get_name): Handle lib groups.
8801         * readsyms.h (Read_symbols): Add an archive member pointer.
8802         (Read_symbols::do_whole_lib_group): New.
8803         (Read_symbols::do_lib_group): New.
8804         (Read_symbols::member_): New.
8805         * script.cc (read_input_script): Update call to queue_soon.
8806
8807 2010-03-19  Doug Kwan  <dougkwan@google.com>
8808
8809         * arm.cc (Stub_table::Stub_table): Initialize new data members
8810         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8811         (Stub_table::add_reloc_stub): Assign stub offset and update
8812         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8813         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8814         New data members.
8815         (Stub_table::update_data_size_and_addralign): Use
8816         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8817         instead of going over all reloc stubs.
8818         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8819         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8820         Stringpool_template::offset_ to size of Stringpool_char.
8821         (Stringpool_template::new_key_offset): Remove code to initialize
8822         Stringpool_template::offset_.
8823         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8824         Stringpool_template::offset_ to zero.
8825
8826 2010-03-15  Doug Kwan  <dougkwan@google.com>
8827
8828         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8829         offset_.
8830         (Stringpool_template::new_key_offset): New method.
8831         (Stringpool_template::add_string): Assign offsets when adding new
8832         strings.
8833         (Stringpool_template::set_string_offsets): Do not set string offsets
8834         when not optimizing.
8835         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8836         member size_.
8837         (Chunked_vector::clear): Clear size_.
8838         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8839         (Chunked_vector::size): Return size_.
8840         (Chunked_vector::push_back): Use size_ to find insert position.
8841         (Chunked_vector::size_): New data member.
8842         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8843         (Stringpool_template::new_key_offset): New method declaration.
8844         (Stringpool_template::offset_): New data member.
8845
8846 2010-03-15   Rafael Espindola  <espindola@google.com>
8847
8848         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8849         Add_symbols' constructor.
8850         * readsyms.h (Add_symbols): Remove the input_group member.
8851
8852 2010-03-10  Ian Lance Taylor  <iant@google.com>
8853
8854         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8855         target to ask whether a reference to a symbol requires a stack
8856         split.
8857         * target.h (Target::is_call_to_non_split): New function.
8858         (Target::do_is_call_to_non_split): Declare virtual function.
8859         * target.cc: Include "symtab.h".
8860         (Target::do_is_call_to_non_split): New function.
8861         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8862
8863 2010-03-10  Cary Coutant  <ccoutant@google.com>
8864
8865         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8866         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8867         (File_read::open[2]): Add whole_file_view_ to list of views.
8868         (File_read::make_view): Remove test of whole_file_view_.
8869         (File_read::find_or_make_view): Create whole_file_view_ if
8870         necessary.
8871         (File_read::clear_views): Replace bool parameter with enum;
8872         adjust all callers.  Don't delete views with permanent data;
8873         do delete cached views and views from archives if
8874         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8875         if clearing the corresponding view.
8876         * fileread.h (File_read::Clear_views_mode): New enum.
8877         (File_read::View::is_permanent_view): New method.
8878         (File_read::clear_views): Replace bool parameter
8879         with enum; adjust all callers.
8880         * options.h (General_options): Change keep_files_mapped option;
8881         add map_whole_files.
8882         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8883         releasing the file.
8884         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8885         the file.
8886
8887 2010-03-10  David S. Miller  <davem@davemloft.net>
8888
8889         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8890
8891 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8892
8893         * icf.cc (get_section_contents): Add '@' marker after processing the
8894         merge reloc.
8895
8896 2010-03-08  Doug Kwan  <dougkwan@google.com>
8897
8898         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8899         due to a conversion warning.
8900         (Arm_relobj::update_output_local_symbol_count): Check for local
8901         symbol with unset output index.
8902
8903 2010-03-05  Ian Lance Taylor  <iant@google.com>
8904
8905         * options.h (class General_options): Add --spare-dynamic-tags.
8906         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8907         --spare-dynamic-tags.
8908
8909 2010-03-05  Ian Lance Taylor  <iant@google.com>
8910
8911         * incremental.cc: Include "libiberty.h".
8912
8913 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8914
8915         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8916         function, is_info_ member.
8917         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8918         (Versions::Versions): Update caller.
8919         (Versions::define_base_version): Likewise.
8920         (Versions::add_def): Likewise.
8921
8922 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8923
8924         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8925         (Scan::possible_function_pointer_reloc): New function.
8926         (Scan::local_reloc_may_be_function_pointer): Change to call
8927         possible_function_pointer_reloc.
8928         (Scan::global_reloc_may_be_function_pointer): Ditto.
8929         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8930         relocations in ".data.rel.ro._ZTV" section.
8931         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8932         * testsuite/icf_safe_so_test.cc: Ditto.
8933         * testsuite/icf_safe_test.cc: Ditto.
8934         * testsuite/icf_safe_test.sh: Ditto.
8935
8936 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8937             Ian Lance Taylor  <iant@google.com>
8938
8939         * target-reloc.h (relocate_section): Check the symbol table index
8940         for -1U before setting the local symbol index.
8941         (scan_relocatable_relocs): If copying the relocation, record that
8942         the local symbol is required.
8943         * object.h (Symbol_value::is_output_symtab_index_set): New
8944         function.
8945         (Symbol_value::may_be_discarded_from_output_symtab): New
8946         function.
8947         (Symbol_value::has_output_symtab_entry): New function.
8948         (Symbol_value::needs_output_symtab_entry): Remove.
8949         (Symbol_value::output_symtab_index): Make sure the symbol index is
8950         set.
8951         (Symbol_value::set_output_symtab_index): Make sure the symbol
8952         index is not set.  Make sure the new index is valid.
8953         (Symbol_value::set_must_have_output_symtab_entry): New function.
8954         (Symbol_value::has_output_dynsym_entry): New function.
8955         (Symbol_value::set_output_dynsym_index): Make sure the new index
8956         is valid.
8957         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8958         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8959         local symbol if permitted.
8960         (Sized_relobj::do_finalize_local_symbols): Call
8961         is_output_symtab_index_set rather than needs_output_symtab_entry.
8962         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8963         rather than needs_output_symtab_entry.  Call
8964         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8965         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8966         is_output_symtab_index_set rather than needs_output_symtab_entry.
8967         * testsuite/discard_locals_relocatable_test.c: New file.
8968         * testsuite/discard_locals_test.sh: Test -r.
8969         * testsuite/Makefile.am (check_DATA): Add
8970         discard_locals_relocatable_test1.syms,
8971         discard_local_relocatable_test2.syms.
8972         (MOSTLYCLEANFILES): Likewise.  Also add
8973         discard_locals_relocatable_test1.lout and
8974         discard_locals_relocatable_test2.out.
8975         (discard_locals_relocatable_test1.syms): New target.
8976         (discard_locals_relocatable_test.o): New target.
8977         (discard_locals_relocatable_test1.out): New target.
8978         (discard_locals_relocatable_test2.syms): New target.
8979         (discard_locals_relocatable_test2.out): New target.
8980         (various): Add missing ../ld-new dependencies.
8981         * testsuite/Makefile.in: Rebuild.
8982
8983 2010-03-03  Nick Clifton  <nickc@redhat.com>
8984
8985         * po/fi.po: New Finnish translation.
8986
8987 2010-03-01  Doug Kwan  <dougkwan@google.com>
8988
8989         * layout.cc (Layout::Layout): Force section types of .init_array*,
8990         .preinit_array* and .fini_array* sections.
8991         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8992         Fix check of return value of std::string::find.().
8993         (Output_section::Input_section_sort_compare::operator()): Remove
8994         comment about .init_array.
8995         (Output_section::Input_section_sort_init_fini_compare::operator()):
8996         New method.
8997         (Output_section::sort_attached_input_sections): Handle .init_array
8998         and .fini_array specially.
8999         * output.h (Output_section::Inut_section_sort_compare): Update
9000         comment.
9001         (Output_section::Input_section_sort_init_fini_compare): New struct.
9002
9003 2010-02-26  Doug Kwan  <dougkwan@google.com>
9004
9005         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
9006         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
9007         * testsuite/debug_msg.sh: Avoid matching source line number for
9008         use of global variable undef_int.
9009
9010 2010-02-26  Doug Kwan  <dougkwan@google.com>
9011
9012         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
9013         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
9014         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
9015         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
9016         * options.cc (General_options::General_options): Initialize member
9017         fix_v4bx_.
9018         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
9019         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
9020         and rm_no_fix_v4bx.stdout
9021         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
9022         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
9023         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
9024         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
9025         and arm_no_fix_v4bx.
9026         * Makefile.in: Regenerate.
9027         * testsuite/arm_fix_v4bx.s: New file.
9028         * testsuite/arm_fix_v4bx.sh: Ditto.
9029
9030 2010-02-24  Doug Kwan  <dougkwan@google.com>
9031
9032         * arm.cc (Target_arm::got_section): Make the .got section the first
9033         non RELRO section in the data segment.
9034         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
9035         suffixes of section names.
9036
9037 2010-02-24  Doug Kwan  <dougkwan@google.com>
9038
9039         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
9040         flags and attributes merging if an input file is a binary file.
9041         * fileread.cc (Input_file::open): Record format of original file.
9042         * fileread.h (Input_file::Format): New enum type.
9043         (Input_file::Input_file): Initialize data member format_.
9044         (Input_file::format): New method definition.
9045         (Input_file::format_):: New data member.
9046
9047 2010-02-24  Doug Kwan  <dougkwan@google.com>
9048
9049         * arm.cc (Arm_output_data_got): New class.
9050         (ARM_TCB_SIZE): New constant
9051         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
9052         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
9053         If user uses a script with a SECTIONS clause, issue only a warning
9054         for a misplaced EXIDX input section.  Otherwise, issue an error.
9055         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
9056         garbage collection.
9057         (Target_arm::got_mode_index_entry): Handle static linking.
9058         (Target_arm::Scan::local): Ditto.
9059         (Target_arm::Scan::global): Ditto.
9060         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
9061         all incorrectly implemented relocations.
9062         (Target_arm::fix_exidx_coverage): Pass layout to
9063         Arm_output_section::fix_exidx_coverage.
9064         * layout.cc (Layout::section_name_mapping): Remove trailing dots
9065         from ".ARM.exidx." and ".ARM.extab.".
9066
9067 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9068
9069         * arm.cc (Target_arm::do_finalize_sections): Create attribute
9070         section if it does not already exist.
9071         * attributes.cc (Attributes_section_data::Attributes_section_data):
9072         Don't crash if size is zero.
9073
9074 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9075             Ian Lance Taylor  <iant@google.com>
9076
9077         * gold.cc (queue_middle_tasks): If no input files were opened,
9078         exit.
9079         * workqueue.h (Task_function::Task_function): Assert that there is
9080         a blocker.
9081
9082 2010-02-22  Doug Kwan  <dougkwan@google.com>
9083
9084         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
9085         * icf.cc (get_section_contents): Cast snprintf arguments to long long
9086         types to avoid warnings due to different uint64_t implementations
9087         on different hosts.
9088
9089 2010-02-21  Doug Kwan  <dougkwan@google.com>
9090
9091         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
9092         handling of the maximum backward branch offset.
9093         (Arm_relocate_functions::thumb_branch_common): Ditto.
9094         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
9095         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
9096         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
9097         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
9098         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
9099         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
9100         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
9101         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
9102         thumb_bl_out_of_range thumb_bl_out_of_range.o,
9103         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
9104         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
9105         thumb2_bl_out_of_range.o): New rules.
9106         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
9107         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
9108         thumb2_bl_out_of_range
9109         * testsuite/Makefile.in: Regenerate.
9110         * testsuite/arm_bl_in_range.s: New file.
9111         * testsuite/arm_bl_out_of_range.s: Ditto.
9112         * testsuite/arm_branch_in_range.sh: Ditto.
9113         * testsuite/arm_branch_range.t: Ditto.
9114         * testsuite/thumb2_branch_range.t: Ditto.
9115         * testsuite/thumb_bl_in_range.s: Ditto.
9116         * testsuite/thumb_bl_out_of_range.s: Ditto.
9117         * testsuite/thumb_branch_range.t: Ditto.
9118
9119 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
9120
9121         * gc.h (gc_process_relocs): Change vectors to point to the new list.
9122         Add reloc offset information.
9123         * icf.cc (get_section_contents): Change iterators to point to the new
9124         vectors. Add reloc offset information to the contents.
9125         * icf.h (Icf::Sections_reachable_info): New typedef.
9126         (Icf::Sections_reachable_list): New typedef.
9127         (Icf::Offset_info): New typedef.
9128         (Icf::Reloc_info): New struct typedef.
9129         (Icf::Reloc_info_list): New typedef.
9130         (Icf::symbol_reloc_list): Delete method.
9131         (Icf::addend_reloc_list): Delete method.
9132         (Icf::section_reloc_list): Delete method.
9133         (Icf::reloc_info_list): New method.
9134         (Icf::reloc_info_list_): New member.
9135
9136 2010-02-19  Doug Kwan  <dougkwan@google.com>
9137
9138         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
9139         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
9140         * arm.cc (Arm_relocation_functions): New forward declaration.
9141         (Target_arm::Target_arm): Initialize new data members
9142         got_mod_index_offset_ and tls_base_symbol_defined_.
9143         (Target_arm::Relocate::relocate_tls): New method.
9144         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
9145          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
9146         New methods.
9147         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
9148         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
9149         (Target_arm::got_mod_index_offset_,
9150         Target_arm::tls_base_symbol_defined_): New data members.
9151         (Target_arm::Scan::local, Target::Scan::global,
9152         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
9153         relocations.
9154
9155 2010-02-18  Doug Kwan  <dougkwan@google.com>
9156
9157         * arm.cc (Arm_relobj::find_linked_text_section): New method.
9158         (Arm_relobj::make_exidx_input_section): Pass section index of linked
9159         text section as a parameter becuase some broken tools may not set
9160         the link in section header.
9161         (Target_arm::has_got_section): New method.
9162         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
9163         without any mapping symbol as data only.  Remove warning.
9164         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
9165         link in its section header, try to discover the link by inspecting the
9166         REL31 relocation at the beginning of the section.
9167         (Target_arm::Scan::check_non_pic): Report name of offending relocation
9168         in error message.
9169         (Target_arm::Scan::global): Treat any reference to the symbol
9170         _GLOBAL_OFFSET_TABLE_ as a GOT access.
9171
9172 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
9173
9174         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
9175         (Scan::global_reloc_may_be_function_pointer): New function.
9176         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9177         (Scan::global_reloc_may_be_function_pointer): New function.
9178         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
9179         (Scan::global_reloc_may_be_function_pointer): New function.
9180         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
9181         (Scan::global_reloc_may_be_function_pointer): New function.
9182         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
9183         (Scan::global_reloc_may_be_function_pointer): New function.
9184         (Scan::possible_function_pointer_reloc): New function.
9185         (Target_x86_64::can_check_for_function_pointers): New function.
9186         * gc.h (gc_process_relocs): Scan relocation types to determine if
9187         function pointers were taken for targets that support it.
9188         * icf.cc (Icf::find_identical_sections): Include functions for
9189         folding in safe ICF whose pointer is not taken.
9190         * icf.h (Secn_fptr_taken_set): New typedef.
9191         (fptr_section_id_): New member.
9192         (section_has_function_pointers): New function.
9193         (set_section_has_function_pointers): New function.
9194         (check_section_for_function_pointers): New function.
9195         * options.h: Fix comment for safe ICF option.
9196         * target.h (can_check_for_function_pointers): New function.
9197         * testsuite/Makefile.am: Add icf_safe_so_test test case.
9198         Modify icf_safe_test for X86-64.
9199         * testsuite/Makefile.in: Regenerate.
9200         * testsuite/icf_safe_so_test.cc: New file.
9201         * testsuite/icf_safe_so_test.sh: New file.
9202         * testsuite/icf_safe_test.cc (kept_func_3): New function.
9203         (main): Change to take pointer to function kept_func_3.
9204         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
9205         folding is done correctly for X86-64.
9206
9207 2010-02-12  David S. Miller  <davem@davemloft.net>
9208
9209         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
9210         is_symbolless parameter.
9211         (Output_reloc<SHT_REL>::is_symbolless): New.
9212         (Output_reloc<SHT_REL>::is_symbolless_): New.
9213         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
9214         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
9215         (Output_reloc<SHT_RELA>::is_symbolless): New.
9216         (Output_data_reloc::add_global): Handle is_symbolless.
9217         (Output_data_reloc::add_global_relative): Likewise.
9218         (Output_data_reloc::add_local): Likewise.
9219         (Output_data_reloc::add_local_relative): Likewise.
9220         (Output_data_reloc::add_symbolless_global_addend): New.
9221         (Output_data_reloc::add_symbolless_local_addend): New.
9222         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
9223         is_symbolless.
9224         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
9225         instead of ->is_relative_
9226         (Output_reloc::write): Likewise.
9227         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
9228         (Output_reloc::write_rel): Simplify.
9229
9230         * sparc.cc (Target_sparc::Scan::local): Use
9231         ->add_symbolless_local_addend as needed.
9232         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
9233         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
9234         based upon relocation offset.
9235
9236 2010-02-11  Doug Kwan  <dougkwan@google.com>
9237
9238         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
9239         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
9240         beginning of function.
9241         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
9242         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
9243         parameter is_32bit in calls to should_apply_static_reloc.
9244         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
9245         (check_DATA): Add arm_abs_global.stdout.
9246         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
9247         arm_abs_global.stdout): New rules.
9248         (MOSTLLYCLEANFILES): Add arm_abs_global
9249         * Makefile.in: Regenerate.
9250         * testsuite/arm_abs_global.s: New file.
9251         * testsuite/arm_abs_global.sh: Ditto.
9252         * testsuite/arm_abs_lib.s: Ditto.
9253
9254 2010-02-11  Ian Lance Taylor  <iant@google.com>
9255
9256         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
9257         Read_relocs task.
9258         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
9259         Allocate_commons_task first.
9260         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
9261         task, rather than symtab_lock_.
9262         (Gc_process_relocs::~Gc_process_relocs): New function.
9263         (Gc_process_relocs::is_runnable): Check this_blocker_.
9264         (Gc_process_relocs::locks): Use next_blocker_ rather than
9265         blocker_.
9266         (Scan_relocs::~Scan_relocs): New function.
9267         (Scan_relocs::is_runnable): Check this_blocker_ rather than
9268         symtab_lock_.
9269         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
9270         next_blocker_.
9271         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
9272         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
9273         constructor accordingly.
9274         (class Gc_process_relocs): Likewise.
9275         (class Scan_relocs): Likewise.
9276         * common.h (class Allocate_commons_task): Remove symtab_lock_
9277         field, and corresponding constructor parameter.
9278         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
9279         symtab_lock_.
9280         (Allocate_commons_task::locks): Likewise.
9281
9282 2010-02-11  Ian Lance Taylor  <iant@google.com>
9283
9284         * gold-threads.h (class Once): Define.
9285         (class Initialize_lock): Rewrite as child of Once.
9286         * gold-threads.cc (class Once_initialize): Define.
9287         (once_pointer_control): New static variable.
9288         (once_pointer, once_arg): New static variables.
9289         (c_run_once): New static function.
9290         (Once::Once, Once::run_once, Once::internal_run): New functions.
9291         (class Initialize_lock_once): Remove.
9292         (initialize_lock_control): Remove.
9293         (initialize_lock_pointer): Remove.
9294         (initialize_lock_once): Remove.
9295         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
9296         (Initialize_lock::initialize): Rewrite.
9297         (Initialize_lock::do_run_once): New function.
9298         * archive.cc (Archive::interpret_header): Only clear name if it is
9299         not already empty.
9300         * fileread.cc: Include "gold-threads.h"
9301         (file_counts_lock): New static variable.
9302         (file_counts_initialize_lock): Likewise.
9303         (File_read::release): Only increment counts when using --stats.
9304         Use a lock around the increment.
9305         * parameters.cc (class Set_parameters_target_once): Define.
9306         (set_parameters_target_once): New static variable.
9307         (Parameters::Parameters): Move here from parameters.h.
9308         (Parameters::set_target): Rewrite.
9309         (Parameters::set_target_once): New function.
9310         (Parameters::clear_target): Move here and rewrite.
9311         * parameters.h (class Parameters): Update declarations.  Add
9312         set_parameters_target_once_ field.
9313         (Parameters::Parameters): Move to parameters.cc.
9314         (Parameters::clear_target): Likewise.
9315         * readsyms.cc (Read_symbols::do_group): Create a Start_group
9316         task.
9317         (Start_group::~Start_group): New function.
9318         (Start_group::is_runnable): New function.
9319         (Start_group::locks, Start_group::run): New functions.
9320         (Finish_group::run): Change saw_undefined to size_t.
9321         * readsyms.h (class Start_group): Define.
9322         (class Finish_group): Change saw_undefined_ field to size_t.
9323         (Finish_group::Finish_group): Remove saw_undefined and
9324         this_blocker parameters.  Change all callers.
9325         (Finish_group::set_saw_undefined): New function.
9326         (Finish_group::set_blocker): New function.
9327         * symtab.h (class Symbol_table): Change saw_undefined to return
9328         size_t.  Change saw_undefined_ field to size_t.
9329         * target-select.cc (Set_target_once::do_run_once): New function.
9330         (Target_selector::Target_selector): Initialize set_target_once_
9331         field.  Don't initialize lock_ and initialize_lock_ fields.
9332         (Target_selector::instantiate_target): Rewrite.
9333         (Target_selector::set_target): New function.
9334         * target-select.h (class Set_target_once): Define.
9335         (class Target_selector): Update declarations.  Make
9336         Set_target_once a friend.  Remove lock_ and initialize_lock_
9337         fields.  Add set_target_once_ field.
9338
9339 2010-02-10  Ian Lance Taylor  <iant@google.com>
9340
9341         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
9342         queueing any tasks.
9343         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
9344         (queue_middle_tasks): Add all blockers before queueing any tasks.
9345         (queue_final_tasks): Likewise.
9346         * token.h (Task_token::add_blockers): New function.
9347         * object.h (Input_objects::number_of_relobjs): New function.
9348
9349 2010-02-10  Ian Lance Taylor  <iant@google.com>
9350
9351         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
9352         shared, not if not position independent.
9353         * x86_64.cc (Relocate::relocate_tls): Likewise.
9354         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
9355         (tls_pie_pic_test): New target.
9356         * testsuite/Makefile.in: Rebuild.
9357
9358         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
9359         (tls_test_main_pie.o, tls_test_pie.o): New targets.
9360         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
9361         * testsuite/Makefile.in: Rebuild.
9362
9363 2010-02-09  David S. Miller  <davem@davemloft.net>
9364
9365         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
9366         R_SPARC_RELATIVE using ->add_local_relative().
9367         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
9368
9369         * output.h (Output_data_dynamic::add_section_size): New method
9370         that takes two Output_data objects.
9371         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
9372         entry param.  Handle it in initializers.
9373         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
9374         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
9375         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
9376         arg.
9377         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
9378         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
9379         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
9380         for dynrel_includes_plt.
9381         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9382         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9383         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
9384         before .rela.plt
9385         (Target_sparc::do_finalize_sections): Update to pass true for
9386         dynrel_includes_plt.
9387         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
9388         output before .rela.plt
9389         (Target_powerpc::do_finalize_sections): Update to pass true for
9390         dynrel_includes_plt when 32-bit.
9391
9392 2010-02-08  Doug Kwan  <dougkwan@google.com>
9393
9394         * arm.cc (Arm_relobj::simple_input_section_output_address): New
9395         method.
9396         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
9397         Arm_relobj::scan_section_for_cortex_a8_stubs,
9398         Arm_relobj::do_relocation_section): Instead of calling
9399         Output_section::output_address, use faster
9400         Arm_relobj::simple_input_section_output_address.
9401
9402 2010-02-08  David S. Miller  <davem@davemloft.net>
9403
9404         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
9405         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
9406         relocation helper function.
9407
9408         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
9409         just like R_SPARC_GOT{10,13,22}.
9410         (Target_sparc::Scan::local): Likewise.
9411         (Target_sparc::Relocate:relocate): Likewise.
9412
9413 2010-02-06  Ian Lance Taylor  <iant@google.com>
9414
9415         * configure.ac: Rewrite targetobjs duplicate removal code to use
9416         only shell constructs.
9417         * configure: Rebuild.
9418
9419 2010-02-05  Doug Kwan  <dougkwan@google.com>
9420
9421         PR 11247
9422         * arm.cc (Arm_relobj::section_is_scannable): New method.
9423         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
9424         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
9425
9426 2010-02-04  Doug Kwan  <dougkwan@google.com>
9427
9428         PR 11247
9429         * arm-reloc-property.cc (cstdio): Include.
9430         * configure.ac (targetobjs): Remove duplicates.
9431         * configure: Regenerate.
9432         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
9433         big and little endian version for a given address size.
9434
9435 2010-02-03  Doug Kwan  <dougkwan@google.com>
9436
9437         * arm-reloc-property.cc
9438         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9439         definition.
9440         * arm-reloc-property.h
9441         (Arm_reloc_property_table::get_implemented_static_reloc_property):
9442         New method definition.
9443         (Arm_reloc_property_table::reloc_name_in_error_message): New method
9444         declaration.
9445         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
9446         overflow to N.
9447         (GOT_PREL): Change implemented to Y.
9448         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
9449         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
9450         (Arm_relocate_functions::movw_abs_nc): Remove method.
9451         (Arm_relocate_functions::movt_abs): Ditto.
9452         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
9453         (Arm_relocate_functions::thm_movt_abs): Ditto.
9454         (Arm_relocate_functions::movw_rel_nc): Ditto.
9455         (Arm_relocate_functions::movw_rel): Ditto.
9456         (Arm_relocate_functions::movt_rel): Ditto.
9457         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
9458         (Arm_relocate_functions:thm_movw_rel): Ditto.
9459         (Arm_relocate_functions:thm_movt_rel): Ditto.
9460         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
9461         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
9462         New method definitions.
9463         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
9464         (Arm_relocation_functions::arm_grp_ldr): Ditto.
9465         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
9466         (Arm_relocation_functions::arm_grp_ldc): Ditto.
9467         (Target_arm::Relocate::relocate): Check for non-static or
9468         unimplemented relocation code and exit early.  Change calls to
9469         Target_arm::reloc_uses_thumb_bit and
9470         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
9471         instead.  Refactor code to handle similar relocations to increase
9472         code sharing.  Remove check for unsupported relocation code in switch
9473         statement.
9474         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
9475         relocation property table to find out size.  Change error message to
9476         print out the name of a relocation code instead of the numeric value.
9477         (Target_arm::scan_reloc_for_stub): Use relocation property table
9478         instead of calling Target_arm::reloc_uses_thumb_bit().
9479
9480 2010-02-02  Doug Kwan  <dougkwan@google.com>
9481
9482         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
9483         types of relaxed input section.
9484
9485 2010-02-02  Doug Kwan  <dougkwan@google.com>
9486
9487         * Makefile.am (HFILES): Add arm-reloc-property.h.
9488         (DEFFILES): New.
9489         (TARGETSOURCES): Add arm-reloc-property.cc
9490         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
9491         (libgold_a_SOURCES): $(DEFFILES)
9492         * Makefile.in: Regenerate.
9493         * arm-reloc-property.cc: New file.
9494         * arm-reloc-property.h: New file.
9495         * arm-reloc.def: New file.
9496         * arm.cc: Update comments.
9497         (arm-reloc-property.h): New included header.
9498         (arm_reloc_property_table): New global variable.
9499         (Target_arm::do_select_as_default_target): New method definition.
9500         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
9501         arm-reloc-property to targ_extra_obj.
9502         * parameters.cc (set_parameters_target): Call
9503         Target::select_as_default_target().
9504         * target.h (Target::select_as_default_target): New method definition.
9505         (Target::do_select_as_default_target): Same.
9506
9507 2010-02-01  Doug Kwan  <dougkwan@google.com>
9508
9509         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
9510         first_output_text_section_.
9511         (Arm_exidx_fixup::first_output_text_section): New method definition.
9512         (Arm_exidx_fixup::first_output_text_section_): New data member.
9513         (Arm_exidx_fixup::process_exidx_section): Record the first text
9514         output section seen.
9515         (Arm_output_section::fix_exidx_coverage): Set correct linked section
9516         and entsize in output section header.
9517
9518 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9519
9520         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
9521         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
9522         (Arm_relocate_functions::thm_alu11): New Method.
9523         (Arm_relocate_functions::thm_pc8): New Method.
9524         (Arm_relocate_functions::thm_pc12): New Method.
9525         (Target_arm::Scan::local): Handle the relocations.
9526         (Target_arm::Scan::global): Likewise.
9527         (Target_arm::Relocate::relocate): Likewise.
9528         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
9529
9530 2010-01-29  Doug Kwan  <dougkwan@google.com>
9531
9532         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
9533         of relocation types as ld.
9534
9535 2010-01-29  Doug Kwan  <dougkwan@google.com>
9536
9537         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
9538         to public.
9539         (Arm_relocate_functions::thumb_branch_common): Ditto.
9540         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
9541         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
9542         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
9543         Arm_relocate_functions::jump24): Remove.
9544         (Target_arm::Relocate::relocate): Adjust code to call
9545         Arm_relocation_functions::arm_branch_common and
9546         Arm_relocation_functions::thumb_branch_common instead of their removed
9547         wrappers.  Merge switch-cases together to reduce source code size.
9548
9549 2010-01-29  Doug Kwan  <dougkwan@google.com>
9550
9551         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
9552         output_local_symbol_count_needs_update_.
9553         (Arm_relobj::output_local_symbol_count_needs_update,
9554          Arm_relobj::set_output_local_symbol_count_needs_update,
9555          Arm_relobj::update_output_local_symbol_count): New methods.
9556         (Arm_relobj::output_local_symbol_count_needs_update_): New data
9557         member.
9558         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
9559         of pointed function as in a R_ARM_PREL31 relocation.
9560         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
9561         for output local symbol count updating.
9562         (Target_arm::do_relax): Update output local symbol counts in objects
9563         if necessary.
9564         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
9565
9566 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9567
9568         * arm.cc: Added support for the ARM relocations:
9569         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
9570         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
9571         (Arm_relocate_functions::movw_rel_nc): Renamed (was
9572         movw_prel_nc).
9573         (Arm_relocate_functions::movw_rel): New method.
9574         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
9575         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
9576         thm_movw_prel_nc).
9577         (Arm_relocate_functions::thm_movw_rel): New method.
9578         (Arm_relocate_functions::thm_movt_rel): Renamed (was
9579         thm_movt_prel).
9580         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
9581         relocations.
9582         (Target_arm::Scan::global): Likewise.
9583         (Target_arm::Relocate::relocate): Likewise.
9584         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9585         Likewise.
9586
9587 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9588
9589         * arm.cc: Added support for ARM group relocations.
9590         (Target_arm::reloc_needs_sym_origin): New method.
9591         (Arm_relocate_functions::calc_grp_kn): New method.
9592         (Arm_relocate_functions::calc_grp_residual): New method.
9593         (Arm_relocate_functions::calc_grp_gn): New method.
9594         (Arm_relocate_functions::arm_grp_alu): New Method.
9595         (Arm_relocate_functions::arm_grp_ldr): New Method.
9596         (Arm_relocate_functions::arm_grp_ldrs): New Method.
9597         (Arm_relocate_functions::arm_grp_ldc): New Method.
9598         (Target_arm::Scan::local): Handle the ARM group relocations.
9599         (Target_arm::Scan::global): Likewise.
9600         (Target_arm::Relocate::relocate): Likewise.
9601         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9602         Likewise.
9603
9604 2010-01-26  Doug Kwan  <dougkwan@google.com>
9605
9606         * arm.cc (set): Include.
9607         (class Arm_exidx_fixup): Change type of last_input_section_ to const
9608         pointer type.
9609         (Arm_output_section::Text_section_list): New type.
9610         (Arm_output_section::append_text_sections_to_list): New method.
9611         (Arm_output_section::fix_exidx_coverage): Ditto.
9612         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
9613         (Arm_relobj::convert_input_section_to_relaxed_section): Use
9614         Relobj::set_section_offset() instead of
9615         Sized_relobj::invalidate_section_offset().
9616         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
9617         parameter for section headers. Ignore relocation sections for
9618         unallocated sections and EXIDX sections.
9619         (Target_arm::fix_exidx_coverage): New method.
9620         (Target_arm::output_section_address_less_than): New type.
9621         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
9622         linked text section instead of the EXIDX section.
9623         (Arm_output_section::create_stub_group): Add an assertion to check
9624         that this is not an EXIDX output section.
9625         (Arm_output_section::append_text_sections_to_list): New method.
9626         (Arm_output_section::fix_exidx_coverage): Ditto.
9627         (Arm_relobj::scan_sections_for_stubs): Adjust call to
9628         Arm_relobj::section_needs_reloc_stub_scanning.
9629         (Target_arm::do_relax): Fix EXIDX output section coverage in the
9630         first pass.
9631         (Target_arm::fix_exidx_coverage): New method.
9632         * object.h (Relobj::set_output_section): New method.
9633         (Sized_relobj::invalidate_section_offset): Remove method.
9634         (Sized_relobj::do_invalidate_section_offset): Remove method.
9635         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9636
9637 2010-01-25  Doug Kwan  <dougkwan@google.com>
9638
9639         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9640         Fix warning due to signed and unsigned comparison on a 32-bit host.
9641
9642 2010-01-22  Doug Kwan  <dougkwan@google.com>
9643
9644         * arm.cc (Target_arm::do_relax): Record an output section for section
9645         offset adjustment it contains any stub table that has changed.
9646         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9647         offsets in an output section if necessary.
9648         * output.cc (Output_section::Output_section): Initialize
9649         section_offsets_need_adjustments_.
9650         (Output_section::add_input_section_for_script): Renamed to
9651         Output_section::add_simple_input_section.
9652         (Output_section::save_states): Add a comment.
9653         (Output_section::discard_states): New method defintion.
9654         (Output_section::adjust_section_offsets): Same.
9655         * output.h (Output_section::add_input_section_for_script): Renamed to
9656         Output_section::add_simple_input_section.
9657         (Output_section::discard_states): New method declaration.
9658         (Output_section::adjust_section_offsets): Same.
9659         (Output_section::section_offsets_need_adjustment,
9660         Output_section::set_section_offsets_need_adjustment): New method
9661         definitions.
9662         (Output_section::section_offsets_need_adjustment_): New data member.
9663         * script-sections.cc
9664         (Output_section_element_input::set_section_address): Adjust code for
9665         renaming of Output_section::add_input_section_for_script.
9666         (Orphan_output_section::set_section_address): Same.
9667
9668 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9669
9670         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9671         Fix_v4bx enum values .
9672         * gold/options.h (General_options): New option definitions.
9673         (General_options::fix_v4bx): New method.
9674         (General_options::Fix_v4bx): New enum.
9675         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9676         (General_options::parse_fix_v4bx_interworking): New method.
9677
9678 2010-01-22  Doug Kwan  <dougkwan@google.com>
9679
9680         * arm.cc (Arm_exidx_fixup): New class.
9681
9682 2010-01-21  Doug Kwan  <dougkwan@google.com>
9683
9684         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9685         classes.
9686         (Arm_exidx_section_offset_map): New type.
9687
9688 2010-01-21  Doug Kwan  <dougkwan@google.com>
9689
9690         * arm.cc (Arm_exidx_input_section): New class.
9691         (Arm_relobj::exidx_input_section_by_link,
9692         Arm_relobj::exidx_input_section_by_shndx,
9693         Arm_relobj::make_exidx_input_section): New methods.
9694         (read_arm_attributes_section): Remove.
9695         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9696         information about them.
9697         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9698         to here.
9699
9700 2010-01-20  Doug Kwan  <dougkwan@google.com>
9701
9702         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9703         Input_section_specifier to Section_id.
9704         (Target_arm::new_arm_input_section: Adjust code for change of key
9705         type.
9706         (Target_arm::find_arm_input_section): Ditto.
9707         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9708         (Section_id): Remove.
9709         (Garbage_collection::Section_id_hash): Remove.
9710         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9711         (Section_id): Remove.
9712         (Icf::Section_id_hash): Remove.
9713         * object.h (Section_id, Const_section_id, Section_id_hash,
9714         Const_section_id_hash): New type definitions.
9715         * output.cc (Output_section::add_relaxed_input_section): Change to
9716         use Const_section_id instead of Input_section_specifier as key type.
9717         (Output_section::add_merge_input_section): Ditto.
9718         (Output_section::build_relaxation_map): Change to use Section_id
9719         instead of Input_section_specifier as key type.
9720         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9721         Ditto.
9722         (Output_section::convert_input_sections_to_relaxed_sections): Change
9723         to use Const_section_id instead of Input_section_specifier as key type.
9724         (Output_section::find_merge_section): Ditto.
9725         (Output_section::find_relaxed_input_section): Ditto.
9726         * output.h (Input_section_specifier): Remove class.
9727         (Output_section::Output_section_data_by_input_section_map): Change
9728         key type to Const_section_id.
9729         (Output_section::Output_relaxed_input_section_by_input_section_map):
9730         Ditto.
9731         (Output_section::Relaxation_map): Change key type to Section_id.
9732
9733 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9734
9735         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9736         (class Arm_v4bx_stub): New class.
9737         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9738         (Stub_factory::make_arm_v4bx_stub): New method.
9739         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9740         (Stub_table::empty): Handle v4bx stubs.
9741         (Stub_table::add_arm_v4bx_stub): New method.
9742         (Stub_table::find_arm_v4bx_stub): New method.
9743         (Arm_relocate_functions::v4bx): New method.
9744         (Target_arm::fix_v4bx): New method.
9745         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9746         (Stub_table::relocate_stubs): Likewise.
9747         (Stub_table::do_write): Likewise.
9748         (Stub_table::update_data_size_and_addralign): Likewise.
9749         (Stub_table::finalize_stubs):  Likewise.
9750         (Target_arm::Scan::local): Likewise.
9751         (Target_arm::Scan::global): Likewise.
9752         (Target_arm::do_finalize_sections): Likewise.
9753         (Target_arm::Relocate::relocate): Likewise.
9754         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9755         Likewise.
9756         (Target_arm::scan_reloc_for_stub): Likewise.
9757         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9758
9759 2010-01-19  Ian Lance Taylor  <iant@google.com>
9760
9761         * output.cc (Output_section_headers::do_sized_write): Write large
9762         segment count to sh_info field.
9763         (Output_file_header::do_sized_write): For large segment count,
9764         write PN_XNUM to e_phnum field.
9765
9766 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9767
9768         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9769         (Arm_relocate_functions::thm_jump8): New function.
9770         (Arm_relocate_functions::thm_jump11): New function.
9771         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9772         R_ARM_THM_JUMP11.
9773         (Target_arm::Scan::global): Likewise.
9774         (Target_arm::Relocate::relocate): Likewise.
9775         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9776         Likewise.
9777
9778 2010-01-14  Doug Kwan  <dougkwan@google.com>
9779
9780         * arm.cc (map, utility): Include headers.
9781         (Target_arm::apply_cortex_a8_workaround): New method.
9782         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9783         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9784         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9785         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9786         the --[no-]fix-cortex-a8 command line options.
9787         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9788         (Target_arm::relocate_stub): Use addend in instruction template.
9789         * options.h (DEFINE_bool): Set the user-set flag.
9790         (General_options): Add --[no-]-fix-cortex options.
9791         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9792         : Update fast look-up map after conversion.
9793
9794 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9795
9796         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9797         in the first pass of do_layout.
9798
9799 2010-01-13  Doug Kwan  <dougkwan@google.com>
9800
9801         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9802         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9803         apparent compiler problem of not folding static constant integral
9804         data members of elfcpp::Elf_sizes<32>.
9805
9806 2010-01-13  Doug Kwan  <dougkwan@google.com>
9807
9808         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9809         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9810         Arm_relobj::scan_section_for_cortex_a8_erratum,
9811         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9812         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9813         sections to scan for relocation stubs into a new method
9814         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9815         relocation and Cortex-A8 stub scanning.
9816         (Target_arm::do_relax): Force stubs to be after stubbed sections
9817         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9818         the beginning of a new relaxation pass.  Update a comment.
9819         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9820
9821 2010-01-12  Ian Lance Taylor  <iant@google.com>
9822
9823         * target-reloc.h (visibility_error): New inline function.
9824         (relocate_section): Call visibility_error.
9825         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9826         (MOSTLYCLEANFILES): Likewise.
9827         (protected_4_pic.o, protected_3.err): New targets.
9828         * testsuite/protected_4.cc: New file.
9829
9830 2010-01-12  Doug Kwan  <dougkwan@google.com>
9831
9832         * arm.cc (Cortex_a8_reloc): New class.
9833         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9834         and cortex_a8_relocs_info_.
9835         (Target_arm::fix_cortex_a8): New method definition.
9836         (Target_arm::Cortex_a8_relocs_info): New type.
9837         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9838         New data member declarations.
9839         (Target_arm::scan_reloc_for_stub): Record information about
9840         relocations for THUMB branches that might be exempted from the
9841         Cortex-A8 workaround.
9842         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9843         at the beginning of a relaxation pass.
9844
9845 2010-01-12  Doug Kwan  <dougkwan@google.com>
9846
9847         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9848         (Arm_relobj::Mapping_symbol_position,
9849          Arm_reloj::Mapping_symbol_position_less,
9850          Arm_relobj::Mapping_symbols_info): New types.
9851         (Target_arm::is_mapping_symbol_name): New method definition.
9852         (Arm_relobj::do_count_local_symbols): Save information about mapping
9853         symbols.
9854
9855 2010-01-11  Doug Kwan  <dougkwan@google.com>
9856
9857         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9858         Arm_relocate_functions::thumb32_branch_upper,
9859         Arm_relocate_functions::thumb32_branch_lower,
9860         Arm_relocate_functions::thumb32_cond_branch_offset,
9861         Arm_relocate_functions::thumb32_cond_branch_upper,
9862         Arm_relocate_functions::thumb32_cond_branch_lower,
9863         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9864         branch offset encoding.
9865         (Arm_relocate_functions::thumb_branch_common): Use new branch
9866         offset encoding methods to avoid code duplication.
9867         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9868         (Stub_addend_reader::operator()): Use new branch encoding method
9869         to avoid code duplication.
9870
9871 2010-01-11  Doug Kwan  <dougkwan@google.com>
9872
9873         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9874         (Target_arm::do_finalize_sections): Define special EXIDX section
9875         symbols only if referenced.
9876         * gc.h (Garbage_collection::add_reference): New method.
9877         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9878         code duplication.
9879
9880 2010-01-11  Ian Lance Taylor  <iant@google.com>
9881
9882         * script.cc (Version_script_info::build_expression_list_lookup):
9883         Change complaing about duplicate wildcard match from error to
9884         warning.
9885
9886         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9887         of 2009-12-30.
9888         (Version_script_info::Version_script_info): Initialize globs_,
9889         default_version_, default_is_global_, and exact_.  Don't
9890         initialize globals_ or locals_.
9891         (Version_script_info::build_lookup_tables): Build local symbols
9892         first.
9893         (Version_script_info::unquote): New function.
9894         (Version_script_info::add_exact_match): New function.
9895         (Version_script_info::build_expression_list_lookup): Remove lookup
9896         parameter.  Add is_global parameter.  Change all callers.  Handle
9897         wildcard pattern specially.  Unquote pattern.  Call
9898         add_exact_match.
9899         (Version_script_info::get_name_to_match): New function.
9900         (Version_script_info::get_symbol_version): New function.
9901         (Version_script_info::get_symbol_version_helper): Remove.
9902         (Version_script_info::check_unmatched_names): Call unquote.
9903         * script.h (class Version_script_info): Change get_symbol_version
9904         to be non-inline and add is_global parameter; change all callers.
9905         Rewrite symbol_is_local.  Update declarations.  Define struct
9906         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9907         Remove globals_ and locals_ members.  Add exact_, globs_,
9908         default_version_, is_global_.
9909         (Version_script_info::Glob): Remove pattern, add expression and
9910         is_global.  Update constructor.  Change all callers.
9911         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9912         default version.
9913         (Versions::symbol_section_contents): If a symbol is undefined, or
9914         defined in a dynamic object, set the version index to
9915         VER_NDX_LOCAL.
9916         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9917         symbol_is_local.
9918         (Symbol_table::add_from_pluginobj): Likewise.
9919         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9920
9921 2010-01-11  Doug Kwan  <dougkwan@google.com>
9922
9923         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9924         (incremental_dump_LDADD): Add linking option for libintl.
9925         * Makefile.in: Regenerate.
9926
9927 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9928
9929         PR gold/11144
9930         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9931         instead of -Ds.
9932         * testsuite/Makefile.in: Regenerated.
9933
9934 2010-01-10  Doug Kwan  <dougkwan@google.com>
9935
9936         * options.h (DEFINE_var): Use parentheses around argument varname__
9937         in macro body to avoid any unintended subsequent substitutions.
9938
9939 2010-01-10  Ian Lance Taylor  <iant@google.com>
9940
9941         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9942         candidates before doing symbol resolution.
9943
9944         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9945         ODR candidates if only one is weak.
9946
9947 2010-01-08  Ian Lance Taylor  <iant@google.com>
9948
9949         * script.cc (Version_script_info::build_expression_list_lookup):
9950         Don't warn about ambiguous version, just record the ambiguity.
9951         (Version_script_info::get_symbol_version_helper): Give error if
9952         version is ambiguous.
9953
9954 2010-01-08  Doug Kwan  <dougkwan@google.com>
9955
9956         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9957         prev_data_size_ and prev_addralign_.  Remove initializer for
9958         deleted data member has_been_changed_.
9959         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9960         to determine if the table is empty.
9961         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9962         Remove.
9963         (Stub_table::add_reloc_stub): Define method in class definition
9964         instead of just declaring it there.
9965         (Stub_table::add_cortex_a8_stub): New method definition.
9966         (Stub_table::update_data_size_and_addralign): Ditto.
9967         (Stub_table::finalize_stubs): Ditto.
9968         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9969         (Stub_table::do_addralign_): Return address alignment in the
9970         (Stub_table::do_reset_address_and_file_offset): Define method in
9971         class definition instead of declaring it there.  Set current data
9972         size to be the data size of the previous pass.
9973         (Stub_table::set_final_data_size): Use current data size as the
9974         final data size.
9975         (Stub_table::relocate_stub): Change parameter type of stub from
9976         Reloc_stub pointer to Stub pointer.
9977         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9978         (Stub_table::Cortex_a8_stub_list): New typedef.
9979         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9980          Stub_table::prev_addralign_): New data member.
9981         (Arm_relobj::Arm_relobj): Initialize data member
9982         section_has_cortex_a8_workaround_.
9983         (Arm_relobj::section_has_cortex_a8_workaround,
9984          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9985          definitions.
9986         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9987         declarations.
9988         (Target_arm::relocate_stub): Change parameter type of stub from
9989         Reloc_stub pointer to Stub pointer.
9990         (Insn_template::size, Insn_template::alignment): Handle
9991         THUMB16_SPECIAL_TYPE.
9992         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9993          Stub_table::update_data_size_and_addralign,
9994          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9995         definitions.
9996         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9997         (Stub_table::do_write): Ditto.
9998         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9999
10000 2010-01-08  Ian Lance Taylor  <iant@google.com>
10001
10002         PR 11108
10003         * symtab.h (class Symbol): Remove fields is_target_special_ and
10004         has_plt_offset_.  Add field is_defined_in_discarded_section_.
10005         (Symbol::is_defined_in_discarded_section): New function.
10006         (Symbol::set_is_defined_in_discarded_section): New function.
10007         (Symbol::has_plt_offset): Rewrite.
10008         (Symbol::set_plt_offset): Verify that new offset is not -1U.
10009         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
10010         Don't initialize is_target_special_ or has_plt_offset_.
10011         Initialize is_defined_in_discarded_section_.
10012         (Symbol_table::add_from_relobj): If appropriate, set
10013         is_defined_in_discarded_section.
10014         * resolve.cc (Symbol::override_base_with_special): Don't test
10015         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
10016         * target-reloc.h (relocate_section): Do special handling for
10017         symbols defined in discarded sections for global symbols as well
10018         as local symbols.
10019
10020 2010-01-08  Ian Lance Taylor  <iant@google.com>
10021
10022         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
10023         the SHT_SYMTAB case.
10024
10025 2010-01-08  Ian Lance Taylor  <iant@google.com>
10026
10027         * object.cc (Sized_relobj::do_layout): Don't get confused if
10028         layout_eh_frame returns NULL.
10029
10030 2010-01-08  Ian Lance Taylor  <iant@google.com>
10031
10032         PR 11084
10033         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
10034         dynamic symbol table, use the normal symbol table.
10035         (Sized_dynobj::do_read_symbols): Remove assertion about type of
10036         symbol table.
10037
10038 2010-01-08  Ian Lance Taylor  <iant@google.com>
10039
10040         PR 11072
10041         * layout.cc (Layout::include_section): Remove .gnu_debuglink
10042         sections.
10043
10044 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
10045
10046         * version.cc (print_version): Change to "Copyright 2010".
10047
10048 2010-01-08  Ian Lance Taylor  <iant@google.com>
10049
10050         PR 10287
10051         PR 11063
10052         * i386.cc (class Target_i386): Change return type of plt_section
10053         to be non-const.
10054         (class Output_data_plt_i386): Add tls_desc_rel_ field.
10055         (Output_data_plt_i386::Output_data_plt_i386): Initialize
10056         tls_desc_rel_ field.
10057         (Output_data_plt_i386::rel_tls_desc): New function.
10058         (Target_i386::rel_tls_desc_section): New function.
10059         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
10060         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
10061         R_386_TLS_DESC reloc in rel_tls_desc_section.
10062         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
10063         Define struct Tlsdesc_info.
10064         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
10065         (Target_x86_64::do_reloc_symbol_index): New function.
10066         (Target_x86_64::add_tlsdesc_info): New function.
10067         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
10068         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
10069         tlsdesc_rel_ field.
10070         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
10071         all callers.
10072         (Output_data_plt_x86_64::rela_tlsdesc): New function.
10073         (Target_x86_64::rela_tlsdesc_section): New function.
10074         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
10075         handling.
10076         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
10077         (Target_x86_64::do_reloc_addend): New function.
10078         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
10079         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
10080         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
10081         (Output_reloc::type): New function.
10082         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
10083         (Output_reloc::is_target_specific): New function.
10084         (Output_reloc::target_arg): New function.
10085         (class Output_reloc) [SHT_RELA]: Add four new constructors for
10086         absolute relocs and target specific relocs.
10087         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
10088         add_target_specific.
10089         (class Output_data_reloc) [SHT_RELA]: Likewise.
10090         * output.cc (Output_reloc::Output_reloc): Add four new versions
10091         for absolute relocs and target specific relocs.
10092         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
10093         (Output_reloc::get_symbol_index): Likewise.
10094         (Output_reloc::local_section_offset): Check that local_sym_index_
10095         is not TARGET_CODE or 0.
10096         (Output_reloc::symbol_value): Likewise.
10097         (Output_reloc::write) [SHT_RELA]: Call target for target specific
10098         reloc.
10099         * target.h (class Target): Add reloc_symbol_index and reloc_addend
10100         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
10101         functions.
10102         * layout.cc (add_target_dynamic_tags): Use output section for
10103         DT_PLTRELSZ and DT_JMPREL.
10104
10105 2010-01-07  Ian Lance Taylor  <iant@google.com>
10106
10107         PR 11061
10108         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
10109         function.
10110         (class Output_data_reloc_generic): Define.
10111         (class Output_data_reloc_base): Change base class to
10112         Output_data_reloc_generic.  Change add() method to call
10113         bump_relative_reloc_count for a relative reloc.  Remove
10114         sort_relocs_ field.
10115         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
10116         to sort_relocs().
10117         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
10118         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
10119         appropriate.
10120         * layout.h (class Layout): Update declaration.
10121
10122 2010-01-07  Ian Lance Taylor  <iant@google.com>
10123
10124         * output.h (class Output_data): Add const version of
10125         output_section and do_output_section.
10126         (class Output_section_data): Add const version of
10127         do_output_section.
10128         (class Output_section): Likewise.
10129         * layout.cc (Layout::add_target_dynamic_tags): New function.
10130         * layout.h (class Layout): Update declarations.
10131         * arm.cc (Target_arm::do_finalize_sections): Use
10132         add_target_dynamic_tags.
10133         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10134         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10135         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10136         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10137
10138 2010-01-07  Ian Lance Taylor  <iant@google.com>
10139
10140         PR 11042
10141         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
10142         object as needed.
10143
10144 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
10145             Ian Lance Taylor  <iant@google.com>
10146
10147         PR 11019
10148         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
10149         Xindex::read_symtab_xindex.
10150
10151 2010-01-07  Doug Kwan  <dougkwan@google.com>
10152
10153         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
10154         (Insn_template::thumb16_bcond_insn): New method declaration.
10155         (Insn_template): Fix spelling.
10156         (Stub::thumb16_special): New method declaration.
10157         (Stub::do_write): Define virtual method which was previously pure
10158         virtual.
10159         (Stub::do_thumb16_special): New method declaration.
10160         (Stub::do_fixed_endian_write): New template member.
10161         (Reloc_stub::do_write): Remove.
10162         (Reloc_stub::do_fixed_endian_write): Remove.
10163         (Cortex_a8_stub): New class definition.
10164         (Stub_factory::make_cortex_a8_stub): New method definition.
10165         (Stub_factory::Stub_factory): Add missing static storage class
10166         qualifier for elf32_arm_stub_a8_veneer_blx.
10167
10168 2010-01-07  Ian Lance Taylor  <iant@google.com>
10169
10170         PR 10980
10171         * options.h (class General_options): Add --warn-unresolved-symbols
10172         and --error-unresolved-symbols.
10173         * errors.cc (Errors::undefined_symbol): Implement
10174         --warn-unresolved-symbols.
10175
10176         * options.h (class General_options): Add -z text and -z textoff.
10177         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
10178
10179 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
10180
10181         * gc.h (Garbage_collection::Cident_section_map): New typedef.
10182         (Garbage_collection::cident_sections): New function.
10183         (Garbage_collection::add_cident_section): New function.
10184         (Garbage_collection::cident_sections_): New member.
10185         (gc_process_relocs): Add references to sections whose names are C
10186         identifiers.
10187         * gold.h (cident_section_start_prefix): New constant.
10188         (cident_section_stop_prefix): New constant.
10189         (is_cident): New function.
10190         * layout.cc (Layout::define_section_symbols): Replace string constants
10191         with the newly defined constants.
10192         * object.cc (Sized_relobj::do_layout): Track sections whose names are
10193         C identifiers.
10194         * testsuite/Makefile.am: Add gc_orphan_section_test.
10195         * testsuite/Makefile.in: Regenerate.
10196         * testsuite/gc_orphan_section_test.cc: New file.
10197         * testsuite/gc_orphan_section_test.sh: New file.
10198
10199 2010-01-06  Ian Lance Taylor  <iant@google.com>
10200
10201         PR 10980
10202         * options.h (class General_options): Add --warn-shared-textrel.
10203         * layout.cc (Layout::finish_dynamic_section): Implement
10204         --warn-shared-textrel.
10205
10206         PR 10980
10207         * options.h (class General_options): Add --warn-multiple-gp.
10208
10209 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10210
10211         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
10212         $(THREADSLIB) and $(LIBDL).
10213         * Makefile.in: Rebuild.
10214
10215 2010-01-06  Ian Lance Taylor  <iant@google.com>
10216
10217         PR 10980
10218         * options.cc (General_options::parse_section_start): New function.
10219         (General_options::section_start): New function.
10220         (General_options::General_options): Initialize all members.
10221         * options.h: Include <map>
10222         (class General_options): Add --section-start.  Add section_starts_
10223         member.
10224         * layout.cc (Layout::attach_allocated_section_to_segment): If
10225         --section-start was used, set the address of the segment.  Remove
10226         local sort_sections.
10227         (Layout::relaxation_loop_body): If the address of the load segment
10228         has been set by --section-start, don't use it.
10229         * output.h (Output_segment::update_flags_for_output_section): New
10230         function.
10231         * output.cc (Output_segment::add_output_section): Call
10232         update_flags_for_output_section.
10233
10234 2010-01-05  Ian Lance Taylor  <iant@google.com>
10235
10236         PR 10980
10237         * options.h (class General_options): Add --undefined-version.
10238         * script.cc (struct Version_expression): Add was_matched_by_symbol
10239         field.
10240         (Version_script_info::matched_symbol): New function.
10241         (Version_script_info::get_symbol_version_helper): Call
10242         matched_symbol.
10243         (Version_script_info::check_unmatched_names): New function.
10244         * script.h (class Version_script_info): Update declarations.
10245         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
10246
10247         * options.h (class General_options): Use DEFINE_bool_alias for
10248         allow_multiple_definition.
10249         * resolve.cc (Symbol_table::should_override): Don't test
10250         allow_multiple_definition.
10251
10252         PR 10980
10253         * options.h (class General_options): Add --cref.
10254         * main.cc (main): Print cref table if --cref.  Don't close mapfile
10255         until after printing cref table.
10256         * cref.cc: Include "symtab.h".
10257         (class Cref_inputs): Define Cref_table_compare and Cref_table.
10258         (Cref_table_compare::operator()): New function.
10259         (Cref_inputs::gather_cref): New function.
10260         (filecol): New static const.
10261         (Cref_inputs::print_cref): New function.
10262         (Cref::print_cref): New function.
10263         * cref.h: Include <cstdio>.
10264         (class Cref): Update declarations.
10265         * mapfile.h (Mapfile::file): New function.
10266         * object.h (class Object): Define Symbols.  Declare virtual
10267         do_get_global_symbols.
10268         (Object::get_global_symbols): New function.
10269         * object.cc (Input_objects::add_object): Pass object to cref_ if
10270         --cref.
10271         (Input_objects::archive_start): Likewise.
10272         (Input_objects::archive_stop): Likewise.
10273         (Input_objects::print_cref): New function.
10274         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
10275         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
10276         --cref.
10277         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
10278         function.
10279         * plugin.h (class Sized_pluginobj): Update declarations.
10280
10281 2010-01-05  Ian Lance Taylor  <iant@google.com>
10282
10283         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
10284         to is_default_version.  Rename insdef to insdefault.
10285         (Symbol_table::add_from_relobj): Rename def to is_default_version
10286         and local to is_forced_local.
10287         (Symbol_table::add_from_pluginobj): Likewise.
10288         (Symbol_table::add_from_dynobj): Likewise.
10289         (Symbol_table::define_special_symbol): Rename insdef to
10290         insdefault.
10291
10292 2010-01-04  Ian Lance Taylor  <iant@google.com>
10293
10294         PR 10980
10295         * options.h (class General_options): Add
10296         --allow-multiple-definition and -z muldefs.
10297         * resolve.cc (Symbol_table::should_override): Don't warn about a
10298         multiple symbol definition if --allow-multiple-definition or -z
10299         muldefs.
10300
10301         PR 10980
10302         * options.h (class General_options): Add --add-needed and
10303         --copy-dt-needed-entries.  Tweak --as-needed help entry.
10304         * object.cc (Input_objects::check_dynamic_dependencies): Give an
10305         error if --copy-dt-needed-entries aka --add-needed is used and
10306         would cause a change in behaviour.
10307
10308         PR 10980
10309         * options.h (class General_options): Add -G as a short version of
10310         --shared.  Add no-op options -assert, -g, and -i.
10311
10312 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
10313
10314         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
10315         check for .text or .gnu.linkonce.t sections.
10316         * icf.cc (Icf::find_identical_sections): Ditto.
10317         Change the detection for mangled function name within the section
10318         name.
10319         * icf.h (is_section_foldable_candidate): New function.
10320
10321 2009-12-30  Ian Lance Taylor  <iant@google.com>
10322
10323         PR 10980
10324         * options.h (class General_options): Permit two dashes with
10325         --retain-symbols-file.
10326
10327 2009-12-30  Ian Lance Taylor  <iant@google.com>
10328
10329         PR 10979
10330         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
10331         don't put the file header and segment headers in the text
10332         segment.
10333
10334         PR 10979
10335         * common.cc (Sort_commons::operator()): Stabilize sort when both
10336         entries are NULL.
10337         (Symbol_table::do_allocate_commons_list): When allocating common
10338         symbols, skip a symbol which is no longer common.
10339         * symtab.h (Symbol::is_common): Test whether the symbol comes from
10340         an object before checking its type.
10341         * testsuite/common_test_2.c: New file.
10342         * testsuite/common_test_3.c: New file.
10343         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
10344         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
10345         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
10346         (common_test_2_pic.o, common_test_2.so): New targets.
10347         (common_test_3_pic.o, common_test_3.so): New targets.
10348         * testsuite/Makefile.in: Rebuild.
10349
10350         PR 10979
10351         * script.cc (read_input_script): If we see a new SECTIONS clause,
10352         and we have added an input section, give an error.
10353         * layout.h (class Layout): Add have_added_input_section function.
10354         Add have_added_input_section_ field.
10355         * layout.cc (Layout::Layout): Initialize
10356         have_added_input_section_.
10357         (Layout::layout): Set have_added_input_section_.
10358         (Layout::layout_eh_frame): Likewise.
10359
10360 2009-12-30  Ian Lance Taylor  <iant@google.com>
10361
10362         PR 10931
10363         * options.h (class General_options): Add --sort-common option.
10364         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
10365         * common.cc (Sort_common): Add sort_order parameter to
10366         constructor.  Add sort_order_ field.
10367         (Sort_commons::operator): Check sort_order_.
10368         (Symbol_table::allocate_commons): Determine the sort order.
10369         (Symbol_table::do_allocate_commons): Add sort_order parameter.
10370         Change all callers.
10371         (Symbol_table::do_allocate_commons_list): Likewise.
10372
10373 2009-12-30  Ian Lance Taylor  <iant@google.com>
10374
10375         PR 10916
10376         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
10377         symbols from this object, don't change the visibility of an
10378         undefined symbol.
10379         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
10380
10381 2009-12-30  Ian Lance Taylor  <iant@google.com>
10382
10383         PR 10861
10384         * script.h (class Version_script_info): Define Language enum.
10385         Update declarations.  Define Glob, Exact, and Lookup types.  Add
10386         new fields globals_, locals_, and is_finalized_.
10387         * script.cc: Various formatting fixes.
10388         (class Parser_closure): Change language_stack_ from a vector of
10389         std::string to one of Version_script_info::Language.  Adjust all
10390         uses accordingly.
10391         (class Lazy_demangler): Remove.
10392         (struct Version_expression): Change language from std::string to
10393         Version_script_info::Language.
10394         (Version_script_info::Version_script_info): New function.
10395         (Version_script_info::~Version_script_info): Don't call clear.
10396         (Version_script_info::finalize): New function.
10397         (Version_script_info::build_lookup_tables): New function.
10398         (Version_script_info::build_expression_list_lookup): New
10399         function.
10400         (Version_script_info::get_symbol_version_helper): Rewrite to use
10401         lookup tables.
10402         (Version_script_info::print_expression_list): Adjust to use
10403         Version_script_info::Language.
10404         (script_push_lex_into_version_mode): Check that the version script
10405         has not been finalized.
10406         (version_script_push_lang): Change language string to
10407         Version_script_info::Language.
10408         * options.cc (Command_line::version_script): New function.
10409         * options.h (class General_options): Add finalize_dynamic_list
10410         function.  Change version_script from declaration to definition.
10411         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
10412         * testsuite/version_script.map: Remove duplicate def of foo.
10413         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
10414         version_script.map.
10415         * testsuite/Makefile.in: Rebuild.
10416
10417 2009-12-30  Ian Lance Taylor  <iant@google.com>
10418
10419         PR 10843
10420         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
10421         if the input symbol index is 0, make the output symbol index 0.
10422
10423 2009-12-30  Ian Lance Taylor  <iant@google.com>
10424
10425         PR 10670
10426         * options.h (class General_options): Add -x/--discard-all.
10427         * object.cc (Sized_relobj::do_count_local_symbols): Handle
10428         --discard-all.  If the local symbol needs a dynamic entry, check
10429         that before handling --discard-locals.
10430
10431 2009-12-30  Ian Lance Taylor  <iant@google.com>
10432
10433         PR 10450
10434         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
10435         flags to PF_R.
10436         (Output_segment::add_output_section): Don't change the flags if
10437         the type is PT_TLS.
10438
10439         PR 10450
10440         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
10441         GNU hash table if they need a dynamic value.  Otherwise, don't add
10442         them if they are defined in a dynamic object or are forced local.
10443
10444 2009-12-29  Ian Lance Taylor  <iant@google.com>
10445
10446         PR 10450
10447         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
10448         .gnu.hash table for a 32-bit target.
10449
10450         PR 10450
10451         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
10452         regular and a dynamic object only needs a dynamic symbol table
10453         entry if it is externally visible.
10454
10455         PR 10450
10456         * i386.cc (class Target_i386): Initialize global_offset_table_ in
10457         constructor.  Add global_offset_table_ field.
10458         (Target_i386::got_section): Set global_offset_table_.
10459         (Target_i386::do_finalize_sections): Set global_offset_table_
10460         size.
10461         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
10462         in constructor.  Add global_offset_table_ field.
10463         (Target_x86_64::got_section): Set global_offset_table_.
10464         (Target_x86_64::do_finalize_sections): Set global_offset_table_
10465         size.
10466
10467         * layout.cc (Layout::Layout): Initialize increase_relro_.
10468         (Layout::get_output_section): Add is_relro, is_last_relro, and
10469         is_first_non_relro parameters.  Change all callers.
10470         (Layout::choose_output_section): Likewise.
10471         (Layout::add_output_section_data): Likewise.
10472         (Layout::make_output_section): Likewise.
10473         (Layout::set_segment_offsets): Clear increase_relro when using a
10474         linker script.
10475         * layout.h (class Layout): Add increase_relro method.  Add
10476         increase_relro_ field.  Update declarations.
10477         * output.cc (Output_section::Output_section): Initialize
10478         is_last_relro_ and is_first_non_relro_.
10479         (Output_segment::add_output_section): Group relro sections is
10480         do_sort is true.  Handle is_last_relro and is_first_non_relro.
10481         (Output_segment::maximum_alignment): Remove relro handling.
10482         (Output_segment::set_section_addresses): Add increase_relro
10483         parameter.  Change all callers.  Add initial alignment to align
10484         relro sections on separate page.  Remove old relro handling.
10485         (Output_segment::set_section_list_addresses): Remove in_relro
10486         parameter.  Change all callers.
10487         (Output_segment::set_offset): Add increase parameter.  Change all
10488         callers.  Remove old relro handling.
10489         * output.h (class Output_section): Add new methods: is_last_relro,
10490         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
10491         Add is_last_relro_ and is_first_non_relro_ fields.
10492         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
10493         Create separate .got.plt section.  Call increase_relro.
10494         * x86_64.cc (Target_x86_64::got_section): Likewise.
10495         * testsuite/relro_script_test.t: Add .got.plt.
10496
10497         PR 10450
10498         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
10499         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
10500         (Layout::finalize): Call set_dynamic_symbol_size.
10501         (Layout::set_dynamic_symbol_size): New function.
10502         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
10503         set_dynamic_symbol_size.
10504
10505         PR 10450
10506         * output.h (class Output_section): Add is_entsize_zero_ field.
10507         * output.cc (Output_section::Output_section): Initialize
10508         is_entsize_zero_.
10509         (Output_section::set_entsize): If two different entsizes are
10510         requested, force it to zero.
10511         (Output_section::add_input_section): Set flags for .debug_str
10512         before updating section flags.  Set entsize.
10513         (Output_section::update_flags_for_input_section): Set SHF_MERGE
10514         and SHF_STRING if all input sections have those flags.
10515
10516 2009-12-29   Rafael Espindola  <espindola@google.com>
10517
10518         * main.cc (main): Fix the sys time reporting.
10519         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
10520         reporting.
10521
10522 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
10523
10524         * options.cc (General_options::parse_version): Allow -v to exit
10525         without an error if there is nothing to link.
10526
10527 2009-12-29  Ian Lance Taylor  <iant@google.com>
10528
10529         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
10530         using a version of gcc before 4.1.
10531         * configure: Rebuild.
10532
10533 2009-12-28  Chris Demetriou  <cgd@google.com>
10534
10535         * attributes.cc (Output_attributes_section_data::do_write): Use
10536         std::vector::front rather than std::vector::data.
10537
10538 2009-12-28  Ian Lance Taylor  <iant@google.com>
10539
10540         * symtab.h (class Symbol_table): Add enum Defined.
10541         * resolve.cc (Symbol_table::should_override): Add defined
10542         parameter.  Change all callers.  Test whether object is NULL
10543         before calling a method on it.
10544         (Symbol_table::report_resolve_problem): Add defined parameter.
10545         Change all callers.
10546         (Symbol_table::should_override_with_special): Likewise.
10547         * symtab.cc (Symbol_table::define_in_output_data): Add defined
10548         parameter.  Change all callers.
10549         (Symbol_table::do_define_in_output_data): Likewise.
10550         (Symbol_table::define_in_output_segment): Likewise.
10551         (Symbol_table::do_define_in_output_segment): Likewise.
10552         (Symbol_table::define_as_constant): Likewise.
10553         (Symbol_table::do_define_as_constant): Likewise.
10554         * script.h (class Symbol_assignment): Add is_defsym parameter to
10555         constructor; change all callers.
10556         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
10557         parameter.  Change all callers.  Add is_defsym_ field.
10558         (class Parser_closure): Add parsing_defsym parameter to
10559         constructor; change all callers.  Add parsing_defsym accessor
10560         function.  Add parsing_defsym_ field.
10561
10562 2009-12-28  Ian Lance Taylor  <iant@google.com>
10563
10564         * gold.cc (queue_middle_tasks): Fix formatting.
10565         * object.cc (Relobj::is_section_name_included): Likewise.
10566
10567 2009-12-23  Ian Lance Taylor  <iant@google.com>
10568
10569         * i386.cc (Target_i386::do_calls_non_split): Recognize
10570         -fsplit-stack prologue for a function with a static chain.
10571         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
10572         -fsplit-stack prologue when using %r11.
10573
10574 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
10575
10576         * options.cc (General_options::parse_version): Make -v continue and do
10577         the link like GNU ld does.
10578
10579 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
10580
10581         * Makefile.am (CCFILES): Add timer.cc.
10582         (HFILES): Add timer.h.
10583         * configure.ac: Check for sysconf and times.
10584         * main.cc: include timer.h.
10585         (main): Use Timer instead of get_run_time.
10586         * timer.cc: New.
10587         * timer.h: New.
10588         * workqueue.cc: include timer.h.
10589         (Workqueue::find_and_run_task):
10590         Report user, sys and wall time.
10591         * Makefile.in: Regenerate.
10592         * config.in: Regenerate.
10593         * configure: Regenerate.
10594
10595 2009-12-16  Doug Kwan  <dougkwan@google.com>
10596
10597         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
10598         sections.
10599         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
10600         relaxed input sections.
10601         * output.cc (Output_section::find_relaxed_input_section): Change
10602         return type to Output_relaxed_input_section pointer.  Adjust code
10603         for new type of relaxed_input_section_map_.
10604         * output.h (Output_section::find_relaxed_input_section): Change
10605         return type to Output_relaxed_input_section pointer.
10606         (Output_section::Output_relaxed_input_section_by_input_section_map):
10607         New type.
10608         (Output_section::relaxed_input_section_map_): Change type to
10609         Output_section::Output_relaxed_input_section_by_input_section_map.
10610         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
10611         input section.
10612
10613 2009-12-15  Ian Lance Taylor  <iant@google.com>
10614
10615         * layout.cc (Layout::create_shstrtab): Only write out after input
10616         sections if we are compressing debug sections.
10617
10618 2009-12-15  Ian Lance Taylor  <iant@google.com>
10619
10620         * archive.cc (Archive::add_symbols): Only look up a symbol without
10621         a version if there is, in fact, a version.
10622
10623 2009-12-14  Ian Lance Taylor  <iant@google.com>
10624
10625         Revert -Wshadow changes, all changes from:
10626         2009-12-11  Doug Kwan  <dougkwan@google.com>
10627         2009-12-11  Nick Clifton  <nickc@redhat.com>
10628         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
10629
10630 2009-12-11  Doug Kwan  <dougkwan@google.com>
10631
10632         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10633         due to -Wshadow.
10634         * attributes.cc (Object_attribute::size): Ditto.
10635         (Attributes_section_data::size): Ditto.
10636         (Attributes_section_data::Attributes_section_data): Ditto.
10637         (Output_attributes_section_data::do_write): Ditto.
10638         * attributes.h (Object_attribute::set_type): Ditto.
10639         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10640
10641 2009-12-11  Nick Clifton  <nickc@redhat.com>
10642
10643         * archive.cc: Fix shadowed variable warnings.
10644         * arm.cc: Likewise.
10645         * compressed_output.cc: Likewise.
10646         * compressed_output.h: Likewise.
10647         * configure: Likewise.
10648         * dwarf_reader.cc: Likewise.
10649         * dynobj.cc: Likewise.
10650         * dynobj.h: Likewise.
10651         * ehframe.cc: Likewise.
10652         * ehframe.h: Likewise.
10653         * errors.cc: Likewise.
10654         * expression.cc: Likewise.
10655         * fileread.cc: Likewise.
10656         * fileread.h: Likewise.
10657         * freebsd.h: Likewise.
10658         * i386.cc: Likewise.
10659         * icf.cc: Likewise.
10660         * incremental.h: Likewise.
10661         * layout.cc: Likewise.
10662         * layout.h: Likewise.
10663         * mapfile.cc: Likewise.
10664         * merge.cc: Likewise.
10665         * merge.h: Likewise.
10666         * object.cc: Likewise.
10667         * object.h: Likewise.
10668         * options.h: Likewise.
10669         * output.cc: Likewise.
10670         * output.h: Likewise.
10671         * parameters.cc: Likewise.
10672         * plugin.cc: Likewise.
10673         * powerpc.cc: Likewise.
10674         * reduced_debug_output.cc: Likewise.
10675         * reduced_debug_output.h: Likewise.
10676         * reloc.cc: Likewise.
10677         * reloc.h: Likewise.
10678         * resolve.cc: Likewise.
10679         * script-sections.cc: Likewise.
10680         * script.cc: Likewise.
10681         * script.h: Likewise.
10682         * sparc.cc: Likewise.
10683         * symtab.cc: Likewise.
10684         * symtab.h: Likewise.
10685         * target-select.cc: Likewise.
10686         * target-select.h: Likewise.
10687         * token.h: Likewise.
10688         * workqueue.cc: Likewise.
10689         * workqueue.h: Likewise.
10690         * x86_64.cc: Likewise.
10691
10692 2009-12-10  Doug Kwan  <dougkwan@google.com>
10693
10694         * arm.cc (attributes.h): New include.
10695         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10696         (Arm_relobj::~Arm_relobj): Delete object pointed by
10697         attributes_section_data_.
10698         (Arm_relobj::attributes_section_data): New method definition.
10699         (Arm_relobj::attributes_section_data_): New data member declaration.
10700         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10701         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10702         attributes_section_data_.
10703         (Arm_dynobj::attributes_section_data): New method definition.
10704         (Arm_dynobj::attributes_section_data_): New data member declaration.
10705         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10706         initialization value of may_use_blx_ to false.
10707         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10708         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10709         object attributes to compute results instead of hard-coding.
10710         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10711         Target_arm::get_secondary_compatible_arch,
10712         Target_arm::set_secondary_compatible_arch
10713         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10714         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10715         New method declarations.
10716         (Target_arm::get_aeabi_object_attribute): New method definition.
10717         (Target_arm::attributes_section_data_): New data member declaration.
10718         (read_arm_attributes_section): New template definition.
10719         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10720         (Arm_dynobj::do_read_symbols): Ditto.
10721         (Target_arm::do_finalize_sections): Merge attributes sections from
10722         input.  Check for BLX use after attributes section merging.
10723         Fix __exidx_start and __exidx_end visibility.  Create an
10724         .ARM.attributes section if necessary.
10725         (Target_arm::get_secondary_compatible_arch,
10726         Target_arm::set_secondary_compatible_arch,
10727         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10728         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10729         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10730         New method definitions.
10731
10732 2009-12-09  Ian Lance Taylor  <iant@google.com>
10733
10734         * plugin.cc (Plugin::load): Don't cast from void* to a function
10735         pointer.
10736
10737 2009-12-09  Ian Lance Taylor  <iant@google.com>
10738
10739         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10740         information fields.
10741
10742 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10743
10744         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10745         Replace two_file_shared_1.so with two_file_shared_2.so.
10746         * testsuite/Makefile.in: Regenerated.
10747
10748 2009-12-08  Doug Kwan  <dougkwan@google.com>
10749
10750         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10751         (HFILES): Add attributes.h and int_encoding.h.
10752         * Makefile.in: Regenerate.
10753         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10754         function definitions to int_encoding.cc
10755         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10756         prototypes to int_encoding.h
10757         * reduced_debug_output.cc (int_encoding.h): New include.
10758         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10759         function definitions to int_encoding.cc
10760         (insert_into_vector, read_from_pointer): Move template definitions to
10761         int_encoding.h
10762         * attributes.cc: New file.
10763         * attributes.h: New file.
10764         * int_encoding.cc: New file.
10765         * int_encoding.h: New file.
10766
10767 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10768
10769         PR gold/11055
10770         * incremental-dump.cc (dump_incremental_inputs): New.
10771         (main): Use dump_incremental_inputs.
10772
10773 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10774
10775         PR gold/10893
10776         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10777         checking elfcpp::STT_FUNC.
10778         (Target_i386::Relocate::relocate): Likewise.
10779         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10780
10781         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10782         symbols from shared libraries into normal FUNC symbols.
10783
10784         * symtab.h (Symbol): Add is_func and use it.
10785
10786 2009-12-05  Doug Kwan  <dougkwan@google.com>
10787
10788         * arm.cc (Target_arm::arm_info): Initialize new fields
10789         attributes_section and attributes_vendor.
10790         * i386.cc (Target_i386::i386_info): Same.
10791         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10792         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10793         fields attributes_section and attributes_vendor.
10794         * sparc.cc (Target_sparc::sparc_info): Same.
10795         * target.h (Target::attributes_section, Target::attributes_vendor,
10796         Target::is_attributes_section, Target::attribute_arg_type,
10797         Target::attributes_order): New method definitions.
10798         (Target::Target_info::attributes_section,
10799         Target::Target_info::attributes_vendor): New fields.
10800         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10801         virtual method definitions.
10802         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10803         attributes_section and attributes_vendor.
10804         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10805
10806 2009-12-05  Doug Kwan  <dougkwan@google.com>
10807
10808         * arm.cc: Update comments about interworking and stub generation.
10809         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10810         considered as non-PIC.
10811         (Arm_relocate_functions::base_abs): Fix formatting.
10812         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10813         of function to use GOT entry address instead of offset.
10814         (Target_arm::Scan::global): Issue an error if a symbol would need a
10815         PLT does not get one because it is untyped.  Remove code to create
10816         dynamic symbols for relative branches.
10817         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10818         takes unsigned integer instead of boolean.
10819
10820 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10821
10822         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10823         (two_file_test_LDADD): Likewise.
10824         (common_test_1_LDADD): Likewise.
10825         (exception_test_LDADD) Likewise.
10826         (weak_test_LDADD): Likewise.
10827         (many_sections_test_LDADD): Likewise.
10828         (initpri1_LDADD): Likewise.
10829         (script_test_1_LDADD): Likewise.
10830         (script_test_2_LDADD): Likewise.
10831         (justsyms_LDADD): Likewise.
10832         (binary_test_LDADD): Likewise.
10833         (large_LDADD): Likewise.
10834         * testsuite/Makefile.in: Regenerated.
10835
10836 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10837
10838         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10839         (Symbol_table::override_with_special): Likewise.
10840         (Symbol_table::add_from_object): Likewise.
10841
10842 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10843
10844         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10845         Don't set the data_offset twice.
10846
10847 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10848
10849         * testsuite/Makefile.in: Regenerate.
10850
10851 2009-12-03  Doug Kwan  <dougkwan@google.com>
10852
10853         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10854         (Target_arm::do_finalize_sections): Add parameter for symbol table
10855         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10856         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10857         parameter for symbol table pointer.
10858         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10859         an additional parameter for a pointer to symbol table.
10860         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10861         parameter for a symbol table pointer.
10862         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10863         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10864         Ditto.
10865         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10866         parameter for a symbol table pointer.
10867
10868 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10869
10870         * incremental.cc (Incremental_inputs_header)
10871         (Incremental_inputs_header_write, Incremental_inputs_entry)
10872         (Incremental_inputs_entry_write): Move ...
10873         * incremental.h (Incremental_inputs_header)
10874         (Incremental_inputs_header_write, Incremental_inputs_entry)
10875         (Incremental_inputs_entry_write): here.
10876
10877 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10878
10879         * incremental.cc (make_sized_incremental_binary): Set the target.
10880         Error if it is incompatible.
10881         * output.h (Output_file): Add filename method.
10882
10883 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10884
10885         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10886         from the get_* methods.
10887
10888 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10889
10890         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10891         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10892         Write 0 for the data_offset of scripts.
10893
10894 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10895
10896         * testsuite/Makefile.am: Add the incremental_test.sh test.
10897         * testsuite/incremental_test.sh: New.
10898         * testsuite/incremental_test_1.c: New.
10899         * testsuite/incremental_test_2.c: New.
10900
10901 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10902
10903         * incremental-dump.cc (main): Fix typos.
10904
10905 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10906
10907         PR gold/11025
10908         * incremental-dump.cc (main): Use llu to print 64 bit values.
10909
10910 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10911             H.J. Lu  <hongjiu.lu@intel.com>
10912
10913         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10914         $(LIBDL).
10915         (incremental_dump_LDADD): Likewise.
10916         * Makefile.in: Regenerated.
10917
10918 2009-11-25  Doug Kwan  <dougkwan@google.com>
10919
10920         Revert:
10921
10922         2009-11-25  Doug Kwan  <dougkwan@google.com>
10923
10924                 * arm.cc (Target_arm::Target_arm): Move method definition
10925                 outside of class definition.  Add code to handle
10926                 --target1-rel, --target1-abs and --target2= options.
10927                 (Target_arm::get_reloc_reloc_type): Change method to be
10928                 non-static and const.
10929                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10930                 New data member declaration.
10931                 (Target_arm::Scan::local, Target_arm::Scan::global,
10932                 Target_arm::Relocate::relocate,
10933                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10934                 Adjust call to Target_arm::get_real_reloc_type.
10935                 (Target_arm::get_real_reloc_type): Use command line options
10936                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10937                 * options.h (--target1-rel, --target1-abs, --target2): New
10938                 ARM-only options.
10939
10940 2009-11-25  Doug Kwan  <dougkwan@google.com>
10941
10942         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10943         class definition.  Add code to handle --target1-rel, --target1-abs
10944         and --target2= options.
10945         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10946         and const.
10947         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10948         member declaration.
10949         (Target_arm::Scan::local, Target_arm::Scan::global,
10950         Target_arm::Relocate::relocate,
10951         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10952         call to Target_arm::get_real_reloc_type.
10953         (Target_arm::get_real_reloc_type): Use command line options to
10954         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10955         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10956         options.
10957
10958 2009-11-25  Doug Kwan  <dougkwan@google.com>
10959
10960         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10961         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10962         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10963         formatting.
10964         (Arm_relocate_functions::thm_call): Replace body with a call to
10965         Arm_relocate_functions::thumb_branch_common.
10966         (Arm_relocate_functions::thm_jump24,
10967         Arm_relocate_functions::thm_xpc22): New method definitions.
10968         (Arm_relocate_functions::thumb_branch_common): New method definition.
10969         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10970         operator.
10971         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10972         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10973
10974 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10975
10976         * Makefile.am: Build incremental-dump
10977         * Makefile.in: Regenerate.
10978         * incremental-dump.cc: New.
10979         * incremental.cc (Incremental_inputs_header_data,
10980         Incremental_inputs_entry_data): Move to incremental.h
10981         * incremental.h: (Incremental_inputs_header_data,
10982         Incremental_inputs_entry_data): Move from incremental.cc
10983
10984 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10985
10986         * incremental.cc (Incremental_inputs_header,
10987         Incremental_inputs_header_write, Incremental_inputs_entry,
10988         Incremental_inputs_entry_write): Add a typedef with the data type.
10989
10990 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10991
10992         * incremental.cc (Incremental_inputs_header,
10993         Incremental_inputs_header_write, Incremental_inputs_entry,
10994         Incremental_inputs_entry_write): Update comment about which
10995         type has the filed descriptions.
10996
10997 2009-11-15  Doug Kwan  <dougkwan@google.com>
10998
10999         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
11000         (Arm_relocate_functions::arm_branch_common): Change method defintion
11001         in class definition to a method declaration and update list of formal
11002         parameters.
11003         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
11004         Arm_relocation_functions::jump24): Adjust call to
11005         Arm_relocate_functions::arm_branch_common.  Update list of formal
11006         parameters.
11007         (Arm_relocate_functions::xpc25): New method definition.
11008         (Arm_relocate_functions::arm_branch_common): Move method defintion
11009         out from class definition.  Use stubs for mode-switching and extending
11010         branch ranges.
11011         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
11012         specially.  Change code to enable use of stubs in ARM branches.
11013
11014 2009-11-10  Doug Kwan  <dougkwan@google.com>
11015
11016         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
11017         in method declaration.
11018         (Target_arm::relocate_stub): New method declaration.
11019         (Target_arm::default_target): Change to return a pointer instead of
11020         a const reference.
11021         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
11022         Target_arm::default_target.
11023         (Arm_Relobj::do_relocate_sections): Remove options paramater in
11024         method definition.
11025         (Target_arm::relocate_section): Adjust view.
11026         (Target_arm::relocate_stub): New method definition.
11027
11028 2009-11-10  Doug Kwan  <dougkwan@google.com>
11029
11030         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
11031         a format warning.
11032         * incremental.cc (open_incremental_binary): Initialized local
11033         variables to avoid warnings.
11034         * object.cc (make_elf_object): Ditto.
11035         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
11036         a format warning.
11037
11038 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
11039
11040         PR gold/10930
11041         * testsuite/plugin_test.c: Include "config.h".
11042
11043 2009-11-09  Doug Kwan  <dougkwan@google.com>
11044
11045         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
11046         (arm_symbol_value): Remove.
11047         (Arm_relocate_functions::arm_branch_common,
11048         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
11049         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
11050         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
11051         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
11052         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
11053         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
11054         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
11055         Arm_relocate_functions::thm_mobw_abs_nc,
11056         Arm_relocate_functions::thm_mov_abs,
11057         Arm_relocate_functions::movw_prel_nc,
11058         Arm_relocate_functions::thm_movt_abs,
11059         Arm_relocate_functions::movt_prel,
11060         Arm_relocate_functions::thm_movw_prel_nc,
11061         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
11062         (Target_arm::Relocate::relocate): Only decompose address into two
11063         parts if relocation type uses the thumb-bit and pass the actual
11064         bit instead of a flag indicating that the thumb-bit is used.  Adjust
11065         calls to methods in Arm_relocate_functions for this change.
11066
11067 2009-11-08  Ian Lance Taylor  <iant@google.com>
11068
11069         PR 10925
11070         * reloc.cc: Instantiate
11071         Sized_relobj::initialize_input_to_output_maps and
11072         Sized_relobj:free_input_to_output_maps.
11073
11074 2009-11-06  Ian Lance Taylor  <iant@google.com>
11075
11076         PR 10876
11077         * defstd.cc (in_segment): Set only_if_ref true for "end".
11078
11079 2009-11-06  Doug Kwan  <dougkwan@google.com>
11080
11081         * arm.cc (class Reloc_stub): Correct a comment.
11082         (Target_arm::Target_arm): Initialize arm_input_section_map_.
11083         (Target_arm::scan_section_for_stubs): New method declaration.
11084         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
11085         Change methods from private to protected.
11086         (Target_arm::do_may_relax): New method definition.
11087         (Target_arm::do_relax, Target_arm::group_sections,
11088         Target_arm::scan_reloc_for_stub,
11089         Target_arm::scan_reloc_section_for_stubs): New method declarations.
11090         (Target_arm::arm_input_section_map_): New data member declaration.
11091         (Target_arm::scan_reloc_for_stub,
11092         Target_arm::scan_reloc_section_for_stubs,
11093         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
11094         Target_arm::do_relax): New method definitions.
11095
11096 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
11097
11098         * configure.ac: Check for (struct stat)::st_mtim
11099         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
11100         * config.in: Regenerate.
11101         * configure: Regenerate.
11102
11103 2009-11-05  Ian Lance Taylor  <iant@google.com>
11104
11105         PR 10910
11106         * output.cc (Output_segment::add_output_section): Add missing
11107         return statement.
11108
11109 2009-11-04  Ian Lance Taylor  <iant@google.com>
11110
11111         PR 10880
11112         * object.h (class Object): Add is_needed and set_is_needed
11113         methods.  Add is_needed_ field.  Make bool fields into bitfields.
11114         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
11115         defined in a dynamic object and referenced by a regular object,
11116         set is_needed for the dynamic object.
11117         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
11118         if the file is marked with as_needed and it is not needed.
11119
11120 2009-11-04  Ian Lance Taylor  <iant@google.com>
11121
11122         PR 10887
11123         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
11124         tags if data is discarded by linker script.
11125         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11126         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11127         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11128         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11129
11130 2009-11-04  Ian Lance Taylor  <iant@google.com>
11131
11132         * layout.cc (Layout::get_output_section): Add is_interp and
11133         is_dynamic_linker_section parameters.  Change all callers.
11134         (Layout::choose_output_section): Likewise.
11135         (Layout::make_output_section): Likewise.
11136         (Layout::add_output_section_data): Add is_dynamic_linker_section
11137         parameter.  Change all callers.
11138         * layout.h (class Layout): Update declarations.
11139         * output.h (class Output_section): Add is_interp, set_is_interp,
11140         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
11141         Add is_interp_, is_dynamic_linker_section_ fields.  Change
11142         generate_code_fills_at_write_ to a bitfield.
11143         * output.cc (Output_section::Output_sections): Initialize new
11144         fields.
11145         (Output_segment::add_output_section): Add do_sort parameter.
11146         Change all callers.
11147
11148 2009-11-03  Ian Lance Taylor  <iant@google.com>
11149
11150         PR 10860
11151         * options.h (class General_options): Add --warn-common.
11152         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
11153         merging two common symbols.
11154         (Symbol_table::should_override): Handle --warn-common when merging
11155         a common symbol with a defined symbol.  Use report_resolve_problem
11156         for multiple definitions.
11157         (Symbol_table::report_resolve_problem): New function.
11158         * symtab.h (class Symbol_table): Declare report_resolve_problem.
11159
11160 2009-11-03  Doug Kwan  <dougkwan@google.com>
11161
11162         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
11163         stub_factory_.
11164         (Target_arm::stub_factory): New method definition.
11165         (Target_arm::new_arm_input_section,
11166         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
11167         Target_arm::reloc_uses_thumb_bit): New method declarations.
11168         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
11169         New type definitions.
11170         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
11171         member declarations.
11172         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
11173         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
11174         New method definitions.
11175
11176 2009-11-03  Ian Lance Taylor  <iant@google.com>
11177
11178         * options.h (class General_options): Add --warn_constructors.
11179
11180 2009-11-03  Ian Lance Taylor  <iant@google.com>
11181
11182         PR 10893
11183         * defstd.cc (in_section): Add entries for __rel_iplt_start,
11184         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
11185
11186 2009-11-03  Ian Lance Taylor  <iant@google.com>
11187
11188         PR 10895
11189         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
11190         --msgid-bugs-address.
11191         (install-pdf): New target.
11192         (install-data_yes): Look up one directory to find mkinstalldirs.
11193
11194 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
11195
11196         * po/Make-in (.po.gmo): Don't generate .gmo files in source
11197         tree.
11198
11199 2009-10-30  Doug Kwan  <dougkwan@google.com>
11200
11201         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
11202
11203 2009-10-30  Doug Kwan  <dougkwan@google.com>
11204
11205         * arm.cc (Stub_addend_reader): New struct template definition
11206         and partial specializations.
11207         (Stub_addend_reader::operator()): New method definition for a
11208         partially specialized template.
11209
11210 2009-10-30  Doug Kwan  <dougkwan@google.com>
11211
11212         * arm.cc (Arm_relobj::processor_specific_flags): New method
11213         definition.
11214         (Arm_relobj::do_read_symbols): New method declaration.
11215         (Arm_relobj::processor_specific_flags_): New data member declaration.
11216         (Arm_dynobj): New class definition.
11217         (Target_arm::do_finalize_sections): Add input_objects parameter.
11218         (Target_arm::do_adjust_elf_header): New method declaration.
11219         (Target_arm::are_eabi_versions_compatible,
11220         (Target_arm::merge_processor_specific_flags): New method declaration.
11221         (Target_arm::do_make_elf_object): New overloaded method definitions
11222         and declaration.
11223         (Arm_relobj::do_read_symbols): New method definition.
11224         (Arm_dynobj::do_read_symbols): Ditto.
11225         (Target_arm::do_finalize_sections): Add input_objects parameters.
11226         Merge processor-specific flags from all input objects.
11227         (Target_arm::are_eabi_versions_compatible,
11228         Target_arm::merge_processor_specific_flags,
11229         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
11230         New method definitions.
11231         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
11232         Input_objects pointer type parameter.
11233         * layout.cc (Layout::finalize): Pass input objects to target's.
11234         finalize_sections function.
11235         * output.cc (Output_file_header::do_sized_write): Set ELF file
11236         header's processor-specific flags.
11237         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
11238         Input_objects pointer type parameter.
11239         * sparc.cc (Target_sparc::do_finalize_sections): Same.
11240         * target.h (Input_objects): New forward class declaration.
11241         (Target::processor_specific_flags,
11242         Target::are_processor_specific_flags_sect): New method definitions.
11243         (Target::finalize_sections): Add input_objects parameter.
11244         (Target::Target): Initialize processor_specific_flags_ and
11245         are_processor_specific_flags_set_.
11246         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
11247         parameter.
11248         (Target::set_processor_specific_flags): New method definition.
11249         (Target::processor_specific_flags_,
11250         Target::are_processor_specific_flags_set_): New data member
11251         declarations.
11252         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
11253         Input_objects pointer type parameter.
11254
11255 2009-10-30  Doug Kwan  <dougkwan@google.com>
11256
11257         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
11258
11259 2009-10-28  Ian Lance Taylor  <iant@google.com>
11260
11261         * object.h (class Relobj): Drop options parameter from
11262         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
11263         do_scan_relocs, do_relocate.  Change all callers.
11264         (class Sized_relobj): Drop options parameters from
11265         do_gc_process_relocs, do_scan_relocs, do_relocate,
11266         do_relocate_sections, relocate_sections, emit_relocs_scan,
11267         emit_relocs_scan_reltype.  Change all callers.
11268         (struct Relocate_info): Remove options field and all references to
11269         it.
11270         * reloc.h (class Read_relocs): Remove options constructor
11271         parameter and options_ field.  Change all callers.
11272         (class Gc_process_relocs, class Scan_relocs): Likewise.
11273         (class Relocate_task): Likewise.
11274         * target-reloc.h (scan_relocs): Remove options parameter.  Change
11275         all callers.
11276         (scan_relocatable_relocs): Likewise.
11277         * target.h (class Sized_target): Remove options parameter from
11278         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
11279         all callers.
11280         * gc.h (gc_process_relocs): Remove options parameter.  Change all
11281         callers.
11282         * arm.cc: Update functions to remove options parameters.
11283         * i386.cc: Likewise.
11284         * powerpc.cc: Likewise.
11285         * sparc.cc: Likewise.
11286         * x86_64.cc: Likewise.
11287         * testsuite/testfile.cc: Likewise.
11288
11289 2009-10-28  Doug Kwan  <dougkwan@google.com>
11290
11291         * arm.cc (Arm_relobj): New class definition.
11292         (Arm_relobj::scan_sections_for_stubs,
11293         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
11294         New method definitions.
11295
11296 2009-10-28  Cary Coutant  <ccoutant@google.com>
11297
11298         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
11299         (Plugin::cleanup_done_): New member.
11300         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
11301         (Plugin_manager::cleanup_done_): Remove.
11302         (Plugin_manager::add_input_file): Edit error message.
11303         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
11304         (Plugin_manager::cleanup): Remove use of cleanup_done_.
11305
11306 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
11307
11308         * fileread.cc: (File_read::View::~View): Use the new
11309         data_ownership_ filed.
11310         (File_read::~File_read): Dispose the new whole_file_view_.
11311         (File_read::open): Mmap the whole file if needed.
11312         (File_read::open): Use whole_file_view_ instead of contents_.
11313         (File_read::find_view): Use whole_file_view_ if applicable.
11314         (File_read::do_read): Use whole_file_view_ instead of contents_.
11315         (File_read::make_view): Use whole_file_view_ instead of contents_,
11316         update File_read::View::View call.
11317         (File_read::find_or_make_view): Update File_read::View::View
11318         call.
11319         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
11320         remove contents_
11321         (File_read::View::Data_ownership): New enum.
11322         (File_read::View::View): Replace bool mapped_ with Data_ownership
11323         argument.
11324         (File_read::View::mapped_): Remove (replaced by data_ownership_).
11325         (File_read::View::data_ownership_): New field.
11326         (File_read::contents_): Remove (replaced by whole_file_view_).
11327         (File_read::whole_file_view_): New field.
11328         * options.h (class General_options): Add --keep-files-mapped.
11329
11330 2009-10-27  Cary Coutant  <ccoutant@google.com>
11331
11332         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
11333         * testsuite/Makefile.am (plugin_test_5): New test case.
11334         * testsuite/Makefile.in: Regenerate.
11335
11336 2009-10-25  Doug Kwan  <dougkwan@google.com>
11337
11338         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
11339         from private to protected to allow access by child class.
11340         (Sized_relobj::do_relocate_sections): New method declaration.
11341         (Sized_relobj::relocate_sections): Virtualize.
11342         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
11343         Sized_relobj::relocate_sections.  Instantiate template explicitly
11344         for different target sizes and endianity.
11345
11346 2009-10-24  Doug Kwan  <dougkwan@google.com>
11347
11348         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
11349         (Arm_input_section::as_arm_input_section): New method.
11350         (Arm_output_section): New class definition.
11351         (Arm_output_section::create_stub_group,
11352         Arm_output_section::group_sections): New method definitions.
11353
11354 2009-10-22  Doug Kwan  <dougkwan@google.com>
11355
11356         * arm.cc (Arm_input_section): New class definition.
11357         (Arm_input_section::init, Arm_input_section:do_write,
11358         Arm_input_section::set_final_data_size,
11359         Arm_input_section::do_reset_address_and_file_offset): New method
11360         definitions.
11361
11362 2009-10-21  Doug Kwan  <dougkwan@google.com>
11363
11364         * arm.cc (Stub_table, Arm_input_section): New forward class
11365         declarations.
11366         (Stub_table): New class defintion.
11367         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
11368         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
11369         New method definition.
11370
11371 2009-10-21  Doug Kwan  <dougkwan@google.com>
11372
11373         * arm.cc: Update copyright comments.
11374         (Target_arm): New forward class template declaration.
11375         (Arm_address): New type.
11376         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
11377         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
11378         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
11379         constants.
11380         (Insn_template): Same.
11381         (DEF_STUBS): New macro.
11382         (Stub_type): New enum type.
11383         (Stub_template): New class definition.
11384         (Stub): Same.
11385         (Reloc_stub): Same.
11386         (Stub_factory): Same.
11387         (Target_arm::Target_arm): Initialize may_use_blx_ and
11388         should_force_pic_veneer_.
11389         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
11390         Target_arm::should_force_pic_veneer,
11391         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
11392         Target_arm::using_thumb_only, Target_arm:;default_target): New
11393         method defintions.
11394         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
11395         New data member declarations.
11396         (Insn_template::size, Insn_template::alignment): New method defintions.
11397         (Stub_template::Stub_template): New method definition.
11398         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
11399         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
11400         (Stub_factory::Stub_factory): New method definition.
11401         * gold.h (string_hash): New template.
11402         * output.h (Input_section_specifier::hash_value): Use
11403         gold::string_hash.
11404         (Input_section_specifier::string_hash): Remove.
11405         * stringpool.cc (Stringpool_template::string_hash): Use
11406         gold::string_hash.
11407
11408 2009-10-20  Doug Kwan  <dougkwan@google.com>
11409
11410         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
11411         symbols of relaxed input sections.
11412         * output.h (Output_section::find_relaxed_input_section): Make
11413         method public.
11414
11415 2009-10-16  Doug Kwan  <dougkwan@google.com>
11416
11417         * dynobj.cc (Versions::Versions): Initialize version_script_.
11418         Only insert base version symbol definition for a shared object
11419         if version script defines any version versions.
11420         (Versions::define_base_version): New method definition.
11421         (Versions::add_def): Check that base version is not needed.
11422         (Versions::add_need): Define base version lazily.
11423         * dynobj.h (Versions::define_base_version): New method declaration.
11424         (Versions::needs_base_version_): New data member declaration.
11425         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
11426         (check_DATA): Add no_version_test.stdout.
11427         (libno_version_test.so, no_version_test.o no_version_test.stdout):
11428         New make rules.
11429         * testsuite/Makefile.in: Regenerate.
11430         * testsuite/no_version_test.c: New file.
11431         * testsuite/no_version_test.sh: Ditto.
11432
11433 2009-10-16  Doug Kwan  <dougkwan@google.com>
11434
11435         * expression.cc (class Segment_start_expression): New class definition.
11436         (Segment_start_expression::value): New method definition.
11437         (script_exp_function_segment_start): Return a new
11438         Segment_start_expression.
11439         * gold/script-c.h (script_saw_segment_start_expression): New function
11440         prototype.
11441         * script-sections.cc (Script_sections::Script_sections): Initialize
11442         SAW_SEGMENT_START_EXPRESSION_ to false.
11443         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
11444         and -Tbbs options to specify section addresses if given in
11445         command line and no SEGMENT_START expression is seen in a script.
11446         * script-sections.h (Script_sections::saw_segment_start_expression,
11447         Script_sections::set_saw_segment_start_expression): New method
11448         definition.
11449         (Script_sections::saw_segment_start_expression_): New data member
11450         declaration.
11451         * script.cc (script_saw_segment_start_expression): New function.
11452         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
11453         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
11454         script_test_7.sh and script_test_8.sh.
11455         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
11456         script_test_8.stdout.
11457         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
11458         (script_test_6, script_test_6.stdout, script_test_7,
11459         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
11460         * Makefile.in: Regenerate.
11461         * testsuite/script_test_6.sh: New file.
11462         * testsuite/script_test_6.t: Same.
11463         * testsuite/script_test_7.sh: Same.
11464         * testsuite/script_test_7.t: Same.
11465         * testsuite/script_test_8.sh: Same.
11466
11467 2009-10-16  Doug Kwan  <dougkwan@google.com>
11468
11469         * output.cc (Output_segment::set_section_list_address): Cast
11470         expressions to unsigned long long type to avoid format warnings.
11471
11472 2009-10-15  Ian Lance Taylor  <iant@google.com>
11473
11474         * script.cc (Script_options::add_symbol_assignment): Always add a
11475         dot assignment to script_sections_.
11476         * script-sections.cc (Script_sections::add_dot_assignment):
11477         Initialize if necessary.
11478
11479         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
11480         program headers with no load segment if there is a linker script.
11481
11482         * layout.cc (Layout::set_segment_offsets): Align the file offset
11483         to the segment aligment for -N or -n with no load segment.
11484         * output.cc (Output_segment::add_output_section): Don't crash if
11485         the first section is a TLS section.
11486         (Output_segment::set_section_list_addresses): Print an error
11487         message if the address moves backward in a linker script.
11488         * script-sections.cc
11489         (Output_section_element_input::set_section_addresses): Don't
11490         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
11491         (Orphan_output_section::set_section_addresses): Likewise.
11492
11493 2009-10-15  Doug Kwan  <dougkwan@google.com>
11494
11495         * layout.cc (Layout::finish_dynamic_section): Generate tags
11496         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
11497         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
11498         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
11499
11500 2009-10-14  Ian Lance Taylor  <iant@google.com>
11501
11502         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
11503         fields.
11504         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
11505         data_shdr fields of relinfo.
11506         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
11507         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
11508         R_386_TLS_LDO_32, adjust based on section flags.
11509         (Target_i386::Relocate::fix_up_ldo): Remove.
11510
11511 2009-10-13  Ian Lance Taylor  <iant@google.com>
11512
11513         Add support for -pie.
11514         * options.h (class General_options): Add -pie and
11515         --pic-executable.
11516         (General_options::output_is_position_independent): Test -pie.
11517         (General_options::output_is_executable): Return true if not shared
11518         and not relocatable.
11519         (General_options::output_is_pie): Remove.
11520         * options.cc (General_options::finalize): Reject incompatible uses
11521         of -pie.
11522         * gold.cc (queue_middle_tasks): A -pie link is not static.
11523         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
11524         * symtab.cc (Symbol::final_value_is_known): Return false if
11525         output_is_position_independent.
11526         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
11527         output_is_position_independent.
11528         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
11529         output_is_position_independent.
11530         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
11531         output_is_position_independent.
11532         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
11533         two_file_pie_test.
11534         (basic_pie_test.o, basic_pie_test): New targets.
11535         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
11536         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
11537         (two_file_pie_test): New target.
11538         * testsuite/Makefile.in: Rebuild.
11539         * README: Remove note saying that -pie is not supported.
11540
11541 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
11542
11543         * options.h (class General_options): Add -init and -fini.
11544         * layout.cc (Layout::finish_dynamic_section): Emit
11545         given init and fini functions.
11546
11547 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
11548
11549         * gc.h (gc_process_relocs): Check if icf is enabled using new
11550         function.
11551         * gold.cc (queue_initial_tasks): Likewise.
11552         (queue_middle_tasks): Likewise.
11553         * object.cc (do_layout): Likewise.
11554         * symtab.cc (is_section_folded): Likewise.
11555         * main.cc (main): Likewise.
11556         * reloc.cc (Read_relocs::run): Likewise.
11557         (Sized_relobj::do_scan_relocs): Likewise.
11558         * icf.cc (is_function_ctor_or_dtor): New function.
11559         (Icf::find_identical_sections): Check if function is ctor or dtor when
11560         safe icf is chosen.
11561         * options.h (General_options::icf): Change option to be an enum.
11562         (Icf_status): New enum.
11563         (icf_enabled): New method.
11564         (icf_safe_folding): New method.
11565         (set_icf_status): New method.
11566         (icf_status_): New variable.
11567         * (options.cc) (General_options::finalize): Set icf_status_.
11568         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
11569         icf_test and icf_keep_unique_test to use the --icf enum flag.
11570         * testsuite/icf_safe_test.sh: New file.
11571         * testsuite/icf_safe_test.cc: New file.
11572
11573 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
11574
11575         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
11576         includes to gc.h and icf.h.
11577         * arm.cc: Include gc.h.
11578         * gold.cc: Likewise.
11579         * i386.cc: Likewise.
11580         * powerpc.cc: Likewise.
11581         * sparc.cc: Likewise.
11582         * x86_64.cc: Likewise.
11583         * gc.h: Include icf.h.
11584
11585 2009-10-11  Ian Lance Taylor  <iant@google.com>
11586
11587         * plugin.cc: Include "gold.h" before other header files.
11588
11589 2009-10-10  Chris Demetriou  <cgd@google.com>
11590
11591         * options.h (Input_file_argument::Input_file_type): New enum.
11592         (Input_file_argument::is_lib_): Replace with...
11593         (Input_file_argument::type_): New member.
11594         (Input_file_argument::Input_file_argument): Take Input_file_type
11595         'type' rather than boolean 'is_lib' as second argument.
11596         (Input_file_argument::is_lib): Use type_.
11597         (Input_file_argument::is_searched_file): New function.
11598         (Input_file_argument::may_need_search): Handle is_searched_file.
11599         * options.cc (General_options::parse_library): Support -l:filename.
11600         (General_options::parse_just_symbols): Update for Input_file_argument
11601         changes.
11602         (Command_line::process): Likewise.
11603         * archive.cc (Archive::get_file_and_offset): Likewise.
11604         * plugin.cc (Plugin_manager::release_input_file): Likewise.
11605         * script.cc (read_script_file, script_add_file): Likewise.
11606         * fileread.cc (Input_file::Input_file): Likewise.
11607         (Input_file::will_search_for): Handle is_searched_file.
11608         (Input_file::open): Likewise.
11609         * readsyms.cc (Read_symbols::get_name): Likewise.
11610         * testsuite/Makefile.am (searched_file_test): New test.
11611         * testsuite/Makefile.in: Regenerate.
11612         * testsuite/searched_file_test.cc: New file.
11613         * testsuite/searched_file_test_lib.cc: New file.
11614
11615 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11616             Ian Lance Taylor  <iant@google.com>
11617
11618         * descriptor.cc: Include <cstdio> and "binary-io.h".
11619         (Descriptors::open): Open the files in binary mode always.
11620         * script.cc (Lex::get_token): Treat \r as whitespace.
11621
11622 2009-10-09  Ian Lance Taylor  <iant@google.com>
11623
11624         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
11625
11626 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11627             Ian Lance Taylor  <iant@google.com>
11628
11629         * configure.ac: Check for readv function also.
11630         * fileread.cc (readv): Define if not HAVE_READV.
11631         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
11632         does not exist.
11633         * config.in: Regenerate.
11634         * configure: Regenerate.
11635
11636 2009-10-09  Doug Kwan  <dougkwan@google.com>
11637
11638         * layout.cc (Layout::make_output_section): Call target hook to make
11639         ordinary output section.
11640         (Layout::finalize): Adjust parameter list of call the
11641         Target::may_relax().
11642         * layout.h (class Layout::section_list): New method.
11643         * merge.h (Output_merge_base::entsize): Change visibility to public.
11644         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11645         New methods.
11646         (Output_merge_string::do_is_string): New method.
11647         * object.cc (Sized_relobj::do_setup): renamed from
11648         Sized_relobj::set_up.
11649         * object.h (Sized_relobj::adjust_shndx,
11650         Sized_relobj::initializ_input_to_output_maps,
11651         Sized_relobj::free_input_to_output_maps): Change visibilities to
11652         protected.
11653         (Sized_relobj::setup): Virtualize.
11654         (Sized_relobj::do_setup): New method declaration.
11655         (Sized_relobj::invalidate_section_offset,
11656         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11657         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11658         * options.cc (parse_int): New function.
11659         * options.h (parse_int): New declaration.
11660         (DEFINE_int): New macro.
11661         (stub_group_size): New option.
11662         * output.cc (Output_section::Output_section): Initialize memebers
11663         merge_section_map_, merge_section_by_properties_map_,
11664         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11665         (Output_section::add_input_section): Handled deferred code-fill
11666         generation and remove an old comment.
11667         (Output_section::add_relaxed_input_section): New method definition.
11668         (Output_section::add_merge_input_section): Use merge section by
11669         properties map to speed to search.  Update merge section maps
11670         as appropriate.
11671         (Output_section::build_relaxation_map): New method definition.
11672         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11673         Same.
11674         (Output_section::relax_input_section): Renamed to
11675         Output_section::convert_input_sections_to_relaxed_sections and change
11676         interface to take a vector of pointers to relaxed sections.
11677         (Output_section::find_merge_section,
11678         Output_section::find_relaxed_input_section): New method definitions.
11679         (Output_section::is_input_address_mapped,
11680         Output_section::output_offset, Output_section::output_address):
11681         Use output section data maps to speed up searching.
11682         (Output_section::find_starting_output_address): Add comments.
11683         (Output_section::do_write,
11684         Output_section::write_to_postprocessing_buffer): Do code-fill
11685         generation as appropriate.
11686         (Output_section::get_input_sections): Invalidate relaxed input section
11687         map.
11688         (Output_section::restore_states): Adjust type of checkpoint .
11689         Invalidate relaxed input section map.
11690         * output.h (Output_merge_base): New class declaration.
11691         (Input_section_specifier): New class defintion.
11692         (class Output_relaxed_input_section) Change base class to
11693         Output_section_data_build.
11694         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11695         base class initializer.
11696         (Output_section::add_relaxed_input_section): New method declaration.
11697         (Output_section::Input_section): Change visibility to protected.
11698         (Output_section::Input_section::relobj,
11699         Output_section::Input_section::shndx): Handle relaxed input sections.
11700         Output_section::input_sections) Change visibility to protected.  Also
11701         define overload to return a non-const pointer.
11702         (Output_section::Merge_section_properties): New class defintion.
11703         (Output_section::Merge_section_by_properties_map,
11704         Output_section::Output_section_data_by_input_section_map,
11705         Output_section::Relaxation_map): New types.
11706         (Output_section::relax_input_section): Rename method to
11707         Output_section::convert_input_sections_to_relaxed_sections and change
11708         interface to take a vector of relaxed section pointers.
11709         (Output_section::find_merge_section,
11710         Output_section::find_relaxed_input_section,
11711         Output_section::build_relaxation_map,
11712         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11713         New method declarations.
11714         (Output_section::merge_section_map_
11715         Output_section::merge_section_by_properties_map_,
11716         Output_section::relaxed_input_section_map_,
11717         Output_section::is_relaxed_input_section_map_valid_,
11718         Output_section::generate_code_fills_at_write_): New data members.
11719         * script-sections.cc
11720         (Output_section_element_input::set_section_addresses): Call
11721         current_data_size and addralign methods of relaxed input sections.
11722         (Orphan_output_section::set_section_addresses): Call current_data_size
11723         and addralign methods of relaxed input sections.
11724         * symtab.cc (Symbol_table::compute_final_value): Extract template
11725         from the body of Symbol_table::sized_finalize_symbol.
11726         (Symbol_table::sized_finalized_symbol): Call
11727         Symbol_table::compute_final_value.
11728         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11729         (Symbol_table::compute_final_value): New templated method declaration.
11730         * target.cc (Target::do_make_output_section): New method defintion.
11731         * target.h (Target::make_output_section): New method declaration.
11732         (Target::relax): Add more parameters for input objects, symbol table
11733         and layout.  Adjust call to do_relax.
11734         (Target::do_make_output_section): New method declaration.
11735         (Target::do_relax): Add parameters for input objects, symbol table
11736         and layout.
11737
11738 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11739
11740         * pread.c: Include stdio.h.
11741
11742 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11743
11744         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11745         defined.
11746
11747 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11748
11749         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11750         Change read_shndx type to unsigned int.
11751         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11752         int.
11753         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11754         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11755         Change read_shndx type to unsigned int.
11756         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11757         int.
11758         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11759         * layout.cc (Layout::create_symtab_sections): Cast the result of
11760         local_symcount * symsize to off_t in the gold_assert.
11761
11762 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11763
11764         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11765         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11766         R_ARM_BASE_ABS.
11767         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11768         (Arm_relocate_functions::thm_abs5): New function.
11769         (Arm_relocate_functions::abs12): New function.
11770         (Arm_relocate_functions::abs16): New function.
11771         (Arm_relocate_functions::base_abs): New function.
11772         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11773         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11774         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11775         R_ARM_BASE_ABS.
11776         (Scan::global): Likewise.
11777         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11778         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11779         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11780         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11781         R_ARM_BASE_ABS.
11782
11783 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11784
11785         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11786         (Arm_relocate_functions::movt_prel): New function.
11787         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11788         (Arm_relocate_functions::thm_movt_prel): New function.
11789         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11790         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11791         (Scan::global, Relocate::relocate): Likewise.
11792         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11793
11794 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11795
11796         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11797         Incremental_checker.
11798         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11799         unsigned int.
11800         (class Incremental_inputs_header): New class.
11801         (Incremental_inputs_header_writer): Edit comment.
11802         (Incremental_inputs_entry): New class.
11803         (Incremental_inputs_entry_writer): Edit comment.
11804         (Sized_incremental_binary::do_find_incremental_inputs_section):
11805         Add *strtab_shndx parameter, fill it.
11806         (Sized_incremental_binary::do_check_inputs): New method.
11807         (Incremental_checker::can_incrementally_link_output_file): Use
11808         Sized_incremental_binary::check_inputs.
11809         (Incremental_inputs::report_command_line): Save command line in
11810         command_line_.
11811         * incremental.h:
11812         (Incremental_binary::find_incremental_inputs_section): New
11813         method.
11814         (Incremental_binary::do_find_incremental_inputs_section): Add
11815         strtab_shndx parameter.
11816         (Incremental_binary::do_check_inputs): New pure virtual method.
11817         (Sized_incremental_binary::do_check_inputs): Declare.
11818         (Incremental_checker::Incremental_checker): Add incremental_inputs
11819         parameter, use it to initialize incremental_inputs_.
11820         (Incremental_checker::incremental_inputs_): New field.
11821         (Incremental_checker::command_line): New method.
11822         (Incremental_checker::inputs): New method.
11823         (Incremental_checker::command_line_): New field.
11824
11825 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11826
11827         * incremental.cc: Include <cstdarg> and "target-select.h".
11828         (vexplain_no_incremental): New function.
11829         (explain_no_incremental): New function.
11830         (Incremental_binary::error): New method.
11831         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11832         method.
11833         (make_sized_incremental_binary): New function.
11834         (open_incremental_binary): New function.
11835         (can_incrementally_link_file): Add checks if output is ELF and has
11836         inputs section.
11837         * incremental.h: Include "elfcpp_file.h" and "output.h".
11838         (Incremental_binary): New class.
11839         (Sized_incremental_binary): New class.
11840         (open_incremental_binary): Declare.
11841         * object.cc (is_elf_object): Use
11842         elfcpp::Elf_recognizer::is_elf_file.
11843         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11844         * output.h (Output_file::filesize): New method.
11845
11846 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11847
11848         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11849         New function.
11850         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11851         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11852         function.
11853         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11854         function.
11855         (Arm_relocate_functions::movw_abs_nc): New function.
11856         (Arm_relocate_functions::movt_abs): New function.
11857         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11858         (Arm_relocate_functions::thm_movt_abs): New function.
11859         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11860         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11861         (Scan::global): Likewise.
11862         (Relocate::relocate): Likewise.
11863         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11864
11865 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11866
11867         * arm.cc (Arm_relocate_functions::got_prel) New function.
11868         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11869         (Relocate::relocate): Likewise.
11870         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11871
11872 2009-10-06  Ian Lance Taylor  <iant@google.com>
11873
11874         * options.h (class General_options): Define
11875         split_stack_adjust_size parameter.
11876         * object.h (class Object): Add uses_split_stack_ and
11877         has_no_split_stack_ fields.  Add uses_split_stack and
11878         has_no_split_stack accessor functions.  Declare
11879         handle_split_stack_section.
11880         (class Reloc_symbol_changes): Define.
11881         (class Sized_relobj): Define Function_offsets.  Declare
11882         split_stack_adjust, split_stack_adjust_reltype, and
11883         find_functions.
11884         * object.cc (Object::handle_split_stack_section): New function.
11885         (Sized_relobj::do_layout): Call handle_split_stack_section.
11886         * dynobj.cc (Sized_dynobj::do_layout): Call
11887         handle_split_stack_section.
11888         * reloc.cc (Sized_relobj::relocate_sections): Call
11889         split_stack_adjust for executable sections in split_stack
11890         objects.  Pass reloc_map to relocate_section.
11891         (Sized_relobj::split_stack_adjust): New function.
11892         (Sized_relobj::split_stack_adjust_reltype): New function.
11893         (Sized_relobj::find_functions): New function.
11894         * target-reloc.h: Include "object.h".
11895         (relocate_section): Add reloc_symbol_changes parameter.  Change
11896         all callers.
11897         * target.h (class Target): Add calls_non_split method.  Declare
11898         do_calls_non_split virtual method.  Declare match_view and
11899         set_view_to_nop.
11900         * target.cc: Include "elfcpp.h".
11901         (Target::do_calls_non_split): New function.
11902         (Target::match_view): New function.
11903         (Target::set_view_to_nop): New function.
11904         * gold.cc (queue_middle_tasks): Give an error if mixing
11905         split-stack and non-split-stack objects with -r.
11906         * i386.cc (Target_i386::relocate_section): Add
11907         reloc_symbol_changes parameter.
11908         (Target_i386::do_calls_non_split): New function.
11909         * x86_64.cc (Target_x86_64::relocate_section): Add
11910         reloc_symbol_changes parameter.
11911         (Target_x86_64::do_calls_non_split): New function.
11912         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11913         parameter.
11914         * powerpc.cc (Target_powerpc::relocate_section): Add
11915         reloc_symbol_changes parameter.
11916         * sparc.cc (Target_sparc::relocate_section): Add
11917         reloc_symbol_changes parameter.
11918         * configure.ac: Call AM_CONDITIONAL for the default target.
11919         * configure: Rebuild.
11920         * testsuite/Makefile.am (TEST_AS): New variable.
11921         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11922         (check_DATA): Add split_i386 and split_x86_64 files.
11923         (SPLIT_DEFSYMS): Define.
11924         (split_i386_[1234n].o): New targets.
11925         (split_i386_[124]): New targets.
11926         (split_i386_[1234r].stdout): New targets.
11927         (split_x86_64_[1234n].o): New targets.
11928         (split_x86_64_[124]): New targets.
11929         (split_x86_64_[1234r].stdout): New targets.
11930         (MOSTLYCLEANFILES): Add new executables.
11931         * testsuite/split_i386.sh: New file.
11932         * testsuite/split_x86_64.sh: New file.
11933         * testsuite/split_i386_1.s: New file.
11934         * testsuite/split_i386_2.s: New file.
11935         * testsuite/split_i386_3.s: New file.
11936         * testsuite/split_i386_4.s: New file.
11937         * testsuite/split_i386_n.s: New file.
11938         * testsuite/split_x86_64_1.s: New file.
11939         * testsuite/split_x86_64_2.s: New file.
11940         * testsuite/split_x86_64_3.s: New file.
11941         * testsuite/split_x86_64_4.s: New file.
11942         * testsuite/split_x86_64_n.s: New file.
11943         * testsuite/testfile.cc (Target_test): Update relocation_section
11944         function.
11945         * testsuite/Makefile.in: Rebuild.
11946
11947 2009-10-06  Ian Lance Taylor  <iant@google.com>
11948
11949         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11950         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11951         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11952         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11953         the address on ldo_addrs_.
11954         (Target_i386::Relocate::fix_up_ldo): New function.
11955
11956 2009-10-06   Rafael Espindola  <espindola@google.com>
11957
11958         * plugin.cc (add_input_library): New.
11959         (Plugin::load): Add add_input_library to tv.
11960         (Plugin_manager::add_input_file): Add the is_lib argument.
11961         (add_input_file): Update call to Plugin_manager::add_input_file.
11962         (add_input_library): New.
11963         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11964
11965 2009-09-30  Doug Kwan  <dougkwan@google.com>
11966
11967         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11968         symbol and call Symbol::may_need_copy_reloc to determine if
11969         a copy reloc is needed.
11970         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11971         nocopyreloc is given in command line.
11972         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11973         given in command line.
11974         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11975         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11976         of the removed Target_i386::may_need_copy_reloc.
11977         * options.h (copyreloc): New option with default value false.
11978         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11979         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11980         instead of the removed Target_powerpc::may_need_copy_reloc.
11981         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11982         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11983         instead of the removed Target_sparc::may_need_copy_reloc.
11984         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11985         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11986         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11987         instead of the removed Target_x86_64::may_need_copy_reloc.
11988
11989 2009-09-30  Ian Lance Taylor  <iant@google.com>
11990
11991         * object.h (class Object): Remove target_ field, and target,
11992         sized_target, and set_target methods.
11993         (Object::sized_target): Remove.
11994         (class Sized_relobj): Update declarations.  Remove sized_target.
11995         * object.cc (Sized_relobj::setup): Remove target parameter.
11996         Change all callers.
11997         (Input_objects::add_object): Don't do anything with the target.
11998         (make_elf_sized_object): Add punconfigured parameter.  Change all
11999         callers.  Set or test parameter target.
12000         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
12001         Change all callers.
12002         * parameters.cc (Parameters::set_target): Change parameter type to
12003         be non-const.
12004         (Parameters::default_target): Remove.
12005         (set_parameters_target): Change parameter type to be non-const.
12006         (parameters_force_valid_target): New function.
12007         (parameters_clear_target): New function.
12008         * parameters.h (class Parameters): Update declarations.  Remove
12009         default_target method.  Add sized_target and clear_target
12010         methods.  Change target_ to be non-const.
12011         (set_parameters_target): Update declaration.
12012         (parameters_force_valid_target): Declare.
12013         (parameters_clear_target): Declare.
12014         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
12015         as NULL if we aren't searching.
12016         (Add_symbols::run): Don't check for compatible target.
12017         * fileread.cc (Input_file::open_binary): Call
12018         parameters_force_valid_target.
12019         * gold.cc (queue_middle_tasks): Likewise.
12020         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
12021         set_target on object.
12022         * dynobj.h (class Sized_dynobj): Update declarations.
12023         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
12024         make_elf_object returns NULL.
12025         (Archive::include_member): Don't check whether object target is
12026         compatible.
12027         * output.cc (Output_section::add_input_section): Get target from
12028         parameters.
12029         (Output_section::relax_input_section): Likewise.
12030         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
12031         parameters.
12032         (Sized_relobj::do_scan_relocs): Likewise.
12033         (Sized_relobj::relocate_sections): Likewise.
12034         * resolve.cc (Symbol_table::resolve): Likewise.
12035         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
12036         parameter.  Change all callers.
12037         (Symbol_table::add_from_object): Get target from parameters.
12038         (Symbol_table::add_from_relobj): Don't check object target.
12039         (Symbol_table::add_from_dynobj): Likewise.
12040         (Symbol_table::define_special_symbol): Get target from
12041         parameters.
12042         * symtab.h (class Symbol_table): Update declaration.
12043         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
12044         parameter.  Change all callers.  Clear parameter target.
12045         (Binary_test): Test target here.
12046         * testsuite/object_unittest.cc (gold_testsuite): Remove
12047         target_test_pointer parameter.  Change all callers.
12048         (Object_test): Test target here.
12049
12050 2009-09-26  Ian Lance Taylor  <iant@google.com>
12051
12052         * testsuite/initpri1.c: Don't try to use constructor priorities if
12053         compiling with gcc before 4.3.
12054
12055 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
12056
12057         * testsuite/retain_symbols_file_test.sh (check_present): Change
12058         output file name to retain_symbols_file_test.stdout.
12059         (check_absent): Likewise.
12060
12061 2009-09-18  Craig Silverstein  <csilvers@google.com>
12062
12063         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
12064         * options.cc: Include <cerrno> and <fstream>.
12065         (General_options::finalize): Parse -retain-symbols-file tag.
12066         * options.h: New flag.
12067         (General_options): New method should_retain_symbol, new
12068         variable symbols_to_retain.
12069         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
12070         should_retain_symbol map.
12071         * testsuite/Makefile.am (retain_symbols_file_test): New test.
12072         * testsuite/Makefile.in: Regenerate.
12073         * testsuite/retain_symbols_file_test.sh: New file.
12074
12075 2009-09-18  Nick Clifton  <nickc@redhat.com>
12076
12077         * po/es.po: Updated Spanish translation.
12078
12079 2009-09-17  Doug Kwan  <dougkwan@google.com>
12080
12081         * debug.h (DEBUG_RELAXATION): New constant.
12082         (DEBUG_ALL): Add DEBUG_RELAXATION.
12083         (debug_string_to_enum): Add relaxation debug option.
12084         * layout.cc
12085         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
12086         Layout::Relaxation_debug_check::read_sections,
12087         Layout::Relaxation_debug_check::read_sections): New method definitions.
12088         (Layout::Layout): Initialize data members
12089         record_output_section_data_from_scrips_,
12090         script_output_section_data_list_ and relaxation_debug_check_.
12091         (Layout::save_segments, Layout::restore_segments,
12092         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12093         Layout::relaxation_loop_body): New method definitions.
12094         (Layout::finalize): Support relaxation.  Move section layout code to
12095         Layout::relaxation_loop_body.
12096         (Layout::set_asection_address_from_script): Move code for orphan
12097         section placement out.
12098         (Layout::place_orphan_sections_in_script): New method definition.
12099         * layout.h (Output_segment_headers, Output_file_header):
12100         New forward class declarations.
12101         (Layout::~Layout): Define.
12102         (Layout::new_output_section_data_from_script): New method definition.
12103         (Layout::place_orphan_sections_in_script): New method declaration.
12104         (Layout::Segment_states): New type declaration.
12105         (Layout::save_segments, Layout::restore_segments,
12106         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
12107         Layout::relaxation_loop_body): New method declarations.
12108         (Layout::Output_section_data_list): New type declaration.
12109         (Layout::Relaxation_debug_check): New class definition.
12110         (Layout::record_output_section_data_from_script_,
12111         Layout::script_output_section_data_list_, Layout::segment_states_,
12112         Layout::relaxation_debug_check_): New data members.
12113         * output.cc: (Output_section_headers::do_size): New method definition.
12114         (Output_section_headers::Output_section_headers): Move size
12115         computation to Output_section_headers::do_size.
12116         (Output_segment_headers::do_size): New method definition.
12117         (Output_file_header::Output_file_header): Move size computation to
12118         Output_file_header::do_size and call it.
12119         (Output_file_header::do_size): New method definition.
12120         (Output_data_group::Output_data_group): Adjust call to
12121         Output_section_data.
12122         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
12123         (Output_symtab_xindex::do_write): Add array bound check.
12124         (Output_section::Input_section::print_to_mapfile): Handle
12125         RELAXED_INPUT_SECTION_CODE.
12126         (Output_section::Output_section): Initialize data member checkpoint_.
12127         (Output_section::~Output_section): Delete checkpoint object pointed
12128         by checkpoint_.
12129         (Output_section::add_input_section): Always add an Input_section if
12130         relaxing.
12131         (Output_section::add_merge_input_section): Add assert.
12132         (Output_section::relax_input_section): New method definition.
12133         (Output_section::set_final_data_size): Set load address to zero for
12134         an unallocated section.
12135         (Output_section::do_address_and_file_offset_have_reset_values):
12136         New method definition.
12137         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
12138         Handle relaxed input section.
12139         (Output_section::sort_attached_input_sections): Checkpoint input
12140         section list lazily.
12141         (Output_section::get_input_sections): Change type of input_sections to
12142         list of Simple_input_section pointers.  Checkpoint input section list
12143         lazily.  Also handle relaxed input sections.
12144         (Output_section::add_input_section_for_script): Take a reference to
12145         a Simple_input_section object instead of Relobj pointer and section
12146         index as parameter.  Handle relaxed input sections.
12147         (Output_section::save_states, Output_section::restore_states): New
12148         method definitions.
12149         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
12150         (Output_data::is_data_size_fixed): New method definition.
12151         (Output_data::reset_addresss_and_file_offset): Do not reset data size
12152         if it is fixed.
12153         (Output_data::address_and_file_offset_have_reset_values): New method
12154         definition.
12155         (Output_data::do_address_and_file_offset_have_reset_values): New method
12156         definition.
12157         (Output_data::set_data_size): Check that data size is not fixed.
12158         (Output_data::fix_data_size): New method definition.
12159         (Output_data::is_data_size_fixed_): New data member.
12160         (Output_section_headers::set_final_data_size): New method definition.
12161         (Output_section_headers::do_size): New method declaration.
12162         (Output_segment_headers::set_final_data_size): New method definition.
12163         (Output_segment_headers::do_size): New method declaration.
12164         (Output_file_header::set_final_data_size)::New method definition.
12165         (Output_file_header::do_size)::New method declaration.
12166         (Output_section_data::Output_section_data): Add new parameter
12167         is_data_size_fixed and use it to fix data size.
12168         (Output_data_const::Output_data_const): Adjust call to base class
12169         constructor and fix data size.
12170         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
12171         base class constructor and fix data size.
12172         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
12173         base class constructor and fix data size.
12174         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
12175         class constructor and fix data size.
12176         (Output_data_group::set_final_data_size): New method definition.
12177         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
12178         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
12179         class constructor and fix data size.
12180         (Output_relaxed_input_section): New class definition.
12181         (Output_section::Simple_input_section): New class definition.
12182         (Output_section::get_input_sections): Adjust parameter list.
12183         (Output_section::add_input_section_for_script): Same.
12184         (Output_section::save_states, Output_section::restore_states,
12185         Output_section::do_address_and_file_offset_have_reset_values,
12186         (Output_section::Input_section::Input_section): Handle
12187         RELAXED_INPUT_SECTION_CODE.  Add new overload for
12188         Output_relaxed_input_section.
12189         (Output_section::Input_section::is_input_section,
12190         Output_section::Input_section::set_output_section): Handle relaxed
12191         input section.
12192         (Output_section::Input_section::is_relaxed_input_section,
12193         Output_section::Input_section::output_section_data,
12194         Output_section::Input_section::relaxed_input_section): New method
12195         definitions.
12196         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
12197         value.
12198         (Output_section::Input_section::u1_): Update comments.
12199         (Output_section::Input_section::u2_): Add new union member poris.
12200         (Output_section::Checkpoint_output_section): New classs definition.
12201         (Output_section::relax_input_section): New method declaration.
12202         (Output_section::checkpoint_): New data member.
12203         (Output_segment): Update comments.
12204         (Output_segment::Output_segment): Un-privatize copy constructor.
12205         (Output_segment::operator=): Un-privatize.
12206         * script-sections.cc (Output_section_element::Input_section_list):
12207         Change element type to Output_section::Simple_input_section.
12208         (Output_section_element_dot_assignment::set_section_addresses):
12209         Register output section data for relaxation clean up.
12210         (Output_data_exression::Output_data_expression): Adjust call to base
12211         constructor to fix data size.
12212         (Output_section_element_data::set_section_addresses): Register
12213         Output_data_expression object for relaxation clean up.
12214         (struct Input_section_info): Replace Relobj pointer and section index
12215         pair with Output_section::Simple_input_section and Convert struct to a
12216         class.
12217         (Input_section_sorter::operator()): Adjust access to
12218         Input_section_info data member to use accessors.
12219         (Output_section_element_input::set_section_addresses): Use layout
12220         parameter.  Adjust code to use Output_section::Simple_input_section
12221         and Input_secction_info classes.  Register filler for relaxation
12222         clean up.
12223         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
12224         and section index pair with Output_section::Simple_input_section
12225         class.  Adjust code accordingly.
12226         (Phdrs_element::release_segment): New method definition.
12227         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
12228         segment list.
12229         (Script_sections::release_segments): New method definition.
12230         * gold/script-sections.h (Script_sections::release_segments): New
12231         method declaration.
12232         * gold/target.h (Target::may_relax, Target::relax,
12233         Target::do_may_relax, Target::do_relax): New method definitions.
12234
12235 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
12236
12237         * arm.cc (has_signed_unsigned_overflow): New function.
12238         (Arm_relocate_functions::abs8): New function.
12239         (Target_arm::Scan::local): Handle R_ARM_ABS8.
12240         (Target_arm::Scan::global): Likewise.
12241         (Target_arm::relocate::relocate): Likewise.
12242         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12243         Likewise.
12244
12245 2009-09-16  Cary Coutant  <ccoutant@google.com>
12246
12247         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
12248         * testsuite/Makefile.in: Regenerate.
12249
12250 2009-09-11  Nick Clifton  <nickc@redhat.com>
12251
12252         * po/gold.pot: Updated by the Translation project.
12253
12254 2009-09-08  Cary Coutant  <ccoutant@google.com>
12255
12256         * output.cc (Output_file::open): Add execute permission to empty file.
12257         * testsuite/Makefile.am (permission_test): New test.
12258         * testsuite/Makefile.in: Regenerate.
12259
12260 2009-09-02  Ian Lance Taylor  <iant@google.com>
12261
12262         * output.cc (Output_file::resize): Call map_no_anonymous rather
12263         than map.
12264
12265 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
12266
12267         * gold.cc: Include "incremental.h".
12268         (queue_initial_tasks): Call Incremental_checker methods.
12269         * incremental.cc: Include "output.h".
12270         (Incremental_checker::can_incrementally_link_output_file): New
12271         method.
12272         * incremental.h (Incremental_checker): New class.
12273
12274         * output.cc (Output_file::open_for_modification): New method.
12275         (Output_file::map_anonymous): Changed return type to bool.  Record
12276         map in base_ field.
12277         (Output_file::map_no_anonymous): New method, broken out of map.
12278         (Output_file::map): Use map_no_anonymous and map_anonymous.
12279         * output.h (class Output_file): Update declarations.
12280
12281 2009-08-24  Cary Coutant  <ccoutant@google.com>
12282
12283         * options.h (Command_line::Pre_options): New class.
12284         (Command_line::pre_options): New member.
12285         * options.cc (gold::options::ready_to_register): New variable.
12286         (One_option::register_option): Do nothing if not registering options.
12287         Assert if same short option registered twice.
12288         (General_options::General_options): Turn off option registration when
12289         done constructing.
12290         (Command_line::Pre_options::Pre_options): New constructor.
12291
12292 2009-08-24  Cary Coutant  <ccoutant@google.com>
12293
12294         * options.h (General_options::no_keep_memory): Remove incorrect
12295         short option.
12296
12297 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12298
12299         * Makefile.am (am__skiplex, am__skipyacc): New.
12300         * Makefile.in: Regenerate.
12301
12302 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
12303
12304         * Makefile.am (AM_CPPFLAGS): Renamed from ...
12305         (INCLUDES): ... this.
12306         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
12307         (AM_CPPFLAGS): Renamed from ...
12308         (INCLUDE): ... this.
12309         * Makefile.in, testsuite/Makefile.in: Regenerate.
12310
12311         * Makefile.in: Regenerate.
12312         * aclocal.m4: Likewise.
12313         * config.in: Likewise.
12314         * configure: Likewise.
12315         * testsuite/Makefile.in: Likewise.
12316
12317         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12318         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
12319         * Makefile.in: Regenerate.
12320         * testsuite/Makefile.in: Regenerate.
12321
12322 2009-08-19  Cary Coutant  <ccoutant@google.com>
12323
12324         * resolve.cc (Symbol_table::resolve): Don't complain about defined
12325         symbols in shared libraries overridden by hidden or internal symbols
12326         in the main program.
12327
12328 2009-08-19  Chris Demetriou  <cgd@google.com>
12329
12330         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
12331         checking source file names in error messages.
12332
12333 2009-08-18  Doug Kwan  <dougkwan@google.com>
12334
12335         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
12336         an elcpp::Ehdr as parameter.  Adjust call to set_target.
12337         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
12338         an elfcpp::Ehdr as parameter.
12339         * object.cc (Object::set_target): Remove the version that looks up
12340         a target and sets it.
12341         (Sized_relobj::setup): Take a Target object instead of
12342         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
12343         (make_elf_sized_object): Find target and ask target to
12344         make an ELF object.
12345         * object.h: (Object::set_target): Remove the version that looks up
12346         a target and sets it.
12347         (Sized_relobj::setup): Take a Target object instead of
12348         an elfcpp:Ehdr as parameter.
12349         * target.cc: Include dynobj.h.
12350         (Target::do_make_elf_object_implementation): New.
12351         (Target::do_make_elf_object): New.
12352         * target.h (Target::make_elf_object): New template declaration.
12353         (Target::do_make_elf_object): New method declarations.
12354         (Target::do_make_elf_object_implementation): New template declaration.
12355
12356 2009-08-14  Ian Lance Taylor  <iant@google.com>
12357
12358         * gold.h (FUNCTION_NAME): Define.
12359         (gold_unreachable): Use FUNCTION_NAME.
12360
12361 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12362
12363         * icf.cc (Icf::find_identical_sections): Issue a warning when a
12364         symbol in the --keep-unique list is not found.
12365
12366 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
12367
12368         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
12369         been maked as --keep-unique.
12370         (Icf::unfold_section): New function.
12371         * icf.h (Icf::unfold_section): New function.
12372         * options.h (General_options::keep_unique): New option.
12373         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
12374         * testsuite/Makefile.in: Regenerate.
12375         * testsuite/icf_keep_unique_test.sh: New file.
12376         * testsuite/icf_keep_unique_test.cc: New file.
12377
12378 2009-08-12  Cary Coutant  <ccoutant@google.com>
12379
12380         PR 10471
12381         * resolve.cc (Symbol_table::resolve): Check for references from
12382         dynamic objects to hidden and internal symbols.
12383         * testsuite/Makefile.am (hidden_test.sh): New test.
12384         * testsuite/Makefile.in: Regenerate.
12385         * testsuite/hidden_test.sh: New script.
12386         * testsuite/hidden_test_1.c: New test source.
12387         * testsuite/hidden_test_main.c: New test source.
12388
12389 2009-08-11  Doug Kwan  <dougkwan@google.com>
12390
12391         * arm.cc: Update comments.
12392         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
12393         segment to locate the .ARM.exidx section if present.
12394
12395 2009-08-09  Doug Kwan  <dougkwan@google.com>
12396
12397         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
12398         patch.
12399
12400 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
12401         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
12402         compiler warnings.
12403
12404 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
12405
12406         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
12407         valid tls_segment only for non-debug-section relocations.
12408         * testsuite/Makefile.am: Add gc_tls_test.
12409         * testsuite/Makefile.in: Regenerate.
12410         * testsuite/gc_tls_test.cc: New file.
12411         * testsuite/gc_tls_test.sh: New file.
12412
12413 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
12414
12415         * icf.cc: New file.
12416         * icf.h: New file.
12417         * Makefile.am (CCFILES): Add icf.cc.
12418         (HFILES): Add icf.h
12419         * Makefile.in: Regenerate.
12420         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
12421         * gc.h (gc_process_relocs): Populate lists used by icf to contain
12422         section, symbol and addend information for the relocs.
12423         * gold.cc (queue_middle_tasks): Call identical code folding.
12424         * gold.h: Add defines for multimap.
12425         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
12426         to the call of finalize_local_symbols.
12427         * main.cc (main): Create object of class Icf.
12428         * object.cc (Sized_relobj::do_layout): Allow this function to be
12429         called twice during icf.
12430         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
12431         to sections marked as identical by icf.
12432         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
12433         when available.
12434         (Sized_relobj::do_section_entsize): New function.
12435         * object.h (Object::section_entsize): New function.
12436         (Object::do_section_entsize): New pure virtual function.
12437         (Relobj::finalize_local_symbols): Add new parameter.
12438         (Relobj::do_section_entsize): New function.
12439         * options.h (General_options::icf): New option.
12440         (General_options::icf_iterations): New option.
12441         (General_options::print_icf_sections): New option.
12442         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
12443         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
12444         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
12445         icf.
12446         * symtab.cc (Symbol_table::is_section_folded): New function.
12447         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
12448         to sections marked as identical by icf.
12449         * symtab.h (Symbol_table::set_icf): New function.
12450         (Symbol_table::icf): New function.
12451         (Symbol_table::is_section_folded): New function.
12452         (Symbol_table::icf_): New data member.
12453         * target-reloc.h (relocate_section): Ignore sections folded by icf.
12454         * testsuite/Makefile.am: Add commands to build icf_test.
12455         * testsuite/Makefile.in: Regenerate.
12456         * testsuite/icf_test.sh: New file.
12457         * testsuite/icf_test.cc: New file.
12458
12459 2009-07-24  Chris Demetriou  <cgd@google.com>
12460
12461         * layout.cc (is_compressible_debug_section): Fix incorrect
12462         comment about compressed section names.
12463
12464 2009-07-20  Ian Lance Taylor  <ian@airs.com>
12465
12466         PR 10419
12467         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
12468
12469 2009-07-16  Ian Lance Taylor  <iant@google.com>
12470
12471         PR 10400
12472         * layout.h: #include <map>.
12473         (class Kept_section): Change from struct to class.  Add accessors
12474         and setters.  Add section size to Comdat_group mapping.  Change
12475         Comdat_group to std::map.  Add is_comdat_ field.  Add
12476         linkonce_size field in union.
12477         (class Layout): Update declaration of find_or_add_kept_section.
12478         Don't declare find_kept_object.
12479         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
12480         parameter.  Add object, shndx, is_comdat, and is_group_name
12481         parameters.  Change all callers.  Adjust for new Kept_section.
12482         (Layout::find_kept_object): Remove.
12483         * object.cc (Sized_relobj::include_section_group): Update use of
12484         Kept_section.  Rename secnum to shndx.  Only record
12485         Kept_comdat_section if sections are the same size.
12486         (Sized_relobj::include_linkonce_section): Update use of
12487         Kept_section.  Only record Kept_comdat_section if sections are the
12488         same size.  Set size of linkonce section.
12489         (Sized_relobj::map_to_kept_section): Update call to
12490         get_kept_comdat_section.
12491         * object.h (class Sized_relobj): Rename fields in
12492         Kept_comdat_section to drop trailing underscores; change object
12493         field to Relobj*.  Change Kept_comdat_section_table to store
12494         struct rather than pointer.
12495         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
12496         Add kept_object and kept_shndx parameters.  Change all callers.
12497         (Sized_relobj::get_kept_comdat_section): Change return type to
12498         bool.  Add kept_object and kept_shndx parameters.  Change all
12499         callers.
12500         * plugin.cc (Pluginobj::include_comdat_group): Update call to
12501         Layout::find_or_add_kept_section.
12502
12503 2009-07-09  Ian Lance Taylor  <iant@google.com>
12504
12505         * merge.cc (Object_merge_map::initialize_input_to_output_map):
12506         Reserve space in the hash table.
12507
12508 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
12509
12510         * fileread.cc (File_read::get_mtime): New method.
12511         * fileread.h (Timespec): New structure.
12512         (File_read::get_mtime): New method.
12513         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
12514         Renamed from timestamp_nsec.
12515         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
12516         Elf_Xword.
12517         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
12518         timestamp_nsec.
12519         (Incremental_inputs::report_archive): Save mtime; style fix.
12520         (Incremental_inputs::report_obejct): Save mtime; style fix.
12521         (Incremental_inputs::report_script): Save mtime; style fix.
12522         (Incremental_inputs::finalize_inputs): Style fix.
12523         (Incremental_inputs::finalize): Style fix.
12524         (Incremental_inputs::create_input_section_data): Store inputs
12525         mtime.
12526         * incremental.h (Incremental_inputs::report_script): Add mtime
12527         argument.
12528         (Incremental_inputs::Input_info::Input_info): Intialize only one
12529         union member.
12530         (Incremental_inputs::Input_info::archive): Move to nameless
12531         union.
12532         (Incremental_inputs::Input_info::obejct): Move to nameless union.
12533         (Incremental_inputs::Input_info::script): Move to nameless union.
12534         (Incremental_inputs::mtime): New field.
12535         * script.cc (read_input_script): Pass file mtime to
12536         Incremental_input.
12537         * script.h (Script_info::inputs): Style fix.
12538
12539 2009-07-01  Ian Lance Taylor  <ian@airs.com>
12540
12541         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
12542         instead of 32.
12543
12544 2009-06-24  Ian Lance Taylor  <iant@google.com>
12545
12546         PR 10156
12547         * layout.cc (Layout::choose_output_section): If we find an
12548         existing section, update the flags.
12549         (Layout::create_notes): New function, broken out of
12550         Layout::finalize.
12551         (Layout::finalize): Don't create note sections.
12552         (Layout::create_note): Don't crash if linker script discards
12553         section.
12554         (Layout::create_gold_note): Likewise.
12555         (Layout::create_build_id): Likewise.  Don't set
12556         after_input_sections on the section.
12557         (Layout::create_executable_stack_info): Remove target parameter.
12558         Change caller.
12559         * layout.h (class Layout): Declare create_notes.  Update
12560         declaration of create_executable_stack_info.
12561         * gold.cc (queue_middle_tasks): Call create_notes.
12562         * output.cc (Output_section::update_flags_for_input_section): Move
12563         here from output.h.  If SHF_ALLOC flag is newly set, mark address
12564         invalid.
12565         * output.h (Output_data::mark_address_invalid): New function.
12566         (class Output_section): Only declare, not define,
12567         update_flags_for_input_section.  Remove set_flags.
12568
12569 2009-06-24  Ian Lance Taylor  <iant@google.com>
12570
12571         * script-sections.cc (Output_section_definition::
12572         set_section_addresses): Rename shadowing local load_address to
12573         laddr.
12574
12575 2009-06-24  Ian Lance Taylor  <iant@google.com>
12576
12577         PR 10244
12578         * reloc.cc (relocate_sections): Skip empty relocation sections.
12579
12580 2009-06-23  Ian Lance Taylor  <iant@google.com>
12581
12582         PR 10156
12583         * layout.cc (Layout::create_note): Use choose_output_section
12584         rather than make_output_section.
12585
12586 2009-06-23  Ian Lance Taylor  <iant@google.com>
12587
12588         PR 10237
12589         * options.cc (General_options::parse_V): Set printed_version_.
12590         (General_options::General_options): Initialize printed_version_.
12591         * options.h (class General_options): Add printed_version_ field.
12592         * gold.cc (queue_initial_tasks): If there are no input files,
12593         don't give a fatal error if we printed the version information.
12594         (queue_middle_tasks): If using -r with a shared object, give a
12595         fatal error rather than an ordinary error.
12596
12597 2009-06-23  Ian Lance Taylor  <iant@google.com>
12598
12599         PR 10219
12600         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
12601         (Layout::make_output_section): Set have_stabstr_section_ if we see
12602         a .stab*str section.
12603         (Layout::finalize): Call link_stabs_sections.
12604         (Layout::link_stabs_sections): New file.
12605         * layout.h (class Layout): Add have_stabstr_section_ field.
12606         Declare link_stabs_sections.
12607
12608 2009-06-23  Doug Kwan  <dougkwan@google.com>
12609
12610         * Makefile.am (libgold_a_LIBADD): New.
12611         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
12612         * Makefile.in: Regenerate.
12613         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
12614         * configure: Regenerate.
12615         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
12616         * fileread.cc: Include sys/state.h
12617         * gold.h: Declare memmem and strndup if found missing.
12618         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
12619
12620 2009-06-23  Ian Lance Taylor  <iant@google.com>
12621
12622         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
12623         * configure: Rebuild.
12624
12625 2009-06-23  Ian Lance Taylor  <iant@google.com>
12626
12627         PR 10147
12628         * object.cc (Object::section_contents): Don't try to get a view if
12629         the section has length zero.
12630         (Object::handle_gnu_warning_section): If the section is empty, use
12631         the name of the section as the warning.
12632
12633 2009-06-23  Ian Lance Taylor  <iant@google.com>
12634
12635         PR 10133
12636         * stringpool.h (class Stringpool_template): Add optimize_ field.
12637         (Stringpool_template::set_optimize): New function.
12638         * stringpool.cc (Stringpool_template::Stringpool_template):
12639         Initialize optimize_ field.
12640         (Stringpool_template::set_string_offsets): Test local optimize
12641         fild rather than parameter.
12642         * layout.cc (Layout::Layout): Call set_optimize on the section
12643         name stringpool.
12644
12645 2009-06-22  Ian Lance Taylor  <iant@google.com>
12646
12647         PR 10030
12648         * yyscript.y: Parse TARGET.
12649         * script.cc (script_set_target): New function.
12650         * script-c.h (script_set_target): Declare.
12651         * options.cc (General_options::string_to_object_format): Rename
12652         from string_to_object_format in anonymous namespace.  Change
12653         callers.
12654         * options.h (class General_options): Declare
12655         string_to_object_format.
12656
12657 2009-06-22  Ian Lance Taylor  <iant@google.com>
12658
12659         * script-sections.cc (Script_sections::create_segments): Don't put
12660         program headers in a PT_LOAD segment if -n or -N.
12661
12662 2009-06-22  Ian Lance Taylor  <iant@google.com>
12663
12664         PR 10141
12665         * options.h (class General_options): Add -z lazy and -z now.  Sort
12666         -z options into alphabetical order.
12667         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12668
12669 2009-06-21  Ian Lance Taylor  <iant@google.com>
12670
12671         * layout.cc (Layout::make_output_section): Call
12672         Target::new_output_section.
12673         (Layout::attach_allocated_section_to_segment): Put large section
12674         sections in a separate load segment with the large segment flag
12675         set.
12676         (Layout::segment_precedes): Sort large data segments after other
12677         load segments.
12678         (align_file_offset): New static function.
12679         (Layout::set_segment_offsets): Use align_file_offset.
12680         * output.h (class Output_section): Add is_small_section_ and
12681         is_large_section_ fields.
12682         (Output_section::is_small_section): New function.
12683         (Output_section::set_is_small_section):  New function.
12684         (Output_section::is_large_section): New function.
12685         (Output_section::set_is_large_section): New function.
12686         (Output_section::is_large_data_section): New function.
12687         (class Output_segment): Add is_large_data_segment_ field.
12688         (Output_segment::is_large_data_segment): New function.
12689         (Output_segment::set_is_large_data_segment): New function.
12690         * output.cc (Output_section::Output_section): Initialize new
12691         fields.
12692         (Output_segment::Output_segment): Likewise.
12693         (Output_segment::add_output_section): Add assertion that large
12694         data sections always go in large data segments.  Force small data
12695         sections to the end of the list of data sections.  Force small BSS
12696         sections to the start of the list of BSS sections.  For large BSS
12697         sections to the end of the list of BSS sections.
12698         * symtab.h (class Symbol): Declare is_common_shndx.
12699         (Symbol::is_defined): Check Symbol::is_common_shndx.
12700         (Symbol::is_common): Likewise.
12701         (class Symbol_table): Define enum Commons_section_type.  Update
12702         declarations.  Add small_commons_ and large_commons_ fields.
12703         * symtab.cc (Symbol::is_common_shndx): New function.
12704         (Symbol_table::Symbol_table): Initialize new fields.
12705         (Symbol_table::add_from_object): Put small and large common
12706         symbols in the right list.
12707         (Symbol_table::sized_finalized_symbol): Check
12708         Symbol::is_common_shndx.
12709         (Symbol_table::sized_write_globals): Likewise.
12710         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12711         common symbol lists.  Don't call do_allocate_commons_list if the
12712         list is empty.
12713         (Symbol_table::do_allocate_commons_list): Remove is_tls
12714         parameter.  Add comons_section_type parameter.  Change all
12715         callers.  Handle small and large common symbols.
12716         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12717         Symbol::is_common_shndx.
12718         * resolve.cc (symbol_to_bits): Likewise.
12719         * target.h (Target::small_common_shndx): New function.
12720         (Target::small_common_section_flags): New function.
12721         (Target::large_common_shndx): New function.
12722         (Target::large_common_section_flags): New function.
12723         (Target::new_output_section): New function.
12724         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12725         small_common_section_flags, and large_common_section_flags
12726         fields.
12727         (Target::do_new_output_section): New virtual function.
12728         * arm.cc (Target_arm::arm_info): Initialize new fields.
12729         * i386.cc (Target_i386::i386_info): Likewise.
12730         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12731         Likewise.
12732         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12733         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12734         (Target_x86_64::do_new_output_section): New function.
12735         * configure.ac: Define conditional MCMODEL_MEDIUM.
12736         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12737         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12738         (large_LDFLAGS): Define.
12739         * testsuite/large.c: New file.
12740         * testsuite/testfile.cc (Target_test::test_target_info):
12741         Initialize new fields.
12742         * configure, testsuite/Makefile.in: Rebuild.
12743
12744 2009-06-05  Doug Kwan  <dougkwan@google.com>
12745
12746         * Makefile.am (CCFILES): Add target.cc.
12747         * Makefile.in: Regenerate.
12748         * i386.cc (class Target_i386): Define new virtual method to
12749         override do_is_local_label_name in parent.
12750         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12751         local symbols if --discard-locals or -X is given.
12752         * options.h (class General_options): Declare new options
12753         '--discard-locals' and '-X' for discarding locals.
12754         * target.h (class Target): Define new methods is_local_label_name.
12755         Declare new virtual method do_is_local_label_name.
12756         * target.cc: New file.
12757         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12758         (check_SCRIPTS): Add discard_locals_test.sh.
12759         (check_DATA): Add discard_local_tests.syms.
12760         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12761         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12762         * testsuite/Makefile.in: Regenerate.
12763         * testsuite/discard_locals_test.c: New file.
12764         * testsuite/discard_locals_test.sh: Same.
12765
12766 2009-06-05  Doug Kwan  <dougkwan@google.com>
12767
12768         * object.cc (Sized_relobj::Sized_relobj): Initialize
12769         discarded_eh_frame_shndx_ to -1U.
12770         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12771         section.
12772         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12773         a discarded .eh_frame section.
12774         (Sized_relobj::do_finalize_local_symbols): Ditto.
12775         * object.h (class Sized_relobj): Declare new member
12776         discarded_eh_frame_shndx_.
12777         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12778         (local_labels_test.o, local_labels_test): New rules.
12779         * testsuite/Makefile.in: Regenerate.
12780
12781 2009-06-04  Doug Kwan  <dougkwan@google.com>
12782
12783         * layout.cc (Layout::section_name_mapping): Add mapping for
12784         special ARM sections.
12785
12786 2009-06-03  Doug Kwan  <dougkwan@google.com>
12787
12788         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12789         (utils::has_overflow): Same.
12790
12791 2009-06-03  Ian Lance Taylor  <iant@google.com>
12792
12793         * layout.cc (Layout::section_name_mapping): New array, replacing
12794         Layout::linkonce_mapping.
12795         (Layout::section_name_mapping_count): New variable, replacing
12796         Layout::linkonce_mapping_count.
12797         (Layout::linkonce_output_name): Remove.
12798         (Layout::output_section_name): Rewrite.
12799         * layout.h (class Layout): Rename Linkonce_mapping to
12800         Section_name_mapping, linkonce_mapping to section_name_mapping,
12801         linkonce_mapping_count to section_name_mapping_count.  Don't
12802         declare linkonce_output_name.
12803
12804 2009-06-03  Doug Kwan  <dougkwan@google.com>
12805
12806         * gold/arm.cc (namespace utils): New.
12807         (Target_arm::reloc_is_non_pic): Define new method.
12808         (class Arm_relocate_functions): New.
12809         (Target_arm::Relocate::relocate): Handle relocation types used by
12810         Android.
12811
12812 2009-06-03  Ian Lance Taylor  <iant@google.com>
12813
12814         * arm.cc (Target_arm::scan::global): Use || instead of |.
12815
12816 2009-06-02  Doug Kwan  <dougkwan@google.com>
12817
12818         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12819         issued_non_pic_error_.
12820         (class Target_arm::Scan): Declare new method check_non_pic.
12821         Define new method symbol_needs_plt_entry.
12822         Declare new data member issued_non_pic_error_.
12823         (class Target_arm::Relocate): Declare new method
12824         should_apply_static_reloc.
12825         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12826         (Target_arm::Scan::check_non_pic): Define new method.
12827         (Target_arm::Scan::local): Handle a small subset of reloc types used
12828         by Android.
12829         (Target_arm::Scan::local): Same.
12830         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12831
12832 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12833
12834         * incremental.cc (Incremental_inputs::report_command_line): Filter
12835         out --incremental-* options.
12836
12837 2009-05-29  Doug Kwan  <dougkwan@google.com>
12838
12839         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12840         template class.
12841         (class Target_arm): Update comment.
12842         (Target_arm::Target_arm): Initialize new data members GOT_,
12843         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12844         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12845         and Target_arm::rel_dyn_section.
12846         Declare new_enum Target_arm::Got_type.
12847         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12848         and DYNBSS_.
12849         Update commments for member do_dynsym_value.
12850         (Target_arm::got_size, Target_arm::plt_section,
12851         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12852         new methods inside class defintion.
12853         (Target_arm::got_section): Define new method.
12854         (Target_arm::rel_dyn_section): Same.
12855         (Output_data_plt_arm): New template class.
12856         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12857         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12858         (Output_data_plt_arm::add_entry): Same.
12859         (Output_data_plt_arm::first_plt_entry): Define new
12860         static data member for PLT instruction template.
12861         (Output_data_plt_arm::plt_entry): Same.
12862         (Output_data_plt_arm::do_write): Define new method.
12863         (Target_arm::make_plt_entry): Same.
12864         (Target_arm::do_finalize_sections): Same.
12865         (Target_arm::do_dynsym_value): Same.
12866
12867 2009-05-28  Doug Kwan  <dougkwan@google.com>
12868
12869         * Makefile.am (TARGETSOURCES): Add arm.cc.
12870         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12871         * Makefile.in: Regenerate.
12872         * arm.cc: New file.
12873         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12874
12875 2009-05-26  Doug Kwan  <dougkwan@google.com>
12876
12877         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12878         (General_options::check_excluded_libs): Strip off directories in
12879         archive name before matching like GNU ld does.
12880         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12881         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12882         (exclude_libs_test_LDFLAGS): Add linker option
12883         -Wl,--exclude-libs,libexclude_libs_test_3
12884         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12885         an explicit archive without using -l.
12886         (alt/libexclude_libs_test_3.a): New make rule.
12887         * testsuite/Makefile.in: Regenerate.
12888         * testsuite/exclude_libs_test.c : Declare lib3_default().
12889         (main): Call it.
12890         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12891         * exclude_libs_test_3.c: New file.
12892
12893 2009-05-26  Nick Clifton  <nickc@redhat.com>
12894
12895         * po/id.po: New Indonesian translation.
12896         * po/gold.pot: Updated template file.
12897
12898 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12899
12900         * testsuite/Makefile.am: Add -ffunction-sections to compile
12901         gc_comdat_test files.  Add -Wl,--gc-sections to build
12902         gc_comdat_test.
12903         * testsuite/Makefile.in: Regenerate.
12904         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12905
12906 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12907
12908         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12909         kept comdat section was garbage collected.
12910         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12911         * testsuite/Makefile.in: Regenerate.
12912         * testsuite/gc_comdat_test.sh: New file.
12913         * testsuite/gc_comdat_test_1.cc: New file.
12914         * testsuite/gc_comdat_test_2.cc: New file.
12915
12916 2009-05-19  Doug Kwan  <dougkwan@google.com>
12917
12918         * archive.cc (Archive::Archive): Move constructor from archive.h
12919         to here.  Initialize no_export_.
12920         (Archive::get_elf_object_for_member): Set no_export flag of object.
12921         * archive.h (Archive::Archive): Move constructor body to
12922         archive.cc.
12923         (Archive::no_export): New method.
12924         (Archive::no_export_): New field.
12925         * object.h (Object::Object): Initialize no_export_ to false.
12926         (Object::no_export, Object::set_no_export): New methods.
12927         (Object::no_export_): New field.
12928         * options.cc (General_options::parse_exclude_libs): New method.
12929         (General_options::check_excluded_libs) Same.
12930         * options.h (exclude_libs): New option.
12931         (General_options::check_excluded_libs): New method declaration.
12932         (General_options::excluded_libs_): New field.
12933         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12934         default or protected visibility if an object has no-export flag set.
12935         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12936         (check_SCRIPTS): Add exclude_libs_test.sh.
12937         (check_DATA): Add exclude_libs_test.syms.
12938         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12939         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12940         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12941         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12942         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12943         libexclude_libs_test_2.a): New rules.
12944         * testsuite/Makefile.in: Regenerate.
12945         * testsuite/exclude_libs_test.c: New file.
12946         * testsuite/exclude_libs_test.sh: Ditto.
12947         * testsuite/exclude_libs_test_1.c: Ditto.
12948         * testsuite/exclude_libs_test_2.c: Ditto.
12949
12950 2009-05-15  Ian Lance Taylor  <iant@google.com>
12951
12952         * configure.ac: Check for declarations for cases where libiberty.h
12953         checks HAVE_DECL_xxx.
12954         * configure, config.in: Rebuild.
12955
12956 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12957
12958         * gold.h (Incremental_argument_list): Remove (invalid) forward
12959         declaration.
12960         * incremental.cc (Incremental_inputs::report_achive): New method.
12961         (Incremental_inputs::report_object): New method.
12962         (Incremental_inputs::report_script): New method.
12963         (Incremental_inputs::finalize_inputs): New method.
12964         (Incremental_inputs::finalize): Call finalize_inputs().
12965         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12966         Create inputs entries.
12967         * incremental.h (Incremental_input_type): New enum.
12968         (Incremental_inputs::Incremental_input): Initialize new fields.
12969         (Incremental_inputs::report_inputs): New method.
12970         (Incremental_inputs::report_achive): New method.
12971         (Incremental_inputs::report_object): New method.
12972         (Incremental_inputs::report_script): New method.
12973         (Incremental_inputs::finalize_inputs): New method.
12974         (Incremental_inputs::Input_info): New struct.
12975         (Incremental_inputs::Input_info_map): New typedef.
12976         (Incremental_inputs::lock_): New field.
12977         (Incremental_inputs::Inputs_): New field.
12978         (Incremental_inputs::Inputs_map): New field.
12979         * main.cc (main): Call Incremental_input::report_inputs.
12980         * options.h (Input_argument_list): Typedef moved from
12981         Input_arguments.
12982         (Input_file_group::Files): Remove, use ::Input_argument_list.
12983         (Input_file_group::Input_argument_list): Remove, use
12984         ::Input_argument_list.
12985         * plugin.cc (Plugin_manager::add_input_file): Add error in
12986         incremental build.
12987         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12988         functions.
12989         * script.cc (read_input_script): Call
12990         Incremental_input::report_script.
12991         * script.h (Script_info): New class.
12992
12993 2009-04-27  Ian Lance Taylor  <iant@google.com>
12994
12995         * x86_64.cc (do_adjust_output_section): Set entsize to
12996         plt_entry_size.
12997
12998 2009-04-23  Elliott Hughes  <enh@google.com>
12999
13000         * output.cc (Output_file::close): After short writes, continue
13001         writing from the correct offset in the buffer being written.
13002
13003 2009-04-23  Chris Demetriou  <cgd@google.com>
13004
13005         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
13006         * configure: Regenerate.
13007         * config.in: Regenerate.
13008         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
13009         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
13010
13011 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
13012
13013         * incremental.cc (Incremental_inputs_header_data): Renamed from
13014         Incremental_input_header_data.
13015         (Incremental_inputs_header_data::data_size): New field.
13016         (Incremental_inputs_header_data::put_input_file_count): Renamed
13017         from input_file_count.
13018         (Incremental_inputs_header_data::put_command_line_offset): Renamed
13019         from command_line_offset.
13020         (Incremental_inputs_header_data::put_reserved): Renamed from
13021         put_reserved.
13022         (Incremental_inputs_entry_data): Renamed from
13023         Incremental_input_entry_data.
13024         (Incremental_inputs_entry_data::data_size): New field.
13025         (Incremental_inputs::report_command_line): New method.
13026         (Incremental_inputs::finalize): New method.
13027         (Incremental_inputs::create_incremental_inputs_data): New method.
13028         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
13029         * incremental.h: New file.
13030         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
13031         (Layout::finalize): Create incremental inputs section in
13032         incremental builds.
13033         (Layout::create_incremental_info_sections): New method.
13034         * layout.h (Layout::incremental_inputs): New method.
13035         (Layout::create_incremental_info_sections): New method.
13036         (Layout::incremental_inputs_): New field.
13037         * main.cc (main): Notify Incremental_input of the command line.
13038
13039 2009-04-01  Ian Lance Taylor  <iant@google.com>
13040             Mikolaj Zalewski  <mikolajz@google.com>
13041
13042         * gold.h (reserve_unordered_map): Define, three versions, one for
13043         each version of Unordered_map.
13044         * layout.cc (Layout::Layout): Remove options parameter.  Add
13045         number_of_input_files parameter.  Don't initialize options_.
13046         Initialize number_of_input_files_ and resized_signatures_.  Move
13047         sections_are_attached_.
13048         (Layout::layout_group): Reserve space for group_signatures_.
13049         (Layout::find_or_add_kept_section): Change name parameter to be a
13050         reference.  Resize signatures_ map when it gets large enough.
13051         (Layout::layout_eh_frame): Use parameters->options() instead of
13052         this->options_.
13053         (Layout::make_output_section): Likewise.
13054         (Layout::attach_allocated_section_to_segment): Likewise.
13055         (Layout::finalize, Layout::create_executable_stack): Likewise.
13056         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
13057         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
13058         * layout.h (class Layout): Update declarations.  Remove options_
13059         field.  Add number_of_input_files_ and resized_signatures_
13060         fields.  Move sections_are_attached_ field.
13061         * main.cc (main): Pass number of input files to Layout
13062         constructor.  Don't pass options.
13063
13064 2009-03-30  Ian Lance Taylor  <iant@google.com>
13065
13066         * ffsll.c (ffsll): Correct implementation.
13067
13068 2009-03-27  Ian Lance Taylor  <iant@google.com>
13069
13070         * ffsll.c: New file.
13071         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
13072         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
13073         * ftruncate.c (ftruncate): Declare before definition.
13074         * mremap.c (mremap): Likewise.
13075         * pread.c (pread): Likewise.
13076         * configure, Makefile.in, config.in: Rebuild.
13077
13078         * mremap.c: New file.
13079         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
13080         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
13081         (mremap): Declare if HAVE_MREMAP is not defined.
13082         * configure, Makefile.in, config.in: Rebuild.
13083
13084 2009-03-27  Cary Coutant  <ccoutant@google.com>
13085
13086         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
13087         position independent.
13088         * sparc.cc (Target_sparc::check_non_pic): Likewise.
13089         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
13090
13091 2009-03-24  Cary Coutant  <ccoutant@google.com>
13092
13093         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
13094         an executable.
13095         (needs_dynamic_reloc): Likewise.
13096
13097 2009-03-24  Ian Lance Taylor  <iant@google.com>
13098
13099         * yyscript.y (file_cmd): Recognize EXTERN.
13100         (extern_name_list, extern_name_list_body): New nonterminals.
13101         * script.cc (script_add_extern): Define.
13102         * script-c.h (script_add_extern): Declare.
13103
13104 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
13105
13106         * object.cc (is_elf_object): Define.
13107         * object.h (is_elf_object): Declare.
13108         * archive.cc (Archive::get_elf_object_for_member): Call
13109         is_elf_object.
13110         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
13111
13112 2009-03-24  Elliott Hughes  <enh@google.com>
13113
13114         * output.cc (Output_file::map_anonymous): Define.
13115         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
13116         try an anonymous one.  Report the size if the mmap fails.
13117         * output.h (class Output_file): Declare map_anonymous.
13118
13119 2009-03-24  Ian Lance Taylor  <iant@google.com>
13120
13121         * target-select.cc (instantiate_target): Don't acquire the lock if
13122         the instantiated_target_ field has already been set.
13123
13124 2009-03-23  Ian Lance Taylor  <iant@google.com>
13125
13126         * gold-threads.h (class Initialize_lock): Define.
13127         * gold-threads.cc (class Initialize_lock_once): Define.
13128         (initialize_lock_control): New static variable.
13129         (initialize_lock_pointer): New static variable.
13130         (initialize_lock_once): New static function.
13131         (Initialize_lock::Initialize_lock): Define.
13132         (Initialize_lock::initialize): Define.
13133         * target-select.h: Include "gold-threads.h".
13134         (class Target_selector): Add lock_ and initialize_lock_ fields.
13135         Don't define instantiate_target, just declare it.
13136         * target-select.cc (Target_selector::Target_selector): Initialize
13137         new fields.
13138         (Target_selector::instantiate_target): Define.
13139         * descriptors.h: Include "gold-threads.h".
13140         (class Descriptors): Add initialize_lock_ field.
13141         * descriptors.cc (Descriptors::Descriptors): Initialize new
13142         field.
13143         (Descriptors::open): Use initialize_lock_ field
13144         * errors.h (class Errors): Add initialize_lock_ field.
13145         * errors.cc (Errors::Errors): Initialize new field.
13146         (Errors::initialize_lock): Use initialize_lock_ field.
13147         * powerpc.cc (class Target_selector_powerpc): Remove
13148         instantiated_target_ field.  In do_recognize call
13149         instantiate_target rather than do_instantiate_target.  In
13150         do_instantiate_target just allocate a new target.
13151         * sparc.cc (class Target_selector_sparc): Likewise.
13152
13153         * freebsd.h: New file.
13154         * i386.cc: Include "freebsd.h".
13155         (Target_i386): Derive from Target_freebsd rather than
13156         Sized_target.
13157         (Target_selector_i386): Derive from Target_selector_freebsd rather
13158         than Target_selector.
13159         * x86_64.cc: Include "freebsd.h".
13160         (Target_x86_64): Derive from Target_freebsd rather than
13161         Sized_target.
13162         (Target_selector_x86_64): Derive from Target_selector_freebsd
13163         rather than Target_selector.
13164         * target.h (class Target): Add adjust_elf_header and
13165         do_adjust_elf_header.
13166         * output.cc (Output_file_header:: do_sized_write): Call target
13167         adjust_elf_header routine.
13168         * configure.tgt: Set targ_osabi.
13169         * configure.ac: Define GOLD_DEFAULT_OSABI.
13170         * parameters.cc (Parameters::default_target): Pass
13171         GOLD_DEFAULT_OSABI to select_target.
13172         * target-select.h (class Target_selector): Make instantiate_target
13173         protected rather than private.
13174         * Makefile.am (HFILES): Add freebsd.h.
13175         * configure, Makefile.in, config.in: Rebuild.
13176
13177         * merge.cc (do_add_input_section): Correct pend value.  Change
13178         message about last entry not being null terminated from error to
13179         warning.
13180
13181 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
13182
13183         * incremental.cc: New file.
13184         * Makefile.am (CCFILES): Add incremental.cc.
13185         * Makefile.in: Rebuild.
13186
13187 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
13188
13189         * layout.cc (Layout::output_section_name): Preserve names
13190         of '.note.' sections.
13191
13192 2009-03-19  Ian Lance Taylor  <iant@google.com>
13193
13194         * descriptors.cc (Descriptors::open): Check that the options are
13195         valid before using them.
13196
13197 2009-03-18  Ian Lance Taylor  <iant@google.com>
13198
13199         * script-sections.h: Include <list>.
13200         (class Script_sections): Change Sections_elements from std::vector
13201         to std::list.  Typedef public Elements_iterator.  Add
13202         orphan_section_placement_, data_segment_align_start_, and
13203         saw_data_segment_align_ fields.  Remove data_segment_align_index_
13204         field.
13205         * script-sections.cc (class Orphan_section_placement): New class.
13206         (class Sections_element): Add virtual functions is_relro and
13207         orphan_section_init.  Remove virtual function place_orphan_here.
13208         (class Output_section_definition): Add is_relro and
13209         orphan_section_init.  Remove place_orphan_here.
13210         (class Orphan_output_section): Likewise.
13211         (Script_sections::Script_sections): Update for field changes.
13212         (Script_sections::data_segment_align): Set saw_data_segment_align_
13213         and data_segment_align_start_, not data_segment_align_index.
13214         (Script_sections::data_segment_relro_end): Check
13215         saw_data_segment_align_.  Use data_segment_align_start_ rather
13216         than data_segment_align_index_.
13217         (Script_sections::place_orphan): Rewrite to use
13218         Orphan_section_placement.
13219
13220 2009-03-17  Ian Lance Taylor  <iant@google.com>
13221
13222         * archive.cc (Archive::add_symbols): Check for a version attached
13223         to the symbol name in the archive map.
13224         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
13225         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
13226         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
13227         (ver_test_11.a): New target.
13228         * testsuite/Makefile.in: Rebuild.
13229
13230         * configure.ac: Check for chsize and posix_fallocate.  Replace
13231         ftruncate.
13232         * ftruncate.c: New file, from gnulib.
13233         * output.cc (posix_fallocate): Define dummy version if not
13234         HAVE_POSIX_FALLOCATE.
13235         (Output_file::map): Call posix_fallocate rather than lseek and
13236         write.
13237         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
13238         * configure, Makefile.in, config.in: Rebuild.
13239
13240 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
13241
13242         * layout.h (Layout::create_note): Add section_name parameter.
13243         * layout.cc (Layout::create_note): Likewise.
13244         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
13245
13246 2009-03-17  Ian Lance Taylor  <iant@google.com>
13247
13248         * descriptors.cc: Include "options.h".
13249         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
13250         (Descriptors::open): Always use O_CLOEXEC when opening a new
13251         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
13252         then set FD_CLOEXEC.
13253
13254         * sparc.cc (class Target_sparc): Add has_got_section.
13255         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
13256         make sure we have a GOT section.
13257
13258         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
13259         (Target_sparc::Scan::local): Likewise.
13260         (Target_sparc::Scan::global): Likewise.
13261         (Target_sparc::Relocate::relocate): Likewise.
13262         (Target_sparc::Relocate::relocate_tls): Likewise.
13263
13264         * symtab.cc (Symbol_table::define_default_version): New function,
13265         broken out of add_from_object.
13266         (Symbol_table::add_from_object): Call define_default_version.
13267         (Symbol_table::define_special_symbol): Add resolve_oldsym
13268         parameter.  Change all callers.  If the version for a symbol comes
13269         from a version script, resolve it with the symbol with the same
13270         name with no version.  Also add the symbol without a version if
13271         appropriate.
13272         (do_define_in_output_data): If resolving with oldsym, don't delete
13273         sym.
13274         (do_define_in_output_segment): Likewise.
13275         (do_define_as_constant): Likewise.
13276         * symtab.h (class Symbol_table): Update declarations.
13277
13278 2009-03-13  Ian Lance Taylor  <iant@google.com>
13279
13280         * readsyms.cc (Read_symbols::incompatible_warning): New function.
13281         (Read_symbols::requeue): New function.
13282         (Read_symbols::do_read_symbols): If make_elf_object fails because
13283         the target type is not configured, and the file was searched for,
13284         issue a warning and retry with the next directory.
13285         (Add_symbols::run): If the file has an incompatible format, and
13286         it was searched for, requeue the Read_symbols task.  On error,
13287         release the object.
13288         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
13289         dirindex parameter to constructor.  Change all callers.  Declare
13290         incompatible_warning and requeue.
13291         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
13292         input_argument_ and input_group_ fields.  Add them to
13293         constructor.  Change all callers.
13294         (class Read_script): Add dirindex_ field.  Add it to constructor.
13295         Change all callers.
13296         * archive.cc (Archive::setup): Remove input_objects parameter.
13297         Change all callers.
13298         (Archive::get_file_and_offset): Likewise.
13299         (Archive::read_all_symbols): Likewise.
13300         (Archive::read_symbols): Likewise.
13301         (Archive::get_elf_object_for_member): Remove input_objects
13302         parameter.  Add punconfigured parameter.  Change all callers.
13303         (Archive::add_symbols): Change return type to bool.  Check return
13304         value of include_member.
13305         (Archive::include_all_members): Likewise.
13306         (Archive::include_member): Change return type to bool.  Return
13307         false if first included object has incompatible target.  Set
13308         included_member_ field.
13309         (Add_archive_symbols::run): If add_symbols returns false, requeue
13310         Read_symbols task.
13311         * archive.h (class Archive): Add included_member_ field.
13312         Initialize it in constructor.  Add input_file and searched_for
13313         methods.  Update declarations.
13314         (class Add_archive_symbols): Add dirpath_, dirindex_, and
13315         input_argument_ fields.  Add them to constructor.  Change all
13316         callers.
13317         * script.cc: Include "target-select.h".
13318         (class Parser_closure): Add skip_on_incompatible_target_ and
13319         found_incompatible_target_ fields.  Add
13320         skip_on_incompatible_target parameter to constructor.  Change all
13321         callers.  Add methods skip_on_incompatible_target,
13322         clear_skip_on_incompatible_target, found_incompatible_target, and
13323         set_found_incompatible_target.
13324         (read_input_script): Add dirindex parameter.  Change all callers.
13325         If parser finds an incompatible target, requeue Read_symbols
13326         task.
13327         (script_set_symbol): Clear skip_on_incompatible_target in
13328         closure.
13329         (script_add_assertion, script_parse_option): Likewise.
13330         (script_start_sections, script_add_phdr): Likewise.
13331         (script_check_output_format): New function.
13332         * script.h (read_input_script): Update declaration.
13333         * script-c.h (script_check_output_format): Declare.
13334         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
13335         (ignore_cmd): Remove OUTPUT_FORMAT.
13336         * fileread.cc (Input_file::Input_file): Add explicit this.
13337         (Input_file::will_search_for): New function.
13338         (Input_file::open): Add pindex parameter.  Change all callers.
13339         * fileread.h (class Input_file): Add input_file_argument method.
13340         Declare will_search_for.  Update declarations.
13341         * object.cc (make_elf_object): Add punconfigured parameter.
13342         Change all callers.
13343         * object.h (class Object): Make input_file public.  Add
13344         searched_for method.
13345         (make_elf_object): Update declaration.
13346         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
13347         restart search.
13348         * dirsearch.h (class Dirsearch): Update declaration.
13349         * options.h (class General_options): Add --warn-search-mismatch.
13350         * parameters.cc (Parameters::is_compatible_target): New function.
13351         * parameters.h (class Parameters): Declare is_compatible_target.
13352         * workqueue.cc (Workqueue::add_blocker): New function.
13353         * workqueue.h (class Workqueue): Declare add_blocker.
13354
13355         * fileread.cc (Input_file::open): Remove options parameter.
13356         Change all callers.
13357         (Input_file::open_binary): Likewise.
13358         * script.cc (read_input_script): Likewise.
13359         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
13360         options parameter from constructor.  Change all callers.
13361         (class Read_script): Likewise.
13362         * fileread.h (class Input_file): Update declarations.
13363         * script.h (read_input_script): Update declaration.
13364
13365 2009-03-10  Nick Clifton  <nickc@redhat.com>
13366
13367         * po/es.po: New Spanish translation.
13368
13369 2009-03-06  Cary Coutant  <ccoutant@google.com>
13370
13371         * options.cc (parse_short_option): Keep dash_z from registering itself.
13372
13373 2009-03-03  Ian Lance Taylor  <iant@google.com>
13374
13375         PR 9918
13376         * target-reloc.h (relocate_section): Pass output_section to
13377         relocate.
13378         * i386.cc (Target_i386::should_apply_static_reloc): Add
13379         output_section parameter.  Change all callers.
13380         (Target_i386::Relocate::relocate): Add output_section parameter.
13381         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13382         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
13383         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
13384         * testsuite/two_file_shared.sh: New script.
13385         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
13386         (check_DATA): Add two_file_shared.dbg.
13387         (two_file_shared.dbg): New target.
13388         * testsuite/Makefile.in: Rebuild.
13389
13390 2009-03-01  Ian Lance Taylor  <iant@google.com>
13391
13392         * configure.ac: Check for byteswap.h.
13393         * configure: Rebuild.
13394         * config.in: Rebuild.
13395
13396 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
13397
13398         * layout.cc (Layout::find_or_add_kept_section): New function.
13399         (Layout::add_comdat): Removed.
13400         * layout.h (struct Kept_section): Move out of class Layout.
13401         Remove trailing underscores from field names.  Add group_sections
13402         field.  Rename group_ field to is_group.  Change all uses.
13403         (class Layout): Declare find_or_add_kept_section, not add_comdat.
13404         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
13405         comdat_groups_ field.
13406         (Sized_relobj::include_section_group): Use
13407         find_or_add_kept_section and Kept_section::group_sections.
13408         (Sized_relobj::include_linkonce_section): Likewise.
13409         * object.cc (class Sized_relobj): Don't define Comdat_group or
13410         Comdat_group_table.  Remove find_comdat_group and
13411         add_comdat_group.  Remove comdat_groups_ field.
13412         * plugin.cc (include_comdat_group): Use
13413         Layout::find_or_add_kept_section.
13414
13415 2009-02-28  Ian Lance Taylor  <iant@google.com>
13416
13417         * README: --gc-sections and map files are now supported.  Document
13418         some build requirements.
13419
13420         PR 6992
13421         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
13422         relocatable link set the value of the section symbol to zero.
13423         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
13424         relocatable link don't include the section address in the local
13425         symbol value.
13426
13427 2009-02-27  Ian Lance Taylor  <iant@google.com>
13428
13429         PR 6811
13430         * options.h (class Search_directory): Add is_system_directory.
13431         (class General_options): Declare is_in_system_directory.
13432         * options.cc (get_relative_sysroot): Make static.
13433         (get_default_sysroot): Make static.
13434         (General_optoins::is_in_system_directory): New function.
13435         * fileread.cc (Input_file::is_in_system_directory): New function.
13436         * fileread.h (class Input_file): Declare is_in_system_directory.
13437         * object.h (class Object): Add is_in_system_directory.
13438         (class Input_objects): Remove system_library_directory_ field.
13439         * object.cc (Input_objects::add_object): Don't set
13440         system_library_directory_.
13441         (input_objects::found_in_system_library_directory): Remove.
13442         * symtab.cc (Symbol_table::write_globals): Remove input_objects
13443         parameter.  Change all callers.
13444         (Symbol_table::sized_write_globals): Likewise.
13445         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
13446         Call Object::is_in_system_directory.
13447         * symtab.h (class Symbol_table): Update declarations.
13448
13449         PR 5990
13450         * descriptors.h (Open_descriptor): Add is_on_stack field.
13451         * descriptors.cc (Descriptors::open): If the descriptor is on the
13452         top of the stack, remove it.  Initialize is_on_stack field.
13453         (Descriptors::release): Only add pod to stack if it is not on the
13454         stack already.
13455         (Descriptors::close_some_descriptor): Clear stack_next and
13456         is_on_stack fields.
13457
13458         PR 7091
13459         * output.cc (Output_section::find_starting_output_address): Rename
13460         from starting_output_address; add PADDR parameter; change return
13461         type.
13462         * output.h (class Output_section): Declare
13463         find_starting_output_address instead of starting_output_address.
13464         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
13465         section symbol for which we can't find a merge section.
13466
13467         PR 9836
13468         * symtab.cc (Symbol_table::add_from_object): If the visibility is
13469         hidden or internal, force the symbol to be local.
13470         * resolve.cc (Symbol::override_visibility): Define.
13471         (Symbol::override_base): Use override_visibility.
13472         (Symbol_table::resolve): Likewise.
13473         (Symbol::override_base_with_special): Likewise.
13474         (Symbol_table::override_with_special): If the visibility is hidden
13475         or internal, force the symbol to be local.
13476         * symtab.h (class Symbol): Add set_visibility and
13477         override_visibility.
13478         * testsuite/ver_test_1.sh: New file.
13479         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
13480         (check_DATA): Add ver_test_1.syms.
13481         (ver_test_1.syms): New target.
13482         * testsuite/Makefile.in: Rebuild.
13483
13484 2009-02-25  Cary Coutant  <ccoutant@google.com>
13485
13486         * layout.cc (Layout::choose_output_section): Don't rename sections
13487         when using a linker script that has a SECTIONS clause.
13488         * Makefile.in: Regenerate.
13489
13490         * testsuite/Makefile.am (script_test_5.sh): New test case.
13491         * testsuite/Makefile.in: Regenerate.
13492         * testsuite/script_test_5.cc: New file.
13493         * testsuite/script_test_5.sh: New file.
13494         * testsuite/script_test_5.t: New file.
13495
13496 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
13497
13498         * archive.cc (Archive::include_member): Update calls to add_symbols.
13499         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
13500         the Layout argument.
13501         * dynobj.h (do_add_symbols): Add the Layout argument.
13502         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
13503         Layout argument.
13504         * object.h (Object::add_symbols): Add the Layout argument.
13505         (Object::do_add_symbols): Add the Layout argument.
13506         (Sized_relobj::do_add_symbols): Add the Layout argument.
13507         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
13508         Unify the two versions.
13509         (Add_plugin_symbols): Remove.
13510         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
13511         (Sized_pluginobj::do_add_symbols): Unify the two versions.
13512         (Add_plugin_symbols): Remove.
13513         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
13514         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
13515         (Add_symbols::run): Make it work with Pulginobj.
13516
13517 2009-02-06  Ian Lance Taylor  <iant@google.com>
13518
13519         * object.cc (Sized_relobj::do_layout): Make info message start
13520         with lower case letter.
13521
13522 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
13523
13524         * binary.cc: Fix file comment.
13525
13526         * options.h (enum Incremental_disposition): Define.
13527         (class General_options): Add new options: --incremental,
13528         --incremental_changed, --incremental_unchanged,
13529         --incremental_unknown.  Add incremental_disposition_ and
13530         implicit_incremental_ fields.
13531         (General_options::incremental_disposition): New function.
13532         (class Position_dependent_options): Add incremental_disposition
13533         option.
13534         (Position_dependent_options::copy_from_options): Set incremental
13535         dispositions.
13536         * options.cc (General_options::parse_incremental_changed): New
13537         function.
13538         (General_options::parse_incremental_unchanged): New function.
13539         (General_options::parse_incremental_unknown): New function.
13540         (General_options::General_options): Initialize new fields
13541         incremental_disposition_ and implicit_incremental_.
13542         (General_options::finalize): Check for uasge of --incremental-*
13543         without --incremental.
13544
13545 2009-02-06  Chris Demetriou  <cgd@google.com>
13546
13547         * gold.h (gold_undefined_symbol): Change to take only a Symbol
13548         pointer and to report location as the file name associated with
13549         the symbol.
13550         (gold_undefined_symbol_at_location): New function to replace the
13551         old gold_undefined_symbol functionality.
13552         * target-reloc.h (relocate_section): Update to use
13553         gold_undefined_symbol_at_location.
13554         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13555         Call gold_undefined_symbol function rather than gold_error.
13556         * errors.h (Errors::undefined_symbol): Take location as a
13557         string, rather than calculating it from a relocation.
13558         * errors.cc (Errors::fatal): Print "fatal error:" before the
13559         formatted message.
13560         (Errors::error, Errors::error_at_location): Print "error: "
13561         before the formatted message.
13562         (Errors::undefined_symbol): Take location as a string, rather
13563         than calculating it from a relocation.
13564         (gold_undefined_symbol_at_location): New function akin to
13565         old gold_undefined_symbol, calculates location from relocation.
13566         (gold_undefined_symbol): Change to take only a Symbol pointer
13567         and to report location as the file name associated with the symbol.
13568         * testsuite/debug_msg.sh: Update for changed error messages.
13569         * testsuite/undef_symbol.sh: Likewise.
13570
13571 2009-02-04  Duncan Sands  <baldrick@free.fr>
13572
13573         PR 9812
13574         * reduced_debug_output.h
13575         (Output_reduced_debug_abbrev_section::failed): Use format for
13576         gold_warning.
13577         (Output_reduced_debug_info_section::faild): Likewise.
13578
13579 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
13580
13581         * script.cc (Lazy_demangler): New class.
13582         (Version_script_info::get_symbol_version_helper): Demangle a
13583         symbol only once.
13584
13585 2009-01-29  Cary Coutant  <ccoutant@google.com>
13586
13587         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
13588         to __tls_get_addr.
13589         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
13590
13591 2009-01-28  Ian Lance Taylor  <iant@google.com>
13592
13593         * version.cc (version_string): Bump to 1.9.
13594
13595         * gold.h: Include <cstring> and <stdint.h>.
13596         * version.cc: Include <cstdio>.
13597         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
13598         warning.
13599         * reduced_debug_output.cc (insert_into_vector): Rename from
13600         Insert_into_vector; change all callers.  Use Swap_unaligned to
13601         avoid aliasing issue; remove union since it is unnecessary.
13602
13603 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
13604
13605         * Makefile.am (CCFILES): Add gc.cc.
13606         (HFILES): Add gc.h.
13607         * Makefile.in: Regenerate.
13608         * gold.cc (Gc_runner): New class.
13609         (queue_initial_tasks): Call garbage collection related tasks
13610         when corresponding options are invoked.
13611         (queue_middle_gc_tasks): New function.
13612         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
13613         processed early before laying out sections during garbage collection.
13614         * gold.h (queue_middle_gc_tasks): New function.
13615         (is_prefix_of): Move from "layout.cc".
13616         * i386.cc (Target_i386::gc_process_relocs): New function.
13617         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
13618         * main.cc (main): Create object of class "Garbage_collection".
13619         * object.cc (Relobj::copy_symbols_data): New function.
13620         (Relobj::is_section_name_included): New function.
13621         (Sized_relobj::do_layout): Allow this function to be called twice
13622         during garbage collection and defer layout of section during the
13623         first call.
13624         * object.h (Relobj::get_symbols_data): New function.
13625         (Relobj::is_section_name_included): New function.
13626         (Relobj::copy_symbols_data): New function.
13627         (Relobj::set_symbols_data): New function.
13628         (Relobj::get_relocs_data): New function.
13629         (Relobj::set_relocs_data): New function.
13630         (Relobj::is_output_section_offset_invalid): New pure virtual function.
13631         (Relobj::gc_process_relocs): New function.
13632         (Relobj::do_gc_process_relocs): New pure virtual function.
13633         (Relobj::sd_): New data member.
13634         (Sized_relobj::is_output_section_offset_invalid): New function.
13635         (Sized_relobj::do_gc_process_relocs): New function.
13636         * options.h (General_options::gc_sections): Modify to not be a no-op.
13637         (General_options::print_gc_sections): New option.
13638         * plugin.cc (Plugin_finish::run): Remove function call to
13639         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13640         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13641         * reloc.cc (Read_relocs::run): Add task to process relocs and
13642         determine unreferenced sections when doing garbage collection.
13643         (Gc_process_relocs): New class.
13644         (Sized_relobj::do_gc_process_relocs): New function.
13645         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13646         sections that are garbage collected.
13647         * reloc.h (Gc_process_relocs): New class.
13648         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13649         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13650         symbols whose corresponding sections are garbage collected.
13651         (Symbol_table::Symbol_table): Add new parameter for the garbage
13652         collection object.
13653         (Symbol_table::gc_mark_undef_symbols): New function.
13654         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13655         (Symbol_table::gc_mark_dyn_syms): New function.
13656         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13657         as garbage.
13658         (Symbol_table::add_from_object): Likewise.
13659         (Symbol_table::add_from_relobj): When building shared objects, do not
13660         treat externally visible symbols as garbage.
13661         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13662         table information for static and relocatable links.
13663         * symtab.h (Symbol_table::set_gc): New function.
13664         (Symbol_table::gc): New function.
13665         (Symbol_table::gc_mark_undef_symbols): New function.
13666         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13667         (Symbol_table::gc_mark_dyn_syms): New function.
13668         (Symbol_table::gc_): New data member.
13669         * target.h (Sized_target::gc_process_relocs): New pure virtual
13670         function.
13671         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13672         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13673
13674 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13675
13676         * options.h (General_options::gc_sections): Define as a no-op for now.
13677         (General_options::no_keep_memory): Ditto.
13678         (General_options::Bshareable): Define.
13679         * options.cc (General_options::finalize): Honor -Bshareable.
13680
13681 2009-01-20  Andreas Schwab  <schwab@suse.de>
13682
13683         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13684         read the value in the contents, since we don't use it.  Use the
13685         template endianness when writing.
13686         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13687
13688 2009-01-19  Andreas Schwab  <schwab@suse.de>
13689
13690         * configure.tgt (powerpc64-*): Fix targ_obj.
13691
13692 2009-01-15  Ian Lance Taylor  <iant@google.com>
13693
13694         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13695         local symbols when stripping all symbols.
13696
13697 2009-01-14  Cary Coutant  <ccoutant@google.com>
13698
13699         * output.cc (Output_reloc): Add explicit instantiations.
13700
13701 2009-01-14  Cary Coutant  <ccoutant@google.com>
13702
13703         * archive.cc (Archive::get_elf_object_for_member): Remove call
13704         to File_read::claim_for_plugin.
13705         * descriptors.cc (Descriptors::open): Remove reference to
13706         is_claimed.
13707         (Descriptors::claim_for_plugin): Remove.
13708         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13709         (Descriptors::is_claimed): Remove.
13710         (claim_descriptor_for_plugin): Remove.
13711         * fileread.cc (File_read::claim_for_plugin): Remove.
13712         * fileread.h (File_read::claim_for_plugin): Remove.
13713         (File_read::descriptor): Reopen descriptor if necessary.
13714         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13715         (Plugin_manager::all_symbols_read): Add task parameter. Change
13716         all callers.
13717         (Plugin_manager::get_input_file): New function.
13718         (Plugin_manager::release_input_file): New function.
13719         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13720         corresponding data member.
13721         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13722         and pass to base constructor. Change all callers.
13723         (get_input_file, release_input_file): New functions.
13724         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13725         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13726         (Plugin_manager::all_symbols_read): Add task parameter.
13727         (Plugin_manager::get_input_file): New function.
13728         (Plugin_manager::release_input_file): New function.
13729         (Plugin_manager::task_): New data member.
13730         (Pluginobj::Pluginobj): Add filesize parameter.
13731         (Pluginobj::filename): New function.
13732         (Pluginobj::descriptor): New function.
13733         (Pluginobj::filesize): New function.
13734         (Pluginobj::filesize_): New data member.
13735         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13736         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13737         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13738
13739         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13740         with archive libraries.
13741         * testsuite/Makefile.in: Regenerate.
13742         * testsuite/plugin_test.c (struct sym_info): New type.
13743         (get_input_file, release_input_file): New static variables.
13744         (onload): Capture new transfer vector entries.
13745         (claim_file_hook): Stop reading at end of file according to filesize.
13746         Factor out parsing of readelf output into separate function.
13747         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13748         APIs and get the source file name from the symbol table.  Convert
13749         source file name to corresponding object file name.  Print info
13750         message when adding new input files.
13751         (parse_readelf_line): New function.
13752         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13753         * testsuite/plugin_test_2.sh: Likewise.
13754         * testsuite/plugin_test_3.sh: Likewise.
13755         * testsuite/plugin_test_4.sh: New test case.
13756
13757 2009-01-07  Ian Lance Taylor  <iant@google.com>
13758
13759         * version.cc (version_string): Bump to 1.8.
13760
13761 2008-12-23  Cary Coutant  <ccoutant@google.com>
13762
13763         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13764         * plugin.cc (Plugin_manager::finish): Rename as
13765         layout_deferred_objects.  Move cleanup to separate function.
13766         (Plugin_manager::cleanup): New function.
13767         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13768         separately.
13769         * plugin.h (Plugin_manager::finish): Rename as
13770         layout_deferred_objects.
13771         (Plugin_manager::cleanup): New function.
13772         (Plugin_manager::cleanup_done): New field.
13773
13774 2008-12-23  Cary Coutant  <ccoutant@google.com>
13775
13776         * plugin.cc (is_visible_from_outside): New function.
13777         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13778         so we don't return "IR only" status for exported symbols or -r links.
13779
13780         * testsuite/Makefile.am (plugin_test_3): New test case.
13781         * testsuite/Makefile.in: Regenerate.
13782         * testsuite/plugin_test_3.sh: New file.
13783
13784 2008-12-22  Cary Coutant  <ccoutant@google.com>
13785
13786         * object.cc (Sized_relobj::layout_section): New function.
13787         (Sized_relobj::do_layout): Defer layout of input sections until after
13788         plugin has provided replacement files.
13789         (Sized_relobj::do_layout_deferred_sections): New function.
13790         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13791         (Relobj::layout_deferred_sections): New function.
13792         (Relobj::do_layout_deferred_sections): New function.
13793         (Sized_relobj::do_layout_deferred_sections): New function.
13794         (Sized_relobj::layout_section): New function.
13795         (Sized_relobj::Deferred_layout): New structure.
13796         (Sized_relobj::deferred_layout_): New field.
13797         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13798         Change all callers.  Layout deferred sections.
13799         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13800         references.
13801         (Plugin_hook::run): Move code from do_plugin_hook inline.
13802         (Plugin_hook::do_plugin_hook): Remove.
13803         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13804         (Plugin_manager::finish): Renamed, was cleanup.
13805         (Plugin_manager::should_defer_layout): New function.
13806         (Plugin_manager::add_deferred_layout_object): New function.
13807         (Plugin_manager::Deferred_layout_list): New type.
13808         (Plugin_manager::deferred_layout_objects_): New field.
13809         (Plugin_hook::do_plugin_hook): Remove.
13810
13811 2008-12-17  Ian Lance Taylor  <iant@google.com>
13812
13813         * options.h (class General_options): Add --no case for
13814         --export-dynamic.
13815
13816 2008-12-16  Cary Coutant  <ccoutant@google.com>
13817
13818         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13819         vector.
13820         (Plugin_manager::claim_file): Create plugin object even if
13821         plugin did not call the add_symbols callback.
13822         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13823         asking for more symbols than were added.
13824         * testsuite/Makefile.am (plugin_test_1): Add test case with
13825         no global symbols.
13826         (empty.syms): New target.
13827         * testsuite/Makefile.in: Regenerate.
13828         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13829         message. Don't call add_symbols if no globals.
13830         (all_symbols_read_hook): Don't provide replacement for empty
13831         claimed file.
13832
13833 2008-12-12  Ian Lance Taylor  <iant@google.com>
13834
13835         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13836         r_type == 0 for a local symbol with r_sym == 0.
13837         (scan_relocatable_relocs): Pass r_sym to
13838         local_non_section_strategy.
13839         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13840         r_sym parameter.
13841
13842         * configure.ac: Update test for TLS descriptors: they are
13843         supported as of glibc 2.9.
13844         * configure: Rebuild.
13845
13846 2008-12-11  Ian Lance Taylor  <iant@google.com>
13847
13848         PR 7091
13849         * target-reloc.h (Default_scan_relocatable_relocs): For each
13850         function, map r_type == 0 to RELOC_DISCARD.
13851
13852 2008-12-10  Cary Coutant  <ccoutant@google.com>
13853
13854         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13855         object to override a kept COMDAT group from a plugin object.
13856
13857 2008-12-09  Ian Lance Taylor  <iant@google.com>
13858
13859         PR 7088
13860         * yyscript.y (file_cmd): Handle INPUT.
13861
13862         * testsuite/initpri1.c: Change all declarations to be full
13863         prototypes by adding void, to avoid compiler warnings.
13864
13865 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13866
13867         * options.cc (General_options::parse_plugin_opt): New.
13868         (General_options::add_plugin): The argument now is just the filename.
13869         (General_options::add_plugin_option): New.
13870         * options.h (plugin_opt): New.
13871         (add_plugin): Change argument name.
13872         (add_plugin_option): New.
13873         * plugin.cc (Plugin::load): Don't parse the plugin option.
13874         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13875         (Plugin::add_option): New.
13876         (Plugin::args_): Change type.
13877         (Plugin::filename_): New.
13878         (Plugin_manager::add_plugin_option): New.
13879         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13880         * testsuite/Makefile.in: Regenerate.
13881
13882 2008-12-05  Cary Coutant  <ccoutant@google.com>
13883
13884         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13885         Handle --strip-lto-sections option.
13886         * options.h (strip_lto_sections): New option.
13887
13888 2008-12-01  Cary Coutant  <ccoutant@google.com>
13889
13890         * plugin.cc (ld_plugin_message): Change format parameter to const.
13891         Fix mismatch between new[] and delete.
13892
13893 2008-11-14  Cary Coutant  <ccoutant@google.com>
13894
13895         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13896         instead of -1U.
13897
13898 2008-11-05  Craig Silverstein  <csilvers@google.com>
13899
13900         * options.cc (General_options::parse_dynamic_list): New function.
13901         * options.h (General_options): New flags dynamic_list,
13902         dynamic_list_data, dynamic_list_cpp_new, and
13903         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13904         (General_options::in_dynamic_list): New function.
13905         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13906         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13907         (Lex::can_continue_name): Likewise.
13908         (yylex): Likewise.
13909         (read_script_file): New parameter script_options.
13910         (read_dynamic_list): New function.
13911         (Script_options::define_dynamic_list): New function.
13912         (dynamic_list_keyword_parsecodes): New variable.
13913         (dynamic_list_keywords): New variable.
13914         * script.h (Script_options::define_dynamic_list): New function
13915         prototype.
13916         (read_dynamic_list): New function prototype.
13917         * symtab.cc (strprefix): New macro.
13918         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13919         dynamic_list_data, dynamic_list_cpp_new, and
13920         dynamic_list_cpp_typeinfo.
13921         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13922         (dynamic_list_expr): New rule.
13923         (dynamic_list_nodes): Likewise.
13924         (dynamic_list_node): Likewise.
13925         * testsuite/Makefile.am (dynamic_list): New test.
13926         * testsuite/Makefile.in: Regenerated.
13927         * testsuite/dynamic_list.t: New file.
13928         * testsuite/dynamic_list.sh: New file.
13929
13930 2008-11-05  Craig Silverstein  <csilvers@google.com>
13931
13932         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13933         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13934         (t11_last): Likewise.
13935         * testsuite/ver_test_6.c (main): Likewise.
13936
13937 2008-10-07  Cary Coutant  <ccoutant@google.com>
13938
13939         * options.c (General_options::finalize): Add check for -static and
13940         -shared.
13941         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13942         is not empty.
13943
13944 2008-10-02  Cary Coutant  <ccoutant@google.com>
13945
13946         * plugin.cc (make_sized_plugin_object): Fix conditional
13947         compilation to work when not all targets are enabled.
13948
13949 2008-09-29  Cary Coutant  <ccoutant@google.com>
13950
13951         * archive.cc (Archive::get_file_and_offset): Use filename instead
13952         of name to get library path.
13953         (Archive::include_member): Unlock external member of a thin archive.
13954
13955         * testsuite/Makefile.am (TEST_AR): New variable.
13956         (thin_archive_test_1): New test.
13957         (thin_archive_test_2): New test.
13958         * testsuite/Makefile.in: Regenerate.
13959         * testsuite/thin_archive_main.cc: New file.
13960         * testsuite/thin_archive_test_1.cc: New file.
13961         * testsuite/thin_archive_test_2.cc: New file.
13962         * testsuite/thin_archive_test_3.cc: New file.
13963         * testsuite/thin_archive_test_4.cc: New file.
13964
13965 2008-09-29  Cary Coutant  <ccoutant@google.com>
13966
13967         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13968         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13969         instead of -1U.
13970         (Sized_relobj::do_finalize_local_symbols): Likewise.
13971         (Sized_relobj::map_to_kept_section): Likewise.
13972         * object.h (Sized_relobj::invalid_address): New constant.
13973         (Sized_relobj::do_output_section_offset): Check for invalid_address
13974         and return -1ULL.
13975         * output.cc (Output_reloc::local_section_offset): Use constant
13976         invalid_address instead of -1U.
13977         (Output_reloc::get_address): Likewise.
13978         (Output_section::output_address): Change -1U to -1ULL.
13979         * output.h (Output_reloc::invalid_address): New constant.
13980         * reloc.cc (Sized_relobj::write_sections): Use constant
13981         invalid_address instead of -1U.
13982         (Sized_relobj::relocate_sections): Likewise.
13983         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13984         values for merge sections.
13985         * target-reloc.h (relocate_for_relocatable): Use constant
13986         invalid_address instead of -1U.
13987
13988 2008-09-19  Cary Coutant  <ccoutant@google.com>
13989
13990         Add plugin functionality for link-time optimization (LTO).
13991         * configure.ac (plugins): Add --enable-plugins option.
13992         * configure: Regenerate.
13993         * config.in: Regenerate.
13994         * Makefile.am (LIBDL): New variable.
13995         (CCFILES): Add plugin.cc.
13996         (HFILES): Add plugin.h.
13997         (ldadd_var): Add LIBDL.
13998         * Makefile.in: Regenerate.
13999
14000         * archive.cc: Include "plugin.h".
14001         (Archive::setup): Don't preread archive symbols when using a plugin.
14002         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
14003         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
14004         files.
14005         (Archive::include_member): Add symbols from plugin objects.
14006         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
14007         * descriptors.cc (Descriptors::open): Check for file descriptors
14008         abandoned by plugins.
14009         (Descriptors::claim_for_plugin): New function.
14010         * descriptors.h (Descriptors::claim_for_plugin): New function.
14011         (Open_descriptor::is_claimed): New field.
14012         (claim_descriptor_for_plugin): New function.
14013         * fileread.cc (File_read::claim_for_plugin): New function.
14014         * fileread.h (File_read::claim_for_plugin): New function.
14015         (File_read::descriptor): New function.
14016         * gold.cc: Include "plugin.h".
14017         (queue_initial_tasks): Add task to call plugin hooks for generating
14018         new object files.
14019         * main.cc: Include "plugin.h".
14020         (main): Load plugin libraries.
14021         * object.h (Pluginobj): Declare.
14022         (Object::pluginobj): New function.
14023         (Object::do_pluginobj): New function.
14024         (Object::set_target): New function.
14025         * options.cc: Include "plugin.h".
14026         (General_options::parse_plugin): New function.
14027         (General_options::General_options): Initialize plugins_ field.
14028         (General_options::add_plugin): New function.
14029         * options.h (Plugin_manager): Declare.
14030         (General_options): Add --plugin option.
14031         (General_options::has_plugins): New function.
14032         (General_options::plugins): New function.
14033         (General_options::add_plugin): New function.
14034         (General_options::plugins_): New field.
14035         * plugin.cc: New file.
14036         * plugin.h: New file.
14037         * readsyms.cc: Include "plugin.h".
14038         (Read_symbols::do_read_symbols): Check for archive before checking
14039         for ELF file.  Call plugin hooks to claim files.
14040         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
14041         from a real object file; force override when processing replacement
14042         files.
14043         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
14044         (Symbol::init_base_object): Likewise.
14045         (Symbol::init_base_output_data): Likewise.
14046         (Symbol::init_base_output_segment): Likewise.
14047         (Symbol::init_base_constant): Likewise.
14048         (Symbol::init_base_undefined): Likewise.
14049         (Symbol::output_section): Assert that object is not a plugin.
14050         (Symbol_table::add_from_pluginobj): New function.
14051         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
14052         undefined.
14053         (Symbol_table::sized_write_globals): Likewise.
14054         (Symbol_table::add_from_pluginobj): Instantiate template.
14055         * symtab.h (Sized_pluginobj): Declare.
14056         (Symbol::in_real_elf): New function.
14057         (Symbol::set_in_real_elf): New function.
14058         (Symbol::in_real_elf_): New field.
14059         (Symbol_table::add_from_pluginobj): New function.
14060
14061         * testsuite/Makefile.am (AM_CFLAGS): New variable.
14062         (LIBDL): New variable.
14063         (LDADD): Add LIBDL.
14064         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
14065         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
14066         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
14067         (MOSTLYCLEANFILES): Likewise.
14068         * testsuite/Makefile.in: Regenerate.
14069         * testsuite/plugin_test.c: New file.
14070         * testsuite/plugin_test_1.sh: New file.
14071         * testsuite/plugin_test_2.sh: New file.
14072
14073 2008-09-16  Ian Lance Taylor  <iant@google.com>
14074
14075         * target-reloc.h (relocate_section): Check whether a symbol is
14076         defined by the ABI before reporting an undefined symbol error.
14077         * target.h (Target::is_defined_by_abi): Make parameter const.
14078         (Target::do_is_defined_by_abi): Likewise.
14079         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
14080         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
14081         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
14082         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
14083         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
14084         * testsuite/Makefile.in: Rebuild.
14085
14086         * fileread.cc (make_view): Add casts to avoid warning.
14087
14088 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14089
14090         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
14091         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14092
14093 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
14094
14095         * options.h (General_options::output_is_executable): New.
14096         (General_options::output_is_pie): New.
14097         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
14098         for shared libraries.
14099         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
14100
14101 2008-09-11  Chris Demetriou  <cgd@google.com>
14102
14103         * options.h (origin): New -z option.
14104         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
14105         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
14106         in DT_FLAGS_1.
14107
14108 2008-09-05  Cary Coutant  <ccoutant@google.com>
14109
14110         * fileread.cc (File_read::make_view): Add check for attempt to map
14111         beyond end of file.
14112
14113 2008-09-05  Cary Coutant  <ccoutant@google.com>
14114
14115         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
14116         explicit instantiations.
14117
14118 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
14119
14120         PR gold/6858
14121         * options.cc (General_options::finalize): Allow undefined symbols
14122         in shlibs if linking -shared.
14123
14124         PR gold/6859
14125         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
14126         symbols as not needing a dynsym entry.
14127
14128 2008-08-20  Craig Silverstein  <csilvers@google.com>
14129
14130         * fileread.cc (File_read::open): Do not lock the file unless it
14131         was successfully opened.
14132
14133 2008-08-14  Cary Coutant  <ccoutant@google.com>
14134
14135         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
14136         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
14137         * testsuite/tls_test.cc (struct int128): 128-bit struct
14138         for testing TLS relocs with non-zero addend.
14139         (v12): New TLS variable.
14140         (t12): New test.
14141         (t_last): Add check for v12.
14142         * testsuite/tls_test.h (t12): New function.
14143         * testsuite/tls_test_main.cc (thread_routine): Call new test.
14144
14145 2008-08-13  Ian Lance Taylor  <iant@google.com>
14146
14147         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
14148         set tls_segment_ or relro_segment_.
14149         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
14150         when appropriate.
14151         * output.h (Output_section::clear_is_relro): New function.
14152         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
14153         sections specially even when output_data_ is empty.
14154         (Output_segment::maximum_alignment): When first section is relro,
14155         only force alignment for PT_LOAD segments.
14156         * script.cc (script_data_segment_align): New function.
14157         (script_data_segment_relro_end): New function.
14158         * script-c.h (script_data_segment_align): Declare.
14159         (script_data_segment_relro_end): Declare.
14160         * script-sections.h (class Script_sections): Declare
14161         data_segment_align and data_segment_relro_end.  Add fields
14162         segment_align_index_ and saw_relro_end_.
14163         * script-sections.cc (class Sections_element): Add set_is_relro
14164         virtual function.  Add new bool* parameter to place_orphan_here.
14165         Add get_output_section virtual function.
14166         (class Output_section_definition): Add set_is_relro.  Add new
14167         bool* parameter to place_orphan_here.  Add get_output_section.
14168         Add is_relro_ field.
14169         (Output_section_definition::Output_section_definition): Initialize
14170         evaluated_address_, evaluated_load_address, evaluated_addralign_,
14171         and is_relro_ fields.
14172         (Output_section_definition::place_orphan_here): Add is_relro
14173         parameter.
14174         (Output_section_definition::set_section_addresses): Set relro for
14175         output section.
14176         (Output_section_definition::alternate_constraint): Likewise.
14177         (class Orphan_output_section): Add new bool* parameter to
14178         place_orphan_here.  Add get_output_section.
14179         (Orphan_output_section::place_orphan_here): Add is_relro
14180         parameter.
14181         (Script_sections::Script_sections): Initialize
14182         data_segment_align_index_ and saw_relro_end_.
14183         (Script_sections::data_segment_align): New function.
14184         (Script_sections::data_segment_relro_end): New function.
14185         (Script_sections::place_orphan): Set or clear is_relro.
14186         (Script_sections::set_section_addresses): Force alignment of first
14187         TLS section.
14188         * yyscript.y (exp): Call script_data_segment_align and
14189         script_data_segment_relro_end.
14190         * testsuite/relro_script_test.t: New file.
14191         * testsuite/relro_test.cc (using_script): Declare.
14192         (t1, t2): Test using_script.
14193         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
14194         (relro_script_test_SOURCES): Define.
14195         (relro_script_test_DEPENDENCIES): Define.
14196         (relro_script_test_LDFLAGS): Define.
14197         (relro_script_test_LDADD): Define.
14198         (relro_script_test.so): New target.
14199         * testsuite/Makefile.in: Rebuild.
14200
14201 2008-08-06  Cary Coutant <ccoutant@google.com>
14202
14203         * archive.cc (Archive::total_archives, Archive::total_members)
14204         (Archive::total_members_loaded): New variables.
14205         (Archive::setup): Add parameter.  Add option to preread
14206         archive symbols.
14207         (Archive::read_armap): Add counter.
14208         (Archive::get_file_and_offset): New function.
14209         (Archive::get_elf_object_for_member): New function.
14210         (Archive::read_all_symbols): New function.
14211         (Archive::read_symbols): New function.
14212         (Archive::add_symbols): Add counters.
14213         (Archive::include_all_members): Use armap to find members if it's
14214         already built.
14215         (Archive::include_member): Skip reading symbols if already read.
14216         Factored code into Archive::get_file_and_offset and
14217         Archive::get_elf_object_for_member.  Changed call to
14218         Mapfile::report_include_archive_member.
14219         (Archive::print_stats): New function.
14220         * archive.h: Declare Object and Read_symbols_data classes.
14221         (Archive::Archive): Add initializers for new members.
14222         (Archive::setup): Add parameter.
14223         (Archive::print_stats): New function.
14224         (Archive::total_archives, Archive::total_members)
14225         (Archive::total_members_loaded): New variables.
14226         (Archive::get_file_and_offset): New function.
14227         (Archive::get_elf_object_for_member): New function.
14228         (Archive::read_all_symbols): New function.
14229         (Archive::read_symbols): New function.
14230         (Archive::Archive_member): New class.
14231         (Archive::members_): New member.
14232         (Archive::num_members_): New member.
14233         * main.cc: Include archive.h.
14234         (main): Call Archive::print_stats.
14235         * mapfile.cc (Mapfile::report_include_archive_member): Delete
14236         archive parameter; member_name is now the fully-decorated name.
14237         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
14238         * options.h: (General_options): Add --preread-archive-symbols option.
14239         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
14240         Archive::setup.
14241
14242 2008-08-04  Ian Lance Taylor  <iant@google.com>
14243
14244         * symtab.h (Symbol::use_plt_offset): New function.
14245         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
14246         * powerpc.cc (Relocate::relocate): Likewise.
14247         * sparc.cc (Relocate::relocate): Likewise.
14248         * x86_64.cc (Relocate::relocate): Likewise.
14249         * testsuite/weak_plt.sh: New test.
14250         * testsuite/weak_plt_main.cc: New test.
14251         * testsuite/weak_plt_shared.cc: New test.
14252         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
14253         (check_PROGRAMS): Add weak_plt.
14254         (check_DATA): Add weak_plt_shared.so.
14255         (weak_plt_main_pic.o, weak_plt): New targets.
14256         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
14257         * testsuite/Makefile.in: Rebuild.
14258
14259         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
14260         gcctestdir/ld.
14261         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
14262         * testsuite/Makefile.in: Rebuild.
14263
14264 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
14265
14266         * Makefile.am (POTFILES.in): Set LC_ALL=C.
14267         * Makefile.in: Regenerate.
14268         * po/POTFILES.in: Regenerate.
14269
14270 2008-07-29  Ian Lance Taylor  <iant@google.com>
14271
14272         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
14273         symbols before other symbols.
14274         * testsuite/script_test_2.cc (test_addr): Declare.
14275         (test_addr_alias): Declare.
14276         (main): Check that test_addr and test_addr_alias have the right
14277         values.
14278         * testsuite/script_test_2.t: Define test_addr_alias and
14279         test_addr.
14280
14281 2008-07-24  Ian Lance Taylor  <iant@google.com>
14282
14283         PR 5990
14284         * descriptors.cc: New file.
14285         * descriptors.h: New file.
14286         * gold-threads.h (class Hold_optional_lock): New class.
14287         * fileread.cc: Include "descriptors.h".
14288         (File_read::~File_read): Release descriptor rather than closing
14289         it.
14290         (File_read::open) [file]: Call open_descriptor rather than open.
14291         Set is_descriptor_opened_.
14292         (File_read::open) [memory]: Assert that descriptor is not open.
14293         (File_read::reopen_descriptor): New function.
14294         (File_read::release): Release descriptor.
14295         (File_read::do_read): Make non-const.  Reopen descriptor.
14296         (File_read::read): Make non-const.
14297         (File_read::make_view): Reopen descriptor.
14298         (File_read::do_readv): Likewise.
14299         * fileread.h (class File_read): Add is_descriptor_opened_ field.
14300         Update declarations.
14301         * layout.cc: Include "descriptors.h".
14302         (Layout::create_build_id): Use open_descriptor rather than open.
14303         * output.cc: Include "descriptors.h".
14304         (Output_file::open): Use open_descriptor rather than open.
14305         * archive.cc (Archive::const_iterator): Change Archive to be
14306         non-const.
14307         (Archive::begin, Archive::end): Make non-const.
14308         (Archive::count_members): Likewise.
14309         * archive.h (class Archive): Update declarations.
14310         * object.h (Object::read): Make non-const.
14311         * Makefile.am (CCFILES): Add descriptors.cc.
14312         (HFILES): Add descriptors.h.
14313         * Makefile.in: Rebuild.
14314
14315         PR 6716
14316         * gold.h: Always include <clocale>.  Add Solaris workarounds
14317         following code in binutils/sysdep.h.
14318
14319         PR 6048
14320         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
14321         this->eh_frame_hdr_ is NULL before using it.
14322
14323         * dynobj.cc (Versions::Versions): Update comment.
14324
14325         * dynobj.cc (Versions::Versions): If there is an soname, use it as
14326         the base version name.
14327
14328         * stringpool.cc (Stringpool_template::add_with_length): Set key to
14329         array size plus one.
14330         (Stringpool_template::set_string_offsets): Subtract one from key
14331         before using it as an array index.
14332         (Stringpool_template::get_offset_with_length): Likewise.
14333         (Stringpool_template::write_to_buffer): Likewise.
14334         * stringpool.h (Stringpool_template::get_offset_from_key):
14335         Likewise.
14336
14337 2008-07-23  Ian Lance Taylor  <iant@google.com>
14338
14339         PR 6658
14340         * object.h (Merged_symbol_value::value): Do our best to handle a
14341         negative addend.
14342
14343         PR 6647
14344         * script.cc (Version_script_info::get_versions): Don't add empty
14345         version tag to return value.
14346         (Version_script_info::get_symbol_version_helper): Change return
14347         type to bool.  Add pversion parameter.  Change all callers.
14348         (script_register_vers_node): Don't require a non-NULL tag.
14349         * script.h (class Version_script_info): Update declarations.
14350         (Version_script_info::get_symbol_version): Change return type to
14351         bool.  Add version parameter.  Change all callers.
14352         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
14353         handling.  Handle an empty version from a version script.
14354         (Symbol_table::define_special_symbol): Likewise.
14355         * testsuite/ver_test_10.script: New file.
14356         * testsuite/ver_test_10.sh: New file.
14357         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
14358         (check_DATA): Add ver_test_10.syms.
14359         (ver_test_10.syms, ver_test_10.so): New target.
14360         * testsuite/Makefile.in: Rebuild.
14361
14362 2008-07-23  Simon Baldwin  <simonb@google.com>
14363
14364         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
14365         to zero for undefined symbols from dynamic libraries.
14366
14367 2008-07-23  Ian Lance Taylor  <iant@google.com>
14368
14369         * symtab.cc (Symbol_table::resolve): Remove version parameter.
14370         Change all callers.
14371         * symtab.h (class Symbol_table): Update declaration.
14372         * testsuite/ver_test_9.cc: New file.
14373         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
14374         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
14375         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
14376         (ver_test_9.so, ver_test_9.o): New targets.
14377         * testsuite/Makefile.in: Rebuild.
14378
14379 2008-07-22  Ian Lance Taylor  <iant@google.com>
14380
14381         * options.h (class General_options): Define --check-sections.
14382         * layout.cc (Layout::set_segment_offsets): Handle
14383         --check-sections.
14384
14385         * options.h (class General_options): Define -n/--nmagic and
14386         -N/--omagic.
14387         * options.cc (General_options::finalize): For -n/--nmagic or
14388         -N/--omagic, set -static.
14389         * layout.cc (Layout::attach_allocated_section_to_segment): If
14390         -N/--omagic, don't put read-only and read-write sections in
14391         different segments.
14392         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
14393         finding a read-only segment.
14394         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
14395         don't set the minimum segment alignment to the common page size,
14396         and don't set the file offset to the address modulo the page size.
14397         * script-sections.cc (Script_sections::create_segments): If
14398         -n/--omagic, don't put read-only and read-write sections in
14399         different segments.
14400
14401         * cref.cc: New file.
14402         * cref.h: New file.
14403         * options.h (class General_options): Add --print-symbol-counts.
14404         * main.cc (main): Issue defined symbol report if requested.
14405         * archive.cc (Archive::interpret_header): Make into a const member
14406         function.
14407         (Archive::add_symbols): Call Input_objects::archive_start and
14408         archive_stop.
14409         (Archive::const_iterator): Define new class.
14410         (Archive::begin, Archive::end): New functions.
14411         (Archive::include_all_members): Rewrite to use iterator.
14412         (Archive::count_members): New function.
14413         * archive.h (class Archive): Update declarations.
14414         (Archive::filename): New function.
14415         * object.cc: Include "cref.h".
14416         (Sized_relobj::Sized_relobj): Initialize defined_count_.
14417         (Sized_relobj::do_get_global_symbol_counts): New function.
14418         (Input_objects::add_object): Add object to cross-referencer.
14419         (Input_objects::archive_start): New function.
14420         (Input_objects::archive_stop): New function.
14421         (Input_objects::print_symbol_counts): New function.
14422         * object.h: Declare Cref and Archive.
14423         (Object::get_global_symbol_counts): New function.
14424         (Object::do_get_global_symbol_counts): New pure virtual function.
14425         (class Sized_relobj): Add defined_count_ field.  Update
14426         declarations.
14427         (class Input_objects): Add cref_ field.  Update constructor.
14428         Update declarations.
14429         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
14430         defined_count_.
14431         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
14432         symbol counts.
14433         (Sized_dynobj::do_get_global_symbol_counts): New function.
14434         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
14435         defined_count_.  Update declarations.  Define Symbols typedef.
14436         * symtab.cc (Symbol_table::add_from_relobj): Add defined
14437         parameter.  Change all callers.
14438         (Symbol_table::add_from_dynobj): Add sympointers and defined
14439         parameters.  Change all callers.
14440         * symtab.h (class Symbol_table): Update declarations.
14441         * Makefile.am (CCFILES): Add cref.cc.
14442         (HFILES): Add cref.h.
14443         * Makefile.in: Rebuild.
14444
14445 2008-07-22  Simon Baldwin  <simonb@google.com>
14446
14447         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
14448         to zero when writing undefined symbols.
14449
14450 2008-07-22  Ian Lance Taylor  <iant@google.com>
14451
14452         * output.cc (Output_section::add_input_section): Don't try to
14453         merge empty merge sections.
14454
14455 2008-07-21  Craig Silverstein  <csilvers@google.com>
14456
14457         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
14458         Include symbol version in error message.
14459
14460 2008-07-20  Chris Demetriou  <cgd@google.com>
14461
14462         * configure.ac (gold_cv_c_random_seed): New configured variable.
14463         (RANDOM_SEED_CFLAGS): New substituted variable.
14464         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
14465         * configure: Rebuild.
14466         * Makefile.in: Likewise.
14467         * testsuite/Makefile.in: Likewise.
14468
14469 2008-07-18  Ian Lance Taylor  <iant@google.com>
14470
14471         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
14472         where we see NAME/NULL and NAME/VERSION  as separate symbols.
14473         * testsuite/ver_test_main.cc (main): Call t4.
14474         (t4, t4_2a): Define.
14475         * testsuite/ver_test_2.cc (t4_2): Define.
14476         * testsuite/ver_test_2.script: Put t4_2a in VER2.
14477         * testsuite/ver_test_4.cc (t4_2a): Define.
14478         * testsuite/ver_test_4.script: Put t4_2a in VER2.
14479         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
14480
14481 2008-07-17  Ian Lance Taylor  <iant@google.com>
14482
14483         * dynobj.cc (Versions::add_def): If we give an error about a
14484         missing version, go ahead and create the version anyhow.
14485
14486 2008-07-10  Ian Lance Taylor  <iant@google.com>
14487
14488         Handle output sections with more than 0x7fffffff bytes.
14489         * object.h (class Relobj): Change map_to_output_ to
14490         output_sections_, and just keep a section pointer.  Change all
14491         uses.  Move comdat group support to Sized_relobj.
14492         (Relobj::is_section_specially_mapped): Remove.
14493         (Relobj::output_section): Remove poff parameter.  Change all
14494         callers.
14495         (Relobj::output_section_offset): New function.
14496         (Relobj::set_section_offset): Rewrite.
14497         (Relobj::map_to_output): Remove.
14498         (Relobj::output_sections): New function.
14499         (Relobj::do_output_section_offset): New pure virtual function.
14500         (Relobj::do_set_section_offset): Likewise.
14501         (class Sized_relobj): Add section_offsets_ field.  Add comdat
14502         group support from Relobj.  Update declarations.
14503         (Sized_relobj::get_output_section_offset): New function.
14504         (Sized_relobj::do_output_section_offset): New function.
14505         (Sized_relobj::do_set_section_offset): New function.
14506         * object.cc (Relobj::output_section_address): Remove.
14507         (Sized_relobj::Sized_relobj): Initialize new fields.
14508         (Sized_relobj::include_section_group): Cast find_kept_object to
14509         Sized_relobj.
14510         (Sized_relobj::include_linkonce_section): Likewise.
14511         (Sized_relobj::do_layout): Use separate arrays for output section
14512         and output offset.
14513         (Sized_relobj::do_count_local_symbols): Change map_to_output to
14514         output_sections.
14515         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
14516         output_sections and section_offsets.
14517         (Sized_relobj::write_local_symbols): Likewise.
14518         (map_to_kept_section): Compute output address directly.
14519         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
14520         output_sections and section_offsets.
14521         (Sized_relobj::write_sections): Likewise.
14522         (Sized_relobj::relocate_sections): Likewise.
14523         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
14524         * output.h (class Output_reloc): Update declarations.  Change
14525         u2_.relobj to Sized_relobj*.
14526         (class Output_data_reloc): Change add functions to use
14527         Sized_relobj*.
14528         * output.cc (Output_reloc::Output_reloc): Change relobj to
14529         Sized_relobj*.
14530         (Output_reloc::local_section_offset): Change return type to
14531         Elf_Addr.  Use get_output_section_offset.
14532         (Output_reloc::get_address): Likewise.
14533         (Output_section::is_input_address_mapped): Don't call
14534         is_section_specially_mapped.
14535         (Output_section::output_offset): Likewise.
14536         (Output_section::output_address): Likewise.
14537         (Output_section::starting_output_address): Likewise.
14538         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
14539         parameter to Sized_relobj*.
14540         (Copy_relocs::need_copy_reloc): Likewise.
14541         (Copy_relocs::save): Likewise.
14542         * copy-relocs.h (class Copy_relocs): Update declarations.
14543         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
14544         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
14545         * target-reloc.h (relocate_for_relocatable): Change
14546         offset_in_output_section type to Elf_Addr.  Change code that uses
14547         it as well.
14548         * layout.cc (Layout::layout): Always set *off.
14549         * mapfile.cc (Mapfile::print_input_section): Use
14550         output_section_offset.
14551         * i386.cc (Target_i386::copy_reloc): Change object parameter to
14552         Sized_relobj*.
14553         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
14554         * sparc.cc (Target_sparc::copy_reloc): Likewise.
14555         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
14556
14557 2008-07-03  Ian Lance Taylor  <iant@google.com>
14558
14559         * layout.cc (Layout::include_section): Do not discard unrecognized
14560         SHT_STRTAB sections.
14561
14562 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
14563
14564         * script.cc (Lex::can_continue_name): Make '?' allowable in
14565         version-script names.
14566         * testsuite/version_script.map: Change glob pattern to use '?'
14567
14568 2008-06-30  Manish Singh  <yosh@gimp.org>
14569
14570         PR 6585
14571         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
14572         Correct typo.
14573
14574 2008-06-30  Ian Lance Taylor  <iant@google.com>
14575
14576         PR 6660
14577         PR 6682
14578         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
14579         versions]: Don't try to read the value in the contents, since we
14580         don't use it.  Use the template endianness when writing.
14581
14582 2008-06-25  Cary Coutant  <ccoutant@google.com>
14583
14584         * fileread.cc (File_read::make_view): Assert on zero-length view.
14585         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
14586         symbol table when there are no symbols to read.
14587
14588 2008-06-23  Craig Silverstein  <csilvers@google.com>
14589
14590         * version.cc (version_string): Bump to 1.7
14591
14592 2008-06-18  Craig Silverstein  <csilvers@google.com>
14593
14594         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
14595         constant 0xFFFF to type Valtype.
14596         (Powerpc_relocate_functions::rel16_ha): Likewise.
14597
14598 2008-06-17  Ian Lance Taylor  <iant@google.com>
14599
14600         * output.h (Output_section::Input_section): Initialize p2align_ to
14601         zero for Output_section_data constructors.
14602         (Output_section::Input_section::addralign): If not an input
14603         section, return the alignment of the Output_section_data.
14604         * testsuite/copy_test.cc: New file.
14605         * testsuite/copy_test_1.cc: New file.
14606         * testsuite/copy_test_2.cc: New file.
14607         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
14608         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
14609         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
14610         (copy_test_1_pic.o, copy_test_1.so): New targets.
14611         (copy_test_2_pic.o, copy_test_2.so): New targets.
14612         * testsuite/Makefile.in: Rebuild.
14613
14614         * script-sections.cc (Script_sections::place_orphan): Initialize
14615         local variable exact.
14616
14617 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
14618
14619         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
14620
14621 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
14622             David S. Miller  <davem@davemloft.net>
14623
14624         * powerpc.cc: New file.
14625         * Makefile.am (TARGETSOURCES): Add powerpc.cc
14626         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
14627         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
14628         * Makefile.in: Rebuild.
14629
14630 2008-06-09  Ian Lance Taylor  <iant@google.com>
14631
14632         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14633         <exception>.
14634         (throwing, orig_terminate): New static variables.
14635         (terminate_handler): New static function.
14636         (t2): Set terminate handler.
14637
14638 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14639
14640         PR 6584
14641         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14642         alignment.
14643
14644 2008-05-30  Cary Coutant  <ccoutant@google.com>
14645
14646         * archive.cc (Archive::include_all_members) Correct to step
14647         over symbol table and extended name table in thin archives.
14648
14649 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14650
14651         PR 6407
14652         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14653         calculation.
14654
14655 2008-05-28  Caleb Howe  <cshowe@google.com>
14656
14657         * reduced_debug_output.cc: New file.
14658         * reduced_debug_output.h: New file.
14659         * options.h (class General_options): Add --strip-debug-non-line.
14660         * options.cc (General_options::finalize): Add strip_debug_non_line
14661         to the strip heirarchy.
14662         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14663         fields.
14664         * layout.cc: Include "reduced_debug_output.h".
14665         (Layout::Layout): Initialize new fields.
14666         (line_only_debug_sections): New static array.
14667         (is_lines_only_debug_sections): New static inline function.
14668         (Layout::include_section): Handle --strip-debug-non-line.
14669         (Layout::make_output_section): If --strip-debug-non-line, build
14670         new output sections for .debug_abbrev and .debug_info.
14671         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14672         gold.  Warn about possible overflow.
14673         (read_signed_LEB_128): Likewise.
14674         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14675         (read_signed_LEB_128): Declare.
14676         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14677         (HFILES): Add reduced_debug_output.h.
14678         * Makefile.in: Rebuild.
14679
14680 2008-05-21  Ian Lance Taylor  <iant@google.com>
14681
14682         * mapfile.cc: New file.
14683         * mapfile.h: New file.
14684         * options.h (class General_options): Add -M/--print-map and -Map.
14685         * options.cc (General_options::finalize): Make -M equivalent to
14686         -Map -.
14687         * main.cc: Include <cstdio> and "mapfile.h".
14688         (main): Open mapfile if requested.
14689         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14690         constructor.  Change caller.
14691         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14692         (queue_middle_tasks): Likewise.
14693         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14694         declarations.
14695         * archive.cc: Include "mapfile.h".
14696         (Archive::add_symbols): Add mapfile parameter.  Change all
14697         callers.  Pass mapfile, symbol, and reason to include_member.
14698         (Archive::include_all_members): Add mapfile parameter.  Change all
14699         callers.
14700         (Archive::include_member): Add mapfile, sym, and why parameters.
14701         Change all callers.  Report inclusion to map file.
14702         * archive.h: Include "fileread.h".
14703         (class Archive): Update declarations.
14704         (Archive::file): New const method.
14705         (class Add_archive_symbols): Add mapfile_ field.  Update
14706         constructor.  Change all callers.
14707         * readsyms.h (class Read_symbols): Likewise.
14708         (class Finish_group): Likewise.
14709         (class Read_script): Likewise.
14710         * common.cc: Include "mapfile.h".
14711         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14712         all callers.
14713         (Symbol_table::do_allocate_commons): Likewise.
14714         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14715         symbol allocation to mapfile.
14716         * common.h (class Allocate_commons_task): Add mapfile_ field.
14717         Update constructor.  Change all callers.
14718         * symtab.h (class Symbol_table): Update declarations.
14719         * layout.cc: Include "mapfile.h".
14720         (Layout_task_runner::run): Print information to mapfile.
14721         (Layout::create_gold_note): Change Output_data_fixed_space to
14722         Output_data_zero_fill.
14723         (Layout::create_build_id): Likewise.
14724         (Layout::print_to_mapfile): New function.
14725         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14726         constructor.  Change caller.
14727         (class Layout): Declare print_to_mapfile.
14728         * output.cc (Output_section::Input_section::print_to_mapfile): New
14729         function.
14730         (Output_section::add_input_section): If producing a map, always
14731         add to input_sections_ list.
14732         (Output_section::do_print_to_mapfile): New function.
14733         (Output_segment::print_sections_to_mapfile): New function.
14734         (Output_segment::print_section_list_to_mapfile): New function.
14735         * output.h: Include "mapfile.h".
14736         (Output_data::print_to_mapfile): New function.
14737         (Output_data::do_print_to_mapfile): New virtual function.
14738         (Output_segment_headers::do_print_to_mapfile): New function.
14739         (Output_file_header::do_print_to_mapfile): New function.
14740         (Output_data_const::do_print_to_mapfile): New function.
14741         (class Output_data_const_buffer): Add map_name_ field.  Update
14742         constructor.  Change all callers.  Add do_print_to_mapfile
14743         function.
14744         (class Output_data_fixed_space): Likewise.
14745         (class Output_data_space): Likewise.
14746         (class Output_data_zero_fill): New class.
14747         (Output_data_strtab::do_print_to_mapfile): New function.
14748         (Output_data_reloc_base::do_print_to_mapfile): New function.
14749         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14750         (Output_data_group::do_print_to_mapfile): New function.
14751         (Output_data_got::do_print_to_mapfile): New function.
14752         (Output_data_dynamic::do_print_to_mapfile): New function.
14753         (Output_symtab_xindex::do_print_to_mapfile): New function.
14754         (class Output_section): Declare do_print_to_mapflie.  Declare
14755         print_to_mapfile in Input_section.
14756         (class Output_segment): Declare new functions.
14757         * object.h (Sized_relobj::symbol_count): New function.
14758         * script-sections.cc
14759         (Output_section_element_dot_assignment::set_section_addresses):
14760         Change Output_data_fixed_space to Output_data_zero_fill.
14761         (Output_data_expression::do_print_to_mapfile): New function.
14762         * script.cc (read_input_script): Add mapfile parameter.  Change
14763         all callers.
14764         * script.h (read_input_script): Update declaration.
14765         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14766         (Eh_frame::do_print_to_mapfile): New function.
14767         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14768         (Output_merge_string::do_print_to_mapfile): New function.
14769         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14770         function.
14771         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14772         function.
14773         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14774         function.
14775         * Makefile.am (CCFILES): Add mapfile.cc.
14776         (HFILES): Add mapfile.h.
14777         * Makefile.in: Rebuild.
14778
14779 2008-05-19  Ian Lance Taylor  <iant@google.com>
14780
14781         * options.h (class General_options): Add -z relro.
14782         * layout.cc (Layout::Layout): Initialize relro_segment_.
14783         (Layout::add_output_section_data): Return the output section.
14784         (Layout::make_output_section): Rcognize relro sections and mark
14785         them appropriately.
14786         (Layout::attach_allocated_section_to_segment): Put relro sections
14787         in a PT_GNU_RELRO segment.
14788         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14789         section as relro.
14790         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14791         PT_TLS segments.
14792         (Layout::linkonce_mapping): Map d.rel.ro.local to
14793         .data.rel.ro.local.
14794         (Layout::output_section_name): Us .data.rel.ro.local for any
14795         section which begins with that.
14796         * layout.h (class Layout): Update add_output_section_data
14797         declaration.  Add relro_segment_ field.
14798         * output.cc (Output_section::Output_section): Initialize is_relro_
14799         and is_relro_local_ fields.
14800         (Output_segment::add_output_section): Group relro sections.
14801         (Output_segment::is_first_section_relro): New function.
14802         (Output_segment::maximum_alignment): If there is a relro section,
14803         align the segment to the common page size.
14804         (Output_segment::set_section_addresses): Track whether we are
14805         looking at relro sections.  If the last section is a relro
14806         section, align to the common page size.
14807         (Output_segment::set_section_list_addresses): Add in_relro
14808         parameter.  Change all callers.  Align to the page size when
14809         moving from relro to non-relro section.
14810         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14811         segment.
14812         * output.h (class Output_section): Add is_relro_ and
14813         is_relro_local_ fields.
14814         (Output_section::is_relro): New function.
14815         (Output_section::set_is_relro): New function.
14816         (Output_section::is_relro_local): New function.
14817         (Output_section::set_is_relro_local): New function.
14818         (class Output_segment): Update declarations.
14819         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14820         * sparc.cc (Target_sparc::got_section): Likewise.
14821         * x86_64.cc (Target_x86_64::got_section): Likewise.
14822         * testsuite/relro_test_main.cc: New file.
14823         * testsuite/relro_test.cc: New file.
14824         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14825         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14826         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14827         (relro_test.so, relro_test_pic.o): New targets.
14828         * testsuite/Makefile.in: Rebuild.
14829
14830 2008-05-16  Ian Lance Taylor  <iant@google.com>
14831
14832         * output.cc (Output_segment::add_output_section): Remove front
14833         parameter.
14834         * output.h (class Output_segment): Remove
14835         add_initial_output_section and overloaded add_output_section.
14836         Update declaration of remaining add_output_section.
14837         * layout.cc (Layout::create_interp): Call add_output_section
14838         rather than add_initial_output_section.
14839         (Layout::finish_dynamic_section): Likewise.
14840
14841         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14842         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14843         know the dynamic type.
14844         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14845         field.  Initialize it in constructor.
14846         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14847         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14848         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14849         reloc.
14850
14851         * output.cc (Output_reloc::get_address): Change return type to
14852         Elf_Addr.
14853         * output.h (class Output_reloc): Update get_address declaration.
14854         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14855         for section addresses.
14856
14857 2008-05-09  Ian Lance Taylor  <iant@google.com>
14858
14859         PR 6493
14860         * gold.cc (gold_nomem): Use return value of write.
14861
14862 2008-05-08  Ian Lance Taylor  <iant@google.com>
14863
14864         * symtab.c (Symbol::init_base_output_data): Add version
14865         parameter.  Change all callers.
14866         (Symbol::init_base_output_segment): Likewise.
14867         (Symbol::init_base_constant): Likewise.
14868         (Symbol::init_base_undefined): Likewise.
14869         (Sized_symbol::init_output_data): Likewise.
14870         (Sized_symbol::init_output_segment): Likewise.
14871         (Sized_symbol::init_constant): Likewise.
14872         (Sized_symbol::init_undefined): Likewise.
14873         (Symbol_table::do_define_in_output_data): If the new symbol has a
14874         version, mark it as the default.
14875         (Symbol_table::do_define_in_output_segment): Likewise.
14876         (Symbol_table::do_define_as_constant): Likewise.
14877         * symtab.h (class Symbol): Update declarations.
14878         (class Sized_symbol): Likewise.
14879         * resolve.cc (Symbol::override_version): New function.
14880         (Symbol::override_base): Call override_version.
14881         (Symbol::override_base_with_special): Likewise.
14882         * testsuite/ver_script_8.script: New file.
14883         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14884         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14885         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14886         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14887
14888 2008-05-06  Ian Lance Taylor  <iant@google.com>
14889
14890         PR 6049
14891         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14892         functions.
14893         (class General_options): Remove existing --undefined, and add
14894         --no-undefined instead.  Add new --undefined as synonym for -u.
14895         * archive.cc (Archive::add_symbols): Check whether symbol was
14896         named with -u.
14897         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14898         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14899         all uses.  Add IS_UNDEFINED.  Update declarations to split
14900         different versions of init_base.  Declare init_base_undefined.
14901         (Symbol::is_defined): Handle IS_UNDEFINED.
14902         (Symbol::is_undefined): Likewise.
14903         (Symbol::is_weak_undefined): Call is_undefined.
14904         (Symbol::is_absolute): Handle IS_CONSTANT.
14905         (class Sized_symbol): Update declarations to split different
14906         versions of init.  Declare init_undefined.
14907         (class Symbol_table): Declare new functions.
14908         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14909         Change all callers.
14910         (Symbol::init_base_output_data): Likewise.
14911         (Symbol::init_base_output_segment): Likewise.
14912         (Symbol::init_base_constant): Likewise.
14913         (Symbol::init_base_undefined): New function.
14914         (Sized_symbol::init_object): Rename from init.  Change all
14915         callers.
14916         (Sized_symbol::init_output_data): Likewise.
14917         (Sized_symbol::init_output_segment): Likewise.
14918         (Sized_symbol::init_constant): Likewise.
14919         (Sized_symbol::init_undefined): New function.
14920         (Symbol_table::add_undefined_symbols_from_command_line): New
14921         function.
14922         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14923         function.
14924         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14925         (Symbol::output_section): Likewise.
14926         (Symbol::set_output_section): Likewise.
14927         (Symbol_table::sized_finalize_symbol): Likewise.
14928         (Symbol_table::sized_write_globals): Likewise.
14929         * resolve.cc (Symbol_table::should_override): Likewise.
14930         (Symbol::override_base_with_special): Likewise.
14931
14932         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14933         symbol, change it to have default visibility.
14934         * testsuite/protected_1.cc: New file.
14935         * testsuite/protected_2.cc: New file.
14936         * testsuite/protected_3.cc: New file.
14937         * testsuite/protected_main_1.cc: New file.
14938         * testsuite/protected_main_2.cc: New file.
14939         * testsuite/protected_main_3.cc: New file.
14940         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14941         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14942         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14943         (protected_1.so): New target.
14944         (protected_1_pic.o, protected_2_pic.o): New targets.
14945         (protected_3_pic.o): New target.
14946         (check_PROGRAMS): Add protected_2.
14947         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14948         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14949         * testsuite/Makefile.in: Rebuild.
14950
14951         * options.h (DEFINE_var): Add set_user_set_##varname__.
14952         (DEFINE_bool_alias): New macro.
14953         (class General_options): Define -Bstatic using DEFINE_bool_alias
14954         rather than DEFINE_special.  Add --undefined as an alias for -z
14955         defs.
14956         * options.cc (General_options::parse_Bstatic): Remove.
14957
14958         * options.h (class General_options): Add --fatal-warnings.
14959         * main.cc (main): Implement --fatal-warnings.
14960         * errors.h (Errors::warning_count): New function.
14961
14962         * options.h (class General_options): Add -Bsymbolic-functions.
14963         * symtab.h (Symbol::is_preemptible): Check for
14964         -Bsymbolic-functions.
14965
14966 2008-05-05  Ian Lance Taylor  <iant@google.com>
14967
14968         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14969         as noVARNAME rather than no-VARNAME.
14970         (class General_options): Add option -z combreloc.
14971         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14972         get_address.
14973         (Output_reloc::sort_before) [SHT_REL]: New function.
14974         (Output_reloc::sort_before) [SHT_RELA]: New function.
14975         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14976         Sort_relocs_comparison.
14977         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14978         parameter.  Change all callers.
14979         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14980         sort_relocs parameter.  Change all callers.
14981         * output.cc (Output_reloc::get_address): New function, broken out
14982         of write_rel.
14983         (Output_reloc::write_rel): Call it.
14984         (Output_reloc::compare): New function.
14985         (Output_data_reloc_base::do_write): Optionally sort relocs.
14986
14987         * configure.ac: If targ_extra_obj is set, link it in.
14988         * configure.tgt: Initialize all variables.
14989         (x86_64*): Set targ_extra_obj and targ_extra_size.
14990         * configure: Rebuild.
14991
14992         * object.cc (Sized_relobj::include_section_group): Adjust section
14993         indexes read from group data.  Build vector to pass to
14994         layout_group.
14995         * layout.cc (Layout::layout_group): Add flags and shndxes
14996         parameters.  Remove contents parameter.  Change caller.  Update
14997         explicit instantiations.
14998         * layout.h (class Layout): Update layout_group declaration.
14999         * output.cc (Output_data_group::Output_data_group): Add flags and
15000         input_shndxes parameters.  Remove contents parameter.  Change
15001         caller.
15002         (Output_data_group::do_write): Change input_sections_ to
15003         input_shndxes_.
15004         * output.h (class Output_data_group): Update constructor
15005         declaration.  Rename input_sections_ to input_shndxes_.
15006         * testsuite/many_sections_test.cc: Add template.
15007
15008 2008-04-30  Cary Coutant  <ccoutant@google.com>
15009
15010         * target-reloc.h (relocate_section): Fix dead-pointer bug.
15011
15012         * layout.cc (Layout::include_section): Refactored check for debug
15013         info section.
15014         (Layout::add_comdat): Add new parameters.  Change type
15015         of signature parameter.  Add object and shndx to signatures table.
15016         (Layout::find_kept_object): New function.
15017         * layout.h: Include <cstring>.
15018         (Layout::is_debug_info_section): New function.
15019         (Layout::add_comdat): Add new parameters.
15020         (Layout::find_kept_object): New function.
15021         (Layout::Kept_section): New struct.
15022         (Layout::Signatures): Change type of map range.
15023         * object.cc (Relobj::output_section_address): New function.
15024         (Sized_relobj::include_section_group): Add new parameters.  Change
15025         calls to Layout::add_comdat.  Change to build table of kept comdat
15026         groups and table mapping discarded sections to kept sections.
15027         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
15028         (Sized_relobj::do_layout): Change calls to include_section_group and
15029         include_linkonce_section.
15030         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
15031         value to zero when section is discarded.
15032         (Sized_relobj::map_to_kept_section): New function.
15033         * object.h (Relobj::output_section_address): New function.
15034         (Relobj::Comdat_group): New type.
15035         (Relobj::find_comdat_group): New function.
15036         (Relobj::Comdat_group_table): New type.
15037         (Relobj::Kept_comdat_section): New type.
15038         (Relobj::Kept_comdat_section_table): New type.
15039         (Relobj::add_comdat_group): New function.
15040         (Relobj::set_kept_comdat_section): New function.
15041         (Relobj::get_kept_comdat_section): New function.
15042         (Relobj::comdat_groups_): New field.
15043         (Relobj::kept_comdat_sections_): New field.
15044         (Symbol_value::input_value): Update comment.
15045         (Sized_relobj::map_to_kept_section) New function.
15046         (Sized_relobj::include_linkonce_section): Add new parameter.
15047         * target-reloc.h (Comdat_behavior): New type.
15048         (get_comdat_behavior): New function.
15049         (relocate_section): Add code to map a discarded section to the
15050         corresponding kept section when applying a relocation.
15051
15052 2008-04-30  Craig Silverstein  <csilvers@google.com>
15053
15054         * dwarf_reader.cc (next_generation_count): New static var.
15055         (Addr2line_cache_entry): New struct.
15056         (addr2line_cache): New static var.
15057         (Dwarf_line_info::one_addr2line): Added caching.
15058         (Dwarf_line_info::clear_addr2line_cache): New function.
15059         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
15060         cache-size parameter.
15061         (Dwarf_line_info::one_addr2line_cache): New function.
15062         * symtab.cc (Symbol_table::detect_odr_violations): Pass
15063         new cache-size argument to one_addr2line(), and clear cache.
15064
15065 2008-04-28  Cary Coutant  <ccoutant@google.com>
15066
15067         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
15068         R_386_PC8 relocations.
15069
15070 2008-04-23  Ian Lance Taylor  <iant@google.com>
15071
15072         * object.cc (Sized_relobj::include_section_group): Check for
15073         invalid section group.
15074
15075         * object.cc (make_elf_object): Correct test for 64-bit ELF file
15076         header size.
15077
15078         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
15079         than read for file header.
15080         * archive.cc (Archive::include_member): Likewise.
15081
15082 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
15083
15084         * aclocal.m4: Regenerate.
15085         * configure: Regenerate.
15086
15087 2008-04-19  Ian Lance Taylor  <iant@google.com>
15088
15089         * version.cc (version_string): Bump to 1.6.
15090
15091         * testsuite/Makefile.am (many_sections_r_test): New target.
15092         (many_sections_r_test_SOURCES): Remove.
15093         (many_sections_r_test_DEPENDENCIES): Remove.
15094         (many_sections_r_test_LDFLAGS): Remove.
15095         (many_sections_r_test_LDADD): Remove.
15096
15097         * object.cc (Sized_relobj::do_add_symbols): Always pass
15098         local_symbol_count_ to add_from_relobj.
15099
15100         * testsuite/Makefile.am (many_sections_check.h): Only check one in
15101         every thousand variables.
15102         * testsuite/Makefile.in: Rebuild.
15103
15104         * object.cc (Xindex::initialize_symtab_xindex): New function.
15105         (Xindex::read_symtab_xindex): New function.
15106         (Xindex::sym_xindex_to_shndx): New function.
15107         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
15108         available.
15109         (Sized_relobj::do_initialize_xindex): New function.
15110         (Sized_relobj::do_read_symbols): Adjust section links.
15111         (Sized_relobj::symbol_section_and_value): Add is_ordinary
15112         parameter.  Change all callers.
15113         (Sized_relobj::include_section_group): Adjust section links and
15114         symbol section indexes.
15115         (Sized_relobj::do_layout): Adjust section links.
15116         (Sized_relobj::do_count_local_symbols): Adjust section links and
15117         symbol section indexes.
15118         (Sized_relobj::do_finalize_local_symbols): Distinguish between
15119         ordinary and special symbols.
15120         (Sized_relobj::write_local_symbols): Add symtab_xindex and
15121         dynsym_xindex parameters.  Change all callers.  Adjust section
15122         links.  Use SHN_XINDEX when needed.
15123         (Sized_relobj::get_symbol_location_info): Adjust section links.
15124         Don't get fooled by special symbols.
15125         * object.h (class Xindex): Define.
15126         (class Object): Add xindex_ parameter.  Declare virtual functoin
15127         do_initialize_xindex.
15128         (Object::adjust_sym_shndx): New function.
15129         (Object::set_xindex): New protected function.
15130         (class Symbol_value): Add is_ordinary_shndx_ field.
15131         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
15132         (Symbol_value::value): Assert ordinary section.
15133         (Symbol_value::initialize_input_to_output_map): Likewise.
15134         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
15135         Change all callers.
15136         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
15137         all callers.
15138         (class Sized_relobj): Update declarations.
15139         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
15140         parameter.  Change all callers.
15141         (Sized_relobj::adjust_shndx): New function.
15142         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
15143         field.
15144         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
15145         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
15146         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
15147         (Sized_dynobj::read_dynsym_section): Adjust section links.
15148         (Sized_dynobj::read_dynamic): Likewise.
15149         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
15150         section links.
15151         (Sized_dynobj::do_initialize_xindex): New function.
15152         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
15153         do_initialize_xindex.
15154         (Sized_dynobj::adjust_shndx): New function.
15155         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
15156         dynsym_xindex_ fields.
15157         (Layout::finalize): Add a call to set_section_indexes before
15158         creating the symtab sections.
15159         (Layout::set_section_indexes): Don't do anything if the section
15160         already has a section index.
15161         (Layout::create_symtab_sections): Add shnum parameter.  Change
15162         caller.  Create .symtab_shndx section if needed.
15163         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
15164         caller.
15165         (Layout::allocated_output_section_count): New function.
15166         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
15167         needed.
15168         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
15169         fields.  Update declarations.
15170         (Layout::symtab_xindex): New function.
15171         (Layout::dynsym_xindex): New function.
15172         (class Write_symbols_task): Add layout_ field.
15173         (Write_symbols_task::Write_symbols_task): Add layout parameter.
15174         Change caller.
15175         * output.cc (Output_section_headers::Output_section_headers): Add
15176         shstrtab_section parameter.  Change all callers.
15177         (Output_section_headers::do_sized_write): Store overflow values
15178         for section count and section string table section index in
15179         section header zero.
15180         (Output_file_header::do_sized_write): Check for overflow of
15181         section count and section string table section index.
15182         (Output_symtab_xindex::do_write): New function.
15183         (Output_symtab_xindex::endian_do_write): New function.
15184         * output.h (class Output_section_headers): Add shstrtab_section_.
15185         Update declarations.
15186         (class Output_symtab_xindex): Define.
15187         (Output_section::has_out_shndx): New function.
15188         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
15189         field.
15190         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
15191         Change all callers.
15192         (Sized_symbol::init): Likewise.
15193         (Symbol::output_section): Check for ordinary symbol.
15194         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
15195         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
15196         callers.
15197         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
15198         Change all callers.  Simplify handling of symbols from sections
15199         not included in the link.
15200         (Symbol_table::add_from_dynobj): Handle ordinary symbol
15201         distinction.
15202         (Weak_alias_sorter::operator()): Assert that symbols are
15203         ordinary.
15204         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
15205         distinction.
15206         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
15207         parameters.  Change all callers.
15208         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
15209         symbol distinction.  Use SHN_XINDEX when needed.
15210         (Symbol_table::write_section_symbol): Add symtab_xindex
15211         parameter.  Change all callers.
15212         (Symbol_table::sized_write_section_symbol): Likewise.  Use
15213         SHN_XINDEX when needed.
15214         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
15215         declarations.
15216         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
15217         (Symbol::is_defined): Check is_ordinary.
15218         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
15219         (Symbol::is_absolute, Symbol::is_common): Likewise.
15220         (class Sized_symbol): Update declarations.
15221         (class Symbol_table): Update declarations.
15222         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
15223         parameters.  Change all callers.
15224         (Sized_symbol::override): Likewise.
15225         (Symbol_table::override): Likewise.
15226         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
15227         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
15228         is_ordinary, and orig_st_shndx parameters.  Change all callers.
15229         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
15230         to be in an ordinary section.
15231         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
15232         object and is_ordinary parameters.  Change all callers.
15233         (Sized_dwarf_line_info::read_relocs): Add object parameter.
15234         Change all callers.  Don't add undefined or non-ordinary symbols
15235         to reloc_map_.
15236         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
15237         Change all callers.
15238         * dwarf_reader.h (class Sized_dwarf_line_info): Update
15239         declarations.
15240         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
15241         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
15242         (Sized_relobj::relocate_sections): Likewise.
15243         * target-reloc.h (scan_relocs): Adjust section symbol index.
15244         (scan_relocatable_relocs): Likewise.
15245         * i386.cc (Scan::local): Check for ordinary symbols.
15246         * sparc.cc (Scan::local): Likewise.
15247         * x86_64.cc (Scan::local): Likewise.
15248         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
15249         to symbol_section_and_value.
15250         * testsuite/many_sections_test.cc: New file.
15251         * testsuite/Makefile.am (BUILT_SOURCES): Define.
15252         (check_PROGRAMS): Add many_sections_test.
15253         (many_sections_test_SOURCES): Define.
15254         (many_sections_test_DEPENDENCIES): Define.
15255         (many_sections_test_LDFLAGS): Define.
15256         (BUILT_SOURCES): Add many_sections_define.h.
15257         (many_sections_define.h): New target.
15258         (BUILT_SOURCES): Add many_sections_check.h.
15259         (many_sections_check.h): New target.
15260         (check_PROGRAMS): Add many_sections_r_test.
15261         (many_sections_r_test_SOURCES): Define.
15262         (many_sections_r_test_DEPENDENCIES): Define.
15263         (many_sections_r_test_LDFLAGS): Define.
15264         (many_sections_r_test_LDADD): Define.
15265         (many_sections_r_test.o): New target.
15266         * testsuite/Makefile.in: Rebuild.
15267
15268 2008-04-17  Cary Coutant  <ccoutant@google.com>
15269
15270         * errors.cc (Errors::info): New function.
15271         (gold_info): New function.
15272         * errors.h (Errors::info): New function.
15273         * gold.h (gold_info): New function.
15274         * object.cc (Input_objects::add_object): Print trace output.
15275         * options.cc (options::parse_set): New function.
15276         (General_options::parse_wrap): Deleted.
15277         (General_options::General_options): Deleted initializer.
15278         * options.h (options::String_set): New typedef.
15279         (options::parse_set): New function.
15280         (DEFINE_set): New macro.
15281         (General_options::wrap): Changed to use DEFINE_set. Changed
15282         callers of any_wrap_symbols and is_wrap_symbol.
15283         (General_options::trace, General_options::trace_symbol):
15284         New options.
15285         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
15286         (General_options::wrap_symbols_): Deleted.
15287         * symtab.cc (Symbol_table::add_from_object): Print trace output.
15288
15289 2008-04-17  David S. Miller  <davem@davemloft.net>
15290
15291         * options.cc (General_options::parse_V): New function.
15292         * options.h: Add entries for -V and -Qy.
15293
15294 2008-04-17  Ian Lance Taylor  <iant@google.com>
15295
15296         * common.cc (Symbol_table::allocate_commons): Remove options
15297         parameter.  Change caller.
15298         (Symbol_table::do_allocate_commons): Remove options parameter.
15299         Change caller.  Just call do_allocate_commons_list twice.
15300         (Symbol_table::do_allocate_commons_list): New function, broken out
15301         of do_allocate_commons.
15302         * common.h (class Allocate_commons_task): Remove options_ field.
15303         Update constructor.
15304         * symtab.cc (Symbol_table::Symbol_table): Initialize
15305         tls_commons_.
15306         (Symbol_table::add_from_object): Put TLS common symbols on
15307         tls_commons_ list.
15308         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
15309         which are IN_OUTPUT_DATA.
15310         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
15311         allocate_commons and do_allocate_commons declarations.  Declare
15312         do_allocate_commons_list.
15313         * gold.cc (queue_middle_tasks): Update creation of
15314         Allocate_commons_task to not pass options.
15315         * testsuite/Makefile.am (INCLUDES): Add -I.. .
15316         (TLS_TEST_C_FLAGS): New variable.
15317         (tls_test_c_pic.o): New target.
15318         (tls_test_shared.so): Link in tls_test_c_pic.o.
15319         (tls_test_c_pic_ie.o): New target.
15320         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
15321         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
15322         (tls_test_c.o): New target.
15323         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
15324         (tls_pic_test_LDADD): Likewise.
15325         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
15326         (tls_shared_gd_to_ie_test_LDADD): Likewise.
15327         (tls_test_c_gnu2.o): New target.
15328         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
15329         tls_test_c_gnu2.o.
15330         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
15331         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
15332         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
15333         * testsuite/tls_test.cc: Include "config.h".
15334         (t_last): Call t11_last.
15335         * testsuite/tls_test.h (t11, t11_last): Declare.
15336         * testsuite/tls_test_c.c: New file.
15337         * testsuite/tls_test_main.cc (thread_routine): Call t11.
15338         * configure.ac: Check for OpenMP support.
15339         * configure, config.in, Makefile.in: Rebuild.
15340         * testsuite/Makefile.in: Rebuild.
15341
15342 2008-04-16  Cary Coutant  <ccoutant@google.com>
15343
15344         * i386.cc (Target_i386::define_tls_base_symbol): New function.
15345         (Target_i386::tls_base_symbol_defined_): New field.
15346         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15347         (Target_i386::Scan::global): Likewise.
15348         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
15349         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
15350         (Target_x86_64::tls_base_symbol_defined_): New field.
15351         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
15352         (Target_x86_64::Scan::global): Likewise.
15353
15354 2008-04-16  Cary Coutant  <ccoutant@google.com>
15355
15356         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
15357         (Symbol::needs_plt_entry): Allow weak undefined symbols.
15358         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
15359         building shared libraries.
15360         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
15361         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
15362         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
15363         * testsuite/Makefile.in: Rebuild.
15364         * testsuite/weak_undef.h: New file.
15365         * testsuite/weak_undef_file1.cc: Add extra test cases.
15366         * testsuite/weak_undef_file2.cc: Likewise.
15367         * testsuite/weak_undef_test.cc: Likewise.
15368
15369 2008-04-16  David S. Miller  <davem@davemloft.net>
15370
15371         * sparc.cc (Target_sparc::Scan): Change from struct to class.
15372         Add issued_non_pic_error_ field.  Declare check_non_pic.
15373         (Target_sparc::Scan::check_non_pic): New function.
15374         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
15375         (Target_sparc::Scan::global): Likewise.
15376
15377         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
15378         * configure: Rebuild.
15379
15380         * options.h (DEFINE_enable): New macro.
15381         (new_dtags): New enable option.
15382         (initfirst, interpose, loadfltr, nodefaultlib,
15383         nodelete, nodlopen, nodump): New -z options.
15384         * layout.cc (Layout:finish_dynamic_section): If new
15385         dtags enabled, emit DT_RUNPATH.  Also, emit a
15386         DT_FLAGS_1 containing any specified -z flags.
15387
15388 2008-04-16  Ian Lance Taylor  <iant@google.com>
15389
15390         * copy-relocs.cc: New file.
15391         * copy-relocs.h: New file.
15392         * reloc.cc: Remove Copy_relocs code.
15393         * reloc.h: Likewise.
15394         * reloc-types.h (struct Reloc_types) [both versions]: Add
15395         get_reloc_addend_noerror.
15396         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
15397         variants of add_global which take an addend which must be zero.
15398         * i386.cc: Include "copy-relocs.h".
15399         (class Target_i386): Change type of copy_relocs_ to variable,
15400         update initializer.
15401         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
15402         Change all callers.
15403         (Target_i386::do_finalize_sections): Change handling of
15404         copy_relocs_.
15405         * sparc.cc: Include "copy-relocs.h".
15406         (class Target_sparc): Change type of copy_relocs_ to variable,
15407         update initializer.
15408         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
15409         Change all callers.
15410         (Target_sparc::do_finalize_sections): Change handling of
15411         copy_relocs_.
15412         * x86_64.cc: Include "copy-relocs.h".
15413         (class Target_x86_64): Change type of copy_relocs_ to variable,
15414         update initializer.
15415         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
15416         class.  Change all callers.
15417         (Target_x86_64::do_finalize_sections): Change handling of
15418         copy_relocs_.
15419         * Makefile.am (CCFILES): Add copy-relocs.cc.
15420         (HFILES): Add copy-relocs.h.
15421
15422         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
15423
15424         * testsuite/script_test_4.sh: Permit leading zeroes.
15425
15426 2008-04-15  Ian Lance Taylor  <iant@google.com>
15427
15428         * script-sections.cc (Script_sections::create_segments): Use
15429         header_size_adjustment even when there is enough room for the
15430         headers.
15431         * testsuite/script_test_4.sh: New file.
15432         * testsuite/script_test_4.t: New file.
15433         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
15434         (check_DATA): Add script_test_4.stdout.
15435         (MOSTLYCLEANFILES): Likewise.
15436         (script_test_4): New target.
15437         (script_test_4.stdout): New target.
15438         * testsuite/Makefile.in: Rebuild.
15439
15440         * sparc.cc: Add definitions for Output_data_plt_sparc class
15441         constants.
15442
15443 2008-04-14  David S. Miller  <davem@davemloft.net>
15444
15445         * sparc.cc: New file.
15446         * Makefile.am (TARGETSOURCES): Add sparc.cc
15447         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
15448         * configure.tgt: Document targ_extra_size and
15449         targ_extra_big_endian.  Add entries for sparc-* and
15450         sparc64-*.
15451         * configure.ac: Handle targ_extra_size and
15452         targ_extra_big_endian.
15453         * Makefile.in: Rebuild.
15454         * configure: Likewise.
15455         * po/POTFILES.in: Likewise.
15456         * po/gold.pot: Likewise.
15457
15458 2008-04-14  Ian Lance Taylor  <iant@google.com>
15459
15460         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
15461         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
15462         in the name/type/flags to section mapping.  Don't call
15463         allocate_output_section.
15464         (Layout::choose_output_section): Change parameter from adjust_name
15465         to is_input_section.  Don't permit input sections after sections
15466         are attached to segments.  Don't call allocate_output_section.
15467         (Layout::layout_eh_frame): Call update_flags_for_input_section,
15468         not write_enable_output_section.
15469         (Layout::make_output_section): Don't push to
15470         unattached_section_list_ nor call attach_to_segment.  Call
15471         attach_section_to_segment if sections are attached.
15472         (Layout::attach_sections_to_segments): New function.
15473         (Layout::attach_section_to_segment): New function.
15474         (Layout::attach_allocated_section_to_segment): Rename from
15475         attach_to_segment.  Remove flags parameter.
15476         (Layout::allocate_output_section): Remove function.
15477         (Layout::write_enable_output_section): Remove function.
15478         * layout.h (class Layout): Update for above changes.  Add new
15479         field sections_are_attached_.
15480         * output.h (Output_section::update_flags_for_input_section): New
15481         function.
15482         * output.cc (Output_section::add_input_section): Call
15483         update_flags_for_input_section.
15484         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
15485
15486 2008-04-11  Cary Coutant  <ccoutant@google.com>
15487
15488         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
15489         thought unnecessary.
15490         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
15491
15492 2008-04-11  Ian Lance Taylor  <iant@google.com>
15493
15494         * output.h (class Output_section_data): Remove inline definition
15495         of set_addralign.
15496         * output.cc (Output_section_data::set_addralign): New function.
15497
15498 2008-04-11  Cary Coutant  <ccoutant@google.com>
15499
15500         Add support for TLS descriptors for i386 and x86_64.
15501         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
15502         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
15503         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
15504         GOT_TYPE_TLS_DESC.
15505         (Target_i386::got_mod_index_entry): Remove unnecessary code.
15506         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
15507         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
15508         relocations.
15509         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
15510         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
15511         Fix problem with initial-exec relocations.
15512         (Target_i386::Relocate::relocate_tls): Likewise.
15513         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
15514         relaxation.
15515         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
15516         support for section-plus-offset dynamic table entries.
15517         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
15518         (Output_data_dynamic::Dynamic_entry): Add support for
15519         section-plus-offset dynamic table entries.
15520         (Output_data_dynamic::Classification): Likewise.
15521         (Output_data_dynamic::classification_): Renamed offset_.
15522         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
15523         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
15524         (Target_x86_64::make_plt_section): New function.
15525         (Target_x86_64::reserve_tlsdesc_entries): New function.
15526         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
15527         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
15528         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
15529         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
15530         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
15531         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
15532         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
15533         add extra PLT entry for TLS descriptors.
15534         (Output_data_plt_x86_64::got_): New field.
15535         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
15536         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
15537         fields.
15538         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
15539         descriptors.
15540         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
15541         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
15542         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
15543         R_386_TLS_DESC_CALL relocations.
15544         (Target_x86_64::Scan::global): Likewise.
15545         (Target_x86_64::do_finalize_sections): Add dynamic table entries
15546         for TLS descriptors.
15547         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
15548         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
15549         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
15550         GD-to-IE relaxation.
15551         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
15552         and TLS_DESCRIPTORS.
15553         * Makefile.in: Rebuild.
15554         * configure: Rebuild.
15555         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
15556         (tls_test_shared2.so): New target.
15557         (tls_shared_gd_to_ie_test_SOURCES): New variable.
15558         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
15559         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
15560         (tls_shared_gd_to_ie_test_LDADD): New variable.
15561         (tls_shared_gnu2_gd_to_ie_test): New target.
15562         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
15563         New targets.
15564         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
15565         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
15566         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
15567         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
15568         (tls_shared_gnu2_test): New target.
15569         (tls_test_gnu2_shared.so): New target.
15570         (tls_shared_gnu2_test_SOURCES): New variable.
15571         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
15572         (tls_shared_gnu2_test_LDFLAGS): New variable.
15573         (tls_shared_gnu2_test_LDADD): New variable.
15574         * testsuite/Makefile.in: Rebuild.
15575         * testsuite/Makefile.
15576
15577 2008-04-11  Ian Lance Taylor  <iant@google.com>
15578
15579         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
15580         justsyms.t.
15581         * testsuite/Makefile.in: Rebuild.
15582
15583         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
15584         long.
15585         * testsuite/script_test_2.cc (main): Adjust test.
15586
15587 2008-04-11  David S. Miller  <davem@davemloft.net>
15588             Ian Lance Taylor  <iant@google.com>
15589
15590         * options.h (General_options): Add entries for '-Y' and
15591         '-relax'.
15592         * options.cc (General_options:finalize): If -Y was used, add those
15593         entries to the library path instead of the default "/lib" and
15594         "/usr/lib".
15595
15596 2008-04-11  David S. Miller  <davem@davemloft.net>
15597
15598         * testsuite/justsyms.t: Start at 0x100.
15599         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
15600         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
15601         long.
15602         * testsuite/script_test_2.cc: Adjust string and section length
15603         checks.
15604
15605 2008-04-09  Ian Lance Taylor  <iant@google.com>
15606
15607         PR gold/5996
15608         * script-sections.cc (Sections_element::allocate_to_segment): Add
15609         orphan parameter.
15610         (Output_section_definition::allocate_to_segment): Likewise.
15611         (Orphan_output_section::allocate_to_segment): Likewise.
15612         (Script_sections::attach_sections_using_phdrs_clause): Don't
15613         propagate non-PT_LOAD segments to orphan sections.
15614         * testsuite/Makefile.am (script_test_3.stdout): Generate using
15615         readelf rather than objdump.
15616         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
15617         .interp section and PT_INTERP segment are the same size.
15618         * testsuite/Makefile.in: Rebuild.
15619
15620         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
15621         aliases for symbols defined in the same object.
15622         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
15623         (weak_alias_test_SOURCES): New variable.
15624         (weak_alias_test_DEPENDENCIES): New variable.
15625         (weak_alias_test_LDFLAGS): New variable.
15626         (weak_alias_test_LDADD): New variable.
15627         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
15628         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
15629         (weak_alias_test_3.o): New target.
15630         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
15631         * testsuite/weak_alias_test_main.cc: New file.
15632         * testsuite/weak_alias_test_1.cc: New file.
15633         * testsuite/weak_alias_test_2.cc: New file.
15634         * testsuite/weak_alias_test_3.cc: New file.
15635
15636 2008-04-08  Ian Lance Taylor  <iant@google.com>
15637
15638         * options.h (class General_options): Add --noinhibit-exec option.
15639         * main.cc (main): Check --noinhibit-exec.
15640
15641         * options.h (class General_options): Define --wrap as a special
15642         option.  Add wrap_symbols_ field.
15643         (General_options::any_wrap_symbols): New function.
15644         (General_options::is_wrap_symbol): New function.
15645         * options.cc (General_options::parse_wrap): New function.
15646         (General_options::General_options): Initialize wrap_symbols_.
15647         * symtab.cc (Symbol_table::wrap_symbol): New function.
15648         (Symbol_table::add_from_object): Handle --wrap.
15649         * symtab.h (class Symbol_table): Declare wrap_symbol.
15650         * target.h (Target::wrap_char): New function.
15651         (Target::Target_info): Add wrap_char field.
15652         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15653         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15654         * testsuite/testfile.cc (Target_test::test_target_info):
15655         Likewise.
15656
15657         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15658         there is one.
15659
15660         * layout.h (class Layout): Add added_eh_frame_data_ field.
15661         * layout.cc (Layout::Layout): Initialize new field.
15662         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15663         output section until we find a section we merged successfully.
15664         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15665         that the size be non-zero.
15666
15667         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15668         qualifier.
15669
15670 2008-04-08  Craig Silverstein  <csilvers@google.com>
15671
15672         * configure.ac: Export new conditional variable HAVE_ZLIB.
15673         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15674         on HAVE_ZLIB.
15675         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15676         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15677
15678 2008-04-07  Ian Lance Taylor  <iant@google.com>
15679
15680         * version.cc (version_string): Set to "1.5".
15681
15682         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15683         Add issued_non_pic_error_ field.  Declare check_non_pic.
15684         (Target_x86_64::Scan::check_non_pic): New function.
15685         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15686         (Target_x86_64::Scan::global): Likewise.
15687
15688         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15689         addend parameter.  Change caller.  Handle merge sections.
15690         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15691         Address to Addend.  Don't add in the result of
15692         local_section_offset, pass down the addend and use the returned
15693         value.
15694         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15695         Update declarations of local_section_offset and symbol_value.
15696         * testsuite/two_file_test_1.cc (t18): New function.
15697         * testsuite/two_file_test_2.cc (f18): New function.
15698         * testsuite/two_file_test_main.cc (main): Call t18.
15699         * testsuite/two_file_test.h (t18, f18): Declare.
15700
15701         * configure.ac: Don't test for objdump, c++filt, or readelf.
15702         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15703         conditionals.
15704         (TEST_READELF): New variable.
15705         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15706         (check_PROGRAMS): Add two_file_strip_test.
15707         (two_file_strip_test): New target.
15708         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15709         (two_file_same_shared_strip_test_SOURCES): New variable.
15710         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15711         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15712         (two_file_same_shared_strip_test_LDADD): New variable.
15713         (two_file_shared_strip.so): New target.
15714         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15715         (ver_test_5.syms, ver_test_7.syms): Likewise.
15716         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15717         (strip_test_3.stdout): Use TEST_OBJDUMP.
15718         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15719
15720 2008-04-04  Cary Coutant  <ccoutant@google.com>
15721
15722         * symtab.h (Symbol::is_weak_undefined): New function.
15723         (Symbol::is_strong_undefined): New function.
15724         (Symbol::is_absolute): New function.
15725         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15726         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15727         absolute symbols.
15728         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15729         (weak_undef_test): New target.
15730         * testsuite/Makefile.in: Rebuild.
15731         * testsuite/weak_undef_file1.cc: New file.
15732         * testsuite/weak_undef_file2.cc: New file.
15733         * testsuite/weak_undef_test.cc: New file.
15734
15735 2008-04-03  Craig Silverstein  <csilvers@google.com>
15736
15737         * compressed_output.h (class Output_compressed_section): Use
15738         unsigned buffer.
15739         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15740         add zlib header.
15741         (zlib_compressed_suffix): Removed.
15742         (Output_compressed_section::set_final_data_size): Use unsigned
15743         buffers.
15744         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15745         Fix linker invocation.
15746         (flagstest_o_specialfile_and_compress_debug_sections):
15747         Likewise.
15748         * testsuite/Makefile.in: Regenerated.
15749
15750 2008-04-02  David S. Miller  <davem@davemloft.net>
15751
15752         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15753         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15754
15755 2008-04-02  Craig Silverstein  <csilvers@google.com>
15756
15757         * TODO: New file.
15758
15759 2008-04-02  Ian Lance Taylor  <iant@google.com>
15760
15761         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15762         parameters.  Update for new key type to views_.  Change all
15763         callers.
15764         (File_read::read): Adjust for byteshift in returned view.
15765         (File_read::add_view): New function, broken out of
15766         find_and_make_view.
15767         (File_read::make_view): New function, broken out of
15768         find_and_make_view.
15769         (File_read::find_or_make_view): Add offset and aligned
15770         parameters.  Rewrite accordingly.  Change all callers.
15771         (File_read::get_view): Add offset and aligned parameters.  Adjust
15772         for byteshift in return value.
15773         (File_read::get_lasting_view): Likewise.
15774         * fileread.h (class File_read): Update declarations.
15775         (class File_read::View): Add byteshift_ field.  Add byteshift to
15776         constructor.  Add byteshift method.
15777         * archive.h (Archive::clear_uncached_views): New function.
15778         (Archive::get_view): Add aligned parameter.  Change all callers.
15779         * object.h (Object::get_view): Add aligned parameter.  Change all
15780         callers.
15781         (Object::get_lasting_view): Likewise.
15782
15783         * fileread.cc (File_read::release): Don't call clear_views if
15784         there are multiple objects.
15785         * fileread.h (File_read::clear_uncached_views): New function.
15786         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15787         on the archive.
15788
15789 2008-03-31  Cary Coutant  <ccoutant@google.com>
15790
15791         Add thin archive support.
15792         * archive.cc (Archive::armagt): New const.
15793         (Archive::setup): Remove task parameter and calls to unlock.
15794         (Archive::unlock_nested_archives): New function.
15795         (Archive::read_header): Add nested_off parameter. Change
15796         all callers.
15797         (Archive::interpret_header): Likewise.
15798         (Archive::include_all_members): Change to handle thin
15799         archives.
15800         (Archive::include_member): Likewise.
15801         * archive.h (Archive::Archive): Add new parameters and
15802         initializers.
15803         (Archive::armagt): New const.
15804         (Archive::setup): Remove task parameter.
15805         (Archive::unlock_nested_archives): New function.
15806         (Archive::read_header): Add nested_off parameter.
15807         (Archive::interpret_header): Likewise.
15808         (Archive::Nested_archive_table): New typedef.
15809         (Archive::is_thin_archive_): New field.
15810         (Archive::nested_archives_): New field.
15811         (Archive::options_): New field.
15812         (Archive::dirpath_): New field.
15813         (Archive::task_): New field.
15814         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15815         for thin archives.  Pass additional parameters to
15816         Archive::Archive.  Unlock the archive file after calling
15817         Archive::setup.
15818
15819 2008-03-29  Ian Lance Taylor  <iant@google.com>
15820
15821         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15822         version symbol to be local.
15823         * testsuite/ver_test_4.sh: New file.
15824         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15825         (check_DATA): Add ver_test_4.syms.
15826         (ver_test_4.syms): New target.
15827         * testsuite/Makefile.in: Rebuild.
15828
15829         * output.cc
15830         (Output_section::Input_section_sort_entry::has_priority): New
15831         function.
15832         (Output_section::Input_section_sort_entry::match_file_name): New
15833         function.
15834         (Output_section::Input_section_sort_entry::match_section_name):
15835         Remove.
15836         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15837         Remove.
15838         (Output_section::Input_section_sort_entry::match_section_file):
15839         Remove.
15840         (Output_section::Input_section_sort_compare::operator()): Rewrite
15841         using new Input_section_sort_entry functions.  Sort crtbegin and
15842         crtend first.  Sort sections with no priority before sections with
15843         a priority.
15844         * testsuite/initpri1.c (d3): Check j != 4.
15845         (cd5): New constructor/destructor function.
15846         (main): Check j != 2.
15847
15848         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15849         new symbol when resolving, don't call set_is_default.
15850         * testsuite/ver_test_7.cc: New file.
15851         * testsuite/ver_test_7.sh: New file.
15852         * testsuite/Makefile.am (ver_test_7.so): New target.
15853         (ver_test_7.o): New target.
15854         (check_SCRIPTS): Add ver_test_7.sh.
15855         (check_DATA): Add ver_test_7.syms.
15856         (ver_test_7.syms): New target.
15857
15858 2008-03-28  Ian Lance Taylor  <iant@google.com>
15859
15860         * layout.cc (Layout::layout): If we see an input section with a
15861         name that needs sorting, set the must_sort flag for the output
15862         section.
15863         (Layout::make_output_section): If the name of the output section
15864         indicates that it might require sorting, set the may_sort flag.
15865         * output.h (Output_section::may_sort_attached_input_sections): New
15866         function.
15867         (Output_section::set_may_sort_attached_input_sections): New
15868         function.
15869         (Output_section::must_sort_attached_input_sections): New
15870         function.
15871         (Output_section::set_must_sort_attached_input_sections): New
15872         function.
15873         (class Output_section): Declare Input_section_sort_entry.  Define
15874         Input_section_sort_compare.  Declare
15875         sort_attached_input_sections.  Add new fields:
15876         may_sort_attached_input_sections_,
15877         must_sort_attached_input_sections_,
15878         attached_input_sections_are_sorted_.
15879         * output.cc (Output_section::Output_section): Initialize new
15880         fields.
15881         (Output_section::add_input_section): Add an entry to
15882         input_sections_ if may_sort or must_sort are true.
15883         (Output_section::set_final_data_size): Call
15884         sort_attached_input_sections if necessary.
15885         (Output_section::Input_section_sort_entry): Define new class.
15886         (Output_section::Input_section_sort_compare::operator()): New
15887         function.
15888         (Output_section::sort_attached_input_sections): New function.
15889         * configure.ac: Check whether the compiler supports constructor
15890         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15891         * testsuite/initpri1.c: New file.
15892         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15893         CONSTRUCTOR_PRIORITY.
15894         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15895         (initpri1_LDFLAGS): New variable.
15896         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15897
15898 2008-03-27  Ian Lance Taylor  <iant@google.com>
15899
15900         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15901         * testsuite/common_test_1.c: New file.
15902         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15903         (common_test_1_SOURCES): New variable.
15904         (common_test_1_DEPENDENCIES): New variable.
15905         (common_test_1_LDFLAGS): New variable.
15906
15907         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15908         and commons_ correctly when NAME/VERSION does not override
15909         NAME/NULL.
15910         * testsuite/ver_test_6.c: New file.
15911         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15912         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15913         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15914
15915 2008-03-26  Ian Lance Taylor  <iant@google.com>
15916
15917         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15918         of an undefined symbol from a version script.
15919         * testsuite/Makefile.am (ver_test_5.so): New target.
15920         (ver_test_5.o): New target.
15921         (check_SCRIPTS): Add ver_test_5.sh.
15922         (check_DATA): Add ver_test_5.syms.
15923         (ver_test_5.syms): New target.
15924         * testsuite/ver_test_5.cc: New file.
15925         * testsuite/ver_test_5.script: New file.
15926         * testsuite/ver_test_5.sh: New file.
15927         * Makefile.in, testsuite/Makefile.in: Rebuild.
15928
15929         PR gold/5986
15930         Fix problems building gold with gcc 4.3.0.
15931         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15932         (gold_error_at_location, gold_warning_at_location): Use it.
15933         * configure.ac: Check whether we can compile and use a template
15934         function with a printf attribute.
15935         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15936         when jumping over bytes.
15937         * object.cc: Instantiate Object::read_section_data.
15938         * debug.h: Include <cstring>
15939         * dwarf_reader.cc: Include <algorithm>
15940         * main.cc: Include <cstring>.
15941         * options.cc: Include <cstring>.
15942         * output.cc: Include <cstring>.
15943         * script.cc: Include <cstring>.
15944         * script.h: Include <string>.
15945         * symtab.cc: Include <cstring> and <algorithm>.
15946         * target-select.cc: Include <cstring>.
15947         * version.cc: Include <string>.
15948         * testsuite/testmain.cc: Include <cstdlib>.
15949         * configure, config.in: Rebuild.
15950
15951 2008-03-25  Ian Lance Taylor  <iant@google.com>
15952
15953         * options.cc: Include "../bfd/bfdver.h".
15954         (options::help): Print bug reporting address.
15955
15956         * version.cc (print_version): Adjust output for current value of
15957         BFD_VERSION_STRING.
15958
15959         * NEWS: New file.
15960
15961         * options.cc (options::help): Print list of supported targets.
15962         * target-select.h: Include <vector>.
15963         (class Target_selector): Make machine_, size_, and is_big_endian_
15964         fields const.  Add bfd_name_ and instantiated_target_ fields.
15965         (Target_selector::Target_selector): Add bfd_name parameter.
15966         (Target_selector::recognize): Make non-virtual, call
15967         do_recognize.
15968         (Target_selector::recognize_by_name): Make non-virtual, call
15969         do_recognize_by_name.
15970         (Target_selector::supported_names): New function.
15971         (Target_selector::bfd_name): New function.
15972         (Target_selector::do_instantiate_target): New pure virtual
15973         function.
15974         (Target_selector::do_recognize): New virtual function.
15975         (Target_selector::do_recognize_by_name): New virtual function.
15976         (Target_selector::instantiate_target): New private function.
15977         (supported_target_names): Declare.
15978         * target-select.cc (Target_selector::Target_selector): Update for
15979         new parameter and fields.
15980         (select_target_by_name): Check that the name matches before
15981         calling recognize_by_name.
15982         (supported_target_names): New function.
15983         * i386.cc (class Target_selector_i386): Update Target_selector
15984         constructor call.  Remove recognize and recognize_by_name.  Add
15985         do_instantiate_target.
15986         * x86_64.cc (class Target_selector_x86_64): Likewise.
15987         * testsuite/testfile.cc (class Target_selector_test): Update for
15988         changes to Target_selector.
15989
15990         * README: Rewrite, with some notes on unsupported features.
15991
15992 2008-03-24  Cary Coutant  <ccoutant@google.com>
15993
15994         * i386.cc (Target_i386::Got_type): New enum declaration.
15995         (Target_i386::Scan::local): Updated callers of Output_data_got
15996         member functions.
15997         (Target_i386::Scan::global): Likewise.
15998         (Target_i386::Relocate::relocate): Likewise.
15999         (Target_i386::Relocate::relocate_tls): Likewise.
16000         * object.h (Got_offset_list): New class.
16001         (Sized_relobj::local_has_got_offset): Added got_type parameter.
16002         (Sized_relobj::local_got_offset): Likewise.
16003         (Sized_relobj::set_local_got_offset): Likewise.
16004         (Sized_relobj::local_has_tls_got_offset): Removed.
16005         (Sized_relobj::local_tls_got_offset): Removed.
16006         (Sized_relobj::set_local_tls_got_offset): Removed.
16007         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
16008         * output.cc (Output_data_got::add_global): Added got_type parameter.
16009         (Output_data_got::add_global_with_rel): Likewise.
16010         (Output_data_got::add_global_with_rela): Likewise.
16011         (Output_data_got::add_global_pair_with_rel): New function.
16012         (Output_data_got::add_global_pair_with_rela): New function.
16013         (Output_data_got::add_local): Added got_type parameter.
16014         (Output_data_got::add_local_with_rel): Likewise.
16015         (Output_data_got::add_local_with_rela): Likewise.
16016         (Output_data_got::add_local_pair_with_rel): New function.
16017         (Output_data_got::add_local_pair_with_rela): New function.
16018         (Output_data_got::add_global_tls): Removed.
16019         (Output_data_got::add_global_tls_with_rel): Removed.
16020         (Output_data_got::add_global_tls_with_rela): Removed.
16021         (Output_data_got::add_local_tls): Removed.
16022         (Output_data_got::add_local_tls_with_rel): Removed.
16023         (Output_data_got::add_local_tls_with_rela): Removed.
16024         * output.h (Output_data_got::add_global): Added got_type parameter.
16025         (Output_data_got::add_global_with_rel): Likewise.
16026         (Output_data_got::add_global_with_rela): Likewise.
16027         (Output_data_got::add_global_pair_with_rel): New function.
16028         (Output_data_got::add_global_pair_with_rela): New function.
16029         (Output_data_got::add_local): Added got_type parameter.
16030         (Output_data_got::add_local_with_rel): Likewise.
16031         (Output_data_got::add_local_with_rela): Likewise.
16032         (Output_data_got::add_local_pair_with_rel): New function.
16033         (Output_data_got::add_local_pair_with_rela): New function.
16034         (Output_data_got::add_global_tls): Removed.
16035         (Output_data_got::add_global_tls_with_rel): Removed.
16036         (Output_data_got::add_global_tls_with_rela): Removed.
16037         (Output_data_got::add_local_tls): Removed.
16038         (Output_data_got::add_local_tls_with_rel): Removed.
16039         (Output_data_got::add_local_tls_with_rela): Removed.
16040         * resolve.cc (Symbol::override_base_with_special): Removed
16041         reference to has_got_offset_ field.
16042         * symtab.cc (Symbol::init_fields): Replaced initialization
16043         of got_offset_ with got_offsets_.  Removed initialization
16044         of has_got_offset_
16045         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
16046         (Symbol::got_offset): Likewise.
16047         (Symbol::set_got_offset): Likewise.
16048         (Symbol::has_tls_got_offset): Removed.
16049         (Symbol::tls_got_offset): Removed.
16050         (Symbol::set_tls_got_offset): Removed.
16051         (Symbol::got_offset_): Removed.
16052         (Symbol::tls_mod_got_offset_): Removed.
16053         (Symbol::tls_pair_got_offset_): Removed.
16054         (Symbol::got_offsets_): New field.
16055         (Symbol::has_got_offset): Removed.
16056         (Symbol::has_tls_mod_got_offset): Removed.
16057         (Symbol::has_tls_pair_got_offset): Removed.
16058         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
16059         (Target_x86_64::Scan::local): Updated callers of Output_data_got
16060         member functions.
16061         (Target_x86_64::Scan::global): Likewise.
16062         (Target_x86_64::Relocate::relocate): Likewise.
16063         (Target_x86_64::Relocate::relocate_tls): Likewise.
16064
16065 2008-03-25  Ben Elliston  <bje@au.ibm.com>
16066
16067         * yyscript.y: Fix spelling error in comment.
16068
16069 2008-03-24  Ian Lance Taylor  <iant@google.com>
16070
16071         * options.h (class General_options): Define build_id option.
16072         * layout.h (class Layout): Declare write_build_id, create_note,
16073         create_build_id.  Add build_id_note_ member.
16074         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
16075         "libiberty.h", "md5.h", "sha1.h".
16076         (Layout::Layout): Initialize eh_frame_data_,
16077         eh_frame_hdr_section_, and build_id_note_.
16078         (Layout::finalize): Call create_build_id.
16079         (Layout::create_note): New function, broken out of
16080         Layout::create_gold_note.
16081         (Layout::create_gold_note): Call create_note.
16082         (Layout::create_build_id): New function.
16083         (Layout::write_build_id): New function.
16084         (Close_task_runner::run): Call write_build_id.
16085
16086         * x86_64.cc: Correct license to GPLv3.
16087
16088 2008-03-23  Ian Lance Taylor  <iant@google.com>
16089
16090         * options.cc: Include "demangle.h".
16091         (parse_optional_string): New function.
16092         (parse_long_option): Handle takes_optional_argument.
16093         (parse_short_option): Update dash_z initializer.  Handle
16094         takes_optional_argument.
16095         (General_options::General_options): Initialize do_demangle_.
16096         (General_options::finalize): Set do_demangle_.  Handle demangling
16097         style.
16098         * options.h (parse_optional_string): Declare.
16099         (struct One_option): Add optional_arg field.  Update constructor.
16100         Update call constructor calls.  Add takes_optional_argument
16101         function.
16102         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
16103         (DEFINE_optional_string): Define.
16104         (General_options::demangle): Change from DEFINE_bool to
16105         DEFINE_optional_string.
16106         (General_options::no_demangle): New function.
16107         (General_options::do_demangle): New function.
16108         (General_options::set_do_demangle): New function.
16109         (General_options::execstack_status_): Move definition to end of
16110         class definition.
16111         (General_options::static_): Likewise.
16112         (General_options::do_demangle_): New field.
16113         * object.cc (big_endian>::get_symbol_location_info): Call
16114         Options::do_demangle, not Options::demangle.
16115         * symtab.cc (demangle): Likewise.
16116
16117 2008-03-22  Ian Lance Taylor  <iant@google.com>
16118
16119         * gold.h: Include <cstddef> and <sys/types.h>
16120         * options.h: Include <cstring>.
16121
16122 2008-03-21  Ian Lance Taylor  <iant@google.com>
16123
16124         * Added source code to GNU binutils.
16125 \f
16126 Copyright (C) 2008-2014 Free Software Foundation, Inc.
16127
16128 Copying and distribution of this file, with or without modification,
16129 are permitted in any medium without royalty provided the copyright
16130 notice and this notice are preserved.
16131
16132 Local Variables:
16133 mode: change-log
16134 left-margin: 8
16135 fill-column: 74
16136 version-control: never
16137 End: