Clear SHF_COMPRESSED flag bit from input to output
[external/binutils.git] / gold / ChangeLog
1 2015-07-20  H.J. Lu  <hongjiu.lu@intel.com>
2
3         PR gold/18689
4         * layout.cc (Layout::layout): Clear the SHF_COMPRESSED flag bit
5         from input group section for relocatable link.
6         * testsuite/Makefile.am (check_SCRIPTS): Add pr18689.sh.
7         (check_DATA): Add pr18689.stdout.
8         (MOSTLYCLEANFILES): Add pr18689a.o pr18689b.o.
9         (pr18689.stdout): New rule.
10         (pr18689a.o): Likewise.
11         (pr18689b.o): Likewise.
12         (pr18689.o): Likewise.
13         * testsuite/pr18689.c: New file.
14         * testsuite/pr18689.sh: Likewise.
15         * testsuite/Makefile.in: Regenerated.
16
17 2015-07-20  Yiran Wang  <yiran@google.com>
18         Cary Coutant  <ccoutant@gmail.com>
19
20         PR gold/15574
21         * resolve.cc (Symbol_table): Remove warning about references
22         from shared objects to hidden symbols.
23         * testsuite/Makefile.am (hidden_test): Add hidden_test.syms.
24         * testsuite/Makefile.in: Regenerate.
25         * testsuite/hidden_test.sh: Check dynamic symbol table; update
26         expected error messages.
27
28 2015-07-14  H.J. Lu  <hongjiu.lu@intel.com>
29
30         * compressed_output.cc (Output_compressed_section::set_final_data_size):
31         Make --compress-debug-sections=zlib the same as
32         --compress-debug-sections=zlib-gabi.
33         * testsuite/Makefile.am (flagstest_compress_debug_sections.check):
34         Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of
35         ".zdebug_".
36         * testsuite/Makefile.in: Regenerated.
37
38 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
39
40         PR gold/18322
41         * compressed_output.cc (zlib_compress): Add argument for
42         compression header size.  Set header size to compression header
43         size if it isn't 0.  Don't write out the zlib header here.
44         (Output_compressed_section::set_final_data_size): Support
45         zlib-gnu and zlib-gabi compressions.  Pass compression header
46         size to zlib_compress and write out compression header.  Set
47         the SHF_COMPRESSED bit for zlib-gabi compression.  Otherwise
48         clear the SHF_COMPRESSED bit
49         * options.h (compress_debug_sections): Add zlib-gnu and
50         zlib-gabi.
51         * output.h (Output_section::set_flags): New.
52         * testsuite/Makefile.am (check_PROGRAMS): Add
53         flagstest_compress_debug_sections_none,
54         flagstest_compress_debug_sections_gnu and
55         flagstest_compress_debug_sections_gabi.
56         (check_DATA): Add flagstest_compress_debug_sections_none.stdout.
57         flagstest_compress_debug_sections.stdout,
58         flagstest_compress_debug_sections.cmp,
59         flagstest_compress_debug_sections.check,
60         flagstest_compress_debug_sections_gnu.stdout,
61         flagstest_compress_debug_sections_gnu.cmp,
62         flagstest_compress_debug_sections_gnu.check,
63         flagstest_compress_debug_sections_gabi.stdout,
64         flagstest_compress_debug_sections_gabi.cmp and
65         flagstest_compress_debug_sections_gabi.check.
66         (flagstest_compress_debug_sections_none): New.
67         (flagstest_compress_debug_sections_none.stdout): Likewise.
68         (flagstest_compress_debug_sections.stdout): Likewise.
69         (flagstest_compress_debug_sections.check): Likewise.
70         (flagstest_compress_debug_sections.cmp): Likewise.
71         (flagstest_compress_debug_sections_gnu): Likewise.
72         (flagstest_compress_debug_sections_gnu.stdout): Likewise.
73         (flagstest_compress_debug_sections_gnu.check): Likewise.
74         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
75         (flagstest_compress_debug_sections_gabi): Likewise.
76         (flagstest_compress_debug_sections_gabi.stdout): Likewise.
77         (flagstest_compress_debug_sections_gnu.check): Likewise.
78         (flagstest_compress_debug_sections_gnu.cmp): Likewise.
79         * testsuite/Makefile.in: Regenerated.
80
81 2015-07-12  H.J. Lu  <hongjiu.lu@intel.com>
82
83         PR gold/18321
84         * compressed_output.h (decompress_input_section): Add arguments
85         for ELF class, big endian and sh_flags.
86         * compressed_output.cc (decompress_input_section): Likewise.
87         Support the SHF_COMPRESSED section.
88         * dynobj.h (Dynobj): Add elfsize and is_big_endian member
89         functions.
90         * plugin.h (Pluginobj): Likewise.
91         * layout.cc (Layout::get_output_section_flags): Also clear the
92         SHF_COMPRESSED bit.
93         * object.h (Compressed_section_info): Add flag to store sh_flags.
94         (Object): Add pure virtual elfsize and is_big_endian member
95         functions.
96         * object.cc (need_decompressed_section): Don't skip the ".zdebug"
97         prefix here.
98         (build_compressed_section_map): Check SHF_COMPRESSED for
99         uncompressed size.  Store sh_flags in Compressed_section_info.
100         Pass size, big_endian and sh_flags to decompress_input_section.
101         Skip the ".debug"/".zdebug" prefix when passing section name to
102         need_decompressed_section.
103         (Sized_relobj_file<size, big_endian>::do_find_special_section):
104         Don't check ".zdebug_*" sections.
105         (Object::decompressed_section_contents): Pass ELF class, big
106         endian and sh_flags to decompress_input_section.
107         * reloc.cc (Sized_relobj_file<size, big_endian>::write_sections):
108         Likewise.
109         * testsuite/Makefile.am (check_DATA): Add
110         debug_msg_cdebug_gabi.err and gdb_index_test_2_gabi.stdout.
111         (MOSTLYCLEANFILES): Add debug_msg_cdebug_gabi.err and
112         gdb_index_test_2_gabi.stdout.
113         (debug_msg_cdebug_gabi.o): New.
114         (odr_violation1_cdebug_gabi.o): Likewise.
115         (odr_violation2_cdebug_gabi.o): Likewise.
116         (debug_msg_cdebug_gabi.err): Likewise.
117         (check_SCRIPTS): Add gdb_index_test_2_gabi.sh.
118         (gdb_index_test_cdebug_gabi.o): Likewise.
119         (gdb_index_test_2_gabi): Likewise.
120         (gdb_index_test_2_gabi.stdout): Likewise.
121         * testsuite/gdb_index_test_2_gabi.sh: New file.
122         * testsuite/Makefile.in: Regenerated.
123
124 2015-07-09  Han Shen  <shenhan@google.com>
125
126         Use "gold_info" instead of "gold_warning" for erratum fix.
127
128         * aarch64.cc (Target_aarch64::scan_erratum_843419_span): Use
129         'gold_info'.
130         (Target_aarch64::scan_erratum_835769_span): USe 'gold_info'.
131
132 2015-07-09  Han Shen  <shenhan@google.com>
133
134         Drop missing symbol warning for arm/aarch64.
135
136         * aarch64.cc (AArch64_relobj::scan_errata): Drop missing symbol warning.
137         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Drop missing
138         symbol warning.
139
140 2015-07-07  Han Shen  <shenhan@google.com>
141
142         Make gold aarch64 accept long form of mapping symbols.
143
144         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Make legal
145         of mapping symbols.
146
147 2015-06-29  Doug Kwan  <dougkwan@google.com>
148
149         * testsuite/arm_bl_out_of_range.s: Align stub table so that it appears
150           at address expected by test.
151         * testsuite/arm_cortex_a8_b.s: Ditto.
152         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
153         * testsuite/arm_cortex_a8_bl.s: Ditto.
154         * testsuite/arm_cortex_a8_blx.s: Ditto.
155         * testsuite/arm_cortex_a8_local.s: Ditto.
156         * testsuite/arm_fix_v4bx.s: Ditto.
157         * testsuite/arm_unaligned_reloc.s: Ditto.
158         * testsuite/thumb_bl_out_of_range.s: Ditto.
159         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
160         * testsuite/thumb_blx_out_of_range.s: Ditto.
161
162 2015-06-29  Han Shen  <shenhan@google.com>
163
164         Patch for erratum 843419 internal error.
165
166         * aarch64.cc (Erratum_stub::Insn_utilities): New typedef.
167         (Erratum_stub::update_erratum_insn): New method.
168         (Stub_table::relocate_stubs): Modified to place relocated insn.
169         (AArch64_relobj::fix_errata): Modified gold_assert.
170
171 2015-06-12  Han Shen  <shenhan@google.com>
172
173         Fix erratum 835769.
174
175         * aarch64.cc (AArch64_insn_utilities::BYTES_PER_INSN): Move
176         defintion outside class definition.
177         (AArch64_insn_utilities::AARCH64_ZR): New static constant.
178         (AArch64_insn_utilities::aarch64_op31): New member.
179         (AArch64_insn_utilities::aarch64_ra): New member.
180         (AArch64_insn_utilities::aarch64_mac): New member.
181         (AArch64_insn_utilities::aarch64_mlxl): New member.
182         (ST_E_835769): New global enum member.
183         (Stub_table::relocate_stubs): Add 835769 handler.
184         (Stub_template_repertoire::Stub_template_repertoire): Install new
185         stub type.
186         (AArch64_relobj::scan_errata): This func is renamed from
187         scan_erratum_843419.
188         (AArch64_relobj::do_count_local_symbols): Add 835769 handler.
189         (AArch64_relobj::do_relocate_sections): Add 835769 handler.
190         (AArch64_relobj::scan_sections_for_stubs): Add 835769 handler.
191         (Target_aarch64::scan_erratum_835769_span): New method.
192         (Target_aarch64::create_erratum_stub): New method.
193         (Target_aarch64::is_erratum_835769_sequence): New method.
194         (Target_aarch64::scan_erratum_843419_sequence): Move part of the
195         code into create_erratum_stub.
196         * options.h (fix_cortex_a53_835769): New option.
197
198 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
199
200         * aarch64.cc (Erratum_stub::STUB_ADDR_ALIGN): Move initialization
201         outside class body.
202         (Reloc_stub::STUB_ADDR_ALIGN): Likewise.
203
204 2015-06-11  Cary Coutant  <ccoutant@gmail.com>
205
206         PR gold/17731
207         * layout.cc (corresponding_uncompressed_section_name): New function.
208         (Layout::choose_output_section): Call it.
209         * layout.h (corresponding_uncompressed_section_name): New function.
210         * script-sections.cc (Input_section_info::set_section_name): Check
211         for compressed debug section (.zdebug style).
212
213 2015-06-11  Jing Yu  <jingyu@google.com>
214
215         * testsuite/Makefile.am: Add -O0 for script_test_12 test.
216         * testsuite/Makefile.in: Regenerate.
217
218 2015-06-11  Davide Italiano  <dccitaliano@gmail.com>
219
220         * gold.h (is_cident): Correct typo.
221
222 2015-06-10  Han Shen  <shenhan@google.com>
223         Patch for erratum-843419 (2 of 2 - fix erratum occurrences).
224
225         Now fixing for 843419 is fully functional.
226
227         The first part of the erratum fix CL is here -
228         https://sourceware.org/ml/binutils/2015-04/msg00229.html
229
230         * aarch64.cc(global enum): New constants representing stub types.
231         (Stub_template): New POD struct.
232         (Stub_template_repertoire): New class.
233         (Stub_base): New class.
234         (Erratum_stub): New class.
235         (Reloc_stub): Refactored to be a subclass of Stub_base.
236         (Reloc_stub::Stub_type): Removed.
237         (Reloc_stub::offset): Moved to Stub_base.
238         (Reloc_stub::set_offset): Moved to Stub_base.
239         (Reloc_stub::destination_address): Moved to Stub_base.
240         (Reloc_stub::set_destination_address): Moved to Stub_base.
241         (Reloc_stub::reset_destination_address): Moved to Stub_base.
242         (Reloc_stub::stub_type): Renamed and moved to Stub_base.
243         (Reloc_stub::stub_size): Renamed and moved to Stub_base.
244         (Reloc_stub::stub_insns): Renamed and moved to Stub_base.
245         (Reloc_stub::write): Moved to Stub_base.
246         (Reloc_stub::invalid_offset): Moved to Stub_base.
247         (Reloc_stub::invalid_address): Moved to Stub_base.
248         (Reloc_stub::stub_type_): Renamed and moved to Stub_base.
249         (Reloc_stub::stub_insns_): Moved to Stub_base.
250         (Reloc_stub::offset_): Moved to Stub_base.
251         (Reloc_stub::destination_address_): Moved to Stub_base.
252         (Stub_table::The_aarch64_relobj): New typedef.
253         (Stub_table::The_erratum_stub): New typedef.
254         (Stub_table::The_erratum_stub_less): New typedef.
255         (Stub_table::The_erratum_stub_set): New typedef.
256         (Stub_table::The_erratum_stub_set_iter): New typedef.
257         (Stub_table::empty): Added emptiness testing for erratum stubs.
258         (Stub_table::add_erratum_stub): New method to add an erratum stub.
259         (Stub_table::find_erratum_stub): New method.
260         (Stub_table::find_erratum_stubs_for_input_section): New method.
261         (Stub_table::erratum_stub_address): New method.
262         (Stub_table::update_date_size_changed_p): Modified to handle erratum stubs.
263         (Stub_table::do_addralign): Modified to handle erratum stubs.
264         (Stub_table::erratum_stubs_): New member.
265         (Stub_table::erratum_stub_size_): New member.
266         (Stub_table::relocate_stubs): Modified to handle erratum stubs.
267         (Stub_table::do_write): Modified to handle erratum stubs.
268         (AArch64_relobj::The_erratum_stub): New typedef.
269         (AArch64_relobj::Erratum_stub_set_iter): New typedef.
270         (AArch64_relobj::fix_errata): New method.
271         (Target_aarch64::The_reloc_stub_type): Removed.
272         (Target_aarch64::The_erratum_stub): New typede.
273         (AArch64_relocate_functions::construct_b): New method.
274
275 2015-06-08  Nick Clifton  <nickc@redhat.com>
276
277         * po/fr.po: New French Translation.
278
279 2015-06-07  Cary Coutant  <ccoutant@gmail.com>
280
281         PR gold/18288
282         * resolve.cc (symbol_to_bits): Remove type parameter; adjust all
283         callers. Don't use STT_COMMON to check for common symbols.
284         (Symbol_table::resolve): Warn if relocatable object has STT_COMMON
285         symbol that's not in a common section.
286         * symtab.h (Symbol::is_common): Don't use STT_COMMON to check for
287         common symbols.
288
289 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
290
291         PR gold/18200
292         * Makefile.am (diststuff): Add target.
293         * Makefile.in: Regenerate.
294
295 2015-06-04  Cary Coutant  <ccoutant@gmail.com>
296
297         PR gold/17498
298         * object.cc (Sized_relobj_file::do_count_local_symbols): Discard
299         temporary locals in merge sections.
300         * options.cc (General_options::parse_discard_all): New method.
301         (General_options::parse_discard_locals): New method.
302         (General_options::parse_discard_none): New method.
303         (General_options::General_options): Initialize discard_locals_.
304         * options.h (--discard-all): Convert to special option.
305         (--discard-locals): Likewise.
306         (--discard-none): New option.
307         (General_options::discard_all): New method.
308         (General_options::discard_locals): New method.
309         (General_options::discard_sec_merge): New method.
310         (General_options::Discard_locals): New enum.
311         (General_options::discard_locals_): New data member.
312
313 2015-06-03  Cary Coutant  <cary@google.com>
314
315         * script-sections.cc (Script_sections::Script_sections): Initialize
316         segments_created_.
317         (Script_sections::create_note_and_tls_segments): Set flag when
318         segments are created.
319         (Script_sections::expected_segment_count): Count PT_INTERP.
320         (Script_sections::attach_sections_using_phdrs_clause): Set flag when
321         segments are created.
322         * script-sections.h (Script_sections::segments_created_): New data
323         member.
324
325 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
326
327         PR gold/15370
328         * script-sections.cc
329         (Output_section_element_input::set_section_addresses): When there
330         are several patterns with no sort spec, put all sections in the same
331         bin.
332         * testsuite/Makefile.am (script_test_12): New testcase.
333         (script_test_12i): New testcase.
334         * testsuite/Makefile.in: Regenerate.
335         * testsuite/script_test_12.t: New test linker script.
336         * testsuite/script_test_12i.t: New test linker script.
337         * testsuite/script_test_12a.c: New test source file.
338         * testsuite/script_test_12b.c: New test source file.
339
340 2015-06-02  Cary Coutant  <ccoutant@gmail.com>
341
342         * nacl.h (Sniff_file): Switch parameters to get_view to get an
343         aligned view.
344
345 2015-06-03  Cary Coutant  <ccoutant@gmail.com>
346
347         PR gold/17819
348         * gold.cc (queue_final_tasks): When --build-id=tree, queue a
349         separate task to schedule the build id computation.
350         * layout.cc (Hash_task::Hash_task): Remove build_id_blocker,
351         add Output_file and offset.
352         (Hash_task::run): Get and release the input views.
353         (Hash_task::is_runnable): Always return NULL (always runnable).
354         (Layout::queue_build_id_tasks): Remove.
355         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
356         parameters; use them instead of class members.
357         (Build_id_task_runner::run): New function.
358         (Close_task_runner::run): Pass array_of_hashes and size_of_hashes
359         to write_build_id.
360         * layout.h (Layout::queue_build_id_tasks): Remove.
361         (Layout::write_build_id): Add array_of_hashes and size_of_hashes
362         parameters.
363         (Layout::array_of_hashes_): Remove.
364         (Layout::size_of_array_of_hashes_): Remove.
365         (Layout::input_view_): Remove.
366         (Build_id_task_runner): New class.
367         (Close_task_runner::Close_task_runner): Add array_of_hashes and
368         size_of_hashes parameters.
369         (Close_task_runner::array_of_hashes_): New data member.
370         (Close_task_runner::size_of_hashes_): New data member.
371         * testsuite/Makefile.am
372         (flagstest_compress_debug_sections_and_build_id_tree): New test.
373         * testsuite/Makefile.in: Regenerate.
374
375 2015-06-01  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
376
377         * merge.cc (get_input_merge_map): Update for data structure change.
378         (get_or_make_input_merge_map): Update for data structure change.
379         * merge.h (Object_merge_map): Use a std::vector<std::pair>> instead of
380         a std::map. Remove first_shnum_, first_map_, second_shnum_, second_map_.
381
382 2015-05-16  Alan Modra  <amodra@gmail.com>
383
384         * reloc.cc (Sized_relobj_file::find_functions): Use function_location.
385         * powerpc.cc (Target_powerpc::do_calls_non_split): New function.
386         (addi_12_1, addis_2_12, addis_12_1, cmpld_7_12_0): New constants.
387         (lis_0): Rename from lis_0_0.
388
389 2015-04-29  Cary Coutant  <cary@google.com>
390             Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
391
392         * gc.h (Garbage_collection::is_section_garbage): Change Object*
393         to Relobj*.
394         (Garbage_collection::add_reference): Likewise.
395         (Garbage_collection::gc_process_relocs): Likewise. Don't push
396         object/shndx pair onto *secvec for dynamic objects. Don't follow
397         relocations pointing to dynamic objects for GC.
398         * icf.cc (Icf::find_identical_sections): Change Object* to Relobj*.
399         (Icf::unfold_section): Likewise.
400         (Icf::is_section_folded): Likewise.
401         (Icf::get_folded_section): Likewise.
402         * icf.h: (Icf::get_folded_section): Likewise.
403         (Icf::unfold_section): Likewise.
404         (Icf::is_section_folded): Likewise.
405         (Icf::section_has_function_pointers): Likewise.
406         (Icf::set_section_has_function_pointers): Likewise.
407         * object.h (Section_id): Likewise.
408         (Const_section_id): Likewise.
409         * output.cc (Output_section::update_section_layout): Likewise.
410         * output.h: (Output_section_lookup_maps::find_relaxed_input_section):
411         Likewise.
412         * plugin.cc (update_section_order): Likewise.
413         (unique_segment_for_sections): Likewise.
414         * powerpc.cc (Powerpc_relobj::add_reference): Likewise.
415         (Target_powerpc::do_gc_add_reference): Likewise.
416         (Target_powerpc::gc_process_relocs): Likewise.
417         (Target_powerpc::do_gc_add_reference): Likewise.
418         * symtab.cc (Symbol_table::is_section_folded): Likewise.
419         (Symbol_table::gc_mark_symbol): Likewise.
420         * symtab.h: (Symbol_table::is_section_folded): Likewise.
421         * target.h: (Sized_target::gc_add_reference): Likewise.
422         (Sized_target::do_gc_add_reference): Likewise.
423
424 2015-04-29  Nick Clifton  <nickc@redhat.com>
425
426         * po/fi.po: Updated Finnish translation.
427
428 2015-04-28  Alan Modra  <amodra@gmail.com>
429
430         * powerpc.cc (Target_powerpc::do_dynsym_value): Use Address rather
431         than unsigned int for find_global_entry result temp.  Compare
432         against invalid_address.
433         (Target_powerpc::do_plt_address_for_global): Likewise.
434         (Target_powerpc::Relocate::relocate): Likewise.  Don't assert
435         on plt call stub existence for debug info.  Do assert for plt
436         and global entry stub existence if an alloc section.
437
438 2015-04-28  Alan Modra  <amodra@gmail.com>
439
440         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't assert
441         on missing global entry stub due to bogus debug info.
442
443 2015-04-27  Han Shen  <shenhan@google.com>
444
445         * options.h (--fix-cortex-a53-843419): Rename option.
446         * aarch64.cc (AArch64_relobj::do_count_local_symbols): Use renamed
447         option.
448         (AArch64_relobj::scan_sections_for_stubs): Use renamed option.
449
450 2015-04-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
451
452         PR gold/18327
453         * output.cc (Output_section::is_input_address_mapped): Assume a missing
454         entry is mapped.
455         * testsuite/Makefile.am: Add the eh_test test.
456         * testsuite/Makefile.in: Regenerate.
457         * testsuite/eh_test_a.cc: New test.
458         * testsuite/eh_test_b.cc: New test.
459
460 2015-04-23  Sriraman Tallam  <tmsriram@google.com>
461
462         * options.h (--weak-unresolved-symbols): New option.
463         * symtab.cc (Symbol_table::sized_write_globals): Change symbol
464         binding to weak with new option.
465         * symtab.h (is_weak_undefined): Check for new option.
466         (is_strong_undefined): Check for new option.
467         * testsuite/Makefile.am (weak_unresolved_symbols_test): New test.
468         * testsuite/Makefile.in: Regenerate.
469         * testsuite/weak_unresolved_symbols_test.cc: New file.
470
471 2015-04-20  Ian Coolidge  <icoolidge@google.com>
472
473         * symtab.cc (Symbol::should_add_dynsym_entry): Return true for
474         GNU_UNIQUE.
475
476 2015-04-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
477
478         * gc.cc (Garbage_collection::do_transitive_closure): Use back and
479         push_back.
480         * gc.h (Garbage_collection): Use a std::vector instead of a std::queue.
481         * object.cc (Sized_relobj_file::do_layout): Use push_back.
482         * powerpc.cc (process_gc_mark): Use push_back.
483         (Target_powerpc::do_gc_mark_symbol): Use push_back.
484         * symtab.cc (Symbol_table::gc_mark_symbol): Use push_back.
485
486 2015-04-16  Han Shen  <shenhan@google.com>
487
488         * aarch64.cc (AArch64_insn_utilities): New utility class.
489         (AArch64_relobj::Mapping_symbol_position): New struct.
490         (AArch64_relobj::Mapping_symbol_info): New typedef.
491         (AArch64_relobj::do_count_local_symbols): New function overriding
492         parent's implementation.
493         (AArch64_relobj::mapping_symbol_info_): New member
494         (AArch64_relobj::scan_erratum_843419): New method.
495         (Target_aarch64::scan_erratum_843419_span): New method.
496         (Target_aarch64::is_erratum_843419_sequence): New method.
497         * options.h (fix_cortex_a53): New option.
498
499 2015-04-09  Cary Coutant  <ccoutant@google.com>
500
501         * symtab.cc (Symbol::final_value_is_known): Check for TLS symbol
502         in a PIE link.
503         * testsuite/Makefile.am (tls_pie_test.sh): New test.
504         * testsuite/Makefile.in: Regenerate.
505         * testsuite/tls_pie_test.sh: New.
506
507 2015-04-09  Cary Coutant  <ccoutant@google.com>
508
509         * debug.h (DEBUG_LOCATION): New.
510         (DEBUG_ALL): Include DEBUG_LOCATION.
511         (debug_string_to_enum): Add DEBUG_LOCATION.
512         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Fix debug
513         output to print correct context.
514         (Sized_dwarf_line_info::do_addr2line): Add debug output. Return
515         up to 4 more locations at the beginning of the function.
516         * symtab.cc (Symbol_table::detect_odr_violations): Get canonical
517         result before sorting list of line numbers.
518         * testsuite/debug_msg.sh: Allow range of line numbers for
519         canonical results on optimized code.
520
521 2015-04-07  HC Yen <hc.yen@mediatek.com>
522
523         Add AArch32 support for gold linker.
524         gold/
525         * arm.cc: Add V8 arch combine table.
526
527 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
528
529         * aarch64.cc (do_reloc_addend): Fix signature to match the parent one.
530
531 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
532
533         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a call
534         to find by using the return value of insert.
535
536 2015-04-06  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
537
538         * gc.cc (Garbage_collection::do_transitive_closure): Avoid a copy
539         constructor call.
540
541 2015-04-06  Ilya Tocar  <ilya.tocar@intel.com>
542
543         PR gold/17641
544         * x86_64.cc (Target_x86_64::can_convert_mov_to_lea): New.
545         (Target_x86_64::Scan::local): Don't create GOT entry, when we
546         can convert mov to lea.
547         (Target_x86_64::Scan::global): Ditto.
548         (Target_x86_64::Relocate::relocate): Convert mov foo@GOTPCREL(%rip),
549         %reg to lea foo(%rip), %reg if possible.
550         * testsuite/Makefile.am (x86_64_mov_to_lea): New test.
551         * testsuite/x86_64_mov_to_lea1.s: New.
552         * testsuite/x86_64_mov_to_lea2.s: Ditto.
553         * testsuite/x86_64_mov_to_lea3.s: Ditto.
554         * testsuite/x86_64_mov_to_lea4.s: Ditto.
555         * testsuite/x86_64_mov_to_lea.sh: Ditto.
556
557 2015-04-02  H.J. Lu  <hongjiu.lu@intel.com>
558
559         * configure: Regenerated.
560
561 2015-04-01  Ilya Tocar  <ilya.tocar@intel.com>
562
563         PR gold/17640
564         * i386.cc (Target_i386::can_convert_mov_to_lea): New.
565         (Target_i386::Scan::local): Don't create GOT entry, when we
566         can convert GOT to GOTOFF.
567         (Target_i386::Scan::global): Ditto.
568         (Target_i386::Relocate::relocate): Convert  mov foo@GOT(%reg), %reg to
569         lea foo@GOTOFF(%reg), %reg if possible.
570         * testsuite/Makefile.am (i386_mov_to_lea): New test.
571         * testsuite/i386_mov_to_lea1.s: New.
572         * testsuite/i386_mov_to_lea2.s: Ditto.
573         * testsuite/i386_mov_to_lea3.s: Ditto.
574         * testsuite/i386_mov_to_lea4.s: Ditto.
575         * testsuite/i386_mov_to_lea5.s: Ditto.
576         * testsuite/i386_mov_to_lea.sh: Ditto.
577
578 2015-04-01  H.J. Lu  <hongjiu.lu@intel.com>
579
580         * Makefile.am (ZLIB): New.
581         (ZLIBINC): Likewise.
582         (AM_CFLAGS): Add $(ZLIBINC).
583         (AM_CXXFLAGS): Likewise.
584         (ldadd_varldadd_var): Add $(ZLIB).
585         (incremental_dump_LDADD): Likewise.
586         (dwp_LDADD): Likewise.
587         * compressed_output.cc: Don't check HAVE_ZLIB_H to include
588         <zlib.h>.
589         (zlib_compress): Don't check HAVE_ZLIB_H.
590         (zlib_decompress): Likewise.
591         * options.h (compress_debug_sections): Likewise.
592         * configure.ac (AM_CONDITIONAL): Removed.
593         * testsuite/Makefile.am (ZLIB): New.
594         (LDADD): Add $(ZLIB).
595         Don't check HAVE_ZLIB.
596         * Makefile.in: Regenerated.
597         * config.in: Likewise.
598         * configure: Likewise.
599         * testsuite/Makefile.in: Likewise.
600
601 2015-03-30  Jing Yu  <jingyu@google.com>
602
603         * aarch64-reloc.def: New TLSLD_ADD_DTPREL_HI12,
604         TLSLD_ADD_DTPREL_LO12_NC.
605         * aarch64.cc (Target_aarch64::define_tls_base_symbol): Always let
606         _TLS_MODULE_BASE_ point to the start of tls segment.
607         (Target_aarch64::optimize_tls_reloc): Add cases for
608         R_AARCH64_TLSLD_ADD_DTPREL_HI12 and
609         R_AARCH64_TLSLD_ADD_DTPREL_LO12_NC.
610         (Target_aarch64::Scan::local): Likewise.
611         (Target_aarch64::Scan::global): Likewise.
612         (Target_aarch64::Relocate::relocate): Likewise.
613         (Target_aarch64::Relocate::relocate_tls): Likewise. And remove
614         subtracting tls segment size from symbol value for TLSLD_*_DTPREL
615         relocations.
616
617 2015-03-27  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
618
619         * merge.cc (Object_merge_map::add_mapping): call
620         Object_merge_map::Input_merge_map::add_mapping.
621         (Object_merge_map::Input_merge_map::add_mapping): New.
622         (Output_merge_data::do_add_input_section): Call
623         get_or_make_input_merge_map before a loop.
624         (Output_merge_string<Char_type>::finalize_merged_data): Call
625         get_or_make_input_merge_map before a loop.
626         * merge.h (Object_merge_map): Make Input_merge_map public.
627         * object.cc (Relobj::add_merge_mapping): Use get_or_create_merge_map.
628         (Relobj::get_or_create_merge_map): New.
629         * object.h (Relobj::get_or_create_merge_map): New.
630
631 2015-03-24  Alan Modra  <amodra@gmail.com>
632
633         PR 18147
634         * powerpc.cc (Target_powerpc::Relocate::relocate): Don't report
635         relocation errors for branches to strong undefined symbols.
636
637 2015-03-23  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
638
639         * merge.cc (Object_merge_map::get_input_merge_map): Make it const.
640         (Object_merge_map::is_merge_section_for): Remove.
641         (Object_merge_map::find_merge_section): New.
642         * merge.h (Object_merge_map::is_merge_section_for): Remove.
643         (Object_merge_map::find_merge_section): New.
644         (Object_merge_map::get_input_merge_map): Add a const version.
645         * object.cc (Relobj::is_merge_section_for): Remove.
646         (Relobj::find_merge_section): New.
647         * object.h (Relobj::is_merge_section_for): Remove.
648         (Relobj::find_merge_section): New.
649         * output.cc
650         (Output_section::Input_section::is_merge_section_for): Remove.
651         (Output_section::add_merge_input_section): Don't call
652         add_merge_input_section.
653         (Output_section::find_merge_section): Return const. Use
654         object->find_merge_section.
655         (Output_section::build_lookup_maps): Don't build a map for
656         merge sections.
657         (Output_section::is_input_address_mapped): Return false if
658         section is not found.
659         (Output_section::find_starting_output_address): Use
660         find_merge_section instead of is_merge_section_for.
661         (Output_section::add_script_input_section):  Don't build a map for
662         merge sections.
663         * output.h (Output_section_lookup_maps::merge_sections_by_id_): Remove.
664         (Output_section_lookup_maps::find_merge_section): Remove.
665         (Output_section_lookup_maps::add_merge_input_section) Remove.
666         (Output_section::find_merge_section): Return const.
667
668 2015-03-22  Cary Coutant  <cary@google.com>
669
670         PR gold/18106
671         * i386.cc (Target_i386::Relocate::tls_gd_to_ie): Fix support for
672         non-SIB form of lea, with nop after the call.
673
674 2015-03-21  Cary Coutant  <cary@google.com>
675
676         PR gold/14217
677         * output.cc (Output_segment::is_first_section_relro): Don't ignore
678         .tdata section.
679         (Output_segment::set_section_addresses): Don't align size of relro
680         segment for .tbss.
681
682 2015-03-21  Cary Coutant  <cary@google.com>
683
684         PR gold/18010
685         * stringpool.cc (Stringpool_template): Don't optimize if section
686         alignment is greater than sizeof(char).
687
688 2015-03-21  Cary Coutant  <cary@google.com>
689
690         PR gold/18048
691         * script-c.h (script_include_directive): Add first_token parameter.
692         * script.cc (script_include_directive): Add first_token parameter, and
693         pass it to read_script_file.
694         * yyscript.y (PARSING_SECTIONS_BLOCK, PARSING_SECTION_CMDS)
695         (PARSING_MEMORY_DEF): New tokens.
696         (top): Add new productions for INCLUDE files.
697         (file_cmd): Replace file_or_sections_cmd with copy of its productions.
698         Pass PARSING_LINKER_SCRIPT to script_include_directive.
699         (section_block_cmd): Likewise; pass PARSING_SECTIONS_BLOCK.
700         (section_cmd): Pass PARSING_SECTION_CMDS.
701         (file_or_sections_cmd): Remove.
702         (memory_def): Pass PARSING_MEMORY_DEF.
703         * testsuite/Makefile.am (memory_test_2): New test.
704         * testsuite/Makefile.in: Regenerate.
705         * testsuite/memory_test_inc.t: New script file.
706         * testsuite/memory_test_inc_1.t.src: New script file.
707         * testsuite/memory_test_inc_2.t.src: New script file.
708         * testsuite/memory_test_inc_3.t.src: New script file.
709
710 2015-03-21  Cary Coutant  <cary@google.com>
711
712         * dwp.cc (Sized_relobj_dwo::do_section_contents): Delete.
713         (Sized_relobj_dwo::setup): Build compressed section map.
714         (Sized_relobj_dwo::do_decompressed_section_contents): Delete.
715         * dynobj.cc (Sized_dynobj::base_read_symbols): Build compressed
716         section map.
717         * object.cc (Sized_relobj_file::Sized_relobj_file): Remove
718         compressed_sections_ field.
719         (build_compressed_section_map): Take Object instead of
720         Sized_relobj_file parameter; add decompress_if_needed parameter.
721         (Sized_relobj_file::do_find_special_sections): Store compressed
722         section map in parent Object.
723         (Sized_relobj_file::do_decompressed_section_contents): Move
724         implementation to Object::decompressed_section_contents.
725         (Sized_relobj_file::do_discard_decompressed_sections): Move
726         implementation to Object::discard_decompressed_sections.
727         * object.h (build_compressed_section_map): Declare.
728         (Object::Object): Add compressed_sections_ field.
729         (Object::section_is_compressed): Move implementation here.
730         (Object::decompressed_section_contents): De-virtualize.
731         (Object::discard_decompressed_sections): De-virtualize.
732         (Object::do_section_is_compressed): Delete.
733         (Object::do_decompressed_section_contents): Delete.
734         (Object::set_compressed_sections): New method.
735         (Object::compressed_sections): New method.
736         (Object::compressed_sections_): New data member.
737         (Compressed_section_info, Compressed_section_map): Move to top of file.
738         (Sized_relobj_file::do_section_is_compressed): Delete.
739         (Sized_relobj_file::do_decompressed_section_contents): Delete.
740         (Sized_relobj_file::do_discard_decompressed_sections): Delete.
741         (Sized_relobj_file::compressed_sections_): Move to Object class.
742
743 2015-03-21  Cary Coutant  <ccoutant@google.com>
744
745         PR gold/18152
746         * gold.cc (queue_middle_tasks): Finalize .eh_frame after laying out
747         deferred objects.
748
749 2015-03-11  Cary Coutant  <ccoutant@google.com>
750
751         * options.cc (General_options::finalize): Don't allow -z relro
752         with incremental linking.
753         * testsuite/Makefile.am (incremental_test): Add -z norelro.
754         (incremental_test_2): Likewise.
755         (incremental_test_3): Likewise.
756         (incremental_test_4): Likewise.
757         (incremental_test_5): Likewise.
758         (incremental_test_6): Likewise.
759         (incremental_copy_test): Likewise.
760         (incremental_common_test_1): Likewise.
761         (incremental_comdat_test_1): Likewise.
762         * testsuite/Makefile.in: Regenerate.
763
764 2015-03-09  Cary Coutant  <ccoutant@google.com>
765
766         PR gold/14675
767         * ehframe.cc (Eh_frame::add_ehframe_input_section): Change return type;
768         return enum indicating whether .eh_frame section is empty, optimizable,
769         unrecognized, or an end marker. Adjust explicit instantiations.
770         * ehframe.h (Eh_frame::Eh_frame_section_disposition): New enum type.
771         (Eh_frame::add_ehframe_input_section): Change return type.
772         * gold.cc (queue_middle_tasks): Call Layout::finalize_eh_frame_section.
773         * layout.cc (Layout::layout_eh_frame): Don't add optimized sections
774         to the .eh_frame output section until we see the end marker.
775         (Layout::finalize_eh_frame_section): New.
776         * layout.h: (Layout::finalize_eh_frame_section): New.
777
778 2015-03-05  H.J. Lu  <hongjiu.lu@intel.com>
779
780         * output.cc (Relobj::initialize_input_to_output_map<size>):
781         Remove typename on elfcpp::Elf_types<size>::Elf_Addr.
782
783 2015-03-04  Cary Coutant  <ccoutant@google.com>
784
785         * parameters.cc (Parameters::set_target_once): Call
786         Target::select_as_default_target just once from here...
787         (set_parameters_target): ...instead of from here.
788
789 2015-03-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
790
791         * ehframe.cc (Cie::set_output_offset): Pass in and use a
792         Output_section_data instead of a Merge_map.
793         (Eh_frame::Eh_frame): Don't initialize merge_map_.
794         (Eh_frame::read_cie): Use add_merge_mapping instead of
795         Merge_map::add_mapping.
796         (Eh_frame::read_fde): Ditto.
797         (Eh_frame::set_final_data_size): Use this instead of this->merge_map_.
798         (Eh_frame::do_output_offset): Use merge_output_offset istead of
799         merge_map_->get_output_offset.
800         (Eh_frame::do_is_merge_section_for): Delete.
801         * ehframe.h (Fde::add_mapping): Pass in and use a Output_section_data
802         instead of a Merge_map.
803         (Cie::set_output_offset): Pass in a Output_section_data instead of a
804         Merge_map.
805         (Eh_frame::do_is_merge_section_for): Delete.
806         (Eh_frame::merge_map_): Delete.
807         * merge.cc (Object_merge_map::get_or_make_input_merge_map): Pass in
808         and use a Output_section_data instead of a Merge_map.
809         (Object_merge_map::add_mapping): Ditto.
810         (Object_merge_map::get_output_offset): Remove the merge_map argument.
811         (Object_merge_map::is_merge_section_for): Pass in and use a
812         Output_section_data instead of a Merge_map.
813         (Merge_map): Delete.
814         (Output_merge_base::do_output_offset): Use merge_output_offset instead
815         of merge_map_.get_output_offset.
816         (Output_merge_base::do_is_merge_section_for): Delete.
817         (Output_merge_data::do_add_input_section): Use
818         object->add_merge_mapping instead of add_mapping.
819         (Output_merge_string<Char_type>::finalize_merged_data): Ditto.
820         * merge.h (Merge_map): Delete forward declaration.
821         (Object_merge_map::add_mapping): Pass in and use a Output_section_data
822         instead of a Merge_map.
823         (Object_merge_map::get_output_offset): Remove the merge_map argument.
824         (Object_merge_map::is_merge_section_for): Pass in and use a
825         Output_section_data instead of a Merge_map.
826         (Input_merge_map::Object_merge_map::merge_map): Replace with
827         output_data.
828         (Object_merge_map::get_or_make_input_merge_map): Pass in and use a
829         Output_section_data instead of a Merge_map.
830         (Merge_map): Delete.
831         (Output_merge_base::Output_merge_base): Don't initialize merge_map_.
832         (Output_merge_base::do_is_merge_section_for): Delete.
833         (Output_merge_base::add_mapping): Delete.
834         (Output_merge_base::merge_map_): Delete.
835         * object.cc (Relobj::initialize_input_to_output_map): New.
836         (Relobj::initialize_input_to_output_map): New.
837         (Relobj::merge_output_offset): New.
838         (Relobj::is_merge_section_for): New.
839         (Relobj::initialize_input_to_output_map): Instantiate for 32 and 64
840         bits.
841         * object.h (Relobj::merge_map): Delete.
842         (initialize_input_to_output_map): New.
843         (set_merge_map): Delete.
844         (add_merge_mapping): New.
845         (merge_output_offset): New.
846         (is_merge_section_for): New.
847         * output.cc (Output_section::Input_section::is_merge_section_for):
848         Use object->is_merge_section_for.
849         * output.h (Output_section_data::is_merge_section_for): Delete.
850         (Output_section_data::do_is_merge_section_for): Delete.
851         * reloc.cc (Merged_symbol_value<size>::initialize_input_to_output_map):
852         Use object->initialize_input_to_output_map.
853         (Merged_symbol_value<size>::value_from_output_section): Use
854         object->merge_output_offset.
855
856 2015-03-02  Peter Collingbourne  <pcc@google.com>
857             Cary Coutant  <ccoutant@google.com>
858
859         * output.cc (Output_section::add_merge_input_section): Do not
860         attempt to merge sections with an entsize of 0.
861
862 2015-03-02  Khem Raj  <raj.khem@gmail.com>
863
864         * attributes.h (class Output_attributes_section_data ): Add
865         do_print_to_mapfile function.
866
867 2015-02-24  Alan Modra  <amodra@gmail.com>
868
869         PR 18010
870         * powerpc.cc (Powerpc_relocate_functions::addr16_ds): Always
871         complain if value is not a multiple of four.
872         (Target_powerpc::Relocate::relocate): Correct handling of
873         R_POWERPC_GOT_TPREL16 and R_POWERPC_GOT_TPREL16_LO for ppc64.
874
875 2015-02-21  H.J. Lu  <hongjiu.lu@intel.com>
876
877         * configure.ac (default_size): Set to 32 for x32.
878         * configure: Regenerated.
879
880 2015-02-18  Alan Modra  <amodra@gmail.com>
881
882         PR 17954
883         * powerpc.cc (Global_symbol_visitor_opd::operator()): Set default
884         visibility.
885
886 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
887
888         * gc.h (Garbage_collection::add_reference): Don't use find.
889
890 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
891
892         * object.cc (write_local_symbols): avoid std::vector copy.
893
894 2015-02-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
895
896         * merge.cc (get_output_offset): Use upper_bound instead of lower_bound.
897
898 2015-02-09  Mark Wielaard  <mjw@redhat.com>
899
900         * gdb-index.cc (Gdb_index_info_reader::visit_top_die): Recognize
901         DW_LANG_Fortran03 and DW_LANG_Fortran08.
902
903 2015-02-16  Cary Coutant  <ccoutant@google.com>
904
905         PR gold/13577
906         PR gold/16992
907         * layout.cc (Layout::finish_dynamic_section): Don't set DT_SYMBOLIC or
908         DF_SYMBOLIC if --dynamic-list option is used.
909         * options.cc (General_options::finalize): --dynamic-list is not
910         mutually exclusive with -Bsymbolic.
911         * symtab.h (Symbol::is_preemptible): Don't exclude dynamic symbols not
912         listed in --dynamic-list.
913         * testsuite/Makefile.am (dynamic_list_lib2.so): Add
914         -Bsymbolic-functions.
915         * testsuite/Makefile.in: Regenerate.
916
917 2015-02-16  Cary Coutant  <ccoutant@google.com>
918
919         PR gold/17971
920         * incremental.cc: Remove redundant include of "output.h".
921
922 2015-02-12  Jing Yu  <jingyu@google.com>
923
924         * aarch64-reloc.def (TLSLE_MOVW_TPREL_G2, TLSLE_MOVW_TPREL_G1,
925         TLSLE_MOVW_TPREL_G1_NC, TLSLE_MOVW_TPREL_G0, TLSLE_MOVW_TPREL_G0_NC,):
926         New relocation.
927         * aarch64.cc (Target_aarch64::Scan::local): Add cases for new
928         TLSLE_MOVW_* relocations.
929         (Target_aarch64::Scan::global): Likewise.
930         (Target_aarch64::Relocate::relocate): Likewise.
931         (Target_aarch64::Relocate::relocate_tls): Add cases and handlings
932         for new TLSLE_MOVW_* relocations.
933
934 2015-02-11  Will Newton  <will.newton@linaro.org>
935
936         PR gold/13321
937         * arm.cc (Target_arm::make_plt_section): Create an ARM
938         state mapping symbol at the start of the PLT.
939
940 2015-02-09  H.J. Lu  <hongjiu.lu@intel.com>
941
942         * testsuite/Makefile.am (two_file_shared_2_pic_1_test_DEPENDENCIES):
943         Replace two_file_shared_2.so with two_file_shared_1.so.
944         * testsuite/Makefile.in: Regenerated.
945
946 2015-02-09  Alan Modra  <amodra@gmail.com>
947
948         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add libweak_undef_2.a,
949         plugin_test_thin.a and defsym_test.
950         * testsuite/Makefile.in: Regenerate.
951
952 2015-02-04  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
953
954         * merge.cc (do_add_input_section): Combine loop epilogue into main loop
955         body.
956
957 2015-02-04  Peter Collingbourne  <pcc@google.com>
958
959         * plugin.cc (Pluginobj::get_symbol_resolution_info): Resolve
960         forwarding symbols when computing symbol resolution info for plugins.
961         * plugin.h (Plugin_manager::symtab): New method.
962         (Pluginobj::get_symbol_resolution_info): Add symtab parameter.
963
964 2015-02-03  Cary Coutant  <ccoutant@google.com>
965             Peter Collingbourne  <pcc@google.com>
966
967         PR gold/15660
968         * archive.cc (Thin_archive_object_unlocker): New class.
969         (Archive::include_member): Unlock external members of thin archives.
970         * testsuite/Makefile.am (plugin_test_1): Rename .syms files.
971         (plugin_test_2): Likewise.
972         (plugin_test_3): Likewise.
973         (plugin_test_4): Likewise.
974         (plugin_test_5): Likewise.
975         (plugin_test_6): Likewise.
976         (plugin_test_7): Likewise.
977         (plugin_test_8): Likewise.
978         (plugin_test_9): Likewise.
979         (plugin_test_10): Likewise.
980         (plugin_test_11): New test case.
981         * testsuite/Makefile.in: Regenerate.
982         * testsuite/plugin_test.c (claim_file_hook): Check for parallel .syms
983         file to decide whether to claim file.
984         (all_symbols_read_hook): Likewise.
985         * testsuite/plugin_test_1.sh: Adjust expected output.
986         * testsuite/plugin_test_2.sh: Likewise.
987         * testsuite/plugin_test_3.sh: Likewise.
988         * testsuite/plugin_test_6.sh: Likewise.
989         * testsuite/plugin_test_tls.sh: Likewise.
990         * testsuite/plugin_test_11.sh: New testcase.
991
992 2015-02-03  Cary Coutant  <ccoutant@google.com>
993
994         * descriptors.cc (Descriptors::open): Set artificially-low limit for
995         file descriptors when debugging enabled. Add debug output.
996         (Descriptors::release): Add debug output.
997         (Descriptors::close_some_descriptor): Likewise.
998         (Descriptors::close_all): Likewise.
999         * fileread.cc (File_read::lock): Likewise.
1000         (File_read::unlock): Likewise.
1001
1002 2015-02-02  Cary Coutant  <ccoutant@google.com>
1003
1004         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for
1005         executable output file.
1006
1007 2015-01-22  Han Shen  <shenhan@google.com>
1008
1009         * arm.cc (Target_arm::Target_arm): Add initialization for new members.
1010         (Target_arm::do_plt_address_for_global): New method.
1011         (Target_arm::do_plt_address_for_local): New method.
1012         (Target_arm::rel_irelative_section): New method.
1013         (Target_arm::make_data_plt): Add more parameters for plt ctor.
1014         (Target_arm::do_make_data_plt): Add more parameters for plt ctor.
1015         (Target_arm::Scan::symbol_needs_plt_entry): Add ifunc support.
1016         (Target_arm::Scan::reloc_needs_plt_for_ifunc): Add ifunc support.
1017         (Target_arm::Scan::check_non_pic): Add ifunc support.
1018         (Target_arm::Scan::local): Add ifunc support.
1019         (Target_arm::Scan::global): Add ifunc support.
1020         (Target_arm::make_plt_section): New method.
1021         (Target_arm::make_plt_entry): Change to call to make_plt_section.
1022         (Target_arm::make_local_ifunc_plt_entry): New method.
1023         (Target_arm::got_irelative_): New member.
1024         (Target_arm::rel_irelative_): New member.
1025         (Target_arm::got_section): Add creation for got_irelative_.
1026         (Target_arm::rel_dyn_section): Add creation for rel_irelative_.
1027         (Target_arm::Relocate::relocate): Properly set local ifunc address.
1028         (Target_arm::do_dynsym_value): Properly set global ifunc address.
1029         (Target_arm::scan_reloc_for_stub): Properly set global ifunc address.
1030         (Output_data_plt_arm::IRelative_data): New type.
1031         (Output_data_plt_arm::Output_data_plt_arm): Add more parameters.
1032         (Output_data_plt_arm::add_entry): Add more parameters.
1033         (Output_data_plt_arm::add_relocation): New method.
1034         (Output_data_plt_arm::add_local_ifunc_entry): New method.
1035         (Output_data_plt_arm::rel_irelative): New method.
1036         (Output_data_plt_arm::entry_count): Modified.
1037         (Output_data_plt_arm::address_for_global): New method.
1038         (Output_data_plt_arm::address_for_local): New method.
1039 gold/
1040         (Output_data_plt_arm::set_final_data_size): Add irelative_count_.
1041         (Output_data_plt_arm::insert_irelative_data): New method.
1042         (Output_data_plt_arm::irelative_rel_): New member.
1043         (Output_data_plt_arm::got_): New member.
1044         (Output_data_plt_arm::got_irelative_): New member.
1045         (Output_data_plt_arm::irelative_count_): New member.
1046         (Output_data_plt_arm::IRelative_data_vec): New typedef.
1047         (Output_data_plt_arm::irelative_data_vec_): New member.
1048         (Output_data_plt_arm::do_write): Write out irelative entries.
1049         (Output_data_plt_arm_standard::Output_data_plt_arm_standard): Add
1050         more parameters to ctor.
1051         (Output_data_plt_arm_nacl::Output_data_plt_arm_nacl): Add
1052         more parameters to ctor.
1053         * output.h (Output_data_reloc::add_local_relative): New method.
1054         * aarch64.cc (Output_data_plt_aarch64): Fixed typo in comment.
1055
1056 2015-01-29  Alan Modra  <amodra@gmail.com>
1057
1058         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct GOT_TLSLD
1059         and GOT_TLSGD to LE optimization.
1060
1061 2015-01-28  Cary Coutant  <ccoutant@google.com>
1062
1063         * x86_64.cc (Target_x86_64::Scan::global): Allow IE-to-LE optimization
1064         for undef TLS symbols.
1065         (Target_x86_64::Relocate::relocate_tls): Likewise.
1066         (Target_x86_64::Relocate::tls_ie_to_le): Likewise.
1067
1068 2015-01-25  Cary Coutant  <ccoutant@google.com>
1069
1070         * output.cc (Output_segment::set_section_addresses): Fix calculation
1071         of size of relro segment.
1072
1073 2015-01-22  Alan Modra  <amodra@gmail.com>
1074
1075         * powerpc.cc (Target_powerpc::Scan::local <got relocs>): Correct
1076         condition for need of ifunc plt entry.
1077         (Target_powerpc::Scan::global <got relocs>): Likewise.
1078
1079 2015-01-14  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1080
1081         * mips.cc (reloc_high): Add r_sym.
1082         (Mips_relocate_functions::relhi16): Add r_sym parameter. Pass r_sym to
1083         reloc_high constructor.
1084         (Mips_relocate_functions::relgot16_local): Likewise.
1085         (Mips_relocate_functions::rello16): Add r_sym parameter. Use r_sym and
1086         r_type to decide whether LO16 matches HI16.
1087         (Target_mips::Relocate::relocate): Pass r_sym to calls to relhi16,
1088         rello16 and relgot16_local.
1089
1090 2015-01-09  Cary Coutant  <ccoutant@google.com>
1091
1092         * layout.cc (Layout::set_segment_offsets): Don't align start of segment
1093         unless alignment is larger than page size.
1094
1095 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1096             Cary Coutant  <ccoutant@google.com>
1097
1098         PR gold/17729
1099         * configure.ac (DEFAULT_TARGET_X86_64): Don't set for x32.
1100         (DEFAULT_TARGET_X32): Set for x32.
1101         * x86_64.cc (cmp_insn_32): New.
1102         (lea_r10_insn_32): Likewise.
1103         (lea_r11_insn_32): Likewise.
1104         (cmp_insn_64): Likewise.
1105         (lea_r10_insn_64): Likewise.
1106         (lea_r11_insn_64): Likewise.
1107         (Target_x86_64<size>::do_calls_non_split): Handle x32.
1108         * testsuite/Makefile.am (check_SCRIPTS): Add split_x32.sh.
1109         (check_DATA): Add split_x32 files.
1110         (split_x32_[1234n].o): New targets.
1111         (split_x32_[124]): New targets.
1112         (split_x32_[1234r].stdout): New targets.
1113         * testsuite/split_x32.sh: New file.
1114         * testsuite/split_x32_1.s: Likewise.
1115         * testsuite/split_x32_2.s: Likewise.
1116         * testsuite/split_x32_3.s: Likewise.
1117         * testsuite/split_x32_4.s: Likewise.
1118         * testsuite/split_x32_n.s: Likewise.
1119         * configure: Regenerated.
1120         * testsuite/Makefile.in: Likewise.
1121
1122 2015-01-06  H.J. Lu  <hongjiu.lu@intel.com>
1123
1124         PR gold/17809
1125         * x86_64.cc (Target_x86_64<size>::Relocate::tls_ie_to_le): Handle
1126         x32.
1127
1128 2015-01-02  Alan Modra  <amodra@gmail.com>
1129
1130         * version.cc (print_version): Just print current year.
1131         * dwp.cc (print_version): Likewise.
1132
1133 2015-01-01  Alan Modra  <amodra@gmail.com>
1134
1135         Update year range in copyright notice of all files.
1136
1137 2014-12-25  Alan Modra  <amodra@gmail.com>
1138
1139         * arm.cc (Target_arm::do_adjust_elf_header): Provide namespace on
1140         new enums.
1141         (Target_arm::merge_object_attributes, ): Likewise.
1142
1143 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
1144
1145         * arm.cc (Target_arm::do_adjust_elf_header): Set e_flags in ELF header
1146         as hard float only when Tag_ABI_VFP_args is 1, using new enum value
1147         AEABI_VFP_args_vfp to check that.
1148         (Target_arm::merge_object_attributes): Handle new Tag_ABI_VFP_args
1149         value and replace hardcoded values by enum values.
1150
1151 2014-12-22  Cary Coutant  <ccoutant@google.com>
1152
1153         * powerpc.cc (Target_powerpc::relocate): Fix overflow check.
1154
1155 2014-12-20  H.J. Lu  <hongjiu.lu@intel.com>
1156
1157         PR gold/14608
1158         * testsuite/debug_msg.cc (SometimesInlineFunction): Changed
1159         to "return i * i * 3;".
1160
1161 2014-12-16  Cary Coutant  <ccoutant@google.com>
1162
1163         * mapfile.cc (Mapfile::print_input_section): Print uncompressed sizes.
1164         (Mapfile::print_output_data): Use current_data_size() to avoid
1165         assert for sections requiring postprocessing; if address is not valid,
1166         print 0.
1167         (Mapfile::print_output_section): Use current_data_size(); print note
1168         that addresses and sizes are before compression.
1169
1170 2014-12-14  H.J. Lu  <hongjiu.lu@intel.com>
1171
1172         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1173         Cast current_group_size to unsigned long when reporting error.
1174
1175 2014-12-10  Jing Yu  <jingyu@google.com>
1176
1177         * aarch64.cc (Target_aarch64): Add new variable stub_group_size_.
1178         (AArch64_relocate_functions::maybe_apply_stub): Add new parameter.
1179         Update error message.
1180         (Target_aarch64::do_relax): Use absolute value of option
1181         stub_group_size. Replace local variable with class member
1182         stub_group_size_.
1183
1184 2014-12-04  Alan Modra  <amodra@gmail.com>
1185
1186         * powerpc.cc (Target_powerpc::Branch_info::make_stub): Ignore
1187         addend of PLTREL24 reloc when not generating a plt stub.  Make
1188         max_branch_offset an "Address".
1189         (Stub_table::can_reach_stub): Make max_branch_offset an "Address".
1190         (Target_powerpc::Relocate::relocate): Likewise.
1191
1192 2014-12-04  Alan Modra  <amodra@gmail.com>
1193
1194         PR 17670
1195         * symtab.cc (Symbol::set_undefined): Remove assertion.
1196         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
1197         on symbols defined in discarded sections, instead return false.
1198         Rearrange params, update all callers.
1199         (Target_powerpc::Branch_info::make_stub): Don't make stubs for
1200         branches to syms in discarded sections.
1201         (Global_symbol_visitor_opd::operator()): Set discarded opd syms
1202         undefined and flag as discarded.
1203         (Target_powerpc::Relocate::relocate): Localize variable.
1204
1205 2014-12-03  H.J. Lu  <hongjiu.lu@intel.com>
1206
1207         PR gold/17675
1208         * testsuite/Makefile.am (pie_copyrelocs_test_CXXFLAGS): New.
1209         * testsuite/Makefile.in: Regenerated.
1210
1211 2014-12-03  Alan Modra  <amodra@gmail.com>
1212
1213         PR 17566
1214         * powerpc.cc (Target_powerpc::Scan::local): Use add_local_section
1215         when adding dynamic relocations against section symbols.
1216
1217 2014-12-01  Dimitry Ivanov <dimitry@google.com>
1218
1219         * layout.cc (Layout::finish_dynamic_section): When '-z global'
1220         is specified set DF_1_GLOBAL in DT_FLAGS_1 flags.
1221         * options.h (General_options): New -z option (global).
1222
1223 2014-12-01  Cary Coutant  <ccoutant@google.com>
1224
1225         PR gold/17578
1226         * layout.cc (Layout::layout_gnu_stack): Don't warn when -z execstack
1227         is given.
1228         (Layout::create_executable_stack_info): Warn when -z noexecstack is
1229         given but some inputs require executable stack.
1230
1231 2014-11-26  Cary Coutant  <ccoutant@google.com>
1232
1233         * layout.cc (gdb_sections): Keep .debug_gdb_scripts and
1234         .debug_str_offsets; strip .debug_gnu_pubnames and
1235         .debug_gnu_pubtypes.
1236         (lines_only_debug_sections): Strip all four new sections.
1237
1238 2014-11-26  Jing Yu  <jingyu@google.com>
1239
1240         * aarch64.cc (Relocate::tls_desc_gd_to_ie): Set ldr target
1241         register to be x0 when to relax TLSDESC_LD64_LO12.
1242
1243 2014-11-26  Alan Modra  <amodra@gmail.com>
1244
1245         * powerpc.cc (struct Stub_table_owner): New.
1246         (Powerpc_relobj): Rename stub_table_ to stub_table_index_, an
1247         unsigned int vector.  Update all references.
1248         (powerpc_relobj::set_stub_table): Take an unsigned int param
1249         rather than a Stub_table.  Update callers.
1250         (Powerpc_relobj::clear_stub_table): New function.
1251         (Target_powerpc): Add relax_failed_, relax_fail_count_ and
1252         stub_group_size_ vars.
1253         (Target_powerpc::new_stub_table): Delete.
1254         (max_branch_delta): New function, extracted from..
1255         (Target_powerpc::Relocate::relocate): ..here..
1256         (Target_powerpc::Branch_info::make_stub): ..and here.  Return
1257         status on whether stub created successfully.
1258         (Stub_control::Stub_control): Add "no_size_errors" param.  Move
1259         default sizing to..
1260         (Target_powerpc::do_relax): ..here.  Init stub_group_size_ and
1261         reduce on relax failure.
1262         (Target_powerpc::group_sections): Add "no_size_errors" param.
1263         Use stub_group_size_.  Set up group info in a temp vector,
1264         before building Stub_table vector.  Account for input sections
1265         possibly already converted to relaxed sections.
1266         (Stub_table::init): Delete.  Merge into..
1267         (Stub_table::Stub_table): ..here.
1268         (Stub_table::can_reach_stub): New function.
1269         (Stub_table::add_plt_call_entry): Add "from" parameter and
1270         return true iff stub could be reached.
1271         (Stub_table::add_long_branch_entry): Similarly.  Add "r_type"
1272         param too.
1273         (Stub_table::clear_stubs): Add "all" param.
1274
1275 2014-11-26  Alan Modra  <amodra@gmail.com>
1276
1277         * powerpc.cc (Stub_control::set_output_and_owner): New function.
1278         (Target_powerpc::group_sections): Use it.
1279
1280 2014-11-25  Cary Coutant  <ccoutant@google.com>
1281
1282         * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol.
1283         (Binary_to_elf::write_symbol): Add st_size parameter.
1284         * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
1285
1286 2014-11-25  Cary Coutant  <ccoutant@google.com>
1287
1288         PR gold/17639
1289         * object.cc (Sized_relobj_file): Initialize is_deferred_layout_.
1290         (Sized_relobj_file::do_layout): Handle deferred sections properly
1291         during GC pass 1. Don't add reloc sections to deferred list twice.
1292         * object.h (Sized_relobj_file::is_deferred_layout): New function.
1293         (Sized_relobj_file::is_deferred_layout_): New data member.
1294
1295 2014-11-21  H.J. Lu  <hongjiu.lu@intel.com>
1296
1297         PR gold/17619
1298         * x86_64.cc (Output_data_plt_x86_64_standard<size>::do_fill_plt_entry):
1299         Check PC-relative offset overflow in PLT entry.
1300
1301 2014-11-21  Alan Modra  <amodra@gmail.com>
1302
1303         * powerpc.cc (Target_powerpc::Relocate::relocate): Correct test
1304         for undefined weaks.
1305
1306 2014-11-20  Alan Modra  <amodra@gmail.com>
1307
1308         * powerpc.cc (Stub_control::Stub_control): Init stub14_group_size_
1309         from --stub-group-size parameter divided by 1024.
1310         (Powerpc_relocate_functions::rela, rela_ua): Add fieldsize
1311         template parameter.  Update all uses.
1312         (Target_powerpc::Relocate::relocate): Rename has_plt_value to
1313         has_stub_value.  Set for long branches.  Don't report overflow for
1314         branch to undefined weak symbols.  Print info message on
1315         overflowing branch to stub.
1316
1317 2014-11-20  Alan Modra  <amodra@gmail.com>
1318
1319         * powerpc.cc (Target_powerpc::do_relax): Add __go_go to thread_starters.
1320
1321 2014-11-13  H.J. Lu  <hongjiu.lu@intel.com>
1322
1323         * x86_64.cc (Target_x86_64<size>::Scan::global): Don't make PLT
1324         entry for R_X86_64_GOTPLT64.
1325         (Target_x86_64<size>::Relocate::relocate): Update comments for
1326         R_X86_64_GOTPLT64.
1327
1328 2014-11-06  Evgeniy Dushistov  <dushistov@mail.ru>
1329
1330         * plugin.cc: use lock to searialize calls of Plugin_manager::claim_file
1331         * plugin.h: add lock definition
1332
1333 2014-10-29  Han Shen  <shenhan@google.com>
1334             Jing Yu   <jingyu@google.com>
1335
1336         * aarch64-reloc.def: Add LD_PREL_LO12, ADR_PREL_LO21,
1337         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1338         TLSLD_MOVW_DTPREL_G0_NC. Change property of TLS relocations to
1339         Symbol::TLS_REF.
1340         * aarch64.cc (Target_aarch64::do_can_check_for_function_pointers): New
1341         method.
1342         (Target_aarch64::reloc_needs_plt_for_ifunc): New method.
1343         (Target_aarch64::tls_ld_to_le): New method.
1344         (Target_aarch64::aarch64_info): Enable can_icf_inline_merge_sections
1345         for 64bit targets.
1346         (Output_data_plt_aarch64::irelative_rel_): New data member.
1347         (Output_data_plt_aarch64::add_entry): Add irelative entries to plt.
1348         (Output_data_plt_aarch64::add_local_ifunc_entry): New method.
1349         (Output_data_plt_aarch64::add_relocation): New method.
1350         (Output_data_plt_aarch64::do_write): Add gold_assert on got_irelative
1351         offset. Add got_irelative size to got size.
1352         (AArch64_relocate_functions): Typedef AArch64_valtype. Replace long
1353         type string with the new typename.
1354         (AArch64_relocate_functions::update_adr): Replace parameter x with
1355         immed.
1356         (AArch64_relocate_functions::update_movnz): Correct wrong val mask.
1357         (AArch64_relocate_functions::reloc_common): New method.
1358         (AArch64_relocate_funcsions::rela_general): Extract common part out
1359         into reloc_common method.
1360         (AArch64_relocate_functions::rela_general): Likewise.
1361         (AArch64_relocate_functions::pcrela_general): Likewise.
1362         (AArch64_relocate_functions::adr): New method.
1363         (AArch64_relocate_functions::adrp): Calculate immed before calling
1364         update_adr.
1365         (AArch64_relocate_functions::adrp): Likewise.
1366         (AArch64_relocate_functions::movnz): Cast x to SignedW type when
1367         comparing x to 0. Calculate immed from ~x when x < 0.
1368         (Target_aarch64::optimize_tls_reloc): Add new cases for
1369         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1370         TLSLD_MOVW_DTPREL_G0_NC.
1371         (Target_aarch64::possible_function_pointer_reloc): Implement this
1372         method.
1373         (Target_aarch64::Scan::local_reloc_may_be_function_pointer): Update
1374         comment.
1375         (Target_aarch64::Scan::local): Add codes to handle STT_GNU_IFUNC
1376         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1377         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1378         (Target_aarch64::Scan::global): Add codes to handle STT_GNU_IFUNC
1379         symbol. Add cases for TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1380         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1381         (Target_aarch64::make_plt_entry): Call add_entry with two more
1382         parameters.
1383         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1384         (Target_aarch64::Relocate::relocate): Add cases for LD_PREL_LO19,
1385         ADR_PREL_LO21, TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC,
1386         TLSLD_MOVW_DTPREL_G1, TLSLD_MOVW_DTPREL_G0_NC.
1387         (Target_aarch64::Relocate::relocate_tls): Add cases for
1388         TLSLD_ADR_PAGE21, TLSLD_ADD_LO12_NC, TLSLD_MOVW_DTPREL_G1,
1389         TLSLD_MOVW_DTPREL_G0_NC.
1390         * testsuite/icf_safe_so_test.cc: Correct test comment.
1391         * testsuite/icf_safe_test.sh: Add AArch64 arch.
1392
1393 2014-10-22  Alan Modra  <amodra@gmail.com>
1394
1395         * powerpc.cc (do_relax): Add gcc-4.9 libgomp functions to
1396         thread_starter.
1397
1398 2014-10-18  Andreas Schwab  <schwab@linux-m68k.org>
1399
1400         * configure.tgt (targ_extra_obj) [aarch64*-*]: Define.
1401
1402 2014-10-17  Cary Coutant  <ccoutant@google.com>
1403
1404         * aarch64.cc (AArch64_relocate_functions::maybe_apply_stub):
1405         Add "typename" keyword.
1406
1407 2014-10-15  Han Shen  <shenhan@google.com>
1408             Jing Yu   <jingyu@google.com>
1409
1410         Patch for gold aarch64 backend to support relaxation.
1411         * aarch64-reloc.def: Change format.
1412         * aarch64.cc (class Reloc_stub): New class.
1413         (class Stub_table): New class.
1414         (class AArch64_relobj): New class.
1415         (class AArch64_input_section): New class.
1416         (class AArch64_output_section): New class.
1417         (Target_aarch64::new_stub_table): New method.
1418         (Target_aarch64::new_aarch64_input_section): New method.
1419         (Target_aarch64::find_aarch64_input_section): New method.
1420         (Target_aarch64::scan_section_for_stubs): New method.
1421         (Target_aarch64::scan_reloc_section_for_stubs): New method.
1422         (Target_aarch64::relocate_stub): New method.
1423         (Target_aarch64::current_target): New method.
1424         (Target_aarch64::do_make_elf_object): New method.
1425         (Target_aarch64::do_may_relax): New method.
1426         (Target_aarch64::do_relax): New method.
1427         (Target_aarch64::group_sections): New method.
1428         (Target_aarch64::scan_reloc_for_stub): New method.
1429         (Target_aarch64::do_make_output_section): New method.
1430         (Target_aarch64::stub_tables_): New data member.
1431         (Target_aarch64::aarch64_input_section_map_): New data member.
1432         (AArch64_relocate_functions::maybe_apply_stub): New method.
1433
1434 2014-09-30  Cary Coutant  <ccoutant@google.com>
1435
1436         PR gold/17432
1437         * resolve.cc (Symbol_table::resolve): Fix local shadowing error.
1438
1439 2014-09-30  Kito Cheng  <kito@0xlab.org>
1440
1441         PR gold/13597
1442         * layout.cc (Layout::create_dynamic_symtab): Build gnu-style
1443         hash table before sysv-style hash table.
1444
1445 2014-09-29  Sriraman Tallam  <tmsriram@google.com>
1446
1447         * options.h (--pic-executable): Add negative to alias to -no-pie.
1448
1449 2014-09-26  Cary Coutant  <ccoutant@google.com>
1450
1451         PR gold/16773
1452         * object.cc (Sized_relobj_file): Compute value of section symbols
1453         for TLS sections the same as TLS symbols.
1454
1455 2014-09-25  Cary Coutant  <ccoutant@google.com>
1456
1457         PR gold/17432
1458         * resolve.cc (Symbol_table::resolve): Override common placeholder
1459         symbols, but adjust sizes.
1460         * symtab.cc (Symbol_table::add_from_object): Don't add placeholder
1461         symbols to common lists.
1462
1463 2014-09-24  Alan Modra  <amodra@gmail.com>
1464
1465         * po/POTFILES.in: Regenerate.
1466
1467 2014-09-23  Taiju Tsuiki  <tzik@google.com>
1468             Cary Coutant  <ccoutant@google.com>
1469
1470         PR gold/14860
1471         * gold.cc (queue_final_tasks): Add Write_sections_task as a blocker
1472         on input_sections_blocker.
1473         * layout.cc (Write_sections_task::locks): Unblock
1474         input_sections_blocker_.
1475         * layout.h (Write_sections_task::Write_sections_task): Add
1476         input_sections_blocker.
1477         * testsuite/Makefile.am (exception_x86_64_bnd_test): Add gcctestdir/ld
1478         to DEPENDENCIES.
1479         * testsuite/Makefile.in: Regenerate.
1480
1481 2014-09-18  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1482
1483         * testsuite/Makefile.am (plugin_test_10): New test.
1484         * testsuite/Makefile.in: Regenerate
1485         * testsuite/plugin_common_test_2.c (c1): Align to 8.
1486         * testsuite/plugin_test_10.sh: New file.
1487
1488 2014-09-17  Rafael Ávila de Espíndola <rafael.espindola@gmail.com>
1489
1490         * plugin.cc (Sized_pluginobj::do_add_symbols): Ignore isym->size.
1491         * resolve.cc (Symbol_table::resolve): Don't override common symbols
1492         during the replacement phase.
1493
1494 2014-09-17  Han Shen  <shenhan@google.com>
1495             Jing Yu  <jingyu@google.com>
1496
1497         * aarch64-reloc.def: Add TLSGD_ADR_PAGE21, TLSGD_ADD_LO12_NC,
1498         TLSDESC_ADR_PAGE21, TLSDESC_LD64_LO12, TLSDESC_ADD_LO12, TLSDESC_CALL.
1499         * aarch64.cc (Target_aarch64): Add data members
1500         got_irelative_, got_tlsdesc_, rela_irelative_, got_mod_index_offset_,
1501         tlsdesc_reloc_info_, tls_base_symbol_defined_. Initialize them in
1502         constructor.
1503         (Target_aarch64::do_reloc_symbol_index): New method.
1504         (Target_aarch64::do_reloc_addend): New method.
1505         (Target_aarch64::add_tlsdesc_info): New method.
1506         (Target_aarch64::do_dynsym_value): New method.
1507         (Target_aarch64::do_make_data_plt): Add new parameters: got,
1508         got_irelative. Pass them to Output_data_plt_aarch64_standard.
1509         (Target_aarch64::make_data_plt): Add new parameters: got,
1510         got_irelative. Pass them to do_make_data_plt.
1511         (Target_aarch64::Relocate): Add skip_call_tls_get_addr_ variable.
1512         (Target_aarch64::Relocate:tls_gd_to_le): New method.
1513         (Target_aarch64::Relocate:tls_ie_to_le): New method.
1514         (Target_aarch64::Relocate:tls_desc_gd_to_le): New method.
1515         (Target_aarch64::Relocate:tls_desc_gd_to_ie): New method.
1516         (Target_aarch64::got_tlsdesc_section): New method.
1517         (Target_aarch64::make_local_ifunc_plt_entry): New method.
1518         (Target_aarch64::define_tls_base_symbol): New method.
1519         (Target_aarch64::reserve_tlsdesc_entries): New method.
1520         (Target_aarch64::got_mod_index_entry): New method.
1521         (Target_aarch64::rela_tlsdesc_section): New method.
1522         (Target_aarch64::rela_irelative_section): New method.
1523         (Target_aarch64::Tlsdesc_info): New struct.
1524         (Target_aarch64::got_section): Create .got.plt space for IRELATIVE
1525         relocations and tlsdesc relocations.
1526         (Target_aarch64::optimize_tls_reloc): Implement method.
1527         (Output_data_plt_aarch64): Add member variables: tlsdesc_rel_, got_,
1528         got_irelative_, irelative_count_, tlsdesc_got_offset_. Initialize them
1529         in constructor.
1530         (Output_data_plt_aarch64::reserve_tlsdesc_entry): New method.
1531         (Output_data_plt_aarch64::has_tlsdesc_entry): New method.
1532         (Output_data_plt_aarch64::get_tlsdesc_got_offset): New method.
1533         (Output_data_plt_aarch64::get_tlsdesc_plt_offset): New method.
1534         (Output_data_plt_aarch64::rela_tlsdesc): New method.
1535         (Output_data_plt_aarch64::rela_irelative): New method.
1536         (Output_data_plt_aarch64::entry_count): Count IRELATIVE relocations.
1537         (Output_data_plt_aarch64::first_plt_entry_offset): Add const attribute.
1538         (Output_data_plt_aarch64::get_plt_tlsdesc_entry_size): New method.
1539         (Output_data_plt_aarch64::fill_tlsdesc_entry): New method.
1540         (Output_data_plt_aarch64::do_get_plt_tlsdesc_entry_size): New method.
1541         (Output_data_plt_aarch64::do_fill_tlsdesc_entry): New method.
1542         (Output_data_plt_aarch64_standard): New member variables:
1543         plt_tlsdesc_entry_size, tlsdesc_plt_entry.
1544         (Output_data_plt_aarch64_standard::Output_data_plt_aarch64_standard):
1545         New parameter: got, got_irelative.
1546         (Output_data_plt_aarch64_standard::do_get_plt_entry_size): New method.
1547         (Output_data_plt_aarch64_standard::do_fill_tlsdesc_entry): New method.
1548         (Output_data_plt_aarch64::do_write): Replace got_address with
1549         gotplt_address. Add irelative_count_ to count. Write tlsdesc entry.
1550         (AArch64_relocate_functions::update_movnz): New method.
1551         (AArch64_relocate_functions): Correct format.
1552         (AArch64_relocate_functions::movnz): New method.
1553         (Target_aarch64::Scan::local): Correct format. Move r_sym, got to
1554         before the switch. Add new cases to switch.
1555         Check ie_to_le relaxation on tlsie relocations. Add code handling
1556         tlsgd tlsdesc cases.
1557         (Target_aarch64::Scan::global): Move arp to front. Do copy_reloc when
1558         needed. Add new cases to switch. Insert dynamic RELATIVE relocation
1559         when needed. Add code handling tlsgd, tlsie, tlsdesc cases.
1560         Call reloc_name_in_error_message to print unsupported reloc.
1561         (Target_aarch64::make_plt_section): Pass got_ and got_irelative_ to
1562         make_data_plt.
1563         (Target_aarch64::do_finalize_sections): Emit relocs to save COPY
1564         relocs. Fill in some more dynamic tags.
1565         (Target_aarch64::Relocate::relocate): Handle tlsgd, tlsdesc relocs.
1566         Skip call tls_get_addr when tlsgd is relaxed.
1567         (Target_aarch64::Relocate::relocate_tls): Correct format. Add code
1568         handling tlsgd, tlsdesc relocs, and tls gd->le, ie->le, tlsdesc->le,
1569         tlsdesc->ie relaxation.
1570
1571 2014-09-03  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1572
1573         * mips.cc (Target_mips_nacl): New class.
1574         (Target_selector_mips_nacl): New class.
1575         (target_selector_mips32): Rename from target_selector_mips32be and use
1576         Target_selector_mips_nacl instead of Target_selector_mips.
1577         (target_selector_mips32el): Rename from target_selector_mips32 and use
1578         Target_selector_mips_nacl instead of Target_selector_mips.
1579         (target_selector_mips64): Rename from target_selector_mips64be and use
1580         Target_selector_mips_nacl instead of Target_selector_mips.
1581         (target_selector_mips64el): Rename from target_selector_mips64 and use
1582         Target_selector_mips_nacl instead of Target_selector_mips.
1583         (Target_mips::mips_info): Add const attribute.
1584
1585 2014-09-02  Cary Coutant  <ccoutant@google.com>
1586
1587         * dwp.cc (Sized_relobj_dwo::do_section_name): Add const attribute.
1588         * dynobj.h (Sized_dynobj::do_section_name): Likewise.
1589         * incremental.cc (Sized_relobj_incr::do_section_name): Likewise.
1590         (Sized_incr_dynobj::do_section_name): Likewise.
1591         * incremental.h (Sized_relobj_incr::do_section_name): Likewise.
1592         (Sized_incr_dynobj::do_section_name): Likewise.
1593         * object.h (Object::section_name): Likewise.
1594         (Object::do_section_name): Likewise.
1595         (Sized_relobj_file::do_section_name): Likewise.
1596         * plugin.cc (Sized_pluginobj::do_section_name): Likewise.
1597         * plugin.h (Sized_pluginobj::do_section_name): Likewise.
1598
1599 2014-09-02  Cary Coutant  <ccoutant@google.com>
1600
1601         PR gold/17005
1602         * ehframe.cc (Fde::write): Add output_offset parameter.
1603         (Cie::write): Likewise.
1604         (Eh_frame::set_final_data_size): Account for offset within output
1605         section.
1606         (Eh_frame::do_sized_write): Likewise.
1607         * ehframe.h (Fde::write): Add output_offset parameter.
1608         (Cie::write): Likewise.
1609         * output.cc (Output_section::Input_section_sort_entry): Remove
1610         section_has_name_; add output_section_name parameter. Use
1611         output section name for non-input sections.
1612         (Output_section::Input_section_sort_entry::section_has_name): Remove.
1613         (Output_section::Input_section_sort_entry::section_has_name_): Remove.
1614         (Output_section::Input_section_sort_compare): Remove logic for
1615         sections without names.
1616         (Output_section::Input_section_sort_init_fini_compare): Likewise.
1617         (Output_section::Input_section_sort_section_prefix_special_ordering_compare):
1618         Likewise.
1619         (Output_section::Input_section_sort_section_name_compare): Likewise.
1620
1621 2014-08-29 Han Shen <shenhan@google.com>
1622            Jing Yu <jingyu@google.com>
1623
1624         * aarch64-reloc-property.cc
1625         (AArch64_reloc_property_table::reloc_name_in_error_message): Fix bug in
1626         reference reloc property in the table.
1627         * aarch64-reloc.def: Add TLSLE reloc types and fix some errors in
1628         3 other entries.
1629         * aarch64.cc: (Output_data_got_aarch64::add_static_reloc):
1630         2 new overloaded methods.
1631         (Output_data_got_aarch64::do_write): Add code to write out
1632         static relocs.
1633         (class Output_data_got_aarch64::Static_reloc): New class to wrap
1634         static relocs.
1635         (Output_data_got_aarch64::static_relocs): New vector to
1636         hold static relocs.
1637         (Target_aarch64::TCB_SIZE): New const static memeber.
1638         (Target_aarch64::tcb_size): New method.
1639         (Target_aarch64::Relocate::relocate): Add code handling new reloc types.
1640         (Target_aarch64::Relocate::relocate_tls): New method.
1641         (Target_aarch64::Scan::local): Add code handling new reloc types.
1642         (Target_aarch64::Scan::global): Add code handling new reloc types.
1643
1644 2014-08-13  Sriraman Tallam  <tmsriram@google.com>
1645
1646         * options.h (-no-pie): Add option.
1647
1648 2014-08-08  Jing Yu  <jingyu@google.com>
1649             Han Shen  <shenhan@google.com>
1650
1651         * Makefile.am (HFILES): Add aarch64-reloc-property.h.
1652         (DEFFILES): add aarch64-reloc.def.
1653         (TARGETSOURCES): Add aarch64-reloc-property.cc.
1654         (ALL_TARGETOBJS): Add aarch64-reloc-property.$(OBJEXT).
1655         * Makefile.in: Regenerate.
1656         * aarch64-reloc-property.cc: New file.
1657         * aarch64-reloc-property.h: New file.
1658         * aarch64-reloc.def: New file.
1659         * aarch64.cc: Include aarch64-reloc-property.h. Replace spaces
1660         with tab to make the format consistent.
1661         (Output_data_got_aarch64::symbol_table_): New method.
1662         (Target_aarch64::do_plt_address_for_global): New method.
1663         (Target_aarch64::do_plt_address_for_local): New method.
1664         (Target_aarch64::do_select_as_default_target): New method.
1665         (Target_aarch64::do_make_data_plt): New method.
1666         (Target_aarch64::make_data_plt): New method.
1667         (Output_data_plt_aarch64::has_irelative_section): New method.
1668         (Output_data_plt_aarch64::address_for_global): New method.
1669         (Output_data_plt_aarch64::address_for_local): New method.
1670         (Output_data_plt_aarch64::irelative_rel_): New parameter.
1671         (Output_data_plt_aarch64::add_entry): Implement contents.
1672         (Output_data_plt_aarch64::set_final_data_size): Fix typo.
1673         (Output_data_plt_aarch64::do_write): Remove useless got_base. Set
1674         the got_pov entry to plt0.
1675         (Output_data_plt_aarch64_standard::do_fill_first_plt_entry):
1676         Implement contents.
1677         (Output_data_plt_aarch64_standard::do_fill_plt_entry): Implement.
1678         (AArch64_howto): New struct.
1679         (aarch64_howto[]): New static const array.
1680         (AArch64_relocate_functions): New class.
1681         (Target_aarch64::Scan::get_reference_flags): Remove method.
1682         (Target_aarch64::Scan::local): Implement to support a few relocations.
1683         (Target_aarch64::Scan::global): Implement to support a few relocations.
1684         (Target_aarch64::make_plt_section): Implement contents.
1685         (Target_aarch64::make_plt_entry): Implement contents.
1686         (Target_aarch64::do_finalize_sections): Implement contents.
1687         (Target_aarch64::Relocate::relocate): Implement a few relocations.
1688         (Target_aarch64::relocate_section): Implement contents.
1689
1690 2014-08-06  Alan Modra  <amodra@gmail.com>
1691
1692         * testsuite/defsym_test.sh: Allow ppc64le localentry annotation.
1693
1694 2014-08-06  Alan Modra  <amodra@gmail.com>
1695
1696         PR 13227
1697         * symtab.cc (Symbol_table::add_from_relobj): Warn on __gnu_lto_slim.
1698
1699 2014-07-21  Sriraman Tallam  <tmsriram@google.com>
1700
1701         * object.cc (Relobj::is_section_name_included): Add
1702         ".rodata.nptl_version" to not garbage collect this section.
1703
1704 2014-07-08  Cary Coutant  <ccoutant@google.com>
1705
1706         * expression.cc (struct Expression::Expression_eval_info): Add
1707         new fields type_pointer, vis_pointer, and nonvis_pointer.
1708         (Expression::eval_maybe_dot): Add type_pointer, vis_pointer, and
1709         nonvis_pointer parameters. Adjust all calls.
1710         (Symbol_expression::value): Update type, visibility, and nonvis bits
1711         in caller.
1712         * script.cc (Symbol_assignment::sized_finalize): Update type,
1713         visibility, and remaining st_other bits for new symbol.
1714         * script.h: (Expression::eval_maybe_dot): Add type_pointer,
1715         vis_pointer, and nonvis_pointer parameters.
1716         * symtab.h (Symbol::set_type): New method.
1717
1718         * testsuite/Makefile.am (defsym_test): New test.
1719         * testsuite/Makefile.in: Regenerate.
1720         * testsuite/defsym_test.c: New file.
1721         * testsuite/defsym_test.sh: New file.
1722
1723 2014-07-08  Cary Coutant  <ccoutant@google.com>
1724
1725         PR gold/15639
1726         * dynobj.h (Sized_dynobj::base_read_symbols): New method.
1727         * dynobj.cc (Sized_dynobj::do_read_symbols): Move body to...
1728         (Sized_dynobj::base_read_symbols): ...new method.
1729         * object.h (Sized_relobj_file::base_read_symbols): New method.
1730         * object.cc (Sized_relobj_file::do_read_symbols): Move body to...
1731         (Sized_relobj_file::base_read_symbols): ...new method.
1732         * arm.cc (Arm_relobj::do_read_symbols): Call base_read_symbols.
1733         * mips.cc: (Mips_relobj::do_read_symbols): Likewise.
1734         * powerpc.cc (Powerpc_dynobj::do_read_symbols): Likewise.
1735
1736 2014-07-04  Alan Modra  <amodra@gmail.com>
1737
1738         * po/POTFILES.in: Regenerate.
1739
1740 2014-07-02  Jing Yu  <jingyu@google.com>
1741
1742         * aarch64.cc: New file
1743         * Makefile.am (TARGETSOURCES): Add aarch64.cc
1744         (ALL_TARGETOBJS): Add aarch64.$(OBJEXT)
1745         * Makefile.in: Regenerate.
1746         * configure.tgt: Add entries for aarch64*.
1747         * configure.ac:  Likewise.
1748         * configure: Likewise.
1749
1750 2014-06-27  Alan Modra  <amodra@gmail.com>
1751
1752         * symtab.cc (Symbol::should_add_dynsym_entry): Don't make inline.
1753
1754 2014-06-24  Cary Coutant  <ccoutant@google.com>
1755
1756         * dwp.cc (Dwo_file::read): Allow files with no .debug_types
1757         sections.
1758         (Dwo_file::sized_read_unit_index): Likewise.
1759
1760 2014-06-23  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1761
1762         * mips.cc: New file.
1763         * Makefile.am (TARGETSOURCES): Add mips.cc
1764         (ALL_TARGETOBJS): Add mips.$(OBJEXT)
1765         * configure.tgt: Add entries for mips*.
1766         * configure.ac: Likewise.
1767         * Makefile.in: Regenerate.
1768         * configure: Likewise.
1769
1770 2014-06-09  Cary Coutant  <ccoutant@google.com>
1771
1772         * dwarf_reader.cc (Dwarf_pubnames_table::read_header): Check that
1773         unit_length is within section bounds.
1774
1775 2014-06-09  Cary Coutant  <ccoutant@google.com>
1776
1777         PR gold/16980
1778         * layout.cc (Layout::print_to_mapfile): Print unattached sections in
1779         map.
1780
1781 2014-06-07  Alan Modra  <amodra@gmail.com>
1782
1783         * powerpc.cc (relocate): Treat field of cmpli insn as a bitfield.
1784
1785 2014-06-06  Cary Coutant  <ccoutant@google.com>
1786
1787         * dwarf_reader.h (Dwarf_pubnames_table): Remove output_section_offset_.
1788         * dwarf_reader.cc (Dwarf_pubnames_table::read_section): Likewise.
1789         (Dwarf_pubnames_table::read_header): Likewise.
1790         * layout.cc (gdb_fast_lookup_sections): Add .debug_gnu_pubnames and
1791         .debug_gnu_pubtypes.
1792
1793 2014-06-05  Joel Brobecker  <brobecker@adacore.com>
1794
1795         * Makefile.am (CONFIG_STATUS_DEPENDENCIES): New.
1796         * Makefile.in, configure: Regenerate.
1797
1798 2014-06-03  Alan Modra  <amodra@gmail.com>
1799
1800         * powerpc.cc (addis_12_2): Define.
1801         (Stub_table::do_write): Support fusion on ELFv2 stubs.
1802
1803 2014-06-03  Alan Modra  <amodra@gmail.com>
1804
1805         * testsuite/plugin_test.c (parse_readelf_line): Skip non-visibility
1806         st_other output.
1807
1808 2014-06-02  Alan Modra  <amodra@gmail.com>
1809
1810         * powerpc.cc (Target_powerpc::local_reloc_may_be_function_pointer):
1811         Only ignore relocs on ELFv1.
1812         (Target_powerpc::global_reloc_may_be_function_pointer): Likewise.
1813
1814 2014-05-30  Cary Coutant  <ccoutant@google.com>
1815
1816         * testsuite/Makefile.am (ehdr_start_test_4): Fix typo in -B option.
1817         * testsuite/Makefile.in: Regenerate.
1818         * testsuite/ehdr_start_test_4.sh: Look for "U" instead of "w".
1819
1820 2014-05-27  H.J. Lu  <hongjiu.lu@intel.com>
1821
1822         PR gold/16945
1823         * x86_64.cc (Target_x86_64::Relocate::relocate): Use signed int
1824         for got_offset.  Properly get GOT address for R_X86_64_PLTOFF64.
1825
1826 2014-05-15  Alan Modra  <amodra@gmail.com>
1827
1828         * powerpc.cc (do_plt_fde_location): Handle zero length .glink.
1829         Compare FDE contents with DW_CFA_nop rather than 0.
1830
1831 2014-05-13  Sriraman Tallam  <tmsriram@google.com>
1832
1833         * symtab.h (may_need_copy_reloc): Remove check for position independent
1834         code.
1835         * x86_64.cc (Target_x86_64<size>::Scan::global): Add check for no
1836         position independence before pc absolute may_need_copy_reloc call.
1837         Add check for executable output befor pc relative may_need_copy_reloc
1838         call.
1839         * i386.cc: Ditto.
1840         * arm.cc: Ditto.
1841         * sparc.cc: Ditto.
1842         * tilegx.cc: Ditto.
1843         * powerpc.cc: Add check for no position independence before
1844         may_need_copy_reloc calls.
1845         * testsuite/pie_copyrelocs_test.cc: New file.
1846         * testsuite/pie_copyrelocs_shared_test.cc: New file.
1847         * Makefile.am (pie_copyrelocs_test): New test.
1848         * Makefile.in: Regenerate.
1849
1850 2014-05-08  Martin Liška  <mliska@suse.cz>
1851
1852         * output.cc (Sized_relobj_file::do_layout): Fix typo in info message.
1853
1854 2014-05-06  Cary Coutant  <ccoutant@google.com>
1855
1856         PR gold/16900
1857         * i386.cc (Output_data_got_plt_i386): New class.
1858         (Output_data_plt_i386::Output_data_plt_i386): Change type of got_plt
1859         parameter. Change all callers.
1860         (Output_data_plt_i386::layout_): Remove.
1861         (Output_data_plt_i386::got_plt_): Change type.
1862         (Target_i386::got_plt_): Change type. Change all references.
1863         (Target_i386::got_section): Create instance of new class.
1864         (Output_data_got_plt_i386::do_write): New function.
1865         * x86_64.cc (Output_data_got_plt_x86_64): New class.
1866         (Output_data_plt_x86_64::Output_data_plt_x86_64): Change type of got_plt
1867         parameter. Change all callers.
1868         (Output_data_plt_x86_64::layout_): Remove.
1869         (Output_data_plt_x86_64::got_plt_): Change type.
1870         (Target_x86_64::got_plt_): Change type. Change all references.
1871         (Target_x86_64::got_section): Create instance of new class.
1872         (Output_data_got_plt_x86_64::do_write): New function.
1873         (Output_data_plt_x86_64::do_write): Don't write reserved words in GOT.
1874         (Target_x86_64<size>::init_got_plt_for_update): Create instance of new
1875         class.
1876
1877 2014-05-05  Cary Coutant  <ccoutant@google.com>
1878
1879         * gdb-index.cc (Gdb_index_info_reader): Don't complain about language
1880         if we have pubnames/pubtypes.
1881
1882 2014-05-02  Cary Coutant  <ccoutant@google.com>
1883
1884         * defstd.cc (in_segment): Define __ehdr_start here...
1885         * layout.cc (Layout::finalize): ...Instead of here.  Set the
1886         output segment when known.
1887         * resolve.cc (Symbol::override_base_with_special): Remember
1888         the original binding.
1889         * symtab.cc (Symbol::set_output_segment): New function.
1890         (Symbol::set_undefined): New function.
1891         * symtab.h (Symbol::is_weak_undefined): Check original undef
1892         binding.
1893         (Symbol::is_strong_undefined): New function.
1894         (Symbol::set_output_segment): New function.
1895         (Symbol::set_undefined): New function.
1896         * target-reloc.h (is_strong_undefined): Remove.
1897         (issue_undefined_symbol_error): Call Symbol::is_weak_undefined.
1898         Check for hidden undefs.
1899         (relocate_section): Call Symbol::is_strong_undefined.
1900
1901         * testsuite/Makefile.am (ehdr_start_test_1)
1902         (ehdr_start_test_2, ehdr_start_test_3)
1903         (ehdr_start_test_4, ehdr_start_test_5): New test cases.
1904         * testsuite/Makefile.in: Regenerate.
1905         * testsuite/ehdr_start_def.cc: New source file.
1906         * testsuite/ehdr_start_test.cc: New source file.
1907         * testsuite/ehdr_start_test.t: New linker script.
1908         * testsuite/ehdr_start_test_4.sh: New shell script.
1909
1910 2014-04-23  Cary Coutant  <ccoutant@google.com>
1911
1912         PR gold/16870
1913         * x86_64.cc (Target_x86_64::Relocate::relocate): Add missing break.
1914
1915 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1916
1917         * layout.cc (Layout::include_section): Allow a target to decide
1918         whether to include a section.
1919         * target.h (Target::should_include_section): New function.
1920         (Target::do_should_include_section): New function.
1921
1922 2014-04-15  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1923
1924         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Remove and
1925         inline into ...
1926         (Copy_relocs::emit): ... here.
1927         * copy-relocs.h (Copy_reloc_entry): Change from class to struct.
1928         (Copy_reloc_entry::make_copy_reloc): Change from private to protected.
1929         (Copy_reloc_entry::entries_): Change from private to protected.
1930
1931 2014-04-02  Sriraman Tallam  <tmsriram@google.com>
1932
1933         * icf.cc (get_section_contents): Replace copies of reloc
1934         vectors with const references.
1935
1936 2014-04-02  Cary Coutant  <ccoutant@google.com>
1937
1938         * configure.ac (HAVE_PUBNAMES): Use C instead of C++.
1939         (HAVE_NO_USE_LINKER_PLUGIN): Check for -fno-use-linker-plugin.
1940         * configure: Regenerate.
1941         * testsuite/Makefile.am (OPT_NO_PLUGINS): New macro for
1942         -fno-use-linker-plugin.
1943         (LINK1, CXXLINK1): Add it to the link command.
1944         * testsuite/Makefile.in: Regenerate.
1945
1946 2014-03-12  Alan Modra  <amodra@gmail.com>
1947
1948         * Makefile.in: Regenerate.
1949
1950 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1951
1952         * symtab.h (Symbol::set_nonvis): New function.
1953
1954 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1955
1956         * symtab.cc (Sized_symbol<32>::init_output_data):
1957         Instantiate the template.
1958         (Sized_symbol<64>::init_output_data): Likewise.
1959
1960 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1961
1962         * symtab.cc (Symbol_table::sized_write_globals): Allow a target to
1963         adjust dynamic symbol value.
1964         * target.h (Target::adjust_dyn_symbol): New function.
1965         (Target::do_adjust_dyn_symbol): New function.
1966
1967 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1968
1969         * output.cc (Output_data_dynamic::Dynamic_entry::write):
1970         Get the value of DYNAMIC_CUSTOM dynamic entry.
1971         * output.h (Output_data_dynamic::add_custom): New function.
1972         (Dynamic_entry::Dynamic_entry): New constructor for DYNAMIC_CUSTOM
1973         dynamic entry.
1974         (enum Dynamic_entry::Classification): Add DYNAMIC_CUSTOM.
1975         * target.h (Target::dynamic_tag_custom_value): New function.
1976         (Target::do_dynamic_tag_custom_value): New function.
1977
1978 2014-03-10  Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
1979
1980         * symtab.cc (Symbol_table::set_dynsym_indexes): Allow a target to set
1981         dynsym indexes.
1982         * target.h (Target::has_custom_set_dynsym_indexes): New function.
1983         (Target::do_has_custom_set_dynsym_indexes): New function.
1984         (Target::set_dynsym_indexes): New function.
1985         (Target::do_set_dynsym_indexes): New function.
1986
1987 2014-03-07  Alan Modra  <amodra@gmail.com>
1988
1989         * powerpc.cc (Powerpc_relocate_functions::Overflow_check): Add
1990         CHECK_UNSIGNED, CHECK_LOW_INSN, CHECK_HIGH_INSN.
1991         (Powerpc_relocate_functions::has_overflow_unsigned): New function.
1992         (Powerpc_relocate_functions::has_overflow_bitfield,
1993         overflowed): Use the above.
1994         (Target_powerpc::Relocate::relocate): Correct overflow checking
1995         for a number of relocations.  Modify overflow test for 16-bit
1996         fields in instructions to signed/unsigned according to whether
1997         the field takes a signed or unsigned value.
1998
1999 2014-03-05  Alan Modra  <amodra@gmail.com>
2000
2001         Update copyright years.
2002
2003 2014-03-05  Alan Modra  <amodra@gmail.com>
2004
2005         * powerpc.cc (Target_powerpc::Scan::local, global): Support
2006         R_PPC64_ADDR64_LOCAL.
2007         (Target_powerpc::Relocate::relocate): Likewise.
2008
2009 2014-03-03  Alan Modra  <amodra@gmail.com>
2010
2011         * dwp.cc (print_version): Update copyright year to current.
2012
2013 2014-02-10  Alan Modra  <amodra@gmail.com>
2014
2015         * po/gold.pot: Regenerate.
2016
2017 2014-02-06  Cary Coutant  <ccoutant@google.com>
2018
2019         Fix problem where -u is ignored when a weak undef is seen.
2020
2021         * archive.cc (Library_base::should_include_member): Reorder
2022         code to check for -u option if a weak undef has already been seen.
2023         * testsuite/Makefile.am (weak_undef_test_2): New test case.
2024         * testsuite/Makefile.in: Regenerate.
2025         * testsuite/weak_undef_file3.cc: New file.
2026         * testsuite/weak_undef_file4.cc: New file.
2027         * testsuite/weak_undef_test_2.cc: New file.
2028
2029 2014-02-05  Cary Coutant  <ccoutant@google.com>
2030
2031         Fix issues with gold undefined symbol diagnostics.
2032
2033         PR binutils/15435
2034         * errors.cc (Errors::undefined_symbol): Move undef vtable symbol
2035         check to here.
2036         * target-reloc.h (is_strong_undefined): New function.
2037         (relocate_section): Move undef vtable symbol check from here.
2038         Check for is_strong_undefined.
2039
2040 2014-02-05  Cary Coutant  <ccoutant@google.com>
2041
2042         Fix problems with the --dynamic-list option.
2043
2044         PR gold/13577
2045         * options.cc (General_options::parse_dynamic_list):
2046         Set have_dynamic_list_.
2047         (General_options::General_options): Initialize have_dynamic_list_.
2048         (General_options::finalize): Turn off -Bsymbolic and
2049         -Bsymbolic-functions if --dynamic-list provided.
2050         * options.h (General_options::have_dynamic_list): New function.
2051         (General_options::have_dynamic_list_): New data member.
2052         * symtab.h (Symbol::is_preemptible): Handle --dynamic-list
2053         correctly.
2054
2055         PR gold/16530
2056         * symtab.cc (Symbol_table::add_from_relobj): If symbol is named
2057         in --dynamic-list, mark it.
2058
2059         * testsuite/Makefile.am (gc_dynamic_list_test.sh): New test case.
2060         (dynamic_list_2): New test case.
2061         * testsuite/Makefile.in: Regenerate.
2062         * testsuite/dynamic_list_2.cc: New file.
2063         * testsuite/dynamic_list_2.t: New file.
2064         * testsuite/dynamic_list_lib1.cc: New file.
2065         * testsuite/dynamic_list_lib2.cc: New file.
2066         * testsuite/gc_dynamic_list_test.c: New file.
2067         * testsuite/gc_dynamic_list_test.sh: New file.
2068         * testsuite/gc_dynamic_list_test.t: New file.
2069
2070 2014-01-28  Cary Coutant  <ccoutant@google.com>
2071
2072         Add .gdb_index version 7 support.
2073
2074         * gold/dwarf_reader.cc: include <utility> (for make_pair).
2075         (Dwarf_abbrev_table::do_read_abbrevs): Check for compressed
2076         debug sections.
2077         (Dwarf_ranges_table::read_ranges_table): Likewise.
2078         (Dwarf_pubnames_table::read_section): Check for GNU-style
2079         sections, and for compressed debug sections.
2080         (Dwarf_pubnames_table::read_header): Compute end address of table.
2081         (Dwarf_pubnames_table::next_name): Return flag_byte.  Check
2082         for end of list by offset, not by offset == 0.
2083         (Dwarf_info_reader::do_read_string_table): Check for compressed
2084         debug sections.
2085         * gold/dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2086         Initialize new data members.
2087         (Dwarf_pubnames_table::next_name): return flag_byte.
2088         (Dwarf_pubnames_table::end_of_table_): New data member.
2089         (Dwarf_pubnames_table::is_gnu_style_): New data member.
2090         * gold/gdb-index.cc (gdb_index_version): Update to version 7.
2091         (Gdb_index_info_reader::read_pubtable): Read flag_byte.
2092         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Don't
2093         read skeleton type unit DIEs.
2094         (Gdb_index::add_symbol): Add flag_byte; adjust all callers.
2095         (Gdb_index::do_write): Write flag_byte.
2096         * gold/gdb-index.h (Gdb_index::add_symbol): Add flags parameter.
2097         (Gdb_index::Cu_vector): Store flags along with cu indexes.
2098         * gold/testsuite/gdb_index_test_3.sh: Allow versions 4-7.
2099         * gold/testsuite/gdb_index_test_comm.sh: Likewise.
2100
2101 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2102
2103         * version.cc (print_version): Update copyright year to 2014.
2104
2105 2013-12-19  Dimitry Andric  <dimitry@andric.com>
2106
2107         * stringpool.cc (Stringpool_template::reserve): Add
2108         HAVE_UNORDERED_MAP case.
2109         * stringpool.cc (Stringpool_template::print_stats): Likewise.
2110
2111 2013-12-18  Cary Coutant  <ccoutant@google.com>
2112
2113         * configure.ac: Check for <unordered_set> and <unordered_map>.
2114         * config.in: Regenerate.
2115         * configure: Regenerate.
2116         * system.h: Use <unordered_set> and <unordered_map> if available.
2117
2118 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2119
2120         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
2121         with $(INSTALL_PROGRAM_ENV).
2122         * Makefile.in: Regenerate.
2123
2124 2013-11-22  Cary Coutant  <ccoutant@google.com>
2125
2126         * configure.ac: Add check for which library is needed for
2127         dlopen.
2128         * configure: Regenerate.
2129
2130 2013-11-22  Cary Coutant  <ccoutant@google.com>
2131
2132         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
2133         assembler.
2134         * testsuite/Makefile.in: Regenerate.
2135
2136 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
2137
2138         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
2139         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
2140         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
2141         (Target_x86_64<size>::Scan::local): Likewise.
2142         (Target_x86_64<size>::Scan::global): Likewise.
2143         (Target_x86_64<size>::Relocate::relocate): Likewise.
2144         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
2145         Likewise.
2146         (Target_x86_64<size>::Scan::check_non_pic(): Handle
2147         R_X86_64_PC32_BND.
2148
2149         * testsuite/Makefile.am (check_PROGRAMS): Add
2150         exception_x86_64_bnd_test.
2151         (exception_x86_64_bnd_test_SOURCES): New macro.
2152         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
2153         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
2154         (exception_x86_64_bnd_test_LDADD): Likewise.
2155         (exception_x86_64_bnd_1.o): New rule.
2156         (exception_x86_64_bnd_2.o): Likewise.
2157         * testsuite/Makefile.in: Regenerated.
2158
2159 2013-11-15  Alan Modra  <amodra@gmail.com>
2160
2161         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
2162         accessor.
2163         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
2164         Only call ppc64_local_entry_offset for 64-bit.  Restrict
2165         symval_for_branch lookup to ELFv1.
2166         (Stub_table::add_plt_call_entry): Use unsigned int off.
2167         (Output_data_glink::Address, invalid_address): New.
2168         (Output_data_glink::add_eh_frame): Move out of line.  Add
2169         support for ELFv2.
2170         (Output_data_glink::add_global_entry, find_global_entry,
2171         global_entry_address): New functions.
2172         (Output_data_glink::global_entry_stubs_, end_branch_table_,
2173         ge_size): New variables.
2174         (Output_data_glink::set_final_data_size): Add global entry
2175         stub sizing.
2176         (Output_data_glink::do_write): Write global entry stubs.
2177         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
2178         parameter.  Return true for ELFv2.  Adjust callers.
2179         (Target_powerpc::Scan::local, global): Restrict opd lookup to
2180         ELFv1.  Similarly for ifunc and dynamic relocation processing
2181         specific to ELFv1.  Recognize that symbols are defined on
2182         their plt entries for ELFv2.
2183         (Target_powerpc::symval_for_branch): Assert if called for
2184         ELFv2 or ppc32.
2185         (Target_powerpc::Relocate::relocate): Use global entry plt
2186         stub for symbol value if such exists on ELFv2.
2187         (Target_powerpc::Relocate::relocate): Don't call
2188         symval_for_branch when ELFv2.  Do adjust for local entry
2189         offset when ELFv2.
2190         (Target_powerpc::do_dynsym_value): Set symbols to global entry
2191         plt stub for ELFv2.
2192         (Target_powerpc::do_plt_address_for_global): Similarly.
2193
2194 2013-11-14  Cary Coutant  <ccoutant@google.com>
2195
2196         Revert patch -- this did not fix the problem, and there is
2197         no race there.
2198
2199         2013-11-14  Cary Coutant  <ccoutant@google.com>
2200
2201             PR gold/14860
2202             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2203             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2204             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2205             updating fde_offsets_.
2206             (Eh_frame_hdr::lock_): New data member.
2207
2208 2013-11-14  Cary Coutant  <ccoutant@google.com>
2209
2210         * dwp.cc (Dwo_file_entry): New type.
2211         (File_list): Use Dwo_file_entry.
2212         (Dwo_file::verify): New function.
2213         (Dwo_file::verify_dwo_list): New function.
2214         (Dwo_file::sized_verify_dwo_list): New function.
2215         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
2216         list.
2217         (Dwp_options): New enum type.
2218         (dwp_options): Add --verify-only.
2219         (usage): Likewise.
2220         (main): Likewise.
2221         * dwp.h (gold_info): Add declaration.
2222
2223 2013-11-14  Cary Coutant  <ccoutant@google.com>
2224
2225         PR gold/14860
2226         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
2227         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
2228         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
2229         updating fde_offsets_.
2230         (Eh_frame_hdr::lock_): New data member.
2231
2232 2013-11-06  Cary Coutant  <ccoutant@google.com>
2233
2234         PR gold/15758
2235         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
2236         before reloc sections.
2237
2238 2013-11-04  Alan Modra  <amodra@gmail.com>
2239
2240         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
2241         (Symbol::needs_dynamic_reloc): Test new flag.
2242         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
2243         (Target_powerpc::Scan::get_reference_flags): Add target param.
2244         Return FUNC_DESC_ABI for 64-bit ELFv1.
2245         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
2246         call.
2247         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
2248         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
2249
2250 2013-10-31  Cary Coutant  <ccoutant@google.com>
2251
2252         Restore support for dwp v2 DWARF package file format.
2253
2254         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2255         tu_length parameter.  Adjust all callers.
2256         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2257         * dwp.cc: Include dwarf.h.
2258         (Section_bounds): New struct type.
2259         (Unit_set): New struct type.
2260         (Dwo_file::Dwo_file): Initialize new data member.
2261         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2262         Combine and rename to...
2263         (Dwo_file::read_unit_index): ...this.
2264         (Dwo_file::sized_read_compunit_index)
2265         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2266         (Dwo_file::sized_read_unit_index): ...this.
2267         (Dwo_file::copy_section): Remove section_name, is_str_offsets
2268         parameters; add section_id parameter.
2269         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2270         (Dwo_file::add_unit_set): ...this.
2271         (Dwo_file::shndx_map_): Remove.
2272         (Dwo_file::sect_offsets_): New data member.
2273         (Dwp_output_file::Dwp_output_file): Initialize new data members.
2274         (Dwp_output_file::add_section): Rename to...
2275         (Dwp_output_file::add_contribution): ...this.
2276         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2277         (Dwp_output_file::add_tu_set): Likewise.
2278         (Dwp_output_file::Contribution): New type.
2279         (Dwp_output_file::Section::contributions): New data member.
2280         (Dwp_output_file::Cu_or_tu_set): Remove.
2281         (Dwp_output_file::Section::Section): New ctor.
2282         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2283         (Dwp_output_file::Dwp_index::Section_table): New type.
2284         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2285         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2286         parameter.
2287         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2288         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2289         (Dwp_output_file::Dwp_index::section_table): New member function.
2290         (Dwp_output_file::Dwp_index::section_table_end): New member function.
2291         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2292         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2293         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2294         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2295         (Dwp_output_file::Dwp_index::section_table_): New data member.
2296         (Dwp_output_file::Dwp_index::section_mask_): New data member.
2297         (Dwp_output_file::add_output_section): New member function.
2298         (Dwp_output_file::write_new_section): New member function.
2299         (Dwp_output_file::write_contributions): New member function.
2300         (Dwp_output_file::section_id_map_): New data member.
2301         (class Dwo_id_info_reader): Remove.
2302         (class Unit_reader): New class.
2303         (get_dwarf_section_name): New function.
2304         (Dwo_file::read_executable): Adjust initializations of class data.
2305         (Dwo_file::read): Add support for v2 package file format.
2306         (Dwo_file::read_unit_index): Likewise.
2307         (Dwo_file::sized_read_unit_index): Likewise.
2308         (Dwo_file::copy_section): Likewise.
2309         (Dwo_file::add_unit_set): Likewise.
2310         (Dwp_output_file::add_output_section): Likewise.
2311         (Dwp_output_file::add_contribution): Likewise.
2312         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2313         for empty slot.
2314         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2315         file format.
2316         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2317         slot.
2318         (Dwp_output_file::initialize): Remove unused function.
2319         (Dwp_output_file::finalize): Add support for v2 package file format.
2320         (Dwp_output_file::write_index): Likewise.
2321         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2322         function prototype.
2323
2324 2013-10-31  Cary Coutant  <ccoutant@google.com>
2325
2326         * configure.ac: Fix check for -fmerge-constants.
2327         * configure.ac: Regenerate.
2328
2329 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2330
2331         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
2332         Correct 9-byte nop sequence to match what the assembler generates.
2333
2334 2013-10-30  Alan Modra  <amodra@gmail.com>
2335
2336         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
2337         ppc64_local_entry_offset, ppc64_local_entry_offset,
2338         do_read_symbols): New functions.
2339         (Powerpc_relobj::e_flags_, st_other_): New vars.
2340         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
2341         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
2342         (Powerpc_relobj::e_flags_): New var.
2343         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
2344         and adjust for ELFv2.
2345         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
2346         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
2347         (Powerpc_dynobj::do_find_special_sections): Likewise.
2348         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
2349         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
2350         to ELFv2 local entry.
2351         (Target_powerpc::do_relax): No thread safe barriers needed for
2352         ELFv2.
2353         (Output_data_plt_powerpc::initial_plt_entry_size_,
2354         plt_entry_size): Delete.  Replace all uses with
2355         first_plt_entry_offset() and plt_entry_size().
2356         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
2357         reserved_size parm.  Update callers.
2358         (Output_data_plt_powerpc::entry_count): Update.
2359         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
2360         and use Target_powerpc::first_plt_entry_offset().
2361         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
2362         rename to plt_entry_size.
2363         (Output_data_plt_powerpc::add_ifunc_entry,
2364         add_local_ifunc_entry): Adjust reloc for ELFv2.
2365         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
2366         (glink_eh_frame_fde_64v2): New.
2367         (Stub_table::plt_call_size): Support ELFv2 sizing.
2368         (Output_data_glink::add_eh_frame): Use the new FDE.
2369         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
2370         (Stub_table::do_write): Write ELFv2 stubs and glink.
2371         (Target_powerpc::Relocate::relocate): Replaces nop after call
2372         with ld 2,24(1) and adjust local offset destination for ELFv2.
2373
2374 2013-10-30  Alan Modra  <amodra@gmail.com>
2375
2376         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
2377         (Target_powerpc::Scan::global, local): Likewise.
2378         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
2379         on all ppc64 @h and @ha relocs.
2380
2381 2013-10-14  Alan Modra  <amodra@gmail.com>
2382
2383         * output.h (Output_data_got::add_constant): Tidy.
2384         (Output_data_got::add_constant_pair): New function.
2385         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
2386         methods used so as to first call reserve_ent().
2387
2388 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2389
2390         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
2391         add_got_entry and add_got_entry_pair.
2392
2393         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
2394         (HAVE_PUBNAMES): Likewise.
2395         * configure: Regenerate.
2396
2397         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
2398         * testsuite/Makefile.in: Regenerate.
2399
2400         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
2401         Remove const from declaration.
2402         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
2403         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
2404         * output.h (Output_file_header): Remove const from member target_
2405         and corresponding constructor argument.
2406         * output.cc (Output_file_header::Output_file_header): Update prototype.
2407         (Output_file_header::do_sized_write): Use this->target_ in place
2408         of parameters()->target().
2409
2410         * testsuite/undef_symbol.cc (Foo::get_a): New method.
2411
2412         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
2413         * configure: Regenerate.
2414         * Makefile.in: Regenerate.
2415         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
2416         * testsuite/merge_string_literals_2.c: Likewise.
2417         * testsuite/Makefile.am
2418         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
2419         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
2420         literal -fmerge-constants.
2421         * testsuite/Makefile.in: Regenerate.
2422
2423         * i386.cc (Target_i386): Remove unused member dynbss_.
2424         * arm.cc (Target_arm): Likewise.
2425         * powerpc.cc (Target_powerpc): Likewise.
2426         * sparc.cc (Target_sparc): Likewise.
2427         * tilegx.cc (Target_tilegx): Likewise.
2428         * x86_64.cc (Target_x86_64): Likewise.
2429         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
2430         type_signature_, type_offset_.
2431         * plugin.h (Plugin_hook): Remove unused member layout_.
2432         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
2433         mapfile_.
2434         (Read_member): Remove unused members input_objects_, symtab_,
2435         mapfile_, layout_.
2436         (Check_library): Remove unused member symtab_.
2437         * archive.h (Lib_group): Remove unused member lib_.
2438         * archive.cc (Lib_group::Lib_group): Update initializer.
2439         * incremental.h (Incremental_binary): Remove unused member target_.
2440         (Incremental_script_entry): Removed unused member script_.
2441         * layout.h (Write_symbols_task): Remove unused member input_objects_.
2442         * icf.h (Icf): Remove unused member num_tracked_relocs.
2443
2444         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
2445         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
2446         its only use.
2447         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
2448
2449         * archive.h: Use struct rather than class for forward declaration
2450         of Read_symbols_data.
2451
2452 2013-10-07  Cary Coutant  <ccoutant@google.com>
2453
2454         PR gold/16010
2455         * testsuite/Makefile.am (icf_test): Fix dependencies.
2456         (icf_safe_test): Likewise.
2457         (icf_safe_so_test): Likewise.
2458         (large_symbol_alignment): Add empty _LDADD rule.
2459         * testsuite/Makefile.in: Regenerate.
2460
2461 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
2462
2463         PR gold/15927
2464         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
2465         relocation for R_X86_64_32 on x32.
2466
2467 2013-08-27  Roland McGrath  <mcgrathr@google.com>
2468
2469         * output.cc (Output_segment::set_section_addresses): Take new
2470         Target* argument.  If target->isolate_execinstr() and the segment
2471         is executable and starts at a target->abi_pagesize() boundary,
2472         pad its end out to a target->abi_pagesize() boundary with code fill.
2473         * output.h (Output_segment::set_section_addresses): Update decl.
2474         * layout.h (Layout::check_output_data_for_reset_values): Take new
2475         argument RELAX_OUTPUTS.
2476         (Layout): New member relax_output_list_.
2477         (Layout::add_relax_output): New method.
2478         * layout.cc (Layout::Layout): Update constructor.
2479         (Layout::reset_relax_output): New method.
2480         (Layout::clean_up_after_relaxation): Call it.
2481         (Layout::prepare_for_relaxation): Update caller.
2482         (Layout::set_segment_offsets): Update callers of set_section_addresses.
2483         Call reset_relax_output before re-processing segments for
2484         isolate_execinstr case.
2485         (Layout::write_data): Handle relax_output_list_.
2486         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
2487         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
2488
2489 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
2490
2491         PR binutils/15834
2492         * object.h: Fix typos.
2493
2494 2013-08-16  Roland McGrath  <mcgrathr@google.com>
2495
2496         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
2497         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
2498
2499 2013-08-07  Cary Coutant  <ccoutant@google.com>
2500
2501         Revert support for v2 DWP files:
2502
2503         2013-03-01  Cary Coutant  <ccoutant@google.com>
2504
2505             Add dwp support for v2 DWARF package file format.
2506             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
2507             tu_length parameter.  Adjust all callers.
2508             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
2509             * dwp.cc: Include dwarf.h.
2510             (Section_bounds): New struct type.
2511             (Unit_set): New struct type.
2512             (Dwo_file::Dwo_file): Initialize new data member.
2513             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
2514             Combine and rename to...
2515             (Dwo_file::read_unit_index): ...this.
2516             (Dwo_file::sized_read_compunit_index)
2517             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
2518             (Dwo_file::sized_read_unit_index): ...this.
2519             (Dwo_file::copy_section): Remove section_name, is_str_offsets
2520             parameters; add section_id parameter.
2521             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
2522             (Dwo_file::add_unit_set): ...this.
2523             (Dwo_file::shndx_map_): Remove.
2524             (Dwo_file::sect_offsets_): New data member.
2525             (Dwp_output_file::Dwp_output_file): Initialize new data members.
2526             (Dwp_output_file::add_section): Rename to...
2527             (Dwp_output_file::add_contribution): ...this.
2528             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
2529             (Dwp_output_file::add_tu_set): Likewise.
2530             (Dwp_output_file::Contribution): New type.
2531             (Dwp_output_file::Section::contributions): New data member.
2532             (Dwp_output_file::Cu_or_tu_set): Remove.
2533             (Dwp_output_file::Section::Section): New ctor.
2534             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
2535             (Dwp_output_file::Dwp_index::Section_table): New type.
2536             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
2537             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
2538             parameter.
2539             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
2540             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
2541             (Dwp_output_file::Dwp_index::section_table): New member function.
2542             (Dwp_output_file::Dwp_index::section_table_end): New member function.
2543             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
2544             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
2545             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
2546             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
2547             (Dwp_output_file::Dwp_index::section_table_): New data member.
2548             (Dwp_output_file::Dwp_index::section_mask_): New data member.
2549             (Dwp_output_file::add_output_section): New member function.
2550             (Dwp_output_file::write_new_section): New member function.
2551             (Dwp_output_file::write_contributions): New member function.
2552             (Dwp_output_file::section_id_map_): New data member.
2553             (class Dwo_id_info_reader): Remove.
2554             (class Unit_reader): New class.
2555             (get_dwarf_section_name): New function.
2556             (Dwo_file::read_executable): Adjust initializations of class data.
2557             (Dwo_file::read): Add support for v2 package file format.
2558             (Dwo_file::read_unit_index): Likewise.
2559             (Dwo_file::sized_read_unit_index): Likewise.
2560             (Dwo_file::copy_section): Likewise.
2561             (Dwo_file::add_unit_set): Likewise.
2562             (Dwp_output_file::add_output_section): Likewise.
2563             (Dwp_output_file::add_contribution): Likewise.
2564             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
2565             for empty slot.
2566             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
2567             file format.
2568             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
2569             slot.
2570             (Dwp_output_file::initialize): Remove unused function.
2571             (Dwp_output_file::finalize): Add support for v2 package file format.
2572             (Dwp_output_file::write_index): Likewise.
2573             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
2574             function prototype.
2575
2576 2013-07-31  Cary Coutant  <ccoutant@google.com>
2577
2578         * object.cc (Sized_relobj::do_output_section_address): New function.
2579         (Sized_relobj): Instantiate explicitly.
2580         * object.h (Object::output_section_address): New function.
2581         (Object::do_output_section_address): New function.
2582         (Sized_relobj::do_output_section_address): New function.
2583         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
2584
2585 2013-07-30  Cary Coutant  <ccoutant@google.com>
2586             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
2587
2588         * parameters.cc (Parameters::entry): Return target-specific entry
2589         symbol name.
2590         * target.h (Target::entry_symbol_name): New function.
2591         (Target_info::entry_symbol_name): New data member.
2592
2593         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
2594         * i386.cc (Target_i386::i386_info): Likewise.
2595         (Target_i386_nacl::i386_nacl_info): Likewise.
2596         * sparc.cc (Target_sparc::sparc_info): Likewise.
2597         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
2598         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
2599         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
2600         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2601
2602 2013-07-22  Sterling Augustine  <saugustine@google.com>
2603
2604         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
2605         Convert parameter shndx to local variable. Add parameters symtab
2606         and symtab_size.  Scan over section names.  Find relocation
2607         section corresponding to current section.  Create and initialize
2608         reloc_mapper_ and reloc_type_.
2609         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
2610         unit_length to off_t.  Initialize member unit_length_.  Fill in field
2611         cu_offset_.
2612         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
2613         Initialize new fields unit_length_ and cu_offset_.
2614         (Dwarf_pubnames_table::read_section): Update prototype.
2615         (Dwarf_pubnames_table::cu_offset): New member function.
2616         (Dwarf_pubnames_table::subsection_size): Likewise.
2617         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
2618         New fields.
2619         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
2620         member functions public.
2621         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
2622         Update comment.  Rework logic.  Move repeated parts to...
2623         (Gdb_index_info_reader::read_pubtable): ...here. New function.
2624         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
2625         pubtypes_table_, and stmt_list_offset.
2626         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2627         Gdb_index::find_pubtype_offset,
2628         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
2629         (Gdb_index::pubnames_read): Update prototype and rework logic.
2630         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
2631         Forward declare.
2632         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
2633         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
2634         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
2635         Gdb_index::map_pubtable_to_dies):
2636         Declare functions.
2637         (Gdb_index::pubnames_read): Update declaration.
2638         (Gdb_index::Pubname_offset_map): New type.
2639         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
2640         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
2641         Gdb_index::stmt_list_offset): Declare.
2642         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
2643         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
2644         Gdb_index::pubtypes_offset_): Remove.
2645
2646 2013-07-19  Roland McGrath  <mcgrathr@google.com>
2647
2648         * options.h (General_options): Add -Trodata-segment option.
2649         * parameters.cc (Parameters::check_rodata_segment): New function.
2650         (Parameters::set_target_once): Call it.
2651         * parameters.h (Parameters): Declare it (private member function).
2652         * layout.cc (load_seg_unusable_for_headers): New function, broken
2653         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
2654         then validate rodata segment rather than text segment.
2655         (relaxation_loop_body): Call that.
2656         (is_text_segment): New function.  Don't admit a non-executable
2657         segment if TARGET->isolate_execinstr().
2658         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
2659
2660 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
2661
2662         PR gold/15070
2663         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
2664         * nacl.h (Sniff_file::View::View): Request aligned view.
2665
2666 2013-07-11  Cary Coutant  <ccoutant@google.com>
2667
2668         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
2669         correct BRLT entry size.
2670
2671 2013-07-03  Alan Modra  <amodra@gmail.com>
2672
2673         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
2674         comment.
2675
2676 2013-07-01  Cary Coutant  <ccoutant@google.com>
2677
2678         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
2679         reloc_type_.
2680         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
2681         (Dwarf_ranges_table::lookup_reloc): New function.
2682         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
2683         reloc_type_.
2684         (Dwarf_ranges_table::lookup_reloc): New function.
2685         (Dwarf_ranges_table::reloc_type_): New data member.
2686
2687 2013-06-27  Jing Yu  <jingyu@google.com>
2688
2689         PR gold/15662
2690         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
2691         function.
2692         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
2693         (Target_powerpc::do_relax): Call the above.
2694
2695 2013-06-27  Cary Coutant  <ccoutant@google.com>
2696
2697         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
2698         on garbage collected .opd section.
2699
2700 2013-06-27  Alan Modra  <amodra@gmail.com>
2701
2702         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
2703         is non-zero.
2704         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
2705         (Target_powerpc::do_function_location): Likewise for loc->shndx.
2706
2707 2013-06-14  Cary Coutant  <ccoutant@google.com>
2708
2709         * resolve.cc (Symbol::override_base): Don't override st_type
2710         from plugin placeholder symbols.
2711         (Symbol_table::resolve): Likewise.
2712         (Symbol_table::should_override): Don't complain about TLS mismatch
2713         if the TO symbol is a plugin placeholder.
2714         * testsuite/Makefile.am (plugin_test_tls): New test.
2715         * testsuite/Makefile.in: Regenerate.
2716         * testsuite/plugin_test_tls.sh: New test script.
2717         * testsuite/two_file_test_2_tls.cc: New test source.
2718         * testsuite/two_file_test_tls.cc: New test source.
2719
2720 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2721
2722         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
2723         the maximum segment alignment is larger than the page size.
2724         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
2725         correctly aligns the symbols with large alignemnt.
2726         * testsuite/Makefile.in: Regenerate.
2727         * testsuite/large_symbol_alignment.cc: New file.
2728
2729 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2730             Sriraman Tallam  <tmsriram@google.com>
2731
2732         * options.h (sort_section): New option.
2733         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
2734         Rename from Input_section_sort_section_name_special_ordering_compare.
2735         (Input_section_sort_section_name_compare): New struct.
2736         * output.cc (Output_section::Input_section_sort_section_name_compare::
2737         operator()): New function.
2738         (Output_section::sort_attached_input_sections): Use new sort function
2739         for .text if --sort-section=name is specified.
2740         * layout.cc (Layout::make_output_section):
2741         Add sorting by name when --sort-section=name is specified.
2742         * testsuite/Makefile.am (text_section_grouping): Test option
2743         --sort-section=name.
2744         * testsuite/Makefile.in: Regenerate.
2745         * testsuite/section_sorting_name.cc: New file.
2746         * testsuite/section_sorting_name.sh: New file.
2747
2748 2013-05-21  Cary Coutant  <ccoutant@google.com>
2749
2750         * symtab.h (Symbol::is_cxx_vtable): New function.
2751         * target-reloc.h (relocate_section): Check for vtable symbol.
2752         * testsuite/Makefile.am (missing_key_func.sh): New test case.
2753         * testsuite/Makefile.in: Regenerate.
2754         * testsuite/missing_key_func.cc: New test source.
2755         * testsuite/missing_key_func.sh: New test script.
2756
2757 2013-05-21  Cary Coutant  <ccoutant@google.com>
2758
2759         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
2760         type of enclosing symbol.
2761         (Relocate_info::location): Check symbol type when describing symbol.
2762         * object.h (Symbol_location_info): Remove unused line_number;
2763         add enclosing_symbol_type.
2764         * testsuite/debug_msg.sh: Adjust expected output.
2765
2766 2013-05-13  Cary Coutant  <ccoutant@google.com>
2767
2768         * configure.ac: Export DEFAULT_TARGET.
2769         * configure: Regenerate.
2770         * Makefile.in: Regenerate.
2771         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
2772         * testsuite/Makefile.in: Regenerate.
2773         * testsuite/debug_msg.sh: Delete duplicate tests.
2774         Don't check undef_int error message match for powerpc where the
2775         source file and line number aren't available.
2776
2777 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2778
2779         * options.h (General_options): Add --rosegment-gap option.
2780         * options.cc (finalize): --rosegment-gap implies --rosegment.
2781         * layout.cc (set_segment_offsets): Let user option override
2782         target->rosegment_gap().
2783
2784 2013-05-10  Roland McGrath  <mcgrathr@google.com>
2785
2786         * options.h (General_options): Remove leading space from help
2787         messages for -nostdlib and --rosegment.
2788
2789 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
2790
2791         PR ld/15365
2792         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
2793
2794 2013-05-03  Alan Modra  <amodra@gmail.com>
2795
2796         * merge.cc (Output_merge_string::do_add_input_section): Correct
2797         scan for number of strings.  Rename vars to avoid shadowing.
2798         Include missing terminator in input_size_.
2799
2800 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
2801
2802         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
2803         Restore empty string handling.
2804
2805 2013-05-01  Cary Coutant  <ccoutant@google.com>
2806
2807         * stringpool.cc (Stringpool_template::new_key_offset): Fix
2808         uninitialized warning.
2809
2810 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
2811
2812         * output.cc (Output_section::add_merge_input_section): Allow
2813         to merge sections if the alignment is more than character size.
2814         * merge.h (Output_merge_string::Output_merge_string): Remove
2815         assert.
2816         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
2817         only not-null strings. Check the alignment of strings.
2818         * stringpool.h
2819         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
2820         alignment as the argument.
2821         (Stringpool_template<Stringpool_char>::addralign_): New class member.
2822         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
2823         Align non-zero length strings according to the addralign_.
2824         (Stringpool_template<Stringpool_char>::set_string_offsets):
2825         Updating offsets according to the given alignment.
2826         * testsuite/Makefile.am (text_section_grouping): Test if string
2827         literals are getting merged.
2828         * testsuite/Makefile.in: Regenerate.
2829         * testsuite/merge_string_literals_1.c: New file.
2830         * testsuite/merge_string_literals_2.c: Ditto.
2831         * testsuite/merge_string_literals.sh: Ditto.
2832
2833 2013-04-26  Ian Lance Taylor  <iant@google.com>
2834
2835         * target-reloc.h (relocate_section): If the reloc offset is out of
2836         range, pass VIEW as NULL to relocate.relocate.
2837         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
2838         * i386.cc (Target_i386::Relocate::relocate): Likewise.
2839         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
2840         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
2841         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
2842         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
2843
2844 2013-04-26  Geoff Pike  <gpike@chromium.org>
2845
2846         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
2847         * layout.cc (Hash_task): New class.
2848         (Layout::queue_build_id_tasks): New function.
2849         (Layout::write_build_id): Handle single-thread portion of build ID
2850         computation.  (In some cases, all of it is single-threaded.)  Replace
2851         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
2852         functionality in fewer lines of code.
2853         * layout.h (Layout::queue_build_id_tasks): New function declaration.
2854         * options.h (General_options): make "--build-id" default to tree
2855         rather than sha1.  Add two new options related to --build-id=tree:
2856         --build-id-chunk-size-for-treehash and
2857         --build-id-min-file-size-for-treehash.
2858         * Makefile.am: add testing of --build-id=tree and related new options
2859         (these tests will be invoked by "make check").
2860         * Makefile.in: Regenerate.
2861
2862 2013-04-25  Alan Modra  <amodra@gmail.com>
2863
2864         * configure.tgt: Add powerpcle and powerpc64le.
2865
2866 2013-04-22  Alan Modra  <amodra@gmail.com>
2867
2868         PR gold/15355
2869         * layout.cc (Layout::segment_precedes): Allow more than one
2870         segment with the same type and flags.
2871
2872 2013-04-15  Cary Coutant  <ccoutant@google.com>
2873
2874         * layout.cc (Layout::set_relocatable_section_offsets): Don't
2875         allocate space in file for BSS sections.
2876
2877 2013-04-15  Cary Coutant  <ccoutant@google.com>
2878
2879         * script-sections.cc (Orphan_output_section): Reset address
2880         to zero after each orphaned section for relocatable links.
2881
2882 2013-04-15  Cary Coutant  <ccoutant@google.com>
2883
2884         * symtab.cc (Symbol_table::sized_write_globals): Subtract
2885         section starting address for relocatable link.
2886         * testsuite/Makefile.am (script_test_11): New test.
2887         * testsuite/Makefile.in: Regenerate.
2888         * testsuite/script_test_11.c: New source file.
2889         * testsuite/script_test_11.t: New linker script.
2890
2891 2013-04-13  Alan Modra  <amodra@gmail.com>
2892
2893         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
2894         owner when sections are not adjacent and exceed group size.
2895         (Target_powerpc::group_sections): Handle corner case.
2896         (Target_powerpc::Branch_info::make_stub): Handle case where
2897         stub table doesn't exist due to branches in non-exec sections.
2898         (Target_powerpc::Relocate::relocate): Likewise.
2899
2900 2013-04-11  Alan Modra  <amodra@gmail.com>
2901
2902         PR gold/15354
2903         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
2904         .branch_lt to match bfd ld.  Adjust comments throughout file.
2905
2906 2013-04-04  Ian Lance Taylor  <iant@google.com>
2907
2908         GCC PR c++/56840
2909         * object.cc (do_layout_deferred_sections): Handle .eh_frame
2910         sections before checking whether they are included in the link.
2911
2912 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
2913
2914         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
2915         object before calling the plugin claim_file handler.  Pass the elf
2916         object of the archive to the plugin. Delete the elf object if the
2917         plugin claims the file.
2918
2919 2013-03-21  Alan Modra  <amodra@gmail.com>
2920
2921         * layout.cc (Layout::set_segment_offsets): Accept writable .text
2922         segment when omagic.
2923
2924 2013-03-21  Alan Modra  <amodra@gmail.com>
2925
2926         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
2927         comparison warning.
2928         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
2929         uninitialized" warning.
2930
2931 2013-03-20  Alan Modra  <amodra@gmail.com>
2932
2933         * symtab.h (Symbol::clear_version): New function.
2934         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
2935         is_needed by weak references.  Clear version for symbols defined
2936         in as-needed objects that are not needed.
2937
2938 2013-03-15  Alan Modra  <amodra@gmail.com>
2939
2940         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
2941         static and public.  Add report_err param.  Return false for data refs.
2942         (Target_powerpc::rela_dyn_section): New overloaded function.
2943         (Target_powerpc::plt_, iplt_): Elucidate.
2944         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
2945         (Output_data_plt_powerpc::do_write): Don't write .iplt.
2946         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
2947         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
2948         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
2949         push_branch and make_plt_entry for ifunc syms when
2950         reloc_needs_plt_for_ifunc.
2951         (Target_powerpc::Relocate::relocate): Don't use plt entry value
2952         for ifunc unless reloc_needs_plt_for_ifunc.
2953
2954 2013-03-15  Alan Modra  <amodra@gmail.com>
2955
2956         * gc.h (gc_process_relocs): Don't look through function descriptors.
2957         * icf.cc (get_section_contents): Do so here instead.
2958
2959 2013-03-13  Alan Modra  <amodra@gmail.com>
2960
2961         * powerpc.cc (is_branch_reloc): Forward declare.
2962         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
2963         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
2964         false for 64-bit, true for 32-bit non-branch relocs.
2965         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
2966         * testsuite/Makefile.am (icf_test): Use linker map file instead of
2967         nm output.
2968         (icf_safe_test): Generate linker map file as well as nm output.
2969         (icf_safe_so_test): Likewise.
2970         * testsuite/Makefile.in: Regenerate.
2971         * testsuite/icf_test.sh: Parse linker map file to determine
2972         section folding.
2973         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
2974         * testsuite/icf_safe_so_test.sh: Likewise.
2975         (X86_32_or_ARM_specific_safe_fold): Merge into..
2976         (arch_specific_safe_fold): ..this.
2977         (X86_64_specific_safe_fold): Delete unused function.
2978
2979 2013-03-12  Alan Modra  <amodra@gmail.com>
2980
2981         * gc.h (gc_process_relocs): Look through function descriptors
2982         to determine shndx, symvalue and addend used by ICF.  Tidy
2983         variable duplication.
2984
2985 2013-03-11  Alan Modra  <amodra@gmail.com>
2986
2987         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
2988         * layout.cc (Layout_task_runner::run): ..to here.
2989         * symtab.h (struct Symbol_location): Extract from..
2990         (class Symbol_table): ..here.
2991         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
2992         * target.h (class Target): Add function_location and
2993         do_function_location functions.
2994         (class Sized_target): Add do_function_location.
2995         * object.h (class Sized_relobj_file): Move find_shdr..
2996         (class Object): ..to here.
2997         * object.cc: Likewise.  Update to suit.  Instantiate.
2998         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
2999         * powerpc.cc (class Powerpc_dynobj): New.
3000         (Target_powerpc::do_function_location): New function.
3001         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
3002         (Powerpc_dynobj::do_read_symbols): New function.
3003         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
3004
3005 2013-03-08  Ian Lance Taylor  <iant@google.com>
3006
3007         * options.cc (General_options::string_to_object_format): Accept
3008         "default".
3009
3010 2013-03-08  Alan Modra  <amodra@gmail.com>
3011
3012         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
3013         pointer to Post_fde.
3014         (struct Post_fde): Move definition to here..
3015         * ehframe.cc (struct Post_fde): ..from here.
3016         (Cie::write): Don't alloc Post_fde.
3017         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
3018
3019 2013-03-07  Alan Modra  <amodra@gmail.com>
3020
3021         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
3022         relocation referencing .LC0.
3023         * testsuite/discard_locals_test.sh: Remove FIXMEs.
3024
3025 2013-03-07  Alan Modra  <amodra@gmail.com>
3026
3027         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
3028         always_inline.  Add assembly for powerpc to avoid GOT.
3029
3030 2013-03-07  Alan Modra  <amodra@gmail.com>
3031
3032         * testsuite/script_test_10.sh: Don't test .bss section
3033         header number.
3034
3035 2013-03-06  Alan Modra  <amodra@gmail.com>
3036
3037         * powerpc.cc (class Powerpc_relobj): Move some member functions.
3038         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
3039         all callers.  Handle folded sections.
3040         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
3041         to Powerpc_relobj.
3042         (Global_symbol_visitor_opd::operator()): Likewise.
3043
3044 2013-03-04  Alan Modra  <amodra@gmail.com>
3045
3046         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
3047         * testsuite/Makefile.in: Regenerate.
3048
3049 2013-03-01  Cary Coutant  <ccoutant@google.com>
3050
3051         Add dwp support for v2 DWARF package file format.
3052         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
3053         tu_length parameter.  Adjust all callers.
3054         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
3055         * dwp.cc: Include dwarf.h.
3056         (Section_bounds): New struct type.
3057         (Unit_set): New struct type.
3058         (Dwo_file::Dwo_file): Initialize new data member.
3059         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
3060         Combine and rename to...
3061         (Dwo_file::read_unit_index): ...this.
3062         (Dwo_file::sized_read_compunit_index)
3063         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
3064         (Dwo_file::sized_read_unit_index): ...this.
3065         (Dwo_file::copy_section): Remove section_name, is_str_offsets
3066         parameters; add section_id parameter.
3067         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
3068         (Dwo_file::add_unit_set): ...this.
3069         (Dwo_file::shndx_map_): Remove.
3070         (Dwo_file::sect_offsets_): New data member.
3071         (Dwp_output_file::Dwp_output_file): Initialize new data members.
3072         (Dwp_output_file::add_section): Rename to...
3073         (Dwp_output_file::add_contribution): ...this.
3074         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
3075         (Dwp_output_file::add_tu_set): Likewise.
3076         (Dwp_output_file::Contribution): New type.
3077         (Dwp_output_file::Section::contributions): New data member.
3078         (Dwp_output_file::Cu_or_tu_set): Remove.
3079         (Dwp_output_file::Section::Section): New ctor.
3080         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
3081         (Dwp_output_file::Dwp_index::Section_table): New type.
3082         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
3083         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
3084         parameter.
3085         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
3086         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
3087         (Dwp_output_file::Dwp_index::section_table): New member function.
3088         (Dwp_output_file::Dwp_index::section_table_end): New member function.
3089         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
3090         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
3091         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
3092         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
3093         (Dwp_output_file::Dwp_index::section_table_): New data member.
3094         (Dwp_output_file::Dwp_index::section_mask_): New data member.
3095         (Dwp_output_file::add_output_section): New member function.
3096         (Dwp_output_file::write_new_section): New member function.
3097         (Dwp_output_file::write_contributions): New member function.
3098         (Dwp_output_file::section_id_map_): New data member.
3099         (class Dwo_id_info_reader): Remove.
3100         (class Unit_reader): New class.
3101         (get_dwarf_section_name): New function.
3102         (Dwo_file::read_executable): Adjust initializations of class data.
3103         (Dwo_file::read): Add support for v2 package file format.
3104         (Dwo_file::read_unit_index): Likewise.
3105         (Dwo_file::sized_read_unit_index): Likewise.
3106         (Dwo_file::copy_section): Likewise.
3107         (Dwo_file::add_unit_set): Likewise.
3108         (Dwp_output_file::add_output_section): Likewise.
3109         (Dwp_output_file::add_contribution): Likewise.
3110         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
3111         for empty slot.
3112         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
3113         file format.
3114         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
3115         slot.
3116         (Dwp_output_file::initialize): Remove unused function.
3117         (Dwp_output_file::finalize): Add support for v2 package file format.
3118         (Dwp_output_file::write_index): Likewise.
3119         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
3120         function prototype.
3121
3122 2013-03-01  Cary Coutant  <ccoutant@google.com>
3123
3124         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
3125         function into class definition in header file.
3126         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
3127         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
3128         New function.
3129         (Dwarf_info_reader::check_buffer): Move here from .cc file.
3130
3131 2013-02-28  Alan Modra  <amodra@gmail.com>
3132
3133         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
3134         * target.cc (Target::do_plt_fde_location): New function.
3135         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
3136         accessor function, and constructor param.
3137         (struct Post_fde, Post_fdes): Declare.
3138         (Cie::write): Add post_fdes param.
3139         * ehframe.cc (Fde::write): Use plt_fde_location.
3140         (struct Post_fde): Define.
3141         (Cie::write): Stash FDEs added post merge mapping.
3142         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
3143         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
3144         (Eh_frame::do_sized_write): Arrange to write post map FDES after
3145         other FDEs.
3146         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
3147         (Target_powerpc::has_glink): New function.
3148         (Target_powerpc::do_relax): Add eh_frame info for stubs.
3149         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
3150         glink_eh_frame_fde_32, default_fde): New data.
3151         (Stub_table::eh_frame_added_): New var.
3152         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
3153         Make const.
3154         (Stub_table::add_eh_frame): New function.
3155         (Output_data_glink::add_eh_frame): New function.
3156         (Target_powerpc::make_glink_section): Call add_eh_frame.
3157
3158 2013-02-15  Ian Lance Taylor  <iant@google.com>
3159
3160         * options.h (DEFINE_uint64_alias): Define.
3161         (class General_options): Add -Ttext-segment as an alias for
3162         -Ttext.
3163
3164 2013-02-15  Alan Modra  <amodra@gmail.com>
3165
3166         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
3167         (Stub_table::do_write): ..here, two places.
3168         (Stub_table::plt_call_size): Use it here too.
3169
3170 2013-02-11  Ian Lance Taylor  <iant@google.com>
3171
3172         * descriptors.cc (Descriptors::close_all): New function.
3173         * descriptors.h (class Descriptors): Declare close_all.
3174         (close_all_descriptors): New inline function.
3175         * plugin.cc: Include "descriptors.h".
3176         (Plugin_manager::cleanup): Call close_all_descriptors.
3177
3178 2013-02-06  Alan Modra  <amodra@gmail.com>
3179
3180         * README: Update coding style link.
3181
3182 2013-01-28  Cary Coutant  <ccoutant@google.com>
3183
3184         * dwp.cc (File_list): New typedef.
3185         (Dwo_name_info_reader): New class.
3186         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
3187         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
3188         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
3189         (Dwo_file::read_executable): New function.
3190         (Dwo_file::read): Move common setup code to ...
3191         (Dwo_file::make_object): ... here.
3192         (dwp_options): Add --exec/-e.
3193         (usage): Likewise.
3194         (main): Likewise.
3195
3196 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
3197
3198         * layout.cc (Layout::layout): Check for option text_reorder.
3199         (Layout::make_output_section): Ditto.
3200         * options.h (text_reorder): New option.
3201         * output.cc (Input_section_sort_compare): Remove special ordering
3202         of section names.
3203         (Output_section::
3204          Input_section_sort_section_name_special_ordering_compare::
3205          operator()): New function.
3206         (Output_section::sort_attached_input_sections): Use new sort function
3207         for .text.
3208         * output.h (Input_section_sort_section_name_special_ordering_compare):
3209         New struct.
3210         * testsuite/Makefile.am (text_section_grouping): Test option
3211         --no-text-reorder
3212         * testsuite/Makefile.in: Regenerate.
3213         * testsuite/text_section_grouping.sh: Check order of functions without
3214         default text reordering.
3215
3216 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3217
3218         * options.h (General_options): Change default to true for new_dtags.
3219
3220 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
3221
3222         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
3223         when enable_new_dtags is false.  Only add DT_RUNPATH when
3224         enable_new_dtags is true.
3225
3226 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
3227
3228         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
3229         used in declaration and definition consistent.
3230         (Target_powerpc::symval_for_branch): Ditto.
3231
3232 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3233
3234         * testsuite/plugin_final_layout.cc: Fix comment.
3235
3236 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
3237
3238         * layout.cc (Layout::layout): Do not do default sorting for
3239         text sections when section ordering is specified.
3240         (make_output_section): Ditto.
3241         * testsuite/plugin_final_layout.cc: Name the function sections
3242         to catch reordering issues.
3243
3244 2013-01-15  Alan Modra  <amodra@gmail.com>
3245
3246         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
3247         plt-thread-safe.
3248
3249 2013-01-15  Alan Modra  <amodra@gmail.com>
3250
3251         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
3252         * testsuite/Makefile.in: Regenerate.
3253
3254 2013-01-14  Alan Modra  <amodra@gmail.com>
3255
3256         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
3257         * testsuite/Makefile.in: Regenerate.
3258
3259 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
3260
3261         PR bfd/14430
3262         Fix mingw gold build with plugins enabled
3263         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
3264         * configure.ac: Export DLOPEN_LIBS and add headers check.
3265         * plugin.cc: Handle non-dlfcn case.
3266         * Makefile.in: Regenerate.
3267         * config.in: Regenerate.
3268         * configure: Regenerate.
3269         * testsuite/Makefile.in: Regenerate.
3270
3271 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
3272
3273         * output.h (sort_attached_input_sections): Change to be public.
3274         * script-sections.cc
3275         (Output_section_definition::set_section_addresses): Sort
3276         attached input sections according to section order before linker
3277         script assigns section addresses.
3278         (Orphan_output_section::set_section_addresses): Sort
3279         attached input sections according to section order before linker
3280         script assigns section addresses.
3281         * Makefile.am (final_layout.sh): Use a simple linker script to
3282         check if section ordering still works.
3283         * Makefile.in: Regenerate.
3284
3285 2013-01-09  Ben Cheng  <bccheng@google.com>
3286
3287         * arm.cc (Target_arm::attributes_accept_div): New function.
3288         (Target_arm::attributes_forbid_div): New function.
3289         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
3290         attribute using the same new functions as what bfd/elf32_arm.c
3291         does.
3292
3293 2013-01-07  Cary Coutant  <ccoutant@google.com>
3294
3295         PR gold/14993
3296         * output.cc (Output_section::add_input_section): For incremental
3297         updates, don't track input sections that are allocated from patch
3298         space.
3299
3300 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3301             Ian Lance Taylor  <iant@google.com>
3302
3303         PR gold/14897
3304         * configure.ac (--enable-ld): Removed.
3305         (install_as_default): Set to yes only for --enable-gold=default
3306         or --disable-ld.
3307         * configure: Regenerated.
3308
3309 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
3310
3311         * options.h (General_options): Add -fuse-ld= for GCC linker
3312         option compatibility.
3313
3314 2013-01-04  Cary Coutant  <ccoutant@google.com>
3315
3316         * configure.ac: Fix typo restoring CXXFLAGS.
3317         * configure: Regenerate.
3318
3319 2013-01-04  Cary Coutant  <ccoutant@google.com>
3320
3321         * testsuite/Makefile.am (CXXLINK_S): New macro.
3322         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
3323         * testsuite/Makefile.in: Regenerate.
3324
3325 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
3326
3327         * version.cc (print_version): Update copyright year to 2013.
3328
3329 2012-12-20  Ian Lance Taylor  <iant@google.com>
3330
3331         * layout.cc (Layout::special_ordering_of_input_section): New
3332         function.
3333         (Layout::layout): If input section requires special ordering, must
3334         sort input sections.
3335         (Layout::make_output_section): May sort .text input sections.
3336         (Layout::is_section_name_prefix_grouped): Remove.
3337         * layout.h (class Layout): Declare
3338         special_ordering_of_input_section.  Don't declare
3339         is_section_name_prefix_grouped.
3340         * output.cc (Output_section::add_input_section): Revert last
3341         change.
3342         (Output_section::Input_section_sort::match_file_name): Don't crash
3343         if called on output section data.
3344         (Output_section::Input_section_sort_compare): Sort based on
3345         special ordering.
3346         (Output_section::Input_section_sort_section_order_index_compare):
3347         Revert last patch.
3348         (Output_section::sort_attached_input_sections): Likewise.
3349
3350 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
3351
3352         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
3353         * layout.h (Layout::is_section_name_prefix_grouped): New function.
3354         * output.cc (Output_section::add_input_section): Check if section
3355         name contains special prefix.  Keep input sections to sort such
3356         sections.
3357         (Output_section::Input_section_sort_section_order_index_compare
3358          ::operator()): Group sections according to prefixes.
3359         (Output_section::sort_attached_input_sections): Add condition to
3360         Input_section_entry constructor call.
3361         * testsuite/Makefile.am (text_section_grouping): New test.
3362         * testsuite/Makefile.in: Regenerate.
3363         * testsuite/text_section_grouping.cc: New file.
3364         * testsuite/text_section_grouping.sh: New file.
3365
3366 2012-12-17  Nick Clifton  <nickc@redhat.com>
3367
3368         * Makefile.am: Add copyright notice.
3369         * NEWS: Likewise.
3370         * README: Likewise.
3371         * configure.ac: Likewise.
3372         * ftruncate.c: Likewise.
3373         * Makefile.in: Regenerate.
3374
3375 2012-12-14  Cary Coutant  <ccoutant@google.com>
3376
3377         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
3378         --no-as-needed flag.
3379         (exception_separate_shared_12_test): Likewise.
3380         (incremental_copy_test): Likewise.
3381         * testsuite/Makefile.in: Regenerate.
3382
3383 2012-12-14  Cary Coutant  <ccoutant@google.com>
3384
3385         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
3386         (Dwp_output_file::Dwp_index::enter_set): Add assert.
3387
3388 2012-12-12  Alan Modra  <amodra@gmail.com>
3389
3390         * powerpc.cc (class Track_tls): New.
3391         (class Relocate, class Scan): Inherit Track_tls.
3392         (Target_powerpc::Scan::local, global): Track tls optimization
3393         and avoid creating plt entry for __tls_get_addr if all uses
3394         are optimized away.
3395         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
3396
3397 2012-12-12  Alan Modra  <amodra@gmail.com>
3398
3399         * options.h (General_options): Add --toc-sort/--no-toc-sort.
3400         Replace no_toc_optimize with toc_optimize.
3401         * output.h (Output_section::input_sections): Provide non-const variant.
3402         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
3403         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
3404         accessors.
3405         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
3406         (class Sort_toc_sections): New.
3407         (Target_powerpc::do_finalize_sections): Sort toc sections.
3408         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
3409
3410 2012-12-10  Roland McGrath  <mcgrathr@google.com>
3411
3412         * testsuite/binary_unittest.cc (read_all): New function.
3413         (Sized_binary_test): Use it instead of ::read.
3414         * fileread.cc (do_read): Don't assume pread always reads the whole
3415         amount in a single call.
3416
3417 2012-12-10  Alan Modra  <amodra@gmail.com>
3418
3419         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
3420         Set EM_PPC64 or EM_PPC here.
3421         (Target_selector_powerpc::do_recognize): Delete.
3422
3423 2012-12-10  Alan Modra  <amodra@gmail.com>
3424
3425         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
3426         stub_table_.
3427         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
3428
3429 2012-12-07  Roland McGrath  <mcgrathr@google.com>
3430
3431         * testsuite/binary_unittest.cc (Sized_binary_test):
3432         Use open_descriptor rather than ::open.
3433
3434 2012-12-07  Alan Modra  <amodra@gmail.com>
3435
3436         * powerpc.cc (Stub_table::do_write): Delete redundant Address
3437         typedef and invalid_address constant.
3438         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
3439         instantiate constants.
3440
3441 2012-12-06  Roland McGrath  <mcgrathr@google.com>
3442
3443         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
3444         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
3445         * aclocal.m4: Regenerate.
3446         * configure: Regenerate.
3447         * Makefile.in: Regenerate.
3448         * testsuite/Makefile.in: Regenerate.
3449
3450 2012-12-07  Alan Modra  <amodra@gmail.com>
3451
3452         * options.h (General_options): Add no_toc_optimize.
3453         * powerpc.cc (ok_lo_toc_insn): New function.
3454         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
3455
3456 2012-12-06  Alan Modra  <amodra@gmail.com>
3457
3458         * options.h (General_options): Add plt_align, plt_static_chain,
3459         plt_thread_safe.  Update stub_group_size help text.
3460         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
3461         for new plt_thread_safe_ var.
3462         (use_plt_offset): Correct comments.
3463         (Target_powerpc::do_relax): Look for thread creation symbols to
3464         determine default plt_thread_safe value.  Clear plt call stubs
3465         as well as branch stubs each iteration.
3466         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
3467         insn constants.
3468         (l, hi, ha, write_insn): Move earlier.
3469         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
3470         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
3471         plt stubs too.
3472         (Stub_table::update_size): Adjust.
3473         (Stub_table::prev_size, set_prev_size): Delete.
3474         (Stub_table::stub_align): Let --plt-align affect result.
3475         (Stub_table::plt_call_size): Calculate sizes for various stubs.
3476         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
3477         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
3478         (Stub_table::do_write): Support more stub variants.
3479
3480 2012-12-04  Alan Modra  <amodra@gmail.com>
3481
3482         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
3483         (Target_powerpc::do_define_standard_symbols): New function.
3484
3485 2012-12-03  Alan Modra  <amodra@gmail.com>
3486
3487         * output.h: Formatting, whitespace.
3488
3489 2012-12-03  Alan Modra  <amodra@gmail.com>
3490
3491         * layout.h (Layout::get_executable_sections): Declare.
3492         * layout.cc (Layout::get_executable_sections): New function.
3493         * arm.cc (Target_arm::group_sections): Use it.
3494         (Arm_output_section::group_sections): Delete now redundant test.
3495         * output.cc (Output_reloc::Output_reloc): Add is_relative.
3496         param to handle relative relocs.
3497         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
3498         (Output_data_reloc::add_absolute): Adjust.
3499         (Output_data_reloc::add_relative): New function.
3500         (Output_data::reset_data_size): New function.
3501         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
3502         (Output_section::set_addralign): New function.
3503         (Output_section::checkpoint_set_addralign): New function.
3504         (Output_section::clear_section_offsets_need_adjustment): New function.
3505         (Output_section::input_sections): Make public.
3506         * powerpc.cc (class Output_data_brlt_powerpc): New.
3507         (class Stub_table, class Stub_control): New.
3508         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
3509         stub_table_, set_stub_table, stub_table): New vectors and accessor
3510         functions.
3511         (Target_powerpc::do_may_relax, do_relax, push_branch,
3512         new_stub_table, stub_tables, brlt_section, group_sections,
3513         add_branch_lookup_table, find_branch_lookup_table,
3514         write_branch_lookup_table, make_brlt_section): New functions.
3515         (Target_powerpc::struct Sort_sections, class Branch_info): New.
3516         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
3517         branch_info_): New vars.
3518         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
3519         make call stubs here.
3520         (Output_data_glink): Remove all call stub handling from this class.
3521         (Target_powerpc::Scan::local, global): Save interesting branch
3522         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
3523         (Target_powerpc::do_finalize_sections): Only make reg save/restore
3524         functions on final link.
3525         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
3526         Handle long branch destinations too.
3527         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
3528         do_plt_address_for_local): Adjust lookup of plt call stubs.
3529
3530 2012-11-30  Alan Modra  <amodra@gmail.com>
3531
3532         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
3533         relocs against protected symbols when building 32-bit shared libs.
3534
3535 2012-11-30  Alan Modra  <amodra@gmail.com>
3536
3537         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
3538         param.  Call got_section() to make .got.  Update all callers
3539         and their callers and so on.
3540
3541 2012-11-30  Alan Modra  <amodra@gmail.com>
3542
3543         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
3544         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
3545         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
3546         value if it already exists.
3547
3548 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
3549
3550         PR gold/14858
3551         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
3552
3553 2012-11-14  Roland McGrath  <mcgrathr@google.com>
3554
3555         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
3556         than bfc instruction for data sandboxing.
3557
3558 2012-11-08  Alan Modra  <amodra@gmail.com>
3559
3560         * po/POTFILES.in: Regenerate.
3561
3562 2012-11-05  Alan Modra  <amodra@gmail.com>
3563
3564         * configure.ac: Apply 2012-09-10 change to config.in here.
3565         * configure: Regenerate.
3566
3567 2012-11-05  Alan Modra  <amodra@gmail.com>
3568
3569         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
3570         (struct Opd_ent): Use "Address" rather than "Offset".
3571         (Output_data_got_powerpc::got_base_offset): Return Valtype.
3572         (Target_powerpc::got_section): Make public.
3573         (Target_powerpc::scan_relocs): Move code setting symbols..
3574         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
3575         Create _SDA_BASE_ only when referenced.
3576
3577 2012-11-02  Roland McGrath  <mcgrathr@google.com>
3578
3579         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
3580         from last change.
3581
3582 2012-11-01  Roland McGrath  <mcgrathr@google.com>
3583
3584         * target.h (Sized_target::relocate_relocs): Use Elf_Off
3585         for offset_in_output_section parameter.
3586         (Sized_target::relocate_special_relocatable): Likewise.
3587         * arm.cc (Target_arm::relocate_relocs): Likewise.
3588         (Target_arm::relocate_special_relocatable): Likewise.
3589         * i386.cc (Target_i386::relocate_relocs): Likewise.
3590         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
3591         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
3592         * target-reloc.h (relocate_relocs): Likewise.
3593         * testsuite/testfile.cc (Target_test): Likewise.
3594         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
3595         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
3596
3597         * system.h: Move inclusion of <clocale> to after <libintl.h> in
3598         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
3599
3600         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
3601         parameter, which is unused in the [!F_SETFD] case.
3602
3603         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
3604         SYMNDX to off_t before comparing it to this->data_size().
3605         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
3606         * incremental.cc (Output_section_incremental_inputs::do_write):
3607         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
3608
3609         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
3610
3611 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
3612
3613         * gold.cc (Target_arm::do_adjust_elf_header): Add the
3614         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
3615         in EABI_VER5.
3616
3617 2012-10-29  Cary Coutant  <ccoutant@google.com>
3618
3619         * dwp.cc (usage): Add file and exit status parameters;
3620         add --help and --version options.
3621         (print_version): New function.
3622         (main): Add --help and --version options.
3623
3624 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3625
3626         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
3627         final_layout_sequence.txt.
3628         * testsuite/Makefile.in: Regenerated.
3629
3630 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3631
3632         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
3633         COMPILE generated by automake.
3634         (LINK1): Likewise.
3635         (CXXCOMPILE1): Likewise.
3636         (CXXLINK1): Likewise.
3637         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
3638         (LINK): Likewise.
3639         (CXXCOMPILE): Likewise.
3640         (CXXLINK): Likewise.
3641         * testsuite/Makefile.in: Regenerated.
3642
3643 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3644
3645         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
3646         on bad fwrite return.
3647
3648 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
3649
3650         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
3651         on val.
3652
3653 2012-10-23  Cary Coutant  <ccoutant@google.com>
3654
3655         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
3656         * testsuite/Makefile.in: Regenerate.
3657         * testsuite/dwp_test.h: New source file.
3658         * testsuite/dwp_test_1.cc: New source file.
3659         * testsuite/dwp_test_1.s: New source file.
3660         * testsuite/dwp_test_1.sh: New source file.
3661         * testsuite/dwp_test_1b.cc: New source file.
3662         * testsuite/dwp_test_1b.s: New source file.
3663         * testsuite/dwp_test_2.cc: New source file.
3664         * testsuite/dwp_test_2.s: New source file.
3665         * testsuite/dwp_test_2.sh: New source file.
3666         * testsuite/dwp_test_main.cc: New source file.
3667         * testsuite/dwp_test_main.s: New source file.
3668
3669 2012-10-23  Cary Coutant  <ccoutant@google.com>
3670
3671         * dwp.h: New header file.
3672         * dwp.cc: New source file.
3673         * gold.h: Move shared declarations to system.h.
3674         * system.h: New header file.
3675         * Makefile.am: Add dwp.
3676         * Makefile.in: Regenerate.
3677
3678 2012-10-23  Cary Coutant  <ccoutant@google.com>
3679
3680         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
3681         Dwarf_info_reader::read_from_pointer.
3682         (Dwarf_pubnames_table::read_header): Likewise.
3683         (Dwarf_pubnames_table::next_name): Likewise.
3684         (Dwarf_die::read_attributes): Likewise.
3685         (Dwarf_die::skip_attributes): Likewise.
3686         (Dwarf_info_reader::read_from_pointer): New function template.
3687         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
3688         (Dwarf_pubnames_table): Likewise.
3689         (Dwarf_info_reader::read_from_pointer): New function template.
3690         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
3691         Dwarf_pubnames_table ctor.
3692
3693 2012-10-23  Cary Coutant  <ccoutant@google.com>
3694
3695         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
3696         abbrev_shndx.
3697         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
3698         abbrev_shndx_.
3699         (Dwarf_info_reader::set_abbrev_shndx): New method.
3700         (Dwarf_info_reader::abbrev_shndx_): New data member.
3701
3702 2012-10-23  Cary Coutant  <ccoutant@google.com>
3703
3704         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
3705         from object, not parameters.
3706         (Dwarf_info_reader::parse): Likewise.
3707         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
3708         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
3709         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
3710         methods.
3711
3712 2012-10-23  Cary Coutant  <ccoutant@google.com>
3713
3714         * fileread.cc (Input_file::Input_file): New constructor.
3715         * fileread.h (class Input_file): Add new constructor.
3716
3717 2012-10-18  Alan Modra  <amodra@gmail.com>
3718
3719         PR gold/14727
3720         * object.cc (Relobj::is_section_name_included): Also match
3721         .sdata personality section.
3722
3723 2012-10-18  Alan Modra  <amodra@gmail.com>
3724
3725         * target-reloc.h (class Default_comdat_behavior): New, package up..
3726         (get_comdat_behaviour): ..this.
3727         (relocate_section): Add Relocate_comdat_behavior template arg,
3728         adjust code to suit.
3729         * arm.cc (Target_arm::relocate_section): Adjust to suit.
3730         (Target_arm::scan_reloc_section): Likewise.
3731         * i386.cc (Target_i386::relocate_section): Likewise.
3732         * sparc.cc (Target_sparc::relocate_section): Likewise.
3733         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
3734         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
3735         * powerpc.cc (class Relocate_comdat_behavior): New.
3736         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
3737         gold::relocate_section with new template arg.
3738
3739 2012-10-18  Alan Modra  <amodra@gmail.com>
3740
3741         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
3742         dynamic relocs for GOT_TPREL got entries, without symbol if
3743         resolving locally.
3744         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
3745         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
3746         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
3747
3748 2012-10-17  Alan Modra  <amodra@gmail.com>
3749
3750         PR gold/14726
3751         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
3752
3753 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
3754
3755         * layout.cc (Layout::include_section): Keep sections marked
3756         SHF_EXCLUDE when doing relocatable links.
3757
3758 2012-10-16  Alan Modra  <amodra@gmail.com>
3759
3760         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
3761         (Target_powerpc::do_finalize_sections): Call it.
3762         (Output_data_save_res): New class and supporting functions.
3763         (Target_powerpc::symval_for_branch): Only look up .opd entry for
3764         normal symbols defined in object files.
3765
3766 2012-10-12  Alan Modra  <amodra@gmail.com>
3767
3768         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
3769         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
3770         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
3771         section if scan_opd_relocs not yet called.
3772         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
3773
3774 2012-10-12  Alan Modra  <amodra@gmail.com>
3775
3776         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3777         add_local_ifunc_entry): Revert last change.
3778         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
3779
3780 2012-10-05  Alan Modra  <amodra@gmail.com>
3781
3782         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
3783         do_plt_address_for_global): New functions.
3784         (Output_data_got_powerpc::do_write): Don't segfault when linking
3785         statically.
3786         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
3787         add_local_ifunc_entry): Return true on adding entry..
3788         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
3789         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
3790         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
3791         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
3792         set up symbols here.
3793         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
3794         syms here.  Do so even when no .iplt.  Don't segfault when linking
3795         statically.
3796         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
3797         new variants without reloc param.
3798         (Glink_sym_ent::Glink_sym_ent): Likewise.
3799         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
3800         reloc when refs will resolve to plt call stub.
3801         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
3802         R_PPC_PLTREL24 to resolve locally.
3803         (Target_powerpc::Scan::global): Correct ifunc handling.
3804         (Target_powerpc::Relocate::relocate): Correct local sym glink
3805         lookup.  Don't destroy "value" when we have a plt call stub,
3806         and when checking plt call validity.
3807         (Target_powerpc::do_dynsym_value): Simplify.
3808
3809 2012-10-05  Alan Modra  <amodra@gmail.com>
3810
3811         * i386.cc (Output_data_plt_i386::address_for_global,
3812         address_for_local): Add plt offset to returned value.  Adjust uses.
3813         * sparc.cc (Output_data_plt_sparc::address_for_global,
3814         address_for_local): Likewise.
3815         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
3816         address_for_local): Likewise.
3817         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
3818         address_for_local): Likewise.
3819         * target.h (Target::plt_address_for_global, plt_address_for_local):
3820         Update comment.
3821         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
3822         (Output_data_got::Got_entry::write): Nor here.
3823         * output.h: Comment fix.
3824
3825 2012-10-02  Jiong Wang  <jiwang@tilera.com>
3826
3827         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
3828         global_offset_table_ value for larget got.
3829         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
3830
3831 2012-09-29  Alan Modra  <amodra@gmail.com>
3832
3833         * powerpc.cc (Target_powerpc::iplt_): New output section.
3834         (Target_powerpc::iplt_section, make_iplt_section,
3835         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
3836         (Target_powerpc::make_plt_entry): Handle ifunc syms.
3837         Target_powerpc::plt_entry_count): Count iplt entries too.
3838         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
3839         reloc section in constructor.  New params.
3840         (Target_powerpc::make_plt_section): Create reloc section here instead.
3841         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
3842         functions.
3843         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
3844         (Output_data_glink::add_entry, find_entry): New functions to
3845         deal with local syms.
3846         (Glink_sym_ent): Add support for local syms.
3847         (Output_data_glink::do_write): Handle ifunc plt entries.
3848         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
3849         (Target_powerpc::Scan::local, global): Handle ifunc syms.
3850         (Target_powerpc::Relocate::relocate): Likewise.
3851         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
3852
3853 2012-09-25  Alan Modra  <amodra@gmail.com>
3854
3855         * object.h (Sized_relobj_file::adjust_local_symbol,
3856         do_adjust_local_symbol): New functions.
3857         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
3858         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
3859         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
3860         and irregular opd entry spacing.
3861         (Powerpc_relobj::do_read_relocs): Add opd size checks.
3862         (Global_symbol_visitor_opd): New functor.
3863         (Target_powerpc::do_finalize_sections): Omit global symbols defined
3864         on deleted opd entries.
3865
3866 2012-09-15  Jiong Wang  <jiwang@tilera.com>
3867
3868         * tilegx.cc: New file.
3869         * Makefile.am (TARGETSOURCES): Add tilegx.cc
3870         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
3871         * configure.tgt: Add entries for tilegx*.
3872         * configure.ac: Likewise.
3873         * Makefile.in: Rebuild.
3874         * configure: Likewise.
3875         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
3876         tilegx.
3877
3878 2012-09-13  Alan Modra  <amodra@gmail.com>
3879
3880         * target-reloc.h (scan_relocs): Call scan.local for relocs
3881         against symbols in discarded sections.  Pass is_discarded
3882         param.
3883         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
3884         Add is_discarded param.
3885         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
3886         is_discarded to flag opd entry as discarded.  Don't emit dyn
3887         relocs on such entries.
3888         (Target_powerpc::Scan::global): Similarly detect and handle
3889         such opd entries.
3890         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
3891         opd_ent_.  Update all uses.
3892         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
3893         (Target_powerpc::relocate_section): Zero out discarded opd
3894         entry relocs.
3895
3896 2012-09-12  Ian Lance Taylor  <iant@google.com>
3897
3898         PR gold/14570
3899         * output.cc: Rename Output_data_got template parameter from size
3900         to got_size for all functions.  Compile all variants of
3901         Output_data_got.
3902         (Output_data_got::Got_entry::write): Correct use of size for
3903         symbol value.  Use local_is_tls rather than casting to
3904         Sized_relobj_file.
3905         * object.h (class Object): Add local_is_tls and do_local_is_tls.
3906         (class Sized_relobj_file): Add do_local_is_tls.
3907         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
3908
3909 2012-09-11  Alan Modra  <amodra@gmail.com>
3910
3911         PR gold/14566
3912         * layout.cc (Layout::set_segment_offsets): When using
3913         common-page-size alignment, ensure we are on a new max-page-size
3914         page.
3915         * output.cc (Output_segment::set_section_addresses): Use
3916         abi_pagesize, not common_pagesize for relro boundary.
3917         (Output_segment::set_offset): Likewise.
3918
3919 2012-09-11  Alan Modra  <amodra@gmail.com>
3920
3921         * output.h (Output_data_got::add_global_tls, add_local_tls,
3922         add_local_tls_pair): New functions.
3923         (Output_data_got::add_local_pair_with_rel): Remove second
3924         reloc param.  Expand comment.
3925         (Output_data_got::Got_entry): Rename use_plt_offset_ to
3926         use_plt_or_tls_offset_, similarly for constructor param.
3927         (Output_data_got::Got_entry::write): Add got_index param.
3928         * output.cc (Output_data_got::add_global_tls, add_local_tls,
3929         add_local_tls_pair): New functions.
3930         (Output_data_got::Got_entry::write): Handle tls symbols
3931         with use_plt_or_tls_offset_ set specially.
3932         (Output_data_got::add_local_pair_with_rel): Only one reloc.
3933         (Output_data_got::do_write): Replace iterator with index, pass
3934         index to entry write function.
3935         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
3936         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
3937         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
3938         call.
3939         * i386.cc (Target_i386::Scan::local): Likewise.
3940         * sparc.cc (Target_sparc::Scan::local): Likewise.
3941         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
3942         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
3943         do_tls_offset_for_global): New functions.
3944         (Target_powerpc::Scan::local): Correct TLS relocations and got
3945         entry values.
3946         (Target_powerpc::Scan::global): Don't emit unnecessary
3947         dynamic relocations on TLS GOT entries.
3948
3949 2012-09-10  Matthias Klose  <doko@ubuntu.com>
3950
3951         * config.in: Disable sanity check for kfreebsd.
3952
3953 2012-09-10  Sterling Augustine  <saugustine@google.com>
3954
3955         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
3956         (Gdb_index::pubtypes_read): New parameter.
3957         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
3958         to calls.
3959         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
3960         pubtypes_object_.
3961
3962 2012-09-09  Alan Modra  <amodra@gmail.com>
3963
3964         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
3965         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
3966         * gc.h (gc_process_relocs): Call target gc_add_reference.
3967         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
3968         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
3969         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
3970         unnecessary cast.
3971         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
3972         to cater for when we don't need code offset.  Update use.
3973         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
3974         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
3975         set_opd_valid): New functions.
3976         (Target_powerpc::do_gc_add_reference): New function.
3977         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
3978         stashed refs.
3979         (Target_powerpc::do_gc_mark_symbol): New function.
3980
3981 2012-09-06  Cary Coutant  <ccoutant@google.com>
3982
3983         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
3984         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
3985         (Dwarf_die::skip_attributes): Likewise.
3986         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
3987         * testsuite/gdb_index_test.cc (inline_func_1): New function.
3988         (main): Call it.
3989         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
3990
3991 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
3992
3993         * testsuite/script_test_3.t: Add .got.plt output section
3994         statement.
3995         * testsuite/script_test_4.t: Likewise.
3996
3997 2012-09-05  Alan Modra  <amodra@gmail.com>
3998
3999         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
4000         update all uses and lose "enum" when using type.
4001
4002 2012-09-05  Alan Modra  <amodra@gmail.com>
4003
4004         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
4005         * configure: Regenerate.
4006         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
4007         (plugin_final_layout.stdout): Likewise.
4008         (memory_test): Set page sizes to 0x1000.
4009         * testsuite/Makefile.in: Regenerate.
4010         * testsuite/discard_locals_test.sh: Add FIXME comment.
4011         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
4012         * testsuite/pr14265.t: Add .got output section statement.
4013         * testsuite/script_test_2.t: Likewise.
4014         * testsuite/script_test_3.t: Likewise.
4015         * testsuite/script_test_4.t: Likewise.
4016         * testsuite/script_test_5.t: Likewise.
4017         * testsuite/script_test_6.t: Likewise.
4018         * testsuite/script_test_7.t: Likewise.
4019         * testsuite/script_test_9.t: Likewise.
4020
4021 2012-09-05  Alan Modra  <amodra@gmail.com>
4022
4023         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
4024         (Powerpc_relocate_functions::Status): New typedef.
4025         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4026         (Target_powerpc::Scan::local): Handle REL64.
4027         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
4028         for REL32 and REL64.
4029         (Target_powerpc::symval_for_branch): New function, extracted from..
4030         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
4031         checks.  Report overflow errors.
4032
4033 2012-09-05  Alan Modra  <amodra@gmail.com>
4034
4035         * object.h (Sized_relobj_file::emit_relocs): Delete.
4036         (Sized_relobj_file::emit_relocs_reltype): Delete.
4037         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
4038         relocate_relocs for --emit-relocs.
4039         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
4040         * output.h: Update comment.
4041         (Output_segment::first_section): New function.
4042         (Output_segment::first_section_load_address): Use first_section.
4043         * output.cc (Output_segment::first_section): New function extracted..
4044         (Output_segment::first_section_load_address): ..from here.  Delete.
4045         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
4046         * target.h (Sized_target::relocate_for_relocatable): Likewise.
4047         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
4048         adjust call to target.h function.
4049         * i386.cc (Target_i386): Likewise.
4050         * sparc.cc (Target_sparc): Likewise.
4051         * x86_64.cc (Target_x86_64): Likewise.
4052         * powerpc.cc (Target_powerpc): Likewise.
4053         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
4054         first tls section has section symbol for optimised local dynamic
4055         output relocs.
4056         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
4057         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
4058         optimised tls code.
4059         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
4060         Rename to relocate_relocs.  Update error message.
4061
4062 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
4063
4064         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
4065         --just-symbols.
4066
4067 2012-08-31  Alan Modra  <amodra@gmail.com>
4068
4069         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
4070         (Powerpc_relobj::toc_base_offset): New stub function.
4071         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
4072         got_mod_index_offset to tlsld_got_offset.  Update all refs.
4073         (Target_powerpc::Relocate::enum skip_tls): New.
4074         (Target_powerpc::call_tls_get_addr_): New var.
4075         (Target_powerpc::is_branch_reloc): Move to file scope.
4076         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
4077         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
4078         New functions.
4079         (Target_powerpc::enum Got_type): Delete old values, add new ones.
4080         (powerpc_info): Correct common_pagesize for ppc64.
4081         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
4082         (Powerpc_relocate_functions): Add overflow check enums and functions.
4083         Add non-shift version of rela, rela_ua.  Delete all rel public
4084         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
4085         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
4086         addr16_ha3, addr14 functions.
4087         (Output_data_got_powerpc::add_constant_pair): New function.
4088         (Output_data_got_powerpc::got_base_offset): Likewise.
4089         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
4090         (instruction constants): Sort, add some more.
4091         (Output_data_glink::do_write): Add and use Address typedef.  Use
4092         object->toc_base_offset() stub for 64-bit.
4093         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
4094         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
4095         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
4096         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
4097         Always treat .opd relocs as against locally defined symbol.
4098         Correct condition for RELATIVE relocs.
4099         (Target_powerpc::do_finalize_sections): Test for NULL sections.
4100         (Target_powerpc::Relocate::relocate): Use plt call stub as value
4101         for 32-bit syms with a plt entry.  Correct ppc64 toc base
4102         calculations.  Handle TLS relocs, and more.  Add overflow
4103         checking and adjust for Powerpc_relocate_functions changes.
4104         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
4105         Reinstate --emit-relocs code with FIXME.
4106
4107 2012-08-30  Alan Modra  <amodra@gmail.com>
4108
4109         * layout.cc (Layout::set_segment_offsets): Set p_align to
4110         abi_pagesize, not common_pagesize.
4111         (Layout::relaxation_loop_body): Similarly use abi_pagesize
4112         to determine whether file header can go in segment.
4113
4114 2012-08-30  Alan Modra  <amodra@gmail.com>
4115
4116         * output.h (Output_reloc::Output_reloc <output section>): Add
4117         is_relative param.  Adjust calls.
4118         (Output_reloc::add_output_section_relative): New functions.
4119         * output.cc (Output_reloc::Output_reloc <output section>): Handle
4120         is_relative.
4121         (Output_reloc::symbol_value): Handle SECTION_CODE.
4122
4123 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
4124
4125         * gold.cc (queue_middle_tasks): Call layout again when unique
4126         segments for sections is desired.
4127         * layout.cc (Layout::Layout): Initialize new members.
4128         (Layout::get_output_section_flags): New function.
4129         (Layout::choose_output_section): Call get_output_section_flags.
4130         (Layout::layout): Make output section for mapping to a unique segment.
4131         (Layout::insert_section_segment_map): New function.
4132         (Layout::attach_allocated_section_to_segment): Make unique segment for
4133         output sections marked so.
4134         (Layout::segment_precedes): Check for unique segments when sorting.
4135         * layout.h (Layout::Unique_segment_info): New struct.
4136         (Layout::Section_segment_map): New typedef.
4137         (Layout::insert_section_segment_map): New function.
4138         (Layout::get_output_section_flags): New function.
4139         (Layout::is_unique_segment_for_sections_specified): New function.
4140         (Layout::set_unique_segment_for_sections_specified): New function.
4141         (Layout::unique_segment_for_sections_specified_): New member.
4142         (Layout::section_segment_map_): New member.
4143         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
4144         Rename is_gc_pass_one to is_pass_one.
4145         Rename is_gc_pass_two to is_pass_two.
4146         Rename is_gc_or_icf to is_two_pass.
4147         Check for which pass based on whether symbols data is present.
4148         Make it two pass when unique segments for sections is desired.
4149         * output.cc (Output_section::Output_section): Initialize new
4150         members.
4151         * output.h (Output_section::is_unique_segment): New function.
4152         (Output_section::set_is_unique_segment): New function.
4153         (Output_section::is_unique_segment_): New member.
4154         (Output_section::extra_segment_flags): New function.
4155         (Output_section::set_extra_segment_flags): New function.
4156         (Output_section::extra_segment_flags_): New member.
4157         (Output_section::segment_alignment): New function.
4158         (Output_section::set_segment_alignment): New function.
4159         (Output_section::segment_alignment_): New member.
4160         (Output_segment::Output_segment): Initialize is_unique_segment_.
4161         (Output_segment::is_unique_segment): New function.
4162         (Output_segment::set_is_unique_segment): New function.
4163         (Output_segment::is_unique_segment_): New member.
4164         * plugin.cc (allow_unique_segment_for_sections): New function.
4165         (unique_segment_for_sections): New function.
4166         (Plugin::load): Add new functions to transfer vector.
4167         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
4168         * Makefile.in: Regenerate.
4169         * testsuite/plugin_final_layout.sh: Check if unique segment
4170         functionality works.
4171         * testsuite/plugin_section_order.c (onload): Check if new interfaces
4172         are available.
4173         (allow_unique_segment_for_sections): New global.
4174         (unique_segment_for_sections): New global.
4175         (claim_file_hook): Call allow_unique_segment_for_sections.
4176         (all_symbols_read_hook): Call unique_segment_for_sections.
4177
4178 2012-08-22  Cary Coutant  <ccoutant@google.com>
4179
4180         * layout.cc (Layout::include_section): Don't assert on GROUP
4181         sections with --emit-relocs.
4182
4183 2012-08-21  Cary Coutant  <ccoutant@google.com>
4184
4185         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
4186         if --export-dynamic-symbol names an undef symbol.
4187
4188 2012-08-18  Alan Modra  <amodra@gmail.com>
4189
4190         * powerpc.cc: Formatting and white space.
4191         (Powerpc_relobj): Rename got2_section_ to special_.
4192         Add opd_ent_shndx_ and opd_ent_off_ vectors.
4193         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
4194         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
4195         (Target_powerpc): Add Address typedef and invalid_address.  Use
4196         throughout.
4197         (Target_powerpc::is_branch_reloc): New function.
4198         (Powerpc_relocate_functions): Add Address typedef, use throughout.
4199         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
4200         for dst_mask, value and addend.
4201         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
4202         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
4203         (Output_data_glink::do_write): Correct toc base.  Don't try to use
4204         uint16_t for 24-bit offset.  Use get_output_section_offset and
4205         check return.
4206         (Target_powerpc::Scan::local): Handle more relocs.
4207         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
4208         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
4209         Plug in toc restoring insn after plt calls.  Translate branches
4210         to function descriptor symbols to corresponding entry point.
4211         (Target_powerpc::relocate_for_relocatable): Check return from
4212         get_output_section_offset.
4213         * symtab.h: Comment typo.
4214
4215 2012-08-14  Ian Lance Taylor  <iant@google.com>
4216
4217         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
4218         unsupported_relocal_local to call unsupported_reloc_global.
4219
4220 2012-08-14  Nick Clifton  <nickc@redhat.com>
4221
4222         PR ld/14265
4223         * script-sections.cc (Sections_element::output_section_name): Add
4224         keep return parameter.
4225         (Output_section_element::match_name): Add keep return parameter.
4226         Return the value of the keep_ member.
4227         * script-sections.h (class Output_section): Update
4228         output_section_name prototype.
4229         * layout.cc (Layout::keep_input_section): New public member
4230         function.
4231         (Layout::choose_output_section): Pass keep parameter to
4232         output_section_name.
4233         * layout.h (class Layout): Add keep_input_section.
4234         * object.cc (Sized_relobj_file::do_layout): Check for kept input
4235         sections.
4236         * testsuite/Makefile.am: Add a test.
4237         * testsuite/Makefile.in: Regenerate.
4238         * testsuite/pr14265.c: Source file for the test.
4239         * testsuite/pr14265.t: Linker script for the test.
4240         * testsuite/pr14265.sh: Shell script for the test.
4241
4242 2012-08-14  Alan Modra  <amodra@gmail.com>
4243
4244         * target.h (Target::output_section_name): New function.
4245         (Target::do_output_section_name): New function.
4246         * layout.cc (Layout::choose_output_section): Call the above.
4247         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
4248
4249 2012-08-14  Alan Modra  <amodra@gmail.com>
4250
4251         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
4252         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
4253         for replace_constant call.
4254         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
4255         (Output_data_glink::do_print_to_mapfile): New function.
4256         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
4257         (Target_powerpc::Relocate::relocate): Likewise.
4258
4259 2012-08-14  Alan Modra  <amodra@gmail.com>
4260
4261         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
4262         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
4263         (Output_data_glink::add_entry,find_entry): Remove shndx param.
4264         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
4265         all references to shndx_.  Handle special case for R_PPC_PLTREL24
4266         here.
4267         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
4268         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
4269         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
4270         here.
4271         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
4272         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
4273
4274 2012-08-12  Alan Modra  <amodra@gmail.com>
4275
4276         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
4277         (glink insn constants): Use uint32_t.
4278         (Output_data_glink::add_entry): Use insert, not [] operator.
4279
4280 2012-08-11  Alan Modra  <amodra@gmail.com>
4281
4282         * object.h (Sized_relobj_file::find_shdr): New function.
4283         (Sized_relobj_file::find_special_sections): New function.
4284         * object.cc (Sized_relobj_file::find_shdr): New function.
4285         (Sized_relobj_file::find_eh_frame): Use find_shdr.
4286         (Sized_relobj_file::find_special_sections): New function, split out..
4287         (Sized_relobj_file::do_read_symbols): ..from here.
4288         * output.h (Output_data_got::replace_constant): New function.
4289         (Output_data_got::num_entries): New function.
4290         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
4291         (Output_data_got::got_offset): Protected rather than private.
4292         (Output_data_got::replace_got_entry): New function.
4293         * output.cc (Output_data_got::replace_got_entry): New function.
4294         * powerpc.cc (class Powerpc_relobj): New.
4295         (class Powerpc_relocate_functions): Delete all psymval variants or
4296         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
4297         Implement _ha functions using corresponding _hi function.
4298         (Powerpc_relobj::find_special_sections): New function.
4299         (Target_powerpc::do_make_elf_object): New function.
4300         (class Output_data_got_powerpc): New.
4301         (class Output_data_glink): New.
4302         (class Powerpc_scan_relocatable_reloc): New.
4303         Many more changes througout file.
4304
4305 2012-08-09  Nick Clifton  <nickc@redhat.com>
4306
4307         * po/vi.po: Updated Vietnamese translation.
4308
4309 2012-08-07  Ian Lance Taylor  <iant@google.com>
4310
4311         * layout.cc (Layout::add_target_dynamic_tags): If
4312         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
4313         plt_rel.
4314
4315 2012-07-30  Nick Clifton  <nickc@redhat.com>
4316
4317         * po/gold.pot: Updated template.
4318         * po/es.po: Updated Spanish translation.
4319
4320 2012-07-18  Cary Coutant  <ccoutant@google.com>
4321
4322         PR gold/14344
4323         * configure.ac: Add check for -gpubnames support.
4324         * configure: Regenerate.
4325         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
4326         support; force -gno-pubnames.
4327         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
4328         support.
4329         (gdb_index_test_4): New test.
4330         * testsuite/Makefile.in: Regenerate.
4331         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
4332         * testsuite/gdb_index_test_2.sh: Likewise.
4333         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
4334         * testsuite/gdb_index_test_4.sh: New script.
4335         * testsuite/gdb_index_test_comm.sh: New script with common code;
4336         don't look for space after colon.
4337
4338 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
4339
4340         * gold.cc (queue_middle_tasks): Update function order only after
4341         deferred objects due to plugins are processed.
4342
4343 2012-07-11  Ian Lance Taylor  <iant@google.com>
4344
4345         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
4346         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
4347         (Target_arm::scan_reloc_for_stub): Likewise.
4348         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
4349         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
4350         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
4351         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
4352         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
4353
4354 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
4355             Ian Lance Taylor  <iant@google.com>
4356
4357         PR gold/14309
4358         * configure.ac: Test whether std::tr1::hash<off_t> works.
4359         * gold.h: Add a specialization for std::tr1::hash<off_t> if
4360         needed.
4361         * output.h (class Output_fill): Add virtual destructor.
4362         * configure, config.in: Rebuild.
4363
4364 2012-06-22  Roland McGrath  <mcgrathr@google.com>
4365
4366         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
4367
4368 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
4369
4370         * plugin.cc (Plugin::load): Handle position independent executables.
4371
4372 2012-06-06  Cary Coutant  <ccoutant@google.com>
4373
4374         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
4375         add .debug_macro.
4376         (lines_only_debug_sections): Likewise.
4377         (gdb_fast_lookup_sections): New static array.
4378         (is_gdb_debug_section): Rename formal parameter.
4379         (is_lines_only_debug_section): Likewise.
4380         (is_gdb_fast_lookup_section): New function.
4381         (Layout::include_section): Check for ".zdebug_" prefix; pass
4382         section name suffix to is_gdb_debug_section, et al.; check for
4383         fast-lookup sections when building .gdb_index.
4384         * options.h (--strip-debug-gdb): Update GDB version number.
4385
4386 2012-06-06  Cary Coutant  <ccoutant@google.com>
4387
4388         * configure.ac: Add check for fallocate.
4389         * configure: Regenerate.
4390         * config.in: Regenerate.
4391
4392         * options.h (class General_options): Add --mmap-output-file and
4393         --posix-fallocate options.
4394         * output.cc: (posix_fallocate): Remove; replace with...
4395         (gold_fallocate): New function.
4396         (Output_file::map_no_anonymous): Call gold_fallocate.
4397         (Output_file::map): Check --mmap-output-file option.
4398
4399 2012-06-05  Jing Yu  <jingyu@google.com>
4400
4401         * gold.h (textdomain): Add do {} to empty while(0).
4402         (bindtextdomain): Likewise.
4403
4404 2012-06-04  Cary Coutant  <ccoutant@google.com>
4405
4406         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
4407         has_dynsym_index.
4408
4409 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
4410
4411         * symtab.cc (Symbol_table::define_special_symbol):
4412         Initialize *poldsym to prevent uninitialized variable errors.
4413
4414 2012-05-23  Cary Coutant  <ccoutant@google.com>
4415
4416         * layout.cc (Layout::section_name_mapping): Add rules to handle
4417         exact match on .data.rel.ro.local or .data.rel.ro.
4418         (Layout::output_section_name): Check for exact matches.
4419
4420 2012-05-23  Cary Coutant  <ccoutant@google.com>
4421
4422         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
4423         more carefully.
4424
4425 2012-05-22  Cary Coutant  <ccoutant@google.com>
4426
4427         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
4428         object before exporting symbol.
4429
4430 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
4431
4432         * testsuite/tls_test.cc: Include "config.h" first.
4433         * testsuite/tls_test_c.c: Likewise.
4434
4435 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
4436             Nick Clifton  <nickc@redhat.com>
4437
4438         PR 14072
4439         * configure.in: Add check that sysdep.h has been included before
4440         any system header files.
4441         * configure: Regenerate.
4442         * config.in: Regenerate.
4443
4444 2012-05-14  Cary Coutant  <ccoutant@google.com>
4445
4446         * layout.cc (Layout::make_output_section): Mark .tdata section
4447         as RELRO.
4448         * testsuite/relro_test.cc: Add a TLS variable.
4449
4450 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
4451
4452         PR gold/14091
4453         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
4454         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
4455         R_X86_64_64.
4456
4457 2012-05-08  Cary Coutant  <ccoutant@google.com>
4458
4459         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
4460         (lines_only_debug_sections): Likewise.
4461
4462 2012-05-02  Roland McGrath  <mcgrathr@google.com>
4463
4464         * nacl.cc: New file.
4465         * nacl.h: New file.
4466         * Makefile.am (CCFILES, HFILES): Add them.
4467         * Makefile.in: Regenerate.
4468         * i386.cc (Output_data_plt_i386_nacl): New class.
4469         (Output_data_plt_i386_nacl_exec): New class.
4470         (Output_data_plt_i386_nacl_dyn): New class.
4471         (Target_i386_nacl): New class.
4472         (Target_selector_i386_nacl): New class.
4473         (target_selector_i386): Use it instead of Target_selector_i386.
4474         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
4475         (Target_x86_64_nacl): New class.
4476         (Target_selector_x86_64_nacl): New class.
4477         (target_selector_x86_64, target_selector_x32): Use it instead of
4478         Target_selector_x86_64.
4479         * arm.cc (Output_data_plt_arm_nacl): New class.
4480         (Target_arm_nacl): New class.
4481         (Target_selector_arm_nacl): New class.
4482         (target_selector_arm, target_selector_armbe): Use it instead of
4483         Target_selector_arm.
4484
4485         * target-select.cc (select_target): Take new Input_file* and off_t
4486         arguments, pass them on to recognize method of selector.
4487         * object.cc (make_elf_sized_object): Update caller.
4488         * parameters.cc (parameters_force_valid_target): Likewise.
4489         * incremental.cc (make_sized_incremental_binary): Likewise.
4490         * target-select.h: Update decl.
4491         (Target_selector::recognize): Take new Input_file* argument,
4492         pass it on to do_recognize.
4493         (Target_selector::do_recognize): Take new Input_file* argument.
4494         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
4495         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
4496         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
4497         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
4498
4499         * target.h (Target::Target_info): New members isolate_execinstr
4500         and rosegment_gap.
4501         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
4502         * arm.cc (Target_arm::arm_info): Update initializer.
4503         * i386.cc (Target_i386::i386_info): Likewise.
4504         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
4505         * sparc.cc (Target_sparc::sparc_info): Likewise.
4506         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
4507         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
4508         * layout.cc (Layout::attach_allocated_section_to_segment):
4509         Take new const Target* argument.  If target->isolate_execinstr(), act
4510         like --rosegment.
4511         (Layout::find_first_load_seg): Take new const Target* argument;
4512         if target->isolate_execinstr(), reject PF_X segments.
4513         (Layout::relaxation_loop_body): Update caller.
4514         (Layout::set_segment_offsets): If target->isolate_execinstr(),
4515         reset file offset to zero when we hit LOAD_SEG, and then do a second
4516         loop over the segments before LOAD_SEG to reassign offsets after
4517         addresses have been determined.  Handle target->rosegment_gap().
4518         (Layout::attach_section_to_segment): Take new const Target* argument;
4519         pass it to attach_allocated_section_to_segment.
4520         (Layout::make_output_section): Update caller.
4521         (Layout::attach_sections_to_segments): Take new const Target* argument;
4522         pass it to attach_section_to_segment.
4523         * gold.cc (queue_middle_tasks): Update caller.
4524         * layout.h (Layout): Update method decls with new arguments.
4525
4526         * arm.cc (Target_arm::Target_arm): Take optional argument for the
4527         Target_info pointer to use.
4528         (Target_arm::do_make_data_plt): New virtual method.
4529         (Target_arm::make_data_plt): New method that calls it.
4530         (Target_arm::make_plt_entry): Use it.
4531         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
4532         for the section alignment.
4533         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
4534         method.
4535         (Output_data_plt_arm::first_plt_entry_offset): Call it.
4536         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
4537         method.
4538         (Output_data_plt_arm::get_plt_entry_size): Call it.
4539         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
4540         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
4541         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
4542         method.
4543         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
4544         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
4545         method instead of sizeof(plt_entry).
4546         (Output_data_plt_arm::add_entry): Likewise.
4547         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
4548         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
4549         than static method.
4550         (Target_arm::plt_entry_size): Likewise.
4551         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
4552         Move to ...
4553         (Output_data_plt_arm_standard): ... here, new class.
4554         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
4555         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
4556         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
4557
4558         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4559         Take additional argument for the PLT entry size.
4560         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
4561         Use get_plt_entry_size method rather than plt_entry_size variable.
4562         (Output_data_plt_x86_64::reserve_slot): Likewise.
4563         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
4564         (Output_data_plt_x86_64::add_entry): Likewise.
4565         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
4566         (Output_data_plt_x86_64::address_for_global): Likewise.
4567         (Output_data_plt_x86_64::address_for_local): Likewise.
4568         (Output_data_plt_x86_64::set_final_data_size): Likewise.
4569         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
4570         Make method non-static.
4571         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
4572         method.
4573         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
4574         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
4575         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
4576         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
4577         virtual method.
4578         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
4579         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
4580         virtual method.
4581         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
4582         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
4583         virtual method.
4584         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
4585         (Output_data_plt_x86_64::plt_entry_size)
4586         (Output_data_plt_x86_64::first_plt_entry)
4587         (Output_data_plt_x86_64::plt_entry)
4588         (Output_data_plt_x86_64::tlsdesc_plt_entry)
4589         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
4590         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
4591         (Output_data_plt_x86_64_standard): ... here, new class.
4592         (Target_x86_64::Target_x86_64): Take optional argument for the
4593         Target_info pointer to use.
4594         (Target_x86_64::do_make_data_plt): New virtual method.
4595         (Target_x86_64::make_data_plt): New method to call it.
4596         (Target_x86_64::init_got_plt_for_update): Use that.
4597         Call this->plt_->add_eh_frame method here.
4598         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
4599         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
4600         rather than static method.
4601         (Target_x86_64::plt_entry_size): Likewise.
4602         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
4603         rather than plt_entry_size variable.  Move guts of PLT filling to...
4604         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
4605         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
4606         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
4607
4608         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
4609         additional argument for the section alignment.
4610         Don't do add_eh_frame_for_plt here.
4611         (Output_data_plt_i386::first_plt_entry_offset): Make the method
4612         non-static.  Use get_plt_entry_size method rather than plt_entry_size
4613         variable.
4614         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
4615         method.
4616         (Output_data_plt_i386::get_plt_entry_size): Call it.
4617         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
4618         (Output_data_plt_i386::add_eh_frame): New method to call it.
4619         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
4620         method.
4621         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
4622         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
4623         method.
4624         (Output_data_plt_i386::fill_plt_entry): New method to call it.
4625         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
4626         method instead of plt_entry_size.
4627         (Output_data_plt_i386::plt_entry_size)
4628         (Output_data_plt_i386::plt_eh_frame_fde_size)
4629         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
4630         (Output_data_plt_i386_standard): ... here, new class.
4631         (Output_data_plt_i386_exec): New class.
4632         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
4633         (Output_data_plt_i386_exec::first_plt_entry): ... here.
4634         (Output_data_plt_i386::exec_plt_entry): Move to ...
4635         (Output_data_plt_i386_exec::plt_entry): ... here.
4636         (Output_data_plt_i386_dyn): New class.
4637         (Output_data_plt_i386::first_plt_entry): Move to ...
4638         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
4639         (Output_data_plt_i386::dyn_plt_entry): Move to ...
4640         (Output_data_plt_i386_dyn::plt_entry): ... here.
4641         (Target_i386::Target_i386): Take optional argument for the Target_info
4642         pointer to use.
4643         (Target_i386::do_make_data_plt): New virtual method.
4644         (Target_i386::make_data_plt): New method to call it.
4645         (Target_i386::make_plt_section): Use that.
4646         Call this->plt_->add_eh_frame method here.
4647         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
4648         rather than plt_entry_size variable.
4649         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
4650         (Output_data_plt_i386::address_for_local): Likewise.
4651         (Output_data_plt_i386::do_write): Likewise.
4652         Move guts of PLT filling to...
4653         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
4654         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
4655         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
4656         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
4657
4658 2012-05-01  Cary Coutant  <ccoutant@google.com>
4659
4660         * dwarf_reader.cc (Dwarf_die::read_attributes)
4661         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
4662         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
4663         * reduced_debug_output.cc
4664         (Output_reduced_debug_info_section::get_die_end): Remove
4665         DW_FORM_GNU_ref_index.  Add default case.
4666
4667 2012-04-26  Mark Wielaard  <mjw@redhat.com>
4668
4669         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
4670         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
4671         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
4672         DW_AT_high_pc as offset from DW_AT_low_pc.
4673
4674         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
4675         * testsuite/Makefile.in: Regenerate.
4676         * testsuite/gdb_index_test_3.c: New test source file.
4677         * testsuite/gdb_index_test_3.sh: New test source file.
4678
4679 2012-04-25  Ian Lance Taylor  <iant@google.com>
4680
4681         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
4682         pointer.
4683         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
4684         as a class, not a struct.
4685         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
4686         (Target_arm::apply_cortex_a8_workaround): Likewise.
4687         * gc.h: Declare Reloc_types as a struct, not a class.
4688         * object.h: Declare Symbols_data as a struct.
4689         * reloc.h: Declare Read_relocs_data as a struct.
4690         * target.h: Declare Relocate_info as a struct.
4691
4692 2012-04-24  David S. Miller  <davem@davemloft.net>
4693
4694         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
4695         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
4696         and R_SPARC_WPLT30.
4697
4698 2012-04-24  Cary Coutant  <ccoutant@google.com>
4699
4700         * incremental-dump.cc (find_input_containing_global): Replace
4701         magic number with symbolic constant.
4702         (dump_incremental_inputs): Update version number.
4703         * incremental.cc (Output_section_incremental_inputs): Update version
4704         number; import symbolic constants from Incremental_inputs_reader.
4705         (Incremental_inputs::create_data_sections): Align relocations
4706         section correctly for 64-bit targets.
4707         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
4708         constants; add padding.
4709         (Output_section_incremental_inputs::write_header): Add assert for
4710         header_size.
4711         (Output_section_incremental_inputs::write_input_files): Add assert
4712         for input_entry_size.
4713         (Output_section_incremental_inputs::write_info_blocks): Add padding;
4714         add assert for object_info_size, input_section_entry_size,
4715         global_sym_entry_size.
4716         * incremental.h (Incremental_inputs_reader): Add symbolic constants
4717         for data structure sizes; use them.
4718         (Incremental_input_entry_reader): Import symbolic constants from
4719         Incremental_inputs_reader; use them.
4720
4721 2012-04-23  David S. Miller  <davem@davemloft.net>
4722
4723         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
4724         and elf_flags_set_.
4725         (Target_sparc::Target_sparc): Initialize new fields.
4726         (Target_sparc::do_make_elf_object): New function.
4727         (Target_sparc::do_adjust_elf_header): New function.
4728
4729 2012-04-23  Cary Coutant  <ccoutant@google.com>
4730
4731         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
4732         CU range table of gdb index.
4733
4734 2012-04-20  David S. Miller  <davem@davemloft.net>
4735
4736         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
4737         instead of false.
4738
4739 2012-04-16  David S. Miller  <davem@davemloft.net>
4740
4741         * sparc.cc (Target_sparc::got_address): New function.
4742         (Sparc_relocate_functions::gdop_hix22): New function.
4743         (Sparc_relocate_functions::gdop_lox10): New function.
4744         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
4745         relocs.
4746         (Target_sparc::Scan::local): Likewise if the global symbol is not
4747         preemptible and is not IFUNC.
4748         (Target_sparc::Relocate::relocate): Perform GOTDATA code
4749         transformations for local and non-preemptible non-IFUNC global
4750         symbols.
4751
4752         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
4753         writing out 64-bit part of ranges.
4754
4755         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
4756         -fpic and -fpie respectively.
4757         * Makefile.in: Regenerate.
4758
4759         * sparc.cc (class Target_sparc): Add rela_ifunc_.
4760         (Target_sparc::Target_sparc): Initialize new field.
4761         (Target_sparc::do_plt_section_for_global): New function.
4762         (Target_sparc::do_plt_section_for_local): New function.
4763         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
4764         (Target_sparc::make_plt_section): New function, broken out of
4765         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
4766         (Target_sparc::make_plt_entry): Call make_plt_section.
4767         (Target_sparc::make_local_ifunc_plt_entry): New function.
4768         (Target_sparc::rela_ifunc_section): New function.
4769         (Target_sparc::plt_section): Remove const.
4770         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
4771         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
4772         and ifunc_count_ fields.
4773         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
4774         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
4775         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
4776         (Output_data_plt_sparc::rela_ifunc): New function.
4777         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
4778         (Output_data_plt_sparc::has_ifunc_section): New function.
4779         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
4780         (Output_data_plt_sparc::address_for_global): New function.
4781         (Output_data_plt_sparc::address_for_local): New function.
4782         (Output_data_plt_sparc::plt_index_to_offset): New function.
4783         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
4784         and entry_count.
4785         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
4786         entry_count.
4787         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
4788         R_SPARC_JMP_IREL to switch.
4789         (Target_sparc::Scan::check_non_pic): Likewise.
4790         (Target_sparc::Scan::local): Handle IFUNC symbols.
4791         (Target_sparc::Scan::local): Likewise.
4792         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
4793         and plt_address_for_local.
4794         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
4795         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
4796
4797         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
4798         (class Output_data_reloc): Adjust calls to Output_reloc_type.
4799         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
4800         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
4801         global relocs too.
4802         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
4803         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
4804         calls.
4805         * sparc.cc (Target_sparc::Scan::global): Likewise.
4806         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
4807
4808 2012-04-16  Cary Coutant  <ccoutant@google.com>
4809
4810         * archive.cc (Library_base::should_include_member): Check for
4811         --export-dynamic-symbol.
4812         * options.h (class General_options): Add --export-dynamic-symbol.
4813         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
4814         --export-dynamic-symbol.
4815         (Symbol_table::gc_mark_undef_symbols): Likewise.
4816         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
4817
4818 2012-04-12  David S. Miller  <davem@davemloft.net>
4819
4820         * sparc.cc (Reloc::wdisp10): New relocation method.
4821         (Reloc::h34): Likewise.
4822         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
4823         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
4824         R_SPARC_WDISP10.
4825         (Target_sparc::Scan::local): Likewise.
4826         (Target_sparc::Scan::global): Likewise.
4827         (Target_sparc::Relocate::relocate): Likewise.
4828
4829 2012-04-09  Cary Coutant  <ccoutant@google.com>
4830
4831         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
4832         low_pc == 0.
4833
4834 2012-04-06  Ian Lance Taylor  <iant@google.com>
4835
4836         * timer.cc: #include <unistd.h>.
4837
4838 2012-04-06  Roland McGrath  <mcgrathr@google.com>
4839
4840         * configure.in (AC_CHECK_HEADERS): Add locale.h.
4841         * config.in: Regenerate.
4842         * configure: Regenerate.
4843
4844 2012-04-05  Nick Clifton  <nickc@redhat.com>
4845
4846         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
4847         (AM_LC_MESSAGES): Add.
4848         * aclocal.m4: Regenerate.
4849         * config.in: Regenerate.
4850         * configure: Regenerate.
4851
4852 2012-03-21  Cary Coutant  <ccoutant@google.com>
4853
4854         * Makefile.am: Add gdb-index.cc, gdb-index.h.
4855         * Makefile.in: Regenerate.
4856         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
4857         (Sized_elf_reloc_mapper::symbol_section): New function.
4858         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
4859         (make_elf_reloc_mapper): New function.
4860         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
4861         (Dwarf_abbrev_table::do_read_abbrevs): New function.
4862         (Dwarf_abbrev_table::do_get_abbrev): New function.
4863         (Dwarf_ranges_table::read_ranges_table): New function.
4864         (Dwarf_ranges_table::read_range_list): New function.
4865         (Dwarf_pubnames_table::read_section): New function.
4866         (Dwarf_pubnames_table::read_header): New function.
4867         (Dwarf_pubnames_table::next_name): New function.
4868         (Dwarf_die::Dwarf_die): New function.
4869         (Dwarf_die::read_attributes): New function.
4870         (Dwarf_die::skip_attributes): New function.
4871         (Dwarf_die::set_name): New function.
4872         (Dwarf_die::set_linkage_name): New function.
4873         (Dwarf_die::attribute): New function.
4874         (Dwarf_die::string_attribute): New function.
4875         (Dwarf_die::int_attribute): New function.
4876         (Dwarf_die::uint_attribute): New function.
4877         (Dwarf_die::ref_attribute): New function.
4878         (Dwarf_die::child_offset): New function.
4879         (Dwarf_die::sibling_offset): New function.
4880         (Dwarf_info_reader::check_buffer): New function.
4881         (Dwarf_info_reader::parse): New function.
4882         (Dwarf_info_reader::do_parse): New function.
4883         (Dwarf_info_reader::do_read_string_table): New function.
4884         (Dwarf_info_reader::lookup_reloc): New function.
4885         (Dwarf_info_reader::get_string): New function.
4886         (Dwarf_info_reader::visit_compilation_unit): New function.
4887         (Dwarf_info_reader::visit_type_unit): New function.
4888         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
4889         Sized_elf_reloc_mapper.
4890         (Sized_dwarf_line_info::symbol_section): Remove function.
4891         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
4892         (Sized_dwarf_line_info::read_line_mappings): Remove object
4893         parameter, adjust callers.
4894         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
4895         * dwarf_reader.h: Include <sys/types.h>.
4896         (class Track_relocs): Remove forward declaration.
4897         (class Elf_reloc_mapper): New class.
4898         (class Sized_elf_reloc_mapper): New class.
4899         (class Dwarf_abbrev_table): New class.
4900         (class Dwarf_range_list): New class.
4901         (class Dwarf_ranges_table): New class.
4902         (class Dwarf_pubnames_table): New class.
4903         (class Dwarf_die): New class.
4904         (class Dwarf_info_reader): New class.
4905         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
4906         (Sized_dwarf_line_info::symbol_section): Remove member function.
4907         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
4908         base class.
4909         * gdb-index.cc: New source file.
4910         * gdb-index.h: New source file.
4911         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
4912         and .debug_types sections, call Layout::add_to_gdb_index.
4913         (Sized_relobj_incr::do_section_name): Implement.
4914         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
4915         return type; Implement.
4916         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
4917         return type.
4918         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
4919         parameter list and return type.
4920         (Sized_incr_dynobj::do_section_contents): Likewise.
4921         * layout.cc: Include gdb-index.h.
4922         (Layout::Layout): Initialize gdb_index_data_.
4923         (Layout::init_fixed_output_section): Check for .gdb_index section.
4924         (Layout::add_to_gdb_index): New function. Instantiate.
4925         * layout.h: Add forward declaration for class Gdb_index.
4926         (Layout::add_to_gdb_index): New member function.
4927         (Layout::gdb_index_data_): New data member.
4928         * main.cc: Include gdb-index.h.
4929         (main): Print statistics for gdb index.
4930         * object.cc (Object::section_contents): Move code into
4931         do_section_contents.
4932         (need_decompressed_section): Check for sections needed when building
4933         gdb index.
4934         (build_compressed_section_map): Likewise.
4935         (Sized_relobj_file::do_read_symbols): Need local symbols when building
4936         gdb index.
4937         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
4938         sections; call Layout::add_to_gdb_index.
4939         (Sized_relobj_file::do_decompressed_section_contents): Call
4940         do_section_contents directly.
4941         * object.h (Object::do_section_contents): Adjust parameter list and
4942         return type.
4943         (Object::do_decompressed_section_contents): Call do_section_contents
4944         directly.
4945         (Sized_relobj_file::do_section_contents): Adjust parameter list and
4946         return type.
4947         * options.h (class General_options): Add --gdb-index option.
4948         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
4949         list and return type.
4950         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
4951         * reloc.h (Track_relocs::checkpoint): New function.
4952         (Track_relocs::reset): New function.
4953
4954         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
4955         New test cases.
4956         * testsuite/Makefile.in: Regenerate.
4957         * testsuite/gdb_index_test.cc: New test source file.
4958         * testsuite/gdb_index_test_1.sh: New test source file.
4959         * testsuite/gdb_index_test_2.sh: New test source file.
4960
4961 2012-03-19  Doug Kwan  <dougkwan@google.com>
4962
4963         * arm.cc (Target_arm::do_define_standard_symbols): New method.
4964         (Target_arm::do_finalize_sections): Remove code which defines
4965         __exidx_start and __exidx_end.  Make symbol table parameter
4966         anonymous as it is not used.
4967         * gold.cc (queue_middle_tasks): Call target hook to define any
4968         target-specific symbols.
4969         * target.h (Target::define_standard_symbols): New method.
4970         (Target::do_define_standard_symbols): Same.
4971         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
4972         * testsuite/Makefile.in: Regenerate.
4973         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
4974         and __exidx_end.
4975         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
4976         relocations are generated for __exidx_start and __exidx_end.
4977
4978 2012-03-16  Doug Kwan  <dougkwan@google.com>
4979
4980         * testsuite/Makefile.am: Disable test initpri3b.
4981         * testsuite/Makefile.in: Regenerate.
4982
4983 2012-03-15  Doug Kwan  <dougkwan@google.com>
4984
4985         * arm.cc (Target_arm::got_section): Make .got section read-only
4986         if -z now is given.
4987
4988 2012-03-15  Ian Lance Taylor  <iant@google.com>
4989
4990         PR gold/13850
4991         * layout.cc (Layout::make_output_section): Correctly mark
4992         SHT_INIT_ARRAY, et. al., as relro.
4993
4994 2012-03-14  Doug Kwan  <dougkwan@google.com>
4995
4996         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
4997         dynamic relocations for protected symbols in shared objects.
4998
4999 2012-03-13  Ian Lance Taylor  <iant@google.com>
5000
5001         * resolve.cc (Symbol_table::resolve): When merging common symbols,
5002         keep the larger alignment.
5003
5004 2012-03-12  Cary Coutant  <ccoutant@google.com>
5005
5006         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
5007         handling of DW_LNE_define_file.
5008
5009 2012-03-12  Cary Coutant  <ccoutant@google.com>
5010
5011         * reduced_debug_output.cc
5012         (Output_reduced_debug_info_section::get_die_end): Add new FORM
5013         codes to switch.
5014
5015 2012-02-29  Cary Coutant  <ccoutant@google.com>
5016
5017         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
5018
5019 2012-02-29  Cary Coutant  <ccoutant@google.com>
5020
5021         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5022         Call Object::decompressed_section_contents.
5023         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
5024         New dtor.
5025         (Sized_dwarf_line_info::buffer_start_): New data member.
5026         * merge.cc (Output_merge_data::do_add_input_section): Call
5027         Object::decompressed_section_contents.
5028         (Output_merge_string::do_add_input_section): Likewise.
5029         * object.cc (need_decompressed_section): New function.
5030         (build_compressed_section_map): Decompress sections needed later.
5031         (Sized_relobj_file::do_decompressed_section_contents): New function.
5032         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5033         * object.h (Object::decompressed_section_contents): New function.
5034         (Object::discard_decompressed_sections): New function.
5035         (Object::do_decompressed_section_contents): New function.
5036         (Object::do_discard_decompressed_sections): New function.
5037         (Compressed_section_info): New type.
5038         (Compressed_section_map): Include decompressed section contents.
5039         (Sized_relobj_file::do_decompressed_section_contents): New function.
5040         (Sized_relobj_file::do_discard_decompressed_sections): New function.
5041
5042 2012-02-16  Cary Coutant  <ccoutant@google.com>
5043
5044         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
5045         * testsuite/Makefile.in: Regenerate.
5046
5047 2012-02-14  Cary Coutant  <ccoutant@google.com>
5048
5049         * options.cc (General_options::finalize): Disallow -pie and -static.
5050
5051 2012-02-03  Doug Kwan  <dougkwan@google.com>
5052
5053         * arm.cc (Arm_relocate_functions::abs8,
5054         Arm_relocate_functions::abs16): Use
5055         Bits::has_signed_unsigned_overflow32.
5056         (Arm_relocate_functions::thm_abs8): Correct range of
5057         overflow check.
5058         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
5059         in assertions.
5060
5061 2012-02-02  Doug Kwan  <dougkwan@google.com>
5062
5063         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
5064         position independent outputs, not just shared objects.
5065
5066 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
5067
5068         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
5069         * configure: Regenerated.
5070
5071 2012-01-27  Ian Lance Taylor  <iant@google.com>
5072
5073         * reloc.h (Bits): New class with static functions, copied from
5074         namespace utils in arm.cc.
5075         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
5076         instead.
5077
5078 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5079
5080         * incremental.cc (write_info_blocks): Correct relocation offset.
5081
5082 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5083
5084         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
5085         (Relocate::tls_gd_to_le): Likewise.
5086
5087 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5088
5089         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
5090
5091 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
5092
5093         * configure.ac: Check if -mcmodel=medium works.
5094         * configure: Regenerated.
5095
5096 2012-01-24  Cary Coutant  <ccoutant@google.com>
5097
5098         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
5099         definition and ...
5100         (read_unsigned_LEB_128_x): ... this new function.
5101         (read_signed_LEB_128): Replaced with inline definition and ...
5102         (read_signed_LEB_128_x): ... this new function.
5103         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
5104         (read_unsigned_LEB_128): Add inline definition.
5105         (read_signed_LEB_128_x): New function.
5106         (read_signed_LEB_128): Add inline definition.
5107         * testsuite/Makefile.am (leb128_unittest): New unit test.
5108         * testsuite/Makefile.in: Regenerate.
5109         * testsuite/leb128_unittest.cc: New unit test.
5110
5111 2012-01-23  Ian Lance Taylor  <iant@google.com>
5112
5113         PR gold/13617
5114         * i386.cc (Target_i386::do_code_fill): When using a jmp
5115         instruction, pad with nop instructions.
5116         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5117
5118 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
5119
5120         * x86_64.cc (gc_process_relocs): Add typename on types used in
5121         template.
5122         (scan_relocs): Likewise.
5123         (relocate_section): Likewise.
5124         (apply_relocation): Likewise.
5125
5126 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
5127
5128         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
5129         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
5130         under x32.
5131
5132 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
5133
5134         * x86_64.cc: Initial support for x32.
5135
5136 2012-01-03  Cary Coutant  <ccoutant@google.com>
5137
5138         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
5139         Use abstract base class for GOT.
5140         * gold/output.h (class Output_data_got_base): New abstract base class.
5141         (class Output_data_got): Derive from new base class, adjust ctors.
5142         (Output_data_got::reserve_slot): Make virtual; rename to
5143         do_reserve_slot; Adjust callers.
5144         * gold/target.h (Sized_target::init_got_plt_for_update): Return
5145         pointer to abstract base class.
5146         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
5147
5148 2011-12-18  Ian Lance Taylor  <iant@google.com>
5149
5150         * object.h (Relobj::local_symbol_value): New function.
5151         (Relobj::local_plt_offset): New function.
5152         (Relobj::local_has_got_offset): New function.
5153         (Relobj::local_got_offset): New function.
5154         (Relobj::set_local_got_offset): New function.
5155         (Relobj::do_local_symbol_value): New pure virtual function.
5156         (Relobj::do_local_plt_offset): Likewise.
5157         (Relobj::do_local_has_got_offset): Likewise.
5158         (Relobj::do_local_got_offset): Likewise.
5159         (Relobj::do_set_local_got_offset): Likewise.
5160         (Sized_relobj::do_local_has_got_offset): Rename from
5161         local_has_got_offset.
5162         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
5163         (Sized_relobj::do_set_local_got_offset): Rename from
5164         set_local_got_offset.
5165         (Sized_relobj_file::do_local_plt_offset): Rename from
5166         local_plt_offset.
5167         (Sized_relobj_file::do_local_symbol_value): New function.
5168         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
5169         local_plt_offset.
5170         * output.cc (Output_data_got::Got_entry::write): Change object to
5171         Relobj.  Use local_symbol_value.
5172         (Output_data_got::add_global_with_rel): Change rel_dyn to
5173         Output_data_reloc_generic*.  Use add_global_generic.
5174         (Output_data_got::add_global_with_rela): Remove.  Change all
5175         callers to use add_global_with_rel.
5176         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
5177         Output_data_reloc_generic*.  Use add_global_generic.
5178         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
5179         callers to use add_global_pair_with_rel.
5180         (Output_data_got::add_local): Change object to Relobj*.
5181         (Output_data_got::add_local_plt): Likewise.
5182         (Output_data_got::add_local_with_rel): Change object to Relobj*,
5183         change rel_dyn to Output_data_reloc_generic*.  Use
5184         add_local_generic.
5185         (Output_data_got::add_local_with_rela): Remove.  Change all
5186         callers to use all_local_with_rel.
5187         (Output_data_got::add_local_pair_with_rel): Change object to
5188         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
5189         add_output_section_generic.
5190         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
5191         callers to use add_local_pair_with_rel.
5192         (Output_data_got::reserve_local): Change object to Relobj*.
5193         * output.h: (class Output_data_reloc_generic): Add pure virtual
5194         declarations for add_global_generic, add_local_generic,
5195         add_output_section_generic.
5196         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
5197         functions for Output_data_reloc_generic.  Update declarations for
5198         changes listed in output.cc.
5199         (class Output_data_got): Change template parameter to got_size.
5200         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
5201         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
5202         function.
5203         (Sized_relobj_incr::do_local_plt_offset): New function.
5204         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
5205         add_global_generic.
5206
5207 2011-12-17  Cary Coutant  <ccoutant@google.com>
5208
5209         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
5210         * resolve.cc (Symbol_table::resolve): Likewise.
5211         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
5212         arrays.
5213         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
5214
5215 2011-12-16  Ian Lance Taylor  <iant@google.com>
5216
5217         * output.h (Output_data_reloc_generic::add): Only call
5218         add_dynamic_reloc if this is a dynamic reloc section.
5219
5220 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
5221
5222         PR gold/13505
5223         * target-reloc.h (apply_relocation): Replace <64, false> with
5224         <size, big_endian>.
5225
5226 2011-11-25  Nick Clifton  <nickc@redhat.com>
5227
5228         * po/it.po: New Italian translation.
5229
5230 2011-11-17  Sterling Augustine  <saugustine@google.com>
5231
5232         * script.cc (script_include_directive): Implement.
5233         (read_script_file): New local variables name and search_path. Update
5234         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
5235         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
5236         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
5237
5238 2011-11-11  Sterling Augustine  <saugustine@google.com>
5239
5240         * yyscript.y (section_cmd): Add support for INCLUDE directive.
5241         (file_or_sections_cmd): Likewise.
5242
5243 2011-11-11  Doug Kwan  <dougkwan@google.com>
5244
5245         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
5246         if --just-symbols is given.
5247
5248 2011-11-10  Doug Kwan  <dougkwan@google.com>
5249
5250         PR gold/13362
5251         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
5252         when processing data relocs.
5253         * reloc.h (Relocate_functions::rel_unaligned): New method.
5254         (Relocate_functions::pcrel_unaligned): Ditto.
5255         (Relocate_functions::rel32_unaligned): Ditto.
5256         (Relocate_functions::pcrel32_unaligned): Ditto.
5257
5258 2011-11-09  Doug Kwan  <dougkwan@google.com>
5259
5260         PR gold/13362
5261         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
5262         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
5263         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
5264         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5265         (Relocate_functions::rel_unaligned): New.
5266         (Relocate_functions::rel32_unaligned): New.
5267         * target-reloc.h (relocate_for_relocatable): Add code to handle
5268         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
5269         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
5270         arm_unaligned_reloc_r): New targets.
5271         * testsuite/Makefile.in: Regenerate.
5272         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
5273         linking.
5274
5275 2011-11-02  Ian Lance Taylor  <iant@google.com>
5276
5277         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
5278         NATIVE_LINKER.
5279         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
5280         * options.cc (General_options::finalize): Use library search path
5281         from configure script if specified.  If not native and no sysroot,
5282         only search TOOLLIBDIR.
5283         * options.h (Search_directory::Search_directory): Change name to
5284         const std::string&.
5285         (General_options::add_to_library_path_with_sysroot): Change arg to
5286         const std::string&.
5287         * configure, Makefile.in, config.in: Rebuild.
5288
5289 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5290
5291         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
5292         we are working around the ARM1176 Erratum.
5293         * options.h (General_options::fix_arm1176): Add option.
5294         * testsuite/Makefile.am: Add testcases, and keep current ones
5295         working.
5296         * testsuite/Makefile.in: Regenerate.
5297         * testsuite/arm_fix_1176.s: New file.
5298         * testsuite/arm_fix_1176.sh: Likewise.
5299
5300 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
5301
5302         * arm.cc (Target_arm::Target_arm): Remove initialisation of
5303         may_use_blx_.
5304         (Target_arm::may_use_blx): Remove method.
5305         (Target_arm::set_may_use_blx): Likewise.
5306         (Target_arm::may_use_v4t_interworking): New method.
5307         (Target_arm::may_use_v5t_interworking): Likewise.
5308         (Target_arm::may_use_blx_): Remove member variable.
5309         (Arm_relocate_functions::arm_branch_common): Check for v5T
5310         interworking.
5311         (Arm_relocate_functions::thumb_branch_common): Likewise.
5312         (Reloc_stub::stub_type_for_reloc): Likewise.
5313         (Target_arm::do_finalize_sections): Correct interworking checks.
5314         * testsuite/Makefile.am: Add new tests.
5315         * testsuite/Makefile.in: Regenerate.
5316         * testsuite/arm_farcall_arm_arm.s: New test.
5317         * testsuite/arm_farcall_arm_arm.sh: Likewise.
5318         * testsuite/arm_farcall_arm_thumb.s: Likewise.
5319         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
5320         * testsuite/arm_farcall_thumb_arm.s: Likewise.
5321         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
5322         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
5323         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
5324
5325 2011-10-31  Cary Coutant  <ccoutant@google.com>
5326
5327         PR gold/13023
5328         * expression.cc (Expression::eval_with_dot): Add
5329         is_section_dot_assignment parameter.
5330         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
5331         absolute and assigning to dot within a section.
5332         * script-sections.cc
5333         (Output_section_element_assignment::set_section_addresses): Pass
5334         dot_section to set_if_absolute.
5335         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
5336         as is_section_dot_assignment flag to eval_with_dot.
5337         (Output_section_element_dot_assignment::set_section_addresses):
5338         Likewise.
5339         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
5340         parameter.  Also set value if relative to dot_section; set the
5341         symbol's output_section.
5342         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
5343         parameter.  Adjust all callers.
5344         (Expression::eval_maybe_dot): Likewise.
5345         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
5346         Adjust all callers.
5347         * testsuite/script_test_2.t: Test assignment of an absolute value
5348         to dot within an output section element.
5349
5350 2011-10-31  Cary Coutant  <ccoutant@google.com>
5351
5352         * options.h (class General_options): Add --[no-]gnu-unique options.
5353         * symtab.cc (Symbol_table::sized_write_globals): Convert
5354         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
5355
5356 2011-10-31  Cary Coutant  <ccoutant@google.com>
5357
5358         PR gold/13359
5359         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
5360         unnecessary assertion.
5361         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
5362
5363 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
5364
5365         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5366         gc_mark_symbol.
5367         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
5368         gc_mark_symbol.
5369         Change to just keep the section associated with symbol.
5370         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
5371         they are externally visible and --export-dynamic is turned on.
5372         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
5373
5374 2011-10-19  Ian Lance Taylor  <iant@google.com>
5375
5376         PR gold/13163
5377         * script-sections.cc
5378         (Output_section_element_dot_assignment::needs_output_section): New
5379         function.
5380
5381 2011-10-19  Ian Lance Taylor  <iant@google.com>
5382
5383         PR gold/13204
5384         * layout.cc (Layout::segment_precedes): Don't assert failure if a
5385         --section-start option was seen.
5386         * options.h (General_options::any_section_start): New function.
5387
5388 2011-10-18  David S. Miller  <davem@davemloft.net>
5389
5390         PR binutils/13301
5391         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
5392         member to track relocation locations that have moved during TLS
5393         reloc optimizations.
5394         (Target_sparc::Relocate::Relocate): Initialize to NULL.
5395         (Target_sparc::Relocate::relocate): Adjust view down by 4
5396         bytes if it matches reloc_adjust_addr_.
5397         (Target_sparc::Relocate::relocate_tls): Always move the
5398         __tls_get_addr call delay slot instruction forward 4 bytes when
5399         performing relaxation.
5400
5401 2011-10-18  Cary Coutant  <ccoutant@google.com>
5402
5403         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
5404         (Output_file::map_no_anonymous): Check for non-zero
5405         return code from posix_fallocate.
5406
5407 2011-10-17  Cary Coutant  <ccoutant@google.com>
5408
5409         PR gold/13245
5410         * plugin.cc (is_visible_from_outside): Check for symbols
5411         referenced from dynamic objects.
5412         * resolve.cc (Symbol_table::resolve): Don't count references
5413         from dynamic objects as references from real ELF files.
5414         * testsuite/plugin_test_2.sh: Adjust expected result.
5415
5416 2011-10-17  Cary Coutant  <ccoutant@google.com>
5417
5418         * gold.cc: Include timer.h.
5419         (queue_middle_tasks): Stamp time.
5420         (queue_final_tasks): Likewise.
5421         * main.cc (main): Store timer in parameters.  Print timers
5422         for each pass.
5423         * parameters.cc (Parameters::Parameters): Initialize timer_.
5424         (Parameters::set_timer): New function.
5425         (set_parameters_timer): New function.
5426         * parameters.h (Parameters::set_timer): New function.
5427         (Parameters::timer): New function.
5428         (Parameters::timer_): New data member.
5429         (set_parameters_timer): New function.
5430         * timer.cc (Timer::stamp): New function.
5431         (Timer::get_pass_time): New function.
5432         * timer.h (Timer::stamp): New function.
5433         (Timer::get_pass_time): New function.
5434         (Timer::pass_times_): New data member.
5435
5436 2011-10-17  Cary Coutant  <ccoutant@google.com>
5437
5438         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
5439         task for members of lib groups.
5440
5441 2011-10-17  Cary Coutant  <ccoutant@google.com>
5442
5443         PR gold/13288
5444         * fileread.cc (File_read::find_view): Add assert.
5445         (File_read::make_view): Move bounds check (replace with assert)...
5446         (File_read::find_or_make_view): ... to here.
5447
5448 2011-10-12  Cary Coutant  <ccoutant@google.com>
5449
5450         * output.cc (Output_file::open_base_file): Handle case where
5451         ::read returns less than requested size.
5452
5453 2011-10-10  Cary Coutant  <ccoutant@google.com>
5454
5455         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
5456         Initialize defined_count_.
5457         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
5458         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
5459         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
5460         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
5461         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
5462         * incremental.h (Sized_relobj_incr::defined_count_): New data
5463         member.
5464         (Sized_incr_dynobj::defined_count_): New data member.
5465         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
5466         Return zeroes instead of internal error.
5467
5468 2011-10-10  Cary Coutant  <ccoutant@google.com>
5469
5470         PR gold/13249
5471         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
5472         (Output_reloc::symbol_value): Return PLT offset if flag is set.
5473         * output.h (class Output_reloc): Add use_plt_offset flag.
5474         (Output_reloc::type_): Adjust size of bit field.
5475         (Output_reloc::use_plt_offset_): New bit field.
5476         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
5477         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
5478         flag.  Adjust all callers.
5479         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
5480         creating RELATIVE relocations.
5481
5482 2011-10-10  Nick Clifton  <nickc@redhat.com>
5483
5484         * po/es.po: Updated Spanish translation.
5485         * po/fi.po: Updated Finnish translation.
5486
5487 2011-10-03   Diego Novillo  <dnovillo@google.com>
5488
5489         * options.cc (parse_uint): Fix dereference of RETVAL.
5490
5491 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
5492
5493         * layout.h (section_order_map_): New member.
5494         (get_section_order_map): New member function.
5495         * output.cc (Output_section::add_input_section): Check for patterns
5496         only when --section-ordering-file is specified.
5497         * gold.cc (queue_middle_tasks): Delay updating order of sections till
5498         output_sections have been formed.
5499         * layout.cc (Layout_Layout): Initialize section_order_map_.
5500         * plugin.cc (update_section_order): Store order in order_map. Do not
5501         update the order.
5502         * testsuite/Makefile.am: Add test case for plugin_final_layout.
5503         * testsuite/Makefile.in: Regenerate.
5504         * testsuite/plugin_section_order.c: New file.
5505         * testsuite/plugin_final_layout.cc: New file.
5506         * testsuite/plugin_final_layout.sh: New file.
5507
5508 2011-09-29  Cary Coutant  <ccoutant@google.com>
5509
5510         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
5511         Check for NULL.
5512         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
5513         symbols during incremental update.
5514         (Symbol_table::add_from_dynobj): Likewise.
5515
5516 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5517             Ian Lance Taylor  <iant@google.com>
5518
5519         * symtab.cc (Symbol_table::define_special_symbol): Always
5520         canonicalize version string.
5521
5522 2011-09-26  Cary Coutant  <ccoutant@google.com>
5523
5524         * gold.cc (queue_initial_tasks): Move option checks ...
5525         * options.cc (General_options::finalize): ... to here. Disable
5526         some options; make others fatal.
5527
5528 2011-09-26  Cary Coutant  <ccoutant@google.com>
5529
5530         gcc PR lto/47247
5531         * plugin.cc (get_symbols_v2): New function.
5532         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
5533         (is_referenced_from_outside): New function.
5534         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
5535         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
5536         (get_symbols): Pass version parameter.
5537         (get_symbols_v2): New function.
5538         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
5539         parameter.
5540         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
5541         (onload): Add LDPT_GET_SYMBOLS_V2.
5542         (all_symbols_read_hook): Use get_symbols_v2; check for
5543         LDPR_PREVAILING_DEF_IRONLY_EXP.
5544         * testsuite/plugin_test_3.sh: Update expected results.
5545
5546 2011-09-23  Simon Baldwin  <simonb@google.com>
5547
5548         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
5549         configuration options.
5550         * configure: Regenerate.
5551         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
5552         * Makefile.in: Regenerate.
5553         * testsuite/Makefile.in: Regenerate.
5554
5555 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
5556
5557         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
5558
5559 2011-09-19  Cary Coutant  <ccoutant@google.com>
5560
5561         * incremental.cc (can_incremental_update): Fix typo in comment.
5562         * incremental.h (can_incremental_update): Likewise.
5563
5564 2011-09-18  Cary Coutant  <ccoutant@google.com>
5565
5566         * incremental.cc (can_incremental_update): New function.
5567         * incremental.h (can_incremental_update): New function.
5568         * layout.cc (Layout::init_fixed_output_section): Call it.
5569         (Layout::make_output_section): Don't allow patch space in .eh_frame.
5570         * object.cc (Sized_relobj_file::do_layout): Call
5571         can_incremental_update.
5572
5573 2011-09-13  Cary Coutant  <ccoutant@google.com>
5574
5575         * configure.ac: Check for glibc support for gnu_indirect_function
5576         support with static linking, setting automake conditional
5577         IFUNC_STATIC.
5578         * Makefile.in: Regenerate.
5579         * configure: Regenerate.
5580
5581         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
5582         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
5583         for IFUNC_STATIC.
5584         * testsuite/Makefile.in: Regenerate.
5585
5586 2011-09-13  Cary Coutant  <ccoutant@google.com>
5587
5588         * incremental.cc (Sized_relobj_incr::do_layout): Call
5589         report_comdat_group for kept comdat sections.
5590         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
5591         * testsuite/Makefile.in: Regenerate.
5592         * testsuite/incr_comdat_test_1.cc: New source file.
5593         * testsuite/incr_comdat_test_2_v1.cc: New source file.
5594         * testsuite/incr_comdat_test_2_v2.cc: New source file.
5595         * testsuite/incr_comdat_test_2_v3.cc: New source file.
5596
5597 2011-09-13  Ian Lance Taylor  <iant@google.com>
5598
5599         * object.cc (Sized_relobj_file::do_layout): Remove unused local
5600         variable external_symbols_offset.
5601
5602 2011-09-12  Ian Lance Taylor  <iant@google.com>
5603
5604         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
5605         triggered if object has no symbols.
5606
5607 2011-09-09  David S. Miller  <davem@davemloft.net>
5608
5609         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
5610         (Output_fill_debug_line::do_write): Likewise.
5611
5612 2011-08-29  Cary Coutant  <ccoutant@google.com>
5613
5614         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
5615         casts to match formatting specs.
5616         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
5617
5618 2011-08-26  Cary Coutant  <ccoutant@google.com>
5619
5620         * layout.cc (Free_list::allocate): Provide guarantee of minimum
5621         remaining hole size when allocating.
5622         (Layout::make_output_section): Set fill methods for debug sections.
5623         * layout.h (Free_list::Free_list_node): Move from private to
5624         public.
5625         (Free_list::set_min_hole_size): New function.
5626         (Free_list::begin, Free_list::end): New functions.
5627         (Free_list::min_hole_): New data member.
5628         * output.cc: Include dwarf.h.
5629         (Output_fill_debug_info::do_minimum_hole_size): New function.
5630         (Output_fill_debug_info::do_write): New function.
5631         (Output_fill_debug_line::do_minimum_hole_size): New function.
5632         (Output_fill_debug_line::do_write): New function.
5633         (Output_section::Output_section): Initialize new data member.
5634         (Output_section::set_final_data_size): Ensure patch space is larger
5635         than minimum hole size.
5636         (Output_section::do_write): Fill holes in debug sections.
5637         * output.h (Output_fill): New class.
5638         (Output_fill_debug_info): New class.
5639         (Output_fill_debug_line): New class.
5640         (Output_section::set_free_space_fill): New function.
5641         (Output_section::free_space_fill_): New data member.
5642         * testsuite/Makefile.am (incremental_test_3): Add
5643         --incremental-patch option.
5644         (incremental_test_4): Likewise.
5645         (incremental_test_5): Likewise.
5646         (incremental_test_6): Likewise.
5647         (incremental_copy_test): Likewise.
5648         (incremental_common_test_1): Likewise.
5649         * testsuite/Makefile.in: Regenerate.
5650
5651 2011-08-26  Nick Clifton  <nickc@redhat.com>
5652
5653         * po/es.po: Updated Spanish translation.
5654
5655 2011-08-01  Cary Coutant  <ccoutant@google.com>
5656
5657         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
5658         * gold/testsuite/Makefile.in: Regenerate.
5659         * gold/testsuite/justsyms_exec.c: New source file.
5660         * gold/testsuite/justsyms_lib.c: New source file.
5661
5662 2011-08-01  Cary Coutant  <ccoutant@google.com>
5663
5664         * layout.cc (Layout::set_segment_offsets): Don't realign text
5665         segment if -Ttext was specified.
5666         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
5667         file type.
5668         * object.h (Sized_relobj_file::e_type): New function.
5669         (Sized_relobj_file::e_type_): New data member.
5670         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
5671         base address for ET_EXEC files.
5672         * target.cc (Target::do_make_elf_object_implementation): Allow
5673         ET_EXEC files with --just-symbols option.
5674
5675 2011-07-28  Cary Coutant  <ccoutant@google.com>
5676
5677         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
5678         Add thread_number parameter.
5679         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
5680         * workqueue-threads.cc
5681         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
5682         current thread if its thread number is greater than desired thread
5683         count.
5684         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
5685         Add thread_number parameter.
5686         (Workqueue::should_cancel_thread): Likewise.
5687         (Workqueue::find_runnable_or_wait): Pass thread_number to
5688         should_cancel_thread.
5689         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
5690         parameter.
5691
5692 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
5693
5694         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
5695         only after checking if it cannot be forced local.
5696         * symtab.h (is_externally_visible): Check if the symbol is not forced
5697         local.
5698
5699 2011-07-15  Ian Lance Taylor  <iant@google.com>
5700
5701         * options.h (class General_options): Add --print-output-format.
5702         Move -EL next to -EB, for  better --help output.
5703         * target-select.cc: Include <cstdio>, "options.h", and
5704         "parameters.h".
5705         (Target_selector::do_target_bfd_name): New function.
5706         (print_output_format): New function.
5707         * target-select.h (class Target_selector): Update declarations.
5708         (Target_selector::target_bfd_name): New function.
5709         (print_output_format): Declare.
5710         * main.cc: Include "target-select.h".
5711         (main): Handle --print-output-format.
5712         * gold.cc: Include "target-select.h".
5713         (queue_initial_tasks): Handle --print-output-format when there are
5714         no input files.
5715         * parameters.cc (parameters_force_valid_target): Give a better
5716         error message if -EB/-EL does not match target.
5717         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
5718         function.
5719
5720 2011-07-15  Ian Lance Taylor  <iant@google.com>
5721
5722         * i386.cc (class Output_data_plt_i386): Add layout_ field.
5723         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
5724         (Output_data_plt_i386::do_write): Write address of .dynamic
5725         section to first entry in .got.plt section.
5726         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
5727         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5728         Initialize layout_.
5729         (Output_data_plt_x86_64::do_write): Write address of .dynamic
5730         section to first entry in .got.plt section.
5731         * layout.h (Layout::dynamic_section): New function.
5732
5733 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
5734
5735         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
5736         to claim_file call.
5737         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
5738         input_section_position_, and input_section_glob_.
5739         (read_layout_from_file): Call function section_ordering_specified.
5740         * layout.h (is_section_ordering_specified): New function.
5741         (section_ordering_specified): New function.
5742         (section_ordering_specified_): New boolean member.
5743         * main.cc(main): Call load_plugins after layout object is defined.
5744         * output.cc (Output_section::add_input_section): Use
5745         function section_ordering_specified to check if section ordering is
5746         needed.
5747         * output.cc (Output_section::add_relaxed_input_section): Use
5748         function section_ordering_specified to check if section ordering is
5749         needed.
5750         (Output_section::update_section_layout): New function.
5751         (Output_section::sort_attached_input_sections): Check if input section
5752         must be reordered.
5753         * output.h (Output_section::update_section_layout): New function.
5754         * plugin.cc (get_section_count): New function.
5755         (get_section_type): New function.
5756         (get_section_name): New function.
5757         (get_section_contents): New function.
5758         (update_section_order): New function.
5759         (allow_section_ordering): New function.
5760         (Plugin::load): Add the new interfaces to the transfer vector.
5761         (Plugin_manager::load_plugins): New parameter.
5762         (Plugin_manager::all_symbols_read): New parameter.
5763         (Plugin_manager::claim_file): New parameter. Save the elf object for
5764         unclaimed objects.
5765         (Plugin_manager::get_elf_object): New function.
5766         (Plugin_manager::get_view): Change to directly use the bool to check
5767         if get_view is called from claim_file_hook.
5768         * plugin.h (input_objects): New function
5769         (Plugin__manager::load_plugins): New parameter.
5770         (Plugin_manager::claim_file): New parameter.
5771         (Plugin_manager::get_elf_object): New function.
5772         (Plugin_manager::in_claim_file_handler): New function.
5773         (Plugin_manager::in_claim_file_handler_): New member.
5774         (layout): New function.
5775         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
5776         handler with an extra parameter. Make the elf object before calling
5777         claim_file handler.
5778         * testsuite/plugin_test.c (get_section_count): New function pointer.
5779         (get_section_type): New function pointer.
5780         (get_section_name): New function pointer.
5781         (get_section_contents): New function pointer.
5782         (update_section_order): New function pointer.
5783         (allow_section_ordering): New function pointer.
5784         (onload): Check if the new interfaces exist.
5785
5786 2011-07-13  Ian Lance Taylor  <iant@google.com>
5787
5788         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
5789         relro section.
5790         * x86_64.cc (Target_x86_64::got_section): Likewise.
5791         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
5792         (relro_now_test_SOURCES): New variable.
5793         (relro_now_test_DEPENDENCIES): New variable.
5794         (relro_now_test_LDFLAGS): New variable.
5795         (relro_now_test_LDADD): New variable.
5796         (relro_now_test.so): New target.
5797         * testsuite/Makefile.in: Rebuild.
5798
5799 2011-07-12  Ian Lance Taylor  <iant@google.com>
5800
5801         PR gold/12980
5802         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
5803         GLOB_DAT relocation rather than a RELATIVE relocation for a
5804         protected symbol when creating a shared library.
5805         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
5806         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
5807         * testsuite/protected_main_1.cc (main): Test that protected
5808         function has same address.
5809
5810 2011-07-11  Ian Lance Taylor  <iant@google.com>
5811
5812         PR gold/12979
5813         * options.h (class General_options): Add -Bgroup.
5814         * options.cc (General_options::finalize): If -Bgroup is set,
5815         default to --unresolved-symbols=report-all.
5816         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
5817         * target-reloc.h (issue_undefined_symbol_error): Handle
5818         --unresolved-symbols=report-all.
5819
5820 2011-07-08  Ian Lance Taylor  <iant@google.com>
5821
5822         PR gold/11985
5823         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
5824         if linker script discards key sections.
5825         (Layout::create_dynamic_symtab): Likewise.
5826         (Layout::assign_local_dynsym_offsets): Likewise.
5827         (Layout::sized_create_version_sections): Likewise.
5828         (Layout::create_interp): Likewise.
5829         (Layout::finish_dynamic_section): Likewise.
5830         (Layout::set_dynamic_symbol_size): Likewise.
5831
5832 2011-07-08  Ian Lance Taylor  <iant@google.com>
5833
5834         PR gold/12386
5835         * options.h (class General_options): Add --unresolved-symbols.
5836         * target-reloc.h (issue_undefined_symbol_error): Check
5837         --unresolved-symbols.  Add comments.
5838
5839 2011-07-08  Ian Lance Taylor  <iant@google.com>
5840
5841         * testsuite/odr_violation2.cc (Ordering::operator()): Make
5842         expression more complex.
5843
5844 2011-07-08  Ian Lance Taylor  <iant@google.com>
5845
5846         PR gold/11317
5847         * target-reloc.h (issue_undefined_symbol_error): New inline
5848         function, broken out of relocate_section.
5849         (relocate_section): Call issue_undefined_symbol_error.
5850         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5851         there is no TLS segment if we are about to issue an undefined
5852         symbol error.
5853         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5854
5855 2011-07-08  Ian Lance Taylor  <iant@google.com>
5856
5857         PR gold/12279
5858         * resolve.cc (Symbol_table::should_override): Add fromtype
5859         parameter.  Change all callers.  Give error when linking together
5860         TLS and non-TLS symbol.
5861         (Symbol_table::should_override_with_special): Add fromtype
5862         parameter.  Change all callers.
5863         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
5864         there is no TLS segment if we have reported some errors.
5865         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
5866
5867 2011-07-08  Ian Lance Taylor  <iant@google.com>
5868
5869         PR gold/12372
5870         * target.h (Target::plt_address_for_global): New function.
5871         (Target::plt_address_for_local): New function.
5872         (Target::plt_section_for_global): Remove.
5873         (Target::plt_section_for_local): Remove.
5874         (Target::do_plt_address_for_global): New virtual function.
5875         (Target::do_plt_address_for_local): New virtual function.
5876         (Target::do_plt_section_for_global): Remove.
5877         (Target::do_plt_section_for_local): Remove.
5878         (Target::register_global_plt_entry): Add Symbol_table and Layout
5879         parameters.
5880         * output.cc (Output_data_got::Got_entry::write): Use
5881         plt_address_for_global and plt_address_for_local.
5882         * layout.cc (Layout::add_target_dynamic_tags): Use size and
5883         address of output section.
5884         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
5885         got_irelative_, and irelative_count_ fields.  Update
5886         declarations.
5887         (Output_data_plt_i386::has_irelative_section): New function.
5888         (Output_data_plt_i386::entry_count): Add irelative_count_.
5889         (Output_data_plt_i386::set_final_data_size): Likewise.
5890         (class Target_i386): Add got_irelative_ and rel_irelative_
5891         fields.  Update declarations.
5892         (Target_i386::Target_i386): Initialize new fields.
5893         (Target_i386::do_plt_address_for_global): New function replacing
5894         do_plt_section_for_global.
5895         (Target_i386::do_plt_address_for_local): New function replacing
5896         do_plt_section_for_local.
5897         (Target_i386::got_section): Create got_irelative_.
5898         (Target_i386::rel_irelative_section): New function.
5899         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
5900         fields.  Don't define __rel_iplt_{start,end}.
5901         (Output_data_plt_i386::add_entry): Add symtab and layout
5902         parameters.  Change all callers.  Use different PLT and GOT for
5903         IFUNC symbols.
5904         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
5905         layout parameters.  Change all callers.  Use different PLT and
5906         GOT.
5907         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
5908         (Output_data_plt_i386::rel_irelative): New function.
5909         (Output_data_plt_i386::address_for_global): New function.
5910         (Output_data_plt_i386::address_for_local): New function.
5911         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
5912         IRELATIVE GOT when changing IFUNC GOT entries.
5913         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
5914         reloc.
5915         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
5916         if we didn't create an IRELATIVE GOT.
5917         (Target_i386::Relocate::relocate): Use plt_address_for_global and
5918         plt_address_for_local.
5919         (Target_i386::do_dynsym_value): Use plt_address_for_global.
5920         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
5921         got_irelative_, and irelative_count_ fields.  Update
5922         declarations.
5923         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
5924         Initialize new fields.  Remove symtab parameter.  Change all
5925         callers.
5926         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
5927         irelative_count_.
5928         (Output_data_plt_x86_64::has_irelative_section): New function.
5929         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
5930         (class Target_x86_64): Add got_irelative_ and rel_irelative_
5931         fields.  Update declarations.
5932         (Target_x86_64::Target_x86_64): Initialize new fields.
5933         (Target_x86_64::do_plt_address_for_global): New function replacing
5934         do_plt_section_for_global.
5935         (Target_x86_64::do_plt_address_for_local): New function replacing
5936         do_plt_section_for_local.
5937         (Target_x86_64::got_section): Create got_irelative_.
5938         (Target_x86_64::rela_irelative_section): New function.
5939         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
5940         all callers.  Don't create __rel_iplt_{start,end}.
5941         (Output_data_plt_x86_64::add_entry): Add symtab and layout
5942         parameters.  Change all callers.  Use different PLT and GOT for
5943         IFUNC symbols.
5944         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
5945         layout parameters.  Change all callers.  Use different PLT and
5946         GOT.
5947         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
5948         parameters.  Change all callers.  Use different PLT and GOT for
5949         IFUNC symbols.
5950         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
5951         (Output_data_plt_x86_64::rela_irelative): New function.
5952         (Output_data_plt_x86_64::address_for_global): New function.
5953         (Output_data_plt_x86_64::address_for_local): New function.
5954         (Output_data_plt_x86_64::set_final_data_size): Likewise.
5955         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
5956         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
5957         (Target_x86_64::register_global_plt_entry): Add symtab and layout
5958         parameters.
5959         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
5960         reloc.
5961         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
5962         symbols if we didn't create an IRELATIVE GOT.
5963         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
5964         plt_address_for_local.
5965         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
5966         * testsuite/ifuncvar1.c: New test file.
5967         * testsuite/ifuncvar2.c: New test file.
5968         * testsuite/ifuncvar3.c: New test file.
5969         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
5970         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
5971         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
5972         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
5973         * testsuite/Makefile.in: Rebuild.
5974
5975 2011-07-07  Cary Coutant  <ccoutant@google.com>
5976
5977         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
5978         (two_file_test_1_ndebug.o): Likewise.
5979         (two_file_test_1b_ndebug.o): Likewise.
5980         (two_file_test_2_ndebug.o): Likewise.
5981         (two_file_test_main_ndebug.o): Likewise.
5982         (incremental_test_2): Link with no-debug versions.
5983
5984 2011-07-06  Cary Coutant  <ccoutant@google.com>
5985
5986         * gold/incremental.cc
5987         (Output_section_incremental_inputs::write_info_blocks): Check for
5988         hidden and internal symbols.
5989
5990 2011-07-06  Cary Coutant  <ccoutant@google.com>
5991
5992         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
5993         Check disposition for startup file.
5994         (Incremental_inputs::report_command_line): Ignore
5995         --incremental-startup-unchanged option.
5996         * options.cc (General_options::parse_incremental_startup_unchanged):
5997         New function.
5998         (General_options::General_options): Initialize new data member.
5999         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
6000         (General_options): Add --incremental-startup-unchanged option.
6001         (General_options::incremental_startup_disposition): New function.
6002         (General_options::incremental_startup_disposition_): New data member.
6003
6004 2011-07-06  Cary Coutant  <ccoutant@google.com>
6005
6006         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
6007         input file index to Script_info ctor.
6008         (Sized_incremental_binary::do_file_has_changed): Find the
6009         command-line argument for files named in scripts.
6010         * incremental.h (Script_info::Script_info): New ctor
6011         with input file index.
6012         (Script_info::input_file_index): New function.
6013         (Script_info::input_file_index_): New data member.
6014         (Incremental_binary::get_library): Add const.
6015         (Incremental_binary::get_script_info): Add const.
6016         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
6017         * testsuite/Makefile.am (incremental_test_5): New test case.
6018         (incremental_test_6): New test case.
6019         * testsuite/Makefile.in: Regenerate.
6020
6021 2011-07-06  Cary Coutant  <ccoutant@google.com>
6022
6023         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
6024         debug output when command lines differ.
6025
6026 2011-07-06  Cary Coutant  <ccoutant@google.com>
6027
6028         * incremental.cc (Incremental_inputs::report_command_line): Ignore
6029         --incremental-patch option.
6030         * layout.cc (Free_list::allocate): Extend allocation beyond original
6031         end if enabled.
6032         (Layout::make_output_section): Mark sections that should get
6033         patch space.
6034         * options.cc (parse_percent): New function.
6035         * options.h (parse_percent): New function.
6036         (DEFINE_percent): New macro.
6037         (General_options): Add --incremental-patch option.
6038         * output.cc (Output_section::Output_section): Initialize new data
6039         members.
6040         (Output_section::add_input_section): Print section name when out
6041         of patch space.
6042         (Output_section::add_output_section_data): Likewise.
6043         (Output_section::set_final_data_size): Add patch space when
6044         doing --incremental-full.
6045         (Output_section::do_reset_address_and_file_offset): Remove patch
6046         space.
6047         (Output_segment::set_section_list_addresses): Print debug output
6048         only if --incremental-update.
6049         * output.h (Output_section::set_is_patch_space_allowed): New function.
6050         (Output_section::is_patch_space_allowed_): New data member.
6051         (Output_section::patch_space_): New data member.
6052         * parameters.cc (Parameters::incremental_full): New function.
6053         * parameters.h (Parameters::incremental_full): New function
6054         * testsuite/Makefile.am (incremental_test_2): Add test for
6055         --incremental-patch option.
6056         * testsuite/Makefile.in: Regenerate.
6057         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
6058         (t18): Remove function body.
6059
6060 2011-07-05  Doug Kwan  <dougkwan@google.com>
6061
6062         PR gold/12771
6063         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
6064         Arm_Address type for relocation result.
6065         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
6066         overflow check.
6067         (Arm_relocate_functions::abs32): Use unaligned access.
6068         (Arm_relocate_functions::rel32): Ditto.
6069         (Arm_relocate_functions::prel31): Ditto.
6070         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
6071         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
6072         static data relocations.
6073         * testsuite/Makefile.in: Regnerate.
6074         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
6075
6076 2011-07-05  Ian Lance Taylor  <iant@google.com>
6077
6078         PR gold/12392
6079         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
6080         symbols if necessary.
6081         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
6082
6083 2011-07-05  Ian Lance Taylor  <iant@google.com>
6084
6085         PR gold/12952
6086         * resolve.cc (Symbol::override_base_with_special): Simply override
6087         version with special symbol version, ignoring previous version.
6088
6089 2011-07-05  Ian Lance Taylor  <iant@google.com>
6090
6091         * object.cc (Sized_relobj_file::include_section_group): Add
6092         information to comment about signature location.
6093
6094 2011-07-02  Ian Lance Taylor  <iant@google.com>
6095
6096         PR gold/12957
6097         * options.h (class General_options): Add -f and -F.
6098         * options.cc (General_options::finalize): Fatal error if -f/-F
6099         are used without -shared.
6100         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
6101
6102 2011-07-02  Ian Lance Taylor  <iant@google.com>
6103
6104         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
6105
6106 2011-07-01  Ian Lance Taylor  <iant@google.com>
6107
6108         PR gold/12525
6109         PR gold/12952
6110         * resolve.cc (Symbol::override_base_with_special): Don't override
6111         the version if the overriding symbol has a different name.
6112         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
6113         all callers.  If we give an error about an undefined version,
6114         define the base version if necessary.
6115         * dynobj.h (class Versions): Update declaration.
6116         * testsuite/weak_alias_test_5.cc: New file.
6117         * testsuite/weak_alias_test.script: New file.
6118         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
6119         and versioned_alias have the right value, and call t2.
6120         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
6121         weak_alias_test_5.so.
6122         (weak_alias_test_LDADD): Likewise.
6123         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
6124         * testsuite/Makefile.in: Rebuild.
6125
6126 2011-07-01  Ian Lance Taylor  <iant@google.com>
6127
6128         PR gold/12525
6129         * options.h (class General_options): Support -z notext.
6130         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
6131         -Wl,-z,notext.
6132         (two_file_shared_nonpic.so): Likewise.
6133         (two_file_shared_mixed.so): Likewise.
6134         (two_file_shared_mixed_1.so): Likewise.
6135         (weak_undef_lib_nonpic.so): Likewise.
6136         (alt/weak_undef_lib_nonpic.so): Likewise.
6137         (tls_test_shared_nonpic.so): Likewise.
6138         * testsuite/Makefile.in: Rebuild.
6139
6140 2011-07-01  Ian Lance Taylor  <iant@google.com>
6141
6142         PR gold/12525
6143         * configure.ac: Test whether static linking works, setting
6144         the automake conditional HAVE_STATIC.
6145         * testsuite/Makefile.am: Disable tests using -static if
6146         HAVE_STATIC is not true.
6147         * configure, testsuite/Makefile.in: Rebuild.
6148
6149 2011-07-01  Ian Lance Taylor  <iant@google.com>
6150
6151         PR gold/12525
6152         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
6153         Assert if we see DW_EH_PE_indirect.
6154         * target.h (Target::ehframe_datarel_base): New function.
6155         (Target::do_ehframe_datarel_base): New target function.
6156         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
6157         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
6158         function.
6159
6160 2011-07-01  Ian Lance Taylor  <iant@google.com>
6161
6162         PR gold/12571
6163         * options.h (class General_options): Add
6164         --ld-generated-unwind-info.
6165         * ehframe.cc (Fde::write): Add address parameter.  Change all
6166         callers.  If associated with PLT, fill in address and size.
6167         (Cie::set_output_offset): Only add merge mapping if there is an
6168         object.
6169         (Cie::write): Add address parameter.  Change all callers.
6170         (Eh_frame::add_ehframe_for_plt): New function.
6171         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
6172         input_offset_ fields into union u_, with new plt field.
6173         (Fde::Fde): Adjust for new union field.
6174         (Fde::Fde) [Output_data version]: New constructor.
6175         (Fde::add_mapping): Only add merge mapping if there is an object.
6176         (class Cie): Update declarations.
6177         (class Eh_frame): Declare add_ehframe_for_plt.
6178         * layout.cc (Layout::layout_eh_frame): Break out code into
6179         make_eh_frame_section, and call it.
6180         (Layout::make_eh_frame_section): New function.
6181         (Layout::add_eh_frame_for_plt): New function.
6182         * layout.h (class Layout): Update declarations.
6183         * merge.cc (Merge_map::add_mapping): Add assertion.
6184         * i386.cc: Include "dwarf.h".
6185         (class Output_data_plt_i386): Make first_plt_entry,
6186         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
6187         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6188         and plt_eh_frame_fde.
6189         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
6190         boundary.  Call add_eh_frame_for_plt if appropriate.
6191         * x86_64.cc: Include "dwarf.h".
6192         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
6193         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
6194         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
6195         and plt_eh_frame_fde.
6196         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
6197         appropriate.
6198
6199 2011-06-29  Ian Lance Taylor  <iant@google.com>
6200
6201         PR gold/12629
6202         * object.cc (Sized_relobj_file::layout_section): Change shdr
6203         parameter to be const.
6204         (Sized_relobj_file::layout_eh_frame_section): New function, broken
6205         out of do_layout.
6206         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
6207         appropriate.  Call layout_eh_frame_section.
6208         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
6209         sections.
6210         * object.h (class Sized_relobj_file): Update declarations.
6211
6212 2011-06-29  Ian Lance Taylor  <iant@google.com>
6213
6214         PR gold/12652
6215         * script.cc (Token::integer_value): Accept trailing M/m/K/k
6216         modifier.
6217         (Lex::gather_token): Accept trailing M/m/K/k for integers.
6218
6219 2011-06-29  Ian Lance Taylor  <iant@google.com>
6220
6221         PR gold/12675
6222         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
6223         SHT_X86_64_UNWIND.
6224         * layout.cc (Layout::layout_eh_frame): Likewise.
6225
6226 2011-06-29  Ian Lance Taylor  <iant@google.com>
6227
6228         PR gold/12695
6229         * layout.cc (Layout::symtab_section_shndx): New function.
6230         * layout.h (class Layout): Declare symtab_section_shndx.
6231         * output.cc (Output_section::write_header): Call it.
6232
6233 2011-06-29  Ian Lance Taylor  <iant@google.com>
6234
6235         PR gold/12818
6236         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
6237         symbols which are not used in a relocation.
6238
6239 2011-06-28  Ian Lance Taylor  <iant@google.com>
6240
6241         PR gold/12898
6242         * layout.cc (Layout::segment_precedes): Don't crash if a linker
6243         script create indistinguishable segments.
6244         (Layout::set_segment_offsets): Use stable_sort when sorting
6245         segments.  Pass this to Compare_segments constructor.
6246         * layout.h (class Layout): Make segment_precedes non-static.
6247         (class Compare_segments): Change from struct to class.  Add
6248         layout_ field.  Add constructor.
6249         * script-sections.cc
6250         (Script_sections::attach_sections_using_phdrs_clause): Rename
6251         local orphan to is_orphan.  Don't report failure to put empty
6252         section in segment.  On attachment failure, report name of
6253         section, and attach to first PT_LOAD segment.
6254
6255 2011-06-28  Ian Lance Taylor  <iant@google.com>
6256
6257         PR gold/12934
6258         * target-select.cc (Target_selector::Target_selector): Add
6259         emulation parameter.  Change all callers.
6260         (select_target_by_bfd_name): Rename from select_target_by_name.
6261         Change all callers.
6262         (select_target_by_emulation): New function.
6263         (supported_emulation_names): New function.
6264         * target-select.h (class Target_selector): Add emulation_ field.
6265         Update declarations.
6266         (Target_selector::recognize_by_bfd_name): Rename from
6267         recognize_by_name.  Change all callers.
6268         (Target_selector::supported_bfd_names): Rename from
6269         supported_names.  Change all callers.
6270         (Target_selector::recognize_by_emulation): New function.
6271         (Target_selector::supported_emulations): New function.
6272         (Target_selector::emulation): New function.
6273         (Target_selector::do_recognize_by_bfd_name): Rename from
6274         do_recognize_by_name.  Change all callers.
6275         (Target_selector::do_supported_bfd_names): Rename from
6276         do_supported_names.  Change all callers.
6277         (Target_selector::do_recognize_by_emulation): New function.
6278         (Target_selector::do_supported_emulations): New function.
6279         (select_target_by_bfd_name): Change name in declaration.
6280         (select_target_by_emulation): Declare.
6281         (supported_emulation_names): Declare.
6282         * parameters.cc (parameters_force_valid_target): Try to find
6283         target based on emulation from -m option.
6284         * options.h (class General_options): Change doc string for -m.
6285         * options.cc (help): Print emulations.
6286         (General_options::parse_V): Likewise.
6287         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
6288         Add emulation parameter.  Change all callers.
6289
6290 2011-06-28  Ian Lance Taylor  <iant@google.com>
6291
6292         * target.h (class Target): Add osabi_ field.
6293         (Target::osabi): New function.
6294         (Target::set_osabi): New function.
6295         (Target::Target): Initialize osabi_.
6296         (Target::do_adjust_elf_header): Make pure virtual.
6297         (Sized_target::do_adjust_elf_header): Declare.
6298         * target.cc (Sized_target::do_adjust_elf_header): New function.
6299         (class Sized_target): Instantiate all versions.
6300         * freebsd.h (class Target_freebsd): Remove.
6301         (Target_selector_freebsd::do_recognize): Call set_osabi on
6302         Target.
6303         (Target_selector_freebsd::do_recognize_by_name): Likewise.
6304         (Target_selector_freebsd::set_osabi): Remove.
6305         * i386.cc (class Target_i386): Inherit from Sized_target rather
6306         than Target_freebsd.
6307         * x86_64.cc (class Target_x86_64): Likewise.
6308
6309 2011-06-28  Ian Lance Taylor  <iant@google.com>
6310
6311         * target.h (Target::can_check_for_function_pointers): Rewrite.
6312         Make non-virtual.
6313         (Target::can_icf_inline_merge_sections): Likewise.
6314         (Target::section_may_have_icf_unsafe_poineters): Likewise.
6315         (Target::Target_info): Add can_icf_inline_merge_sections field.
6316         (Target::do_can_check_for_function_pointers): New virtual
6317         function.
6318         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
6319         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
6320         from can_check_for_function_pointers, move in file.
6321         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
6322         section_may_have_icf_unsafe_poineters, move in file.
6323         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
6324         * i386.cc (Target_i386::do_can_check_for_function_pointers):
6325         Rename from can_check_for_function_pointers, move in file.
6326         (Target_i386::can_icf_inline_merge_sections): Remove.
6327         (Target_i386::i386_info): Initialize
6328         can_icf_inline_merge_sections.
6329         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
6330         Initialize can_icf_inline_merge_sections.
6331         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
6332         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
6333         Rename from can_check_for_function_pointers, move in file.
6334         (Target_x86_64::can_icf_inline_merge_sections): Remove.
6335         (Target_x86_64::x86_64_info): Initialize
6336         can_icf_inline_merge_sections.
6337         * testsuite/testfile.cc (Target_test::test_target_info):
6338         Likewise.
6339         * icf.cc (get_section_contents): Correct formatting.
6340
6341 2011-06-27  Ian Lance Taylor  <iant@google.com>
6342
6343         * symtab.cc (Symbol::versioned_name): New function.
6344         (Symbol_table::add_to_final_symtab): Use versioned_name when
6345         appropriate.
6346         (Symbol_table::sized_write_symbol): Likewise.
6347         * symtab.h (class Symbol): Declare versioned_name.
6348         * stringpool.h (class Stringpool_template): Add variant of add
6349         which takes a std::basic_string.
6350         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
6351         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
6352         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
6353         (ver_test_12.o): New target.
6354         * testsuite/Makefile.in: Rebuild.
6355
6356 2011-06-27  Doug Kwan  <dougkwan@google.com>
6357
6358         * arm.cc (Arm_relocate_functions::thm_jump8,
6359         Arm_relocate_functions::thm_jump11): Use a wider signed
6360         type to compute offset.
6361         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
6362         arm_thm_jump8.
6363         * testsuite/Makefile.in: Regenerate.
6364         * testsuite/arm_branch_in_range.sh: Check test results of
6365         arm_thm_jump11 and arm_thm_jump8.
6366         * testsuite/arm_thm_jump11.s: New test source file.
6367         * testsuite/arm_thm_jump11.t: New linker script.
6368         * testsuite/arm_thm_jump8.s: New test source file.
6369         * testsuite/arm_thm_jump8.t: New linker script.
6370
6371 2011-06-24  Ian Lance Taylor  <iant@google.com>
6372
6373         * layout.cc: Include "object.h".
6374         (ctors_sections_in_init_array): New static variable.
6375         (Layout::is_ctors_in_init_array): New function.
6376         (Layout::layout): Add entry to ctors_sections_in_init_array if
6377         appropriate.
6378         * layout.h (class Layout): Declare is_ctors_in_init_array.
6379         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
6380         is_ctors_reverse_view is set.
6381         (Sized_relobj_file::write_sections): Add layout parameter.  Change
6382         all callers.  Set is_ctors_reverse_view field of View_size.
6383         (Sized_relobj_file::reverse_words): New function.
6384         * object.h (Sized_relobj_file::View_size): Add
6385         is_ctors_reverse_view field.
6386         (class Sized_relobj_file): Update declarations.
6387         * testsuite/initpri3.c: New test.
6388         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
6389         initpri3b.
6390         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
6391         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
6392         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
6393         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
6394         * testsuite/Makefile.in: Rebuild.
6395
6396 2011-06-24  Cary Coutant  <ccoutant@google.com>
6397
6398         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
6399         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
6400         (debug_msg_cdebug.err): New targets.
6401         * testsuite/Makefile.in: Regenerate.
6402         * testsuite/debug_msg.sh: Check output of link with compressed debug.
6403         Fix checks for link with shared library.
6404
6405 2011-06-24  Doug Kwan  <dougkwan@google.com>
6406
6407         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
6408         skip empty text sections.
6409         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
6410
6411 2011-06-22  Ian Lance Taylor  <iant@google.com>
6412
6413         PR gold/12910
6414         * options.h (class General_options): Add --ctors-in-init-array.
6415         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
6416         friends as SHT_PROGBITS for merging sections.
6417         (Layout::layout): Remove special handling of .init_array and
6418         friends.  Don't sort if doing relocatable link.  Sort for .ctors
6419         and .dtors if ctors_in_init_array.
6420         (Layout::make_output_section): Force correct section types for
6421         .init_array and friends.  Don't sort if doing relocatable link,
6422         Don't sort .ctors and .dtors if ctors_in_init_array.
6423         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
6424         (Layout::output_section_name): Add relobj parameter.  Change all
6425         callers.  Handle .ctors. and .dtors. in code rather than table.
6426         Handle .ctors and .dtors if ctors_in_init_array.
6427         (Layout::match_file_name): New function, moved from output.cc.
6428         * layout.h (class Layout): Update declarations.
6429         * output.cc: Include "layout.h".
6430         (Input_section_sort_entry::get_priority): New function.
6431         (Input_section_sort_entry::match_file_name): Just call
6432         Layout::match_file_name.
6433         (Output_section::Input_section_sort_init_fini_compare::operator()):
6434         Handle .ctors and .dtors.  Sort by explicit priority rather than
6435         by name.
6436         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
6437         * testsuite/initpri2.c: New test.
6438         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
6439         (check_PROGRAMS): Add initpri2.
6440         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
6441         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
6442         * configure, testsuite/Makefile.in: Rebuild.
6443
6444 2011-06-19  Ian Lance Taylor  <iant@google.com>
6445
6446         PR gold/12880
6447         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
6448         .interp section to a PT_INTERP segment even if we have seen a
6449         --dynamic-linker option.  Don't do it if we have seen a PHDRS
6450         clause in a linker script.
6451         (Layout::finalize): Don't create a .interp section if we've
6452         already create a PT_INTERP segment.
6453         (Layout::create_interp): Always call choose_output_section (revert
6454         patch of 2011-06-17).  Don't create PT_INTERP segment.
6455         * script-sections.cc
6456         (Script_sections::create_note_and_tls_segments): Add a .interp
6457         section to a PT_INTERP segment even if we have seen a
6458         --dynamic-linker option.
6459
6460 2011-06-18  Ian Lance Taylor  <iant@google.com>
6461
6462         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
6463         merely because a non-PT_LOAD segment has a dynamic reloc.
6464
6465 2011-06-18  Ian Lance Taylor  <iant@google.com>
6466
6467         * layout.cc (Layout::finish_dynamic_section): Don't create
6468         DT_FLAGS entry if not needed.
6469
6470 2011-06-18  Ian Lance Taylor  <iant@google.com>
6471
6472         PR gold/12745
6473         * layout.cc (Layout::layout_eh_frame): Correct handling of
6474         writable .eh_frame section.
6475
6476 2011-06-17  Ian Lance Taylor  <iant@google.com>
6477
6478         PR gold/12893
6479         * resolve.cc (Symbol_table::resolve): Don't give an error if a
6480         symbol is redefined with the exact same object and value.
6481
6482 2011-06-17  Ian Lance Taylor  <iant@google.com>
6483
6484         PR gold/12880
6485         * layout.h (class Layout): Add interp_segment_ field.
6486         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
6487         (Layout::attach_allocated_section_to_segment): If making shared
6488         library, put .interp section in PT_INTERP segment.
6489         (Layout::finalize): Also call create_interp if -dynamic-linker
6490         option was used.
6491         (Layout::create_interp): Assert that there is no PT_INTERP
6492         segment.  If not using a SECTIONS clause, use make_output_section.
6493         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
6494         * script-sections.cc
6495         (Script_sections::create_note_and_tls_segments): If making shared
6496         library, put .interp section in PT_INTERP segment.
6497
6498 2011-06-17  Ian Lance Taylor  <iant@google.com>
6499
6500         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
6501         when making a shared library.
6502
6503 2011-06-17  Ian Lance Taylor  <iant@google.com>
6504
6505         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
6506         parameter.  Change all callers.  Don't issue warning about PC32
6507         against locally defined symbol.
6508
6509 2011-06-16  Ian Lance Taylor  <iant@google.com>
6510
6511         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
6512         occurs in same object.
6513
6514 2011-06-14  Alan Modra  <amodra@gmail.com>
6515
6516         * po/POTFILES.in: Regenerate.
6517
6518 2011-06-09  Ian Lance Taylor  <iant@google.com>
6519
6520         * script-sections.cc
6521         (Orphan_output_section::set_section_addresses): For a relocatable
6522         link set address to 0.
6523
6524 2011-06-09  Cary Coutant  <ccoutant@google.com>
6525
6526         PR gold/12804
6527         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
6528         used with --compress-debug-sections.
6529         * gold/object.cc (Sized_relobj_file::do_layout): Report
6530         uncompressed size of compressed input sections.
6531
6532 2011-06-08  Cary Coutant  <ccoutant@google.com>
6533
6534         PR gold/12804
6535         * testsuite/two_file_test_2_v1.cc: Change initialization of
6536         v2 to keep it in .data.
6537
6538 2011-06-07  Cary Coutant  <ccoutant@google.com>
6539
6540         * common.cc (Symbol_table::do_allocate_commons_list): Call
6541         gold_fallback.
6542         * errors.cc (Errors::fatal): Adjust call to gold_exit.
6543         (Errors::fallback): New function.
6544         (gold_fallback): New function.
6545         * errors.h (Errors::fallback): New function.
6546         * gold.cc (gold_exit): Change status parameter to enum; adjust
6547         all callers.
6548         (queue_initial_tasks): Call gold_fallback.
6549         * gold.h: Include cstdlib.
6550         (Exit_status): New enum type.
6551         (gold_exit): Change status parameter to enum.
6552         (gold_fallback): New function.
6553         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
6554         (Layout::create_symtab_sections): Likewise.
6555         (Layout::create_shdrs): Likewise.
6556         * main.cc (main): Adjust call to gold_exit.
6557         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
6558         (Output_data_got::add_got_entry_pair): Likewise.
6559         (Output_section::add_input_section): Likewise.
6560         (Output_section::add_output_section_data): Likewise.
6561         (Output_segment::set_section_list_addresses): Likewise.
6562         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
6563
6564 2011-06-07  Cary Coutant  <ccoutant@google.com>
6565
6566         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
6567         for incremental links.
6568         * output.cc (Output_segment::set_section_list_addresses): Remove
6569         FIXME and test for TLS or BSS.
6570
6571 2011-06-07  Cary Coutant  <ccoutant@google.com>
6572
6573         * testsuite/Makefile.am: Add incremental_copy_test,
6574         incremental_common_test_1.
6575         * testsuite/Makefile.in: Regenerate.
6576         * testsuite/common_test_1_v1.c: New source file.
6577         * testsuite/common_test_1_v2.c: New source file.
6578         * testsuite/copy_test_v1.cc: New source file.
6579
6580 2011-06-07  Cary Coutant  <ccoutant@google.com>
6581
6582         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
6583         update, allocate common from bss section's free list.
6584         * incremental-dump.cc (dump_incremental_inputs): Print flag for
6585         linker-defined symbols.
6586         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
6587         Skip GOT and PLT entries that are no longer referenced.
6588         (Output_section_incremental_inputs::write_info_blocks): Mark
6589         linker-defined symbols.
6590         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
6591         * output.cc (Output_section::allocate): New function.
6592         * output.h (Output_section::allocate): New function.
6593         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
6594         linker-defined symbols.
6595         (Symbol::override_base_with_special): Copy is_predefined_ flag.
6596         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
6597         (Symbol::init_base_output_data): Likewise.
6598         (Symbol::init_base_output_segment): Likewise.
6599         (Symbol::init_base_constant): Likewise.
6600         (Sized_symbol::init_output_data): Likewise.
6601         (Sized_symbol::init_output_segment): Likewise.
6602         (Sized_symbol::init_constant): Likewise.
6603         (Symbol_table::do_define_in_output_data): Likewise.
6604         (Symbol_table::do_define_in_output_segment): Likewise.
6605         (Symbol_table::do_define_as_constant): Likewise.
6606         * symtab.h (Symbol::is_predefined): New function.
6607         (Symbol::init_base_output_data): Add is_predefined parameter.
6608         (Symbol::init_base_output_segment): Likewise.
6609         (Symbol::init_base_constant): Likewise.
6610         (Symbol::is_predefined_): New data member.
6611         (Sized_symbol::init_output_data): Add is_predefined parameter.
6612         (Sized_symbol::init_output_segment): Likewise.
6613         (Sized_symbol::init_constant): Likewise.
6614         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
6615
6616 2011-06-07  Cary Coutant  <ccoutant@google.com>
6617
6618         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
6619         instead of emit_copy_reloc.
6620         (Copy_relocs::emit_copy_reloc): Refactor.
6621         (Copy_relocs::make_copy_reloc): New function.
6622         (Copy_relocs::add_copy_reloc): Remove.
6623         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
6624         section.
6625         (Copy_relocs::make_copy_reloc): New function.
6626         (Copy_relocs::add_copy_reloc): Remove.
6627         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
6628         unchanged input files.
6629         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
6630         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
6631         Reserve BSS space for COPY relocations.
6632         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6633         (Output_section_incremental_inputs::write_info_blocks): Record
6634         whether a symbol is copied from a shared object.
6635         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
6636         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
6637         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
6638         (Incremental_input_entry_reader::get_output_symbol_index): Add
6639         is_copy parameter.
6640         (Incremental_binary::emit_copy_relocs): New function.
6641         (Incremental_binary::do_emit_copy_relocs): New function.
6642         (Sized_incremental_binary::Sized_incremental_binary): Initialize
6643         new data member.
6644         (Sized_incremental_binary::add_copy_reloc): New function.
6645         (Sized_incremental_binary::do_emit_copy_relocs): New function.
6646         (Sized_incremental_binary::Copy_reloc): New struct.
6647         (Sized_incremental_binary::Copy_relocs): New typedef.
6648         (Sized_incremental_binary::copy_relocs_): New data member.
6649         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
6650         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
6651         * target.h (Sized_target::emit_copy_reloc): New function.
6652         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
6653
6654 2011-06-02  Cary Coutant  <ccoutant@google.com>
6655
6656         PR gold/12163
6657         * gold/archive.cc (Archive::Archive): Initialize new data member.
6658         (Archive::include_all_members): Return if archive has already been
6659         included.
6660         * gold/archive.h (Archive::include_all_members_): New data member.
6661
6662 2011-06-02  Nick Clifton  <nickc@redhat.com>
6663
6664         * dynobj.h: Fix spelling mistake in comment.
6665         * output.cc: Likewise.
6666
6667 2011-05-31  Doug Kwan  <dougkwan@google.com>
6668             Asier Llano
6669
6670         PR gold/12826
6671         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
6672         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
6673         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
6674         redundant arm_exidx_test.so.
6675         * testsuite/Makefile.in: Regenerate.
6676         (check_SCRIPTS): Add pr12826.sh
6677         (check_DATA): Add pr12826.stdout
6678         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
6679         * testsuite/pr12826.sh: New file.
6680         * testsuite/pr12826_1.s: Ditto.
6681         * testsuite/pr12826_1.s: Ditto.
6682
6683 2011-05-30  Ian Lance Taylor  <iant@google.com>
6684
6685         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
6686         sections.
6687
6688 2011-05-29  Ian Lance Taylor  <iant@google.com>
6689
6690         PR gold/12804
6691         * testsuite/Makefile.am: Use different file name for two_file_test
6692         temporary file for each incremental test.
6693         * testsuite/Makefile.in: Rebuild.
6694
6695 2011-05-29  Ian Lance Taylor  <iant@google.com>
6696
6697         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
6698         binary input file is empty.
6699
6700 2011-05-27  Ian Lance Taylor  <iant@google.com>
6701
6702         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
6703         (ver_test_9.so): Likewise.
6704         * testsuite/Makefile.in: Rebuild.
6705
6706 2011-05-26 Cary Coutant  <ccoutant@google.com>
6707
6708         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
6709         * incremental.cc (Incremental_inputs::report_input_section): Fix
6710         comment, indentation.
6711         (Incremental_inputs::report_comdat_group): New function.
6712         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6713         of data for incremental input file entry.
6714         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
6715         group count, COMDAT group signatures.
6716         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
6717         an unchanged input file.
6718         * incremental.h (Incremental_object_entry::Incremental_object_entry):
6719         Initialize new data member.
6720         (Incremental_object_entry::add_comdat_group): New function.
6721         (Incremental_object_entry::get_comdat_group_count): New function.
6722         (Incremental_object_entry::get_comdat_signature_key): New function.
6723         (Incremental_object_entry::groups_): New data member.
6724         (Incremental_inputs::report_comdat_group): New function.
6725         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
6726         data for incremental input file entry.
6727         (Incremental_input_entry_reader::get_comdat_group_count): New function.
6728         (Incremental_input_entry_reader::get_input_section): Adjust size of
6729         data for incremental input file entry.
6730         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
6731         (Incremental_input_entry_reader::get_comdat_group_signature): New
6732         function.
6733         * object.cc (Sized_relobj::include_section_group): Report kept
6734         COMDAT groups for incremental links.
6735
6736 2011-05-24  David Meyer  <pdox@google.com>
6737
6738         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
6739         with name parameter.  Add found_name parameter.
6740         * fileread.cc (Input_file::find_file): Adjust code accordingly.
6741         * dirsearch.h (class Dirsearch): Update declaration.
6742
6743 2011-05-24  Ian Lance Taylor  <iant@google.com>
6744
6745         * archive.cc (Library_base::should_include_member): Pull in object
6746         from archive if it defines the entry symbol.
6747         * parameters.cc (Parameters::entry): New function.
6748         * parameters.h (class Parameters): Declare entry.
6749         * output.h (class Output_file_header): Remove entry_ field.
6750         * output.cc (Output_file_header::Output_file_header): Remove entry
6751         parameter.  Change all callers.
6752         (Output_file_header::entry): Use parameters->entry.
6753         * gold.cc (queue_middle_tasks): Likewise.
6754         * plugin.cc (Plugin_hook::run): Likewise.
6755
6756 2011-05-24 Cary Coutant  <ccoutant@google.com>
6757
6758         * gold.cc (queue_initial_tasks): Pass incremental base filename
6759         to Output_file::open_base_file; don't print error message.
6760         * incremental-dump.cc (main): Adjust call to
6761         Output_file::open_for_modification.
6762         * incremental-dump.cc (main): Likewise.
6763         * incremental.cc (Incremental_inputs::report_command_line):
6764         Ignore --incremental-base option when comparing command lines.
6765         Ignore parameter when given as separate argument.
6766         * options.h (class General_options): Add --incremental-base.
6767         * output.cc (Output_file::Output_file):
6768         (Output_file::open_base_file): Add base_name and writable parameters;
6769         read base file into new file; print error message here.
6770         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6771         callers.
6772         * output.h (Output_file::open_for_modification): Rename to...
6773         (Output_file::open_base_file): ...this; add base_name and
6774         writable parameters; adjust all callers.
6775         (Output_file::map_no_anonymous): Add writable parameter; adjust all
6776         callers.
6777         * testsuite/Makefile.am (incremental_test_4): Test
6778         --incremental-base.
6779         * testsuite/Makefile.in: Regenerate.
6780
6781 2011-05-24 Cary Coutant  <ccoutant@google.com>
6782
6783         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
6784         incremental_test_4.
6785         * testsuite/Makefile.in: Regenerate.
6786         * testsuite/two_file_test_1_v1.cc: New test source file.
6787         * testsuite/two_file_test_1b_v1.cc: New test source file.
6788         * testsuite/two_file_test_2_v1.cc: New test source file.
6789
6790 2011-05-24 Cary Coutant  <ccoutant@google.com>
6791
6792         * dynobj.h (Dynobj::do_dynobj): New function.
6793         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
6794         flag and soname for shared objects.
6795         * incremental.cc (Incremental_inputs::report_object): Make
6796         either Incremental_object_entry or Incremental_dynobj_entry; add
6797         soname to string table.
6798         (Incremental_inputs::report_input_section): Add assertion.
6799         (Output_section_incremental_inputs::set_final_data_size): Adjust
6800         type of input file entry for shared libraries; adjust size of
6801         shared library info entry.
6802         (Output_section_incremental_inputs::write_input_files): Write
6803         as_needed flag for shared libraries.
6804         (Output_section_incremental_inputs::write_info_blocks): Adjust type
6805         of input file entry for shared libraries; write soname.
6806         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
6807         soname from incremental info.
6808         * incremental.h (enum Incremental_input_flags): Add
6809         INCREMENTAL_INPUT_AS_NEEDED.
6810         (Incremental_input_entry::Incremental_input_entry): Initialize new
6811         data member.
6812         (Incremental_input_entry::set_as_needed): New function.
6813         (Incremental_input_entry::as_needed): New function.
6814         (Incremental_input_entry::do_dynobj_entry): New function.
6815         (Incremental_input_entry::as_needed_): New data member.
6816         (Incremental_object_entry::Incremental_object_entry): Don't check
6817         for shared library.
6818         (Incremental_object_entry::do_type): Likewise.
6819         (class Incremental_dynobj_entry): New class.
6820         (Incremental_input_entry_reader::as_needed): New function.
6821         (Incremental_input_entry_reader::get_soname): New function.
6822         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
6823         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
6824         size of shared library info entry.
6825         * layout.cc (Layout::finish_dynamic_section): Don't test for
6826         incremental link when adding DT_NEEDED entries.
6827         * object.h (Object::Object): Initialize new data member.
6828         (Object::dynobj): New function.
6829         (Object::set_as_needed): New function.
6830         (Object::as_needed): New function.
6831         (Object::do_dynobj): New function.
6832         (Object::as_needed_): New data member.
6833
6834 2011-05-24 Cary Coutant  <ccoutant@google.com>
6835
6836         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
6837         info; adjust display of GOT entries.
6838         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
6839         vector of input objects; remove file_status_.
6840         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
6841         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
6842         got_plt reader; call target hooks to reserve GOT entries.
6843         (Output_section_incremental_inputs::set_final_data_size): Adjust size
6844         of input file info header and GOT info entry.
6845         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
6846         relocation info.
6847         (Got_plt_view_info::got_descriptor): Remove.
6848         (Got_plt_view_info::sym_index): New data member.
6849         (Got_plt_view_info::input_index): New data member.
6850         (Local_got_offset_visitor::visit): Write input file index.
6851         (Global_got_offset_visitor::visit): Write 0 for input file index.
6852         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
6853         with sym_index and input_index.
6854         (Output_section_incremental_inputs::write_got_plt): Adjust size of
6855         incremental info GOT entry; replace got_descriptor with input_index.
6856         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
6857         map from input file index to object.
6858         (Sized_relobj_incr::do_layout): Replace direct data member reference
6859         with accessor function.
6860         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
6861         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
6862         Adjust size of input file info header.
6863         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
6864         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
6865         (Incremental_input_entry_reader::get_input_section): Adjust size of
6866         input file info header.
6867         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
6868         of incremental info GOT entry.
6869         (Incremental_got_plt_reader::get_got_desc): Remove.
6870         (Incremental_got_plt_reader::get_got_symndx): New function.
6871         (Incremental_got_plt_reader::get_got_input_index): New function.
6872         (Sized_incremental_binary::Sized_incremental_binary): Remove
6873         file_status_; add input_objects_.
6874         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
6875         (Sized_incremental_binary::set_file_is_unchanged): Remove.
6876         (Sized_incremental_binary::file_is_unchanged): Remove.
6877         (Sized_incremental_binary::set_input_object): New function.
6878         (Sized_incremental_binary::input_object): New function.
6879         (Sized_incremental_binary::file_status_): Remove.
6880         (Sized_incremental_binary::input_objects_): New data member.
6881         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
6882         references.
6883         (Sized_relobj_incr::invalid_address): Move to base class.
6884         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
6885         class.
6886         (Sized_relobj_incr::do_output_section_offset): Likewise.
6887         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
6888         (Sized_relobj_incr::section_offsets_): Likewise.
6889         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
6890         function.
6891         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
6892         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
6893         with accessor function.
6894         (Sized_relobj_file::do_layout): Likewise.
6895         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
6896         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
6897         (Sized_relobj_file::compute_final_local_value): Replace refs to
6898         section_offsets_ with accessor function.
6899         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
6900         * object.h (Relobj::Relobj): Initialize new data members.
6901         (Relobj::add_dyn_reloc): New function.
6902         (Relobj::first_dyn_reloc): New function.
6903         (Relobj::dyn_reloc_count): New function.
6904         (Relobj::first_dyn_reloc_): New data member.
6905         (Relobj::dyn_reloc_count_): New data member.
6906         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
6907         references.
6908         (Sized_relobj::Address): New typedef.
6909         (Sized_relobj::invalid_address): Move here from child class.
6910         (Sized_relobj::Sized_relobj): Initialize new data members.
6911         (Sized_relobj::sized_relobj): New function.
6912         (Sized_relobj::is_output_section_offset_invalid): Move here from
6913         child class.
6914         (Sized_relobj::get_output_section_offset): Likewise.
6915         (Sized_relobj::local_has_got_offset): Likewise.
6916         (Sized_relobj::local_got_offset): Likewise.
6917         (Sized_relobj::set_local_got_offset): Likewise.
6918         (Sized_relobj::do_for_all_local_got_entries): Likewise.
6919         (Sized_relobj::clear_got_offsets): New function.
6920         (Sized_relobj::section_offsets): Move here from child class.
6921         (Sized_relobj::do_output_section_offset): Likewise.
6922         (Sized_relobj::do_set_section_offset): Likewise.
6923         (Sized_relobj::Local_got_offsets): Likewise.
6924         (Sized_relobj::local_got_offsets_): Likewise.
6925         (Sized_relobj::section_offsets_): Likewise.
6926         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
6927         references.
6928         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
6929         class.
6930         (Sized_relobj_file::sized_relobj): New function
6931         (Sized_relobj_file::local_has_got_offset): Move to base class.
6932         (Sized_relobj_file::local_got_offset): Likewise.
6933         (Sized_relobj_file::set_local_got_offset): Likewise.
6934         (Sized_relobj_file::get_output_section_offset): Likewise.
6935         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
6936         (Sized_relobj_file::do_output_section_offset): Likewise.
6937         (Sized_relobj_file::do_set_section_offset): Likewise.
6938         (Sized_relobj_file::Local_got_offsets): Likewise.
6939         (Sized_relobj_file::local_got_offsets_): Likewise.
6940         (Sized_relobj_file::section_offsets_): Likewise.
6941         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
6942         (all constructors).
6943         (set_needs_dynsym_index): Convert relobj to derived class pointer.
6944         (Output_reloc::get_symbol_index): Likewise.
6945         (Output_reloc::local_section_offset): Likewise.
6946         (Output_reloc::get_address): Likewise.
6947         (Output_reloc::symbol_value): Likewise.
6948         (Output_data_got::reserve_slot): Move to class definition.
6949         (Output_data_got::reserve_local): New function.
6950         (Output_data_got::reserve_slot_for_global): Remove.
6951         (Output_data_got::reserve_global): New function.
6952         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
6953         (all constructors, two instantiations).
6954         (Output_reloc::get_relobj): New function (two instantiations).
6955         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
6956         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
6957         (Output_data_reloc::add_global): Adjust type of relobj.
6958         (Output_data_reloc::add_global_relative): Likewise.
6959         (Output_data_reloc::add_symbolless_global_addend): Likewise.
6960         (Output_data_reloc::add_local): Likewise.
6961         (Output_data_reloc::add_local_relative): Likewise.
6962         (Output_data_reloc::add_symbolless_local_addend): Likewise.
6963         (Output_data_reloc::add_local_section): Likewise.
6964         (Output_data_reloc::add_output_section): Likewise.
6965         (Output_data_reloc::add_absolute): Likewise.
6966         (Output_data_reloc::add_target_specific): Likewise.
6967         (Output_data_got::reserve_slot): Move definition here.
6968         (Output_data_got::reserve_local): New function.
6969         (Output_data_got::reserve_global): New function.
6970         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
6971         section_offsets_ with accessor function.
6972         (Sized_relobj_file::write_sections): Likewise.
6973         (Sized_relobj_file::do_relocate_sections): Likewise.
6974         * target.h (Sized_target::reserve_local_got_entry): New function.
6975         (Sized_target::reserve_global_got_entry): New function.
6976         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
6977         (Target_x86_64::reserve_global_got_entry): New function.
6978         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
6979
6980 2011-05-23 Cary Coutant  <ccoutant@google.com>
6981
6982         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
6983         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
6984         bit when checking got_type.
6985         * incremental.cc (Sized_incremental_binary::setup_readers):
6986         Store symbol table and string table locations; initialize bit vector
6987         of file status flags.
6988         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
6989         unchanged files.
6990         (Sized_incremental_binary::do_process_got_plt): New function.
6991         (Sized_incremental_binary::get_symtab_view): Use stored locations.
6992         (Output_section_incremental_inputs::set_final_data_size): Record
6993         file index for each input file.
6994         (Output_section_incremental_inputs::write_got_plt): Store file index
6995         instead of input entry offset for each GOT entry.
6996         * incremental.h
6997         (Incremental_input_entry::Incremental_input_entry): Initialize new
6998         data member.
6999         (Incremental_input_entry::set_offset): Store file index.
7000         (Incremental_input_entry::get_file_index): New function.
7001         (Incremental_input_entry::file_index_): New data member.
7002         (Incremental_binary::process_got_plt): New function.
7003         (Incremental_binary::do_process_got_plt): New function.
7004         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7005         data members.
7006         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
7007         (Sized_incremental_binary::set_file_is_unchanged): New function.
7008         (Sized_incremental_binary::file_is_unchanged): New function.
7009         (Sized_incremental_binary::do_process_got_plt): New function.
7010         (Sized_incremental_binary::file_status_): New data member.
7011         (Sized_incremental_binary::main_symtab_loc_): New data member.
7012         (Sized_incremental_binary::main_strtab_loc_): New data member.
7013         * output.cc (Output_data_got::Got_entry::write): Add case
7014         RESERVED_CODE.
7015         (Output_data_got::add_global): Call add_got_entry.
7016         (Output_data_got::add_global_plt): Likewise.
7017         (Output_data_got::add_global_with_rel): Likewise.
7018         (Output_data_got::add_global_with_rela): Likewise.
7019         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
7020         (Output_data_got::add_global_pair_with_rela): Likewise.
7021         (Output_data_got::add_local): Call add_got_entry.
7022         (Output_data_got::add_local_plt): Likewise.
7023         (Output_data_got::add_local_with_rel): Likewise.
7024         (Output_data_got::add_local_with_rela): Likewise.
7025         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
7026         (Output_data_got::add_local_pair_with_rela): Likewise.
7027         (Output_data_got::reserve_slot): New function.
7028         (Output_data_got::reserve_slot_for_global): New function.
7029         (Output_data_got::add_got_entry): New function.
7030         (Output_data_got::add_got_entry_pair): New function.
7031         (Output_section::add_output_section_data): Edit FIXME.
7032         * output.h
7033         (Output_section_data_build::Output_section_data_build): New
7034         constructor with size parameter.
7035         (Output_data_space::Output_data_space): Likewise.
7036         (Output_data_got::Output_data_got): Initialize new data member; new
7037         constructor with size parameter.
7038         (Output_data_got::add_constant): Call add_got_entry.
7039         (Output_data_got::reserve_slot): New function.
7040         (Output_data_got::reserve_slot_for_global): New function.
7041         (class Output_data_got::Got_entry): Add RESERVED_CODE.
7042         (Output_data_got::add_got_entry): New function.
7043         (Output_data_got::add_got_entry_pair): New function.
7044         (Output_data_got::free_list_): New data member.
7045         * target.h (Sized_target::init_got_plt_for_update): New function.
7046         (Sized_target::register_global_plt_entry): New function.
7047         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
7048         Initialize new data member; call init; add constructor with PLT count.
7049         (Output_data_plt_x86_64::init): New function.
7050         (Output_data_plt_x86_64::add_relocation): New function.
7051         (Output_data_plt_x86_64::reserve_slot): New function.
7052         (Output_data_plt_x86_64::free_list_): New data member.
7053         (Target_x86_64::init_got_plt_for_update): New function.
7054         (Target_x86_64::register_global_plt_entry): New function.
7055         (Output_data_plt_x86_64::add_entry): Allocate from free list for
7056         incremental updates.
7057         (Output_data_plt_x86_64::add_relocation): New function.
7058         * testsuite/object_unittest.cc (Object_test): Set default options.
7059
7060 2011-05-16  Ian Lance Taylor  <iant@google.com>
7061
7062         * options.h (class General_options): Make -i a synonym for -r.
7063
7064 2011-05-16  Ian Lance Taylor  <iant@google.com>
7065
7066         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
7067
7068 2011-05-10 Cary Coutant  <ccoutant@google.com>
7069
7070         * object.cc (Sized_relobj::do_count_local_symbols): Check for
7071         strip_all (-s).
7072
7073 2011-05-06  Ian Lance Taylor  <iant@google.com>
7074
7075         * layout.cc (Layout::layout): If the output section flags change,
7076         update the ordering.
7077
7078 2011-04-25 Cary Coutant  <ccoutant@google.com>
7079
7080         * incremental-dump.cc (dump_incremental_inputs): Print local
7081         symbol info for each input file.
7082         * incremental.cc
7083         (Output_section_incremental_inputs::set_final_data_size): Add local
7084         symbol info to input file entries in incremental info.
7085         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7086         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
7087         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
7088         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
7089         implementation.
7090         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
7091         (Sized_incr_relobj::do_relocate): Write the local symbols.
7092         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
7093         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
7094         Adjust size of input file header.
7095         (Incremental_inputs_reader::get_local_symbol_offset): New function.
7096         (Incremental_inputs_reader::get_local_symbol_count): New function.
7097         (Incremental_inputs_reader::get_input_section): Adjust size of input
7098         file header.
7099         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
7100         (Sized_incr_relobj::This): New typedef.
7101         (Sized_incr_relobj::sym_size): New const data member.
7102         (Sized_incr_relobj::Local_symbol): New struct.
7103         (Sized_incr_relobj::do_output_local_symbol_count): New function.
7104         (Sized_incr_relobj::do_local_symbol_offset): New function.
7105         (Sized_incr_relobj::local_symbol_count_): New data member.
7106         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
7107         (Sized_incr_relobj::local_symbol_index_): New data member.
7108         (Sized_incr_relobj::local_symbol_offset_): New data member.
7109         (Sized_incr_relobj::local_dynsym_offset_): New data member.
7110         (Sized_incr_relobj::local_symbols_): New data member.
7111         * object.h (Relobj::output_local_symbol_count): New function.
7112         (Relobj::local_symbol_offset): New function.
7113         (Relobj::do_output_local_symbol_count): New function.
7114         (Relobj::do_local_symbol_offset): New function.
7115         (Sized_relobj::do_output_local_symbol_count): New function.
7116         (Sized_relobj::do_local_symbol_offset): New function.
7117
7118 2011-04-22  Vladimir Simonov  <sv@sw.ru>
7119
7120         * descriptors.cc (set_close_on_exec): New function.
7121         (Descriptors::open): Use set_close_on_exec.
7122         * output.cc (S_ISLNK): Define if not defined.
7123
7124 2011-04-22 Cary Coutant  <ccoutant@google.com>
7125
7126         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
7127         global symbol map.
7128         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7129         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
7130         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
7131         relocations.
7132         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
7133         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
7134         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
7135         * incremental.h
7136         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
7137         function.
7138         (Incremental_binary::apply_incremental_relocs): New function.
7139         (Incremental_binary::do_apply_incremental_relocs): New function.
7140         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
7141         data member.
7142         (Sized_incremental_binary::add_global_symbol): New function.
7143         (Sized_incremental_binary::global_symbol): New function.
7144         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
7145         (Sized_incremental_binary::symbol_map_): New data member.
7146         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
7147         * target.h (Sized_target::apply_relocation): New function.
7148         * target-reloc.h (apply_relocation): New function.
7149         * x86_64.cc (Target_x86_64::apply_relocation): New function.
7150
7151 2011-04-22  Doug Kwan  <dougkwan@google.com>
7152
7153         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
7154         flag of a SHT_ARM_EXIDX section.
7155         * testsuite/Makefile.am (arm_exidx_test): New test rules.
7156         * testsuite/Makefile.in: Regenerate.
7157         * testsuite/arm_exidx_test.s: New file.
7158         * testsuite/arm_exidx_test.sh: Same.
7159
7160 2011-04-20 Cary Coutant  <ccoutant@google.com>
7161
7162         PR gold/12689
7163         * archive.h (Incremental_archive_entry::Archive_member):
7164         Initialize arg_serial_ (second constructor).
7165
7166 2011-04-17  Ian Lance Taylor  <iant@google.com>
7167
7168         * object.cc (Relocate_info::location): Simplify location string.
7169         * errors.cc (Errors::error_at_location): Don't print program
7170         name.
7171         (Errors::warning_at_location): Likewise.
7172         (Errors::undefined_symbol): Likewise.
7173         * testsuite/debug_msg.sh: Update accordingly.
7174
7175 2011-04-14 Cary Coutant  <ccoutant@google.com>
7176
7177         * gold/layout.cc (Layout::symtab_section_offset): New function.
7178         * gold/layout.h (Layout::symtab_section_offset): New function.
7179         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
7180
7181 2011-04-12  Ian Lance Taylor  <iant@google.com>
7182
7183         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
7184         with MREMAP_MAYMOVE.
7185         * output.h (class Output_file): Add map_is_allocated_ field.
7186         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
7187         not available, provide stubs.  If mremap is not available, #define
7188         it to gold_mremap.
7189         (MREMAP_MAYMOVE): Define if not defined.
7190         (Output_file::Output_file): Initialize map_is_allocated_.
7191         (Output_file::resize): Check map_is_allocated_.
7192         (Output_file::map_anonymous): If mmap fails, use malloc.
7193         (Output_file::unmap): Don't do anything for an anonymous map.
7194         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
7195         is not available, provide stubs.
7196         (File_read::View::~View): Use free rather than delete[].
7197         (File_read::make_view): Use malloc rather than new[].  If mmap
7198         fails, use malloc.
7199         (File_read::find_or_make_view): Use malloc rather than new[].
7200         * gold.h: Remove HAVE_REMAP code.
7201         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
7202         exists.  Rename mremap to gold_mremap.  If mmap is not available
7203         don't do anything.
7204         * configure, config.in: Rebuild.
7205
7206 2011-04-11  Ian Lance Taylor  <iant@google.com>
7207
7208         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
7209         initialize local variable v.
7210
7211 2011-04-11  Cary Coutant  <ccoutant@google.com>
7212
7213         * archive.cc (Archive::include_member): Adjust call to
7214         report_object.
7215         (Add_archive_symbols::run): Track argument serial numbers.
7216         (Lib_group::include_member): Likewise.
7217         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
7218         * archive.h (Incremental_archive_entry::Archive_member):
7219         Initialize arg_serial_.
7220         (Archive_member::arg_serial_): New data member.
7221         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
7222         (Sized_dynobj::do_add_symbols): Track symbols when doing an
7223         incremental link.
7224         (Sized_dynobj::do_for_all_local_got_entries): New function.
7225         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
7226         function.
7227         * fileread.cc (get_mtime): New function.
7228         * fileread.h (get_mtime): New function.
7229         * gold.cc (queue_initial_tasks): Check for incremental update.
7230         (process_incremental_input): New function.
7231         (queue_middle_tasks): Don't force valid target for incremental
7232         update.
7233         * incremental-dump.cc (find_input_containing_global): Adjust
7234         size of symbol info entry.
7235         (dump_incremental_inputs): Dump argument serial number and
7236         in_system_directory flag; bias shndx by 1; print symbol names
7237         when dumping per-file symbol lists; use new symbol info readers.
7238         * incremental.cc
7239         (Output_section_incremental_inputs:update_data_size): New function.
7240         (Sized_incremental_binary::setup_readers): Setup input readers
7241         for each input file; build maps for files added from libraries
7242         and scripts.
7243         (Sized_incremental_binary::check_input_args): New function.
7244         (Sized_incremental_binary::do_check_inputs): Build map of argument
7245         serial numbers to input arguments.
7246         (Sized_incremental_binary::do_file_has_changed): Rename
7247         do_file_is_unchanged to this; compare file modification times.
7248         (Sized_incremental_binary::do_init_layout): New function.
7249         (Sized_incremental_binary::do_reserve_layout): New function.
7250         (Sized_incremental_binary::do_get_input_reader): Remove.
7251         (Sized_incremental_binary::get_symtab_view): New function.
7252         (Incremental_checker::can_incrementally_link_output_file): Remove.
7253         (Incremental_inputs::report_command_line): Exclude --debug options.
7254         (Incremental_inputs::report_archive_begin): Add parameter; track
7255         argument serial numbers; don't put input file entry for archive
7256         before archive members.
7257         (Incremental_inputs::report_archive_end): Put input file entry
7258         for archive after archive members.
7259         (Incremental_inputs::report_object): Add parameter; track argument
7260         serial numbers and in_system_directory flag.
7261         (Incremental_inputs::report_script): Add parameter; track argument
7262         serial numbers.
7263         (Output_section_incremental_inputs::set_final_data_size): Adjust
7264         size of symbol info entry; check for forwarding symbols.
7265         (Output_section_incremental_inputs::write_input_files): Write
7266         in_system_directory flag and argument serial number.
7267         (Output_section_incremental_inputs::write_info_blocks): Map section
7268         indices between incremental info and original input file; store
7269         input section index for each symbol.
7270         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
7271         change operator() to visit().
7272         (class Global_got_offset_visitor): Likewise.
7273         (class Global_symbol_visitor_got_plt):
7274         (Output_section_incremental_inputs::write_got_plt): Use new visitor
7275         classes.
7276         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
7277         (Sized_incr_relobj::do_read_symbols): New function.
7278         (Sized_incr_relobj::do_layout): New function.
7279         (Sized_incr_relobj::do_layout_deferred_sections): New function.
7280         (Sized_incr_relobj::do_add_symbols): New function.
7281         (Sized_incr_relobj::do_should_include_member): New function.
7282         (Sized_incr_relobj::do_for_all_global_symbols): New function.
7283         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
7284         (Sized_incr_relobj::do_section_size): New function.
7285         (Sized_incr_relobj::do_section_name): New function.
7286         (Sized_incr_relobj::do_section_contents): New function.
7287         (Sized_incr_relobj::do_section_flags): New function.
7288         (Sized_incr_relobj::do_section_entsize): New function.
7289         (Sized_incr_relobj::do_section_address): New function.
7290         (Sized_incr_relobj::do_section_type): New function.
7291         (Sized_incr_relobj::do_section_link): New function.
7292         (Sized_incr_relobj::do_section_info): New function.
7293         (Sized_incr_relobj::do_section_addralign): New function.
7294         (Sized_incr_relobj::do_initialize_xindex): New function.
7295         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
7296         (Sized_incr_relobj::do_read_relocs): New function.
7297         (Sized_incr_relobj::do_gc_process_relocs): New function.
7298         (Sized_incr_relobj::do_scan_relocs): New function.
7299         (Sized_incr_relobj::do_count_local_symbols): New function.
7300         (Sized_incr_relobj::do_finalize_local_symbols): New function.
7301         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
7302         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
7303         (Sized_incr_relobj::do_relocate): New function.
7304         (Sized_incr_relobj::do_set_section_offset): New function.
7305         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
7306         (Sized_incr_dynobj::do_read_symbols): New function.
7307         (Sized_incr_dynobj::do_layout): New function.
7308         (Sized_incr_dynobj::do_add_symbols): New function.
7309         (Sized_incr_dynobj::do_should_include_member): New function.
7310         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
7311         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
7312         (Sized_incr_dynobj::do_section_size): New function.
7313         (Sized_incr_dynobj::do_section_name): New function.
7314         (Sized_incr_dynobj::do_section_contents): New function.
7315         (Sized_incr_dynobj::do_section_flags): New function.
7316         (Sized_incr_dynobj::do_section_entsize): New function.
7317         (Sized_incr_dynobj::do_section_address): New function.
7318         (Sized_incr_dynobj::do_section_type): New function.
7319         (Sized_incr_dynobj::do_section_link): New function.
7320         (Sized_incr_dynobj::do_section_info): New function.
7321         (Sized_incr_dynobj::do_section_addralign): New function.
7322         (Sized_incr_dynobj::do_initialize_xindex): New function.
7323         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
7324         (make_sized_incremental_object): New function.
7325         (Incremental_library::copy_unused_symbols): New function.
7326         (Incremental_library::do_for_all_unused_symbols): New function.
7327         * incremental.h (enum Incremental_input_flags): New type.
7328         (class Incremental_checker): Remove.
7329         (Incremental_input_entry::Incremental_input_entry): Add argument
7330         serial number.
7331         (Incremental_input_entry::arg_serial): New function.
7332         (Incremental_input_entry::set_is_in_system_directory): New function.
7333         (Incremental_input_entry::is_in_system_directory): New function.
7334         (Incremental_input_entry::arg_serial_): New data member.
7335         (Incremental_input_entry::is_in_system_directory_): New data member.
7336         (class Script_info): Move here from script.h.
7337         (Script_info::Script_info): Add filename parameter.
7338         (Script_info::filename): New function.
7339         (Script_info::filename_): New data member.
7340         (Incremental_script_entry::Incremental_script_entry): Add argument
7341         serial number.
7342         (Incremental_object_entry::Incremental_object_entry): Likewise.
7343         (Incremental_object_entry::add_input_section): Build list of input
7344         sections with map to original shndx.
7345         (Incremental_object_entry::get_input_section_index): New function.
7346         (Incremental_object_entry::shndx_): New data member.
7347         (Incremental_object_entry::name_key_): Rename; adjust all refs.
7348         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
7349         (Incremental_archive_entry::Incremental_archive_entry): Add argument
7350         serial number.
7351         (Incremental_inputs::report_archive_begin): Likewise.
7352         (Incremental_inputs::report_object): Likewise.
7353         (Incremental_inputs::report_script): Likewise.
7354         (class Incremental_global_symbol_reader): New class.
7355         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
7356         and store flags and input file type.
7357         (Incremental_input_entry_reader::arg_serial): New function.
7358         (Incremental_input_entry_reader::type): Extract type from flags.
7359         (Incremental_input_entry_reader::is_in_system_directory): New function.
7360         (Incremental_input_entry_reader::get_input_section_count): Call
7361         accessor function for type.
7362         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
7363         function for type; adjust size of global symbol entry.
7364         (Incremental_input_entry_reader::get_global_symbol_count): Call
7365         accessor function for type.
7366         (Incremental_input_entry_reader::get_object_count): Likewise.
7367         (Incremental_input_entry_reader::get_object_offset): Likewise.
7368         (Incremental_input_entry_reader::get_member_count): Likewise.
7369         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
7370         (Incremental_input_entry_reader::get_member_offset): Likewise.
7371         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
7372         (Incremental_input_entry_reader::Global_symbol_info): Remove.
7373         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
7374         (Incremental_input_entry_reader::get_global_symbol_reader): New
7375         function.
7376         (Incremental_input_entry_reader::get_output_symbol_index): New
7377         function.
7378         (Incremental_input_entry_reader::type_): Remove.
7379         (Incremental_input_entry_reader::flags_): New data member.
7380         (Incremental_inputs_reader::input_file_offset): New function.
7381         (Incremental_inputs_reader::input_file_index): New function.
7382         (Incremental_inputs_reader::input_file): Call input_file_offset.
7383         (Incremental_inputs_reader::input_file_at_offset): New function.
7384         (Incremental_relocs_reader::get_r_type): Reformat.
7385         (Incremental_relocs_reader::get_r_shndx): Reformat.
7386         (Incremental_relocs_reader::get_r_offset): Reformat.
7387         (Incremental_relocs_reader::data): New function.
7388         (Incremental_binary::Incremental_binary): Initialize new data members.
7389         (Incremental_binary::check_inputs): Add cmdline parameter.
7390         (Incremental_binary::file_is_unchanged): Remove.
7391         (Input_reader::arg_serial): New function.
7392         (Input_reader::get_unused_symbol_count): New function.
7393         (Input_reader::get_unused_symbol): New function.
7394         (Input_reader::do_arg_serial): New function.
7395         (Input_reader::do_get_unused_symbol_count): New function.
7396         (Input_reader::do_get_unused_symbol): New function.
7397         (Incremental_binary::input_file_count): New function.
7398         (Incremental_binary::get_input_reader): Change signature to use
7399         index instead of filename.
7400         (Incremental_binary::file_has_changed): New function.
7401         (Incremental_binary::get_input_argument): New function.
7402         (Incremental_binary::get_library): New function.
7403         (Incremental_binary::get_script_info): New function.
7404         (Incremental_binary::init_layout): New function.
7405         (Incremental_binary::reserve_layout): New function.
7406         (Incremental_binary::output_file): New function.
7407         (Incremental_binary::do_check_inputs): New function.
7408         (Incremental_binary::do_file_is_unchanged): Remove.
7409         (Incremental_binary::do_file_has_changed): New function.
7410         (Incremental_binary::do_init_layout): New function.
7411         (Incremental_binary::do_reserve_layout): New function.
7412         (Incremental_binary::do_input_file_count): New function.
7413         (Incremental_binary::do_get_input_reader): Change signature.
7414         (Incremental_binary::input_args_map_): New data member.
7415         (Incremental_binary::library_map_): New data member.
7416         (Incremental_binary::script_map_): New data member.
7417         (Sized_incremental_binary::Sized_incremental_binary): Initialize
7418         new data members.
7419         (Sized_incremental_binary::output_section): New function.
7420         (Sized_incremental_binary::inputs_reader): Add const.
7421         (Sized_incremental_binary::symtab_reader): Add const.
7422         (Sized_incremental_binary::relocs_reader): Add const.
7423         (Sized_incremental_binary::got_plt_reader): Add const.
7424         (Sized_incremental_binary::get_symtab_view): New function.
7425         (Sized_incremental_binary::Inputs_reader): New typedef.
7426         (Sized_incremental_binary::Input_entry_reader): New typedef.
7427         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
7428         (Sized_incremental_binary::do_file_is_unchanged): Remove.
7429         (Sized_incremental_binary::do_file_has_changed): New function.
7430         (Sized_incremental_binary::do_init_layout): New function.
7431         (Sized_incremental_binary::do_reserve_layout): New function.
7432         (Sized_input_reader::Inputs_reader): Remove.
7433         (Sized_input_reader::Input_entry_reader): Remove.
7434         (Sized_input_reader::do_arg_serial): New function.
7435         (Sized_input_reader::do_get_unused_symbol_count): New function.
7436         (Sized_input_reader::do_get_unused_symbol): New function.
7437         (Sized_incremental_binary::do_input_file_count): New function.
7438         (Sized_incremental_binary::do_get_input_reader): Change signature;
7439         use index instead of filename.
7440         (Sized_incremental_binary::section_map_): New data member.
7441         (Sized_incremental_binary::input_entry_readers_): New data member.
7442         (class Sized_incr_relobj): New class.
7443         (class Sized_incr_dynobj): New class.
7444         (make_sized_incremental_object): New function.
7445         (class Incremental_library): New class.
7446         * layout.cc (Free_list::num_lists): New static data member.
7447         (Free_list::num_nodes): New static data member.
7448         (Free_list::num_removes): New static data member.
7449         (Free_list::num_remove_visits): New static data member.
7450         (Free_list::num_allocates): New static data member.
7451         (Free_list::num_allocate_visits): New static data member.
7452         (Free_list::init): New function.
7453         (Free_list::remove): New function.
7454         (Free_list::allocate): New function.
7455         (Free_list::dump): New function.
7456         (Free_list::print_stats): New function.
7457         (Layout_task_runner::run): Resize output file for incremental updates.
7458         (Layout::Layout): Initialize new data members.
7459         (Layout::set_incremental_base): New function.
7460         (Layout::init_fixed_output_section): New function.
7461         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
7462         incremental updates.
7463         (Layout::create_gold_note): Do not create gold note section for
7464         incremental updates.
7465         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
7466         for incremental updates.
7467         (Layout::set_section_offsets): For incremental updates, allocate space
7468         from free list.
7469         (Layout::create_symtab_sections): Layout with offsets relative to
7470         start of section; for incremental updates, allocate space from free
7471         list.
7472         (Layout::create_shdrs): For incremental updates, allocate space from
7473         free list.
7474         (Layout::finish_dynamic_section): For incremental updates, do not
7475         check --as-needed (fixed in subsequent patch).
7476         * layout.h (class Free_list): New class.
7477         (Layout::set_incremental_base): New function.
7478         (Layout::incremental_base): New function.
7479         (Layout::init_fixed_output_section): New function.
7480         (Layout::allocate): New function.
7481         (Layout::incremental_base_): New data member.
7482         (Layout::free_list_): New data member.
7483         * main.cc (main): Print Free_list statistics.
7484         * object.cc (Relobj::finalize_incremental_relocs): Add
7485         clear_counts parameter; clear counts only when clear_counts is set.
7486         (Sized_relobj::Sized_relobj): Initialize new base class.
7487         (Sized_relobj::do_layout): Don't report special sections.
7488         (Sized_relobj::do_for_all_local_got_entries): New function.
7489         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
7490         symtab_off to all symbol table offsets.
7491         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
7492         * object.h (class Got_offset_list): Move to top of file.
7493         (Object::Object): Allow case where input_file == NULL.
7494         (Object::~Object): Likewise.
7495         (Object::input_file): Assert that input_file != NULL.
7496         (Object::lock): Allow case where input_file == NULL.
7497         (Object::unlock): Likewise.
7498         (Object::is_locked): Likewise.
7499         (Object::token): Likewise.
7500         (Object::release): Likewise.
7501         (Object::is_incremental): New function.
7502         (Object::get_mtime): New function.
7503         (Object::for_all_local_got_entries): New function.
7504         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
7505         (Object::set_is_in_system_directory): New function.
7506         (Object::is_in_system_directory): New function.
7507         (Object::do_is_incremental): New function.
7508         (Object::do_get_mtime): New function.
7509         (Object::do_for_all_local_got_entries): New function.
7510         (Object::is_in_system_directory_): New data member.
7511         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
7512         (class Sized_relobj_base): New class.
7513         (class Sized_relobj): Derive from Sized_relobj_base.
7514         (class Sized_relobj::Symbols): Redeclare from base class.
7515         (class Sized_relobj::local_got_offset_list): Remove.
7516         (class Sized_relobj::Output_sections): Redeclare from base class.
7517         (class Sized_relobj::do_for_all_local_got_entries): New function.
7518         (class Sized_relobj::write_local_symbols): Add offset parameter.
7519         (class Sized_relobj::local_symbol_offset_): Update comment.
7520         (class Sized_relobj::local_dynsym_offset_): Update comment.
7521         * options.cc (Input_arguments::add_file): Remove const.
7522         * options.h (Input_file_argument::Input_file_argument):
7523         Initialize arg_serial_ (all constructors).
7524         (Input_file_argument::set_arg_serial): New function.
7525         (Input_file_argument::arg_serial): New function.
7526         (Input_file_argument::arg_serial_): New data member.
7527         (Input_arguments::Input_arguments): Initialize file_count_.
7528         (Input_arguments::add_file): Remove const.
7529         (Input_arguments::number_of_input_files): New function.
7530         (Input_arguments::file_count_): New data member.
7531         (Command_line::number_of_input_files): Call
7532         Input_arguments::number_of_input_files.
7533         * output.cc (Output_segment_headers::Output_segment_headers):
7534         Set current size.
7535         (Output_section::Input_section::current_data_size): New function.
7536         (Output_section::Output_section): Initialize new data members.
7537         (Output_section::add_input_section): Don't do merge sections for
7538         an incremental link; allocate space from free list for an
7539         incremental update.
7540         (Output_section::add_output_section_data): Allocate space from
7541         free list for an incremental update.
7542         (Output_section::update_data_size): New function.
7543         (Output_section::set_fixed_layout): New function.
7544         (Output_section::reserve): New function.
7545         (Output_segment::set_section_addresses): Remove const.
7546         (Output_segment::set_section_list_addresses): Remove const; allocate
7547         space from free list for an incremental update.
7548         (Output_segment::set_offset): Adjust size of RELRO segment for an
7549         incremental update.
7550         * output.h (Output_data::current_data_size): Move here from
7551         child classes.
7552         (Output_data::pre_finalize_data_size): New function.
7553         (Output_data::update_data_size): New function.
7554         (Output_section_headers::update_data_size): new function.
7555         (Output_section_data_build::current_data_size): Move to Output_data.
7556         (Output_data_strtab::update_data_size): New function.
7557         (Output_section::current_data_size): Move to Output_data.
7558         (Output_section::set_fixed_layout): New function.
7559         (Output_section::has_fixed_layout): New function.
7560         (Output_section::reserve): New function.
7561         (Output_section::update_data_size): New function.
7562         (Output_section::has_fixed_layout_): New data member.
7563         (Output_section::free_list_): New data member.
7564         (Output_segment::set_section_addresses): Remove const.
7565         (Output_segment::set_section_list_addresses): Remove const.
7566         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
7567         New function.
7568         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
7569         New function.
7570         * readsyms.cc (Read_symbols::do_read_symbols): Add library
7571         parameter when calling Add_symbols constructor; store argument
7572         serial number for members of a lib group.
7573         (Add_symbols::locks): Allow case where token == NULL.
7574         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
7575         (Read_member::~Read_member): New function.
7576         (Read_member::is_runnable): New function.
7577         (Read_member::locks): New function.
7578         (Read_member::run): New function.
7579         (Check_script::~Check_script): New function.
7580         (Check_script::is_runnable): New function.
7581         (Check_script::locks): New function.
7582         (Check_script::run): New function.
7583         (Check_library::~Check_library): New function.
7584         (Check_library::is_runnable): New function.
7585         (Check_library::locks): New function.
7586         (Check_library::run): New function.
7587         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
7588         (Add_symbols::library_): New data member.
7589         (class Read_member): New class.
7590         (class Check_script): New class.
7591         (class Check_library): New class.
7592         * reloc.cc (Read_relocs::is_runnable): Allow case where
7593         token == NULL.
7594         (Read_relocs::locks): Likewise.
7595         (Scan_relocs::locks): Likewise.
7596         (Relocate_task::locks): Likewise.
7597         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
7598         to clear counters.
7599         (Sized_relobj::incremental_relocs_scan): Fix comment.
7600         (Sized_relobj::do_relocate): Pass output file offset to
7601         write_local_symbols.
7602         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
7603         from class declaration.
7604         * script.cc (read_input_script): Allocate Script_info; pass
7605         argument serial number to report_script.
7606         * script.h (class Script_info): Move to incremental.h.
7607         * symtab.cc (Symbol_table::add_from_incrobj): New function.
7608         * symtab.h (Symbol_table::add_from_incrobj): New function.
7609         (Symbol_table::set_file_offset): New function.
7610
7611 2011-04-05  Cary Coutant  <ccoutant@google.com>
7612
7613         * incremental-dump.cc (dump_incremental_inputs): Change signature
7614         to take a Sized_incremental_binary; change caller.  Use readers
7615         in Sized_incremental_binary.
7616         * incremental.cc
7617         (Sized_incremental_binary::find_incremental_inputs_sections):
7618         Rename do_find_incremental_inputs_sections to this.
7619         (Sized_incremental_binary::setup_readers): New function.
7620         (Sized_incremental_binary::do_check_inputs): Check
7621         has_incremental_info_ flag; move setup code to setup_readers;
7622         use input readers.
7623         (Sized_incremental_binary::do_file_is_unchanged): New function.
7624         (Sized_incremental_binary::do_get_input_reader): New function.
7625         * incremental.h (class Incremental_binary): Move to end of file.
7626         (Incremental_binary::file_is_unchanged): New function.
7627         (Incremental_binary::do_file_is_unchanged): New function.
7628         (Incremental_binary::Input_reader): New class.
7629         (Incremental_binary::get_input_reader): New function.
7630         (class Sized_incremental_binary): Move to end of file.
7631         (Sized_incremental_binary::Sized_incremental_binary): Setup the
7632         input section reader classes.
7633         (Sized_incremental_binary::has_incremental_info): New function.
7634         (Sized_incremental_binary::inputs_reader): New function.
7635         (Sized_incremental_binary::symtab_reader): New function.
7636         (Sized_incremental_binary::relocs_reader): New function.
7637         (Sized_incremental_binary::got_plt_reader): New function.
7638         (Sized_incremental_binary::do_file_is_unchanged): New function.
7639         (Sized_incremental_binary::Sized_input_reader): New class.
7640         (Sized_incremental_binary::get_input_reader): New function.
7641         (Sized_incremental_binary::find_incremental_inputs_sections):
7642         Rename do_find_incremental_inputs_sections to this.
7643         (Sized_incremental_binary::setup_readers): New function.
7644         (Sized_incremental_binary::has_incremental_info_): New data member.
7645         (Sized_incremental_binary::inputs_reader_): New data member.
7646         (Sized_incremental_binary::symtab_reader_): New data member.
7647         (Sized_incremental_binary::relocs_reader_): New data member.
7648         (Sized_incremental_binary::got_plt_reader_): New data member.
7649         (Sized_incremental_binary::current_input_file_): New data member.
7650
7651 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
7652
7653         PR gold/12640
7654         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
7655         violation.
7656
7657 2011-03-30  Cary Coutant  <ccoutant@google.com>
7658
7659         * archive.cc (Archive::include_member): Adjust call to report_object.
7660         (Add_archive_symbols::run): Add script_info to call to
7661         report_archive_begin.
7662         (Lib_group::include_member): Adjust call to report_object.
7663         (Add_lib_group_symbols::run): Adjust call to report_object.
7664         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
7665         blocks.  Add object count for script input files.
7666         * incremental.cc (Incremental_inputs::report_archive_begin): Add
7667         script_info parameter; change all callers.
7668         (Incremental_inputs::report_object): Add script_info parameter;
7669         change all callers.
7670         (Incremental_inputs::report_script): Store backpointer to
7671         incremental info entry.
7672         (Output_section_incremental_inputs::set_final_data_size): Record
7673         additional information for scripts.
7674         (Output_section_incremental_inputs::write_info_blocks): Likewise.
7675         * incremental.h (Incremental_script_entry::add_object): New function.
7676         (Incremental_script_entry::get_object_count): New function.
7677         (Incremental_script_entry::get_object): New function.
7678         (Incremental_script_entry::objects_): New data member; adjust
7679         constructor.
7680         (Incremental_inputs::report_archive_begin): Add script_info parameter.
7681         (Incremental_inputs::report_object): Add script_info parameter.
7682         (Incremental_inputs_reader::get_object_count): New function.
7683         (Incremental_inputs_reader::get_object_offset): New function.
7684         * options.cc (Input_arguments::add_file): Return reference to
7685         new input argument.
7686         * options.h (Input_argument::set_script_info): New function.
7687         (Input_argument::script_info): New function.
7688         (Input_argument::script_info_): New data member; adjust all
7689         constructors.
7690         (Input_file_group::add_file): Return reference to new input argument.
7691         (Input_file_lib::add_file): Likewise.
7692         (Input_arguments::add_file): Likewise.
7693         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
7694         * script.cc (Parser_closure::Parser_closure): Add script_info
7695         parameter; adjust all callers.
7696         (Parser_closure::script_info): New function.
7697         (Parser_closure::script_info_): New data member.
7698         (read_input_script): Report scripts earlier to incremental info.
7699         (script_add_file): Set script_info in Input_argument.
7700         (script_add_library): Likewise.
7701         * script.h (Script_options::Script_info): Rewrite class.
7702
7703 2011-03-29  Cary Coutant  <ccoutant@google.com>
7704
7705         * archive.cc (Library_base::should_include_member): Move
7706         method here from class Archive.
7707         (Archive::Archive): Initialize base class.
7708         (Archive::should_include_member): Move to base class.
7709         (Archive::do_for_all_unused_symbols): New function.
7710         (Add_archive_symbols::run): Remove redundant access to
7711         incremental_inputs.
7712         (Lib_group::Lib_group): Initialize base class.
7713         (Lib_group::do_filename): New function.
7714         (Lib_group::include_member): Pass pointer to Lib_group to
7715         report_object.
7716         (Lib_group::do_for_all_unused_symbols): New function.
7717         (Add_lib_group_symbols::run): Report archive information for
7718         incremental links.
7719         * archive.h (class Library_base): New base class.
7720         (class Archive): Derive from Library_base.
7721         (Archive::filename): Move to base class.
7722         (Archive::set_incremental_info): Likewise.
7723         (Archive::incremental_info): Likewise.
7724         (Archive::Should_include): Likewise.
7725         (Archive::should_include_member): Likewise.
7726         (Archive::Armap_entry): Remove.
7727         (Archive::Unused_symbol_iterator): Remove.
7728         (Archive::unused_symbols_begin): Remove.
7729         (Archive::unused_symbols_end): Remove.
7730         (Archive::do_filename): New function.
7731         (Archive::do_get_mtime): New function.
7732         (Archive::do_for_all_unused_symbols): New function.
7733         (Archive::task_): Move to base class.
7734         (Archive::incremental_info_): Likewise.
7735         (class Lib_group): Derive from Library_base.
7736         (Lib_group::do_filename): New function.
7737         (Lib_group::do_get_mtime): New function.
7738         (Lib_group::do_for_all_unused_symbols): New function.
7739         (Lib_group::task_): Move to base class.
7740         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
7741         function.
7742         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
7743         function.
7744         * incremental.cc (Incremental_inputs::report_archive_begin):
7745         Use Library_base; call library's get_mtime; add incremental inputs
7746         entry before members.
7747         (class Unused_symbol_visitor): New class.
7748         (Incremental_inputs::report_archive_end): Use Library_base; use
7749         visitor class to record unused symbols; don't add incremental inputs
7750         entry after members.
7751         (Incremental_inputs::report_object): Use Library_base.
7752         * incremental.h
7753         (Incremental_archive_entry::Incremental_archive_entry): Remove
7754         unused Archive parameter.
7755         (Incremental_inputs::report_archive_begin): Use Library_base.
7756         (Incremental_inputs::report_archive_end): Likewise.
7757         (Incremental_inputs::report_object): Likewise.
7758         * object.cc (Sized_relobj::do_for_all_global_symbols): New
7759         function.
7760         * object.h (Object::for_all_global_symbols): New function.
7761         (Object::do_for_all_global_symbols): New function.
7762         (Sized_relobj::do_for_all_global_symbols): New function.
7763         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
7764         function.
7765         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
7766         function.
7767
7768 2011-03-27  Ian Lance Taylor  <iant@google.com>
7769
7770         * archive.cc (Archive::interpret_header): Return -1 if something
7771         goes wrong.  Change callers accordingly.
7772
7773 2011-03-25  Cary Coutant  <ccoutant@google.com>
7774
7775         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
7776         * testsuite/Makefile.in: Regenerate.
7777
7778 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
7779
7780         * plugin.cc (get_view): New.
7781         (Plugin::load): Pass get_view to the plugin.
7782         (Plugin_manager::get_view): New.
7783
7784 2011-03-21  Ian Lance Taylor  <iant@google.com>
7785
7786         * testsuite/final_layout.sh: Rewrite to not use dc.
7787         * testsuite/relro_test.sh: Fail if dc is not present.
7788
7789 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
7790
7791         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
7792         Change == to -eq.
7793         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
7794         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
7795         Change == to -eq.
7796         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
7797         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
7798
7799 2011-03-14  Ian Lance Taylor  <iant@google.com>
7800
7801         * script-sections.cc (Sort_output_sections::script_compare):
7802         Rename from is_before, change return type.
7803         (Sort_output_sections::operator()): Adjust accordingly.
7804
7805 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
7806
7807         PR gold/12572
7808         * testsuite/odr_violation2.cc: Add comment to make all error line
7809         numbers double digits.
7810         * testsuite/debug_msg.sh: Adjust expected errors.
7811
7812 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
7813
7814         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
7815         but mark earlier ones as non-canonical
7816         (offset_to_iterator): Update search target and example
7817         (do_addr2line): Return extra lines in a vector*
7818         (format_file_lineno): Extract from do_addr2line
7819         (one_addr2line): Add vector* out-param
7820         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
7821         when a lineno entry appeared last for its instruction
7822         (Dwarf_line_info): Add vector* out-param
7823         * object.cc (Relocate_info): Pass NULL for the vector* out-param
7824         * symtab.cc (Odr_violation_compare): Include the lineno in the
7825         comparison again.
7826         (linenos_from_loc): New. Combine the canonical line for an
7827         address with its other lines.
7828         (True_if_intersect): New. Helper functor to make
7829         std::set_intersection a query.
7830         (detect_odr_violations): Compare sets of lines instead of just
7831         one line for each function. This became less deterministic, but
7832         has fewer false positives.
7833         * symtab.h: Declarations.
7834         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
7835         mix an optimized and non-optimized object in the same binary
7836         (odr_violation2.so): Same.
7837         * testsuite/Makefile.in: Regenerate from Makefile.am.
7838         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
7839         * testsuite/debug_msg.sh: Update line numbers and add
7840         assertions.
7841         * testsuite/odr_violation1.cc: Use OdrDerived, in a
7842         non-optimized context.
7843         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
7844         isn't inlined, and use OdrDerived in an optimized context.
7845         * testsuite/odr_header1.h: Defines OdrDerived, where
7846         optimization will change the
7847         first-instruction-in-the-destructor's file and line number.
7848         * testsuite/odr_header2.h: Defines OdrBase.
7849
7850 2011-03-09  Ian Lance Taylor  <iant@google.com>
7851
7852         * fileread.cc (File_read::clear_views): Don't delete the whole
7853         file view.
7854
7855 2011-03-08  Ian Lance Taylor  <iant@google.com>
7856
7857         PR gold/12525
7858         * fileread.cc: #include <climits>.
7859         (GOLD_IOV_MAX): Define.
7860         (File_read::read_multiple): Limit number of entries by iov_max.
7861         * fileread.h (class File_read): Always set max_readv_entries to
7862         128.
7863
7864 2011-03-07  Ian Lance Taylor  <iant@google.com>
7865
7866         PR gold/12525
7867         * options.h (class General_options): Add -dy and -dn.
7868
7869 2011-03-02  Cary Coutant  <ccoutant@google.com>
7870
7871         * testsuite/script_test_9.t: Add TLS segment.
7872
7873 2011-03-02  Simon Baldwin  <simonb@google.com>
7874
7875         * configure.ac: Add check for gnu_indirect_function support in
7876         the toolchain building binutils.
7877         * configure: Rebuild.
7878
7879 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
7880
7881         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
7882         plugin only symbols.
7883         (Symbol_table::sized_finalize_symbol) Mark symbol only present
7884         in plugin files as not needed in the symbol table.
7885
7886 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
7887
7888         * output.cc (Output_section::add_input_section): Delay fill
7889         generation for section ordering.
7890
7891 2011-02-09  Ian Lance Taylor  <iant@google.com>
7892
7893         PR gold/12316
7894         * object.h (class Sized_relobj): Remove clear_local_symbols.
7895         * reloc.cc (Sized_relobj::do_relocate): Don't call
7896         clear_local_symbols.
7897
7898 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
7899
7900         * plugin.cc (is_visible_from_outside): Return true for symbols
7901         in the -u option.
7902
7903 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
7904
7905         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
7906         filename.
7907
7908 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
7909
7910         * icf.h (is_section_foldable_candidate): Change type of parameter
7911         to std::string.
7912         * icf.cc (Icf::find_identical_sections): Change type of local variable
7913         section_name to be std::string.
7914         (is_function_ctor_or_dtor): Change type of parameter to std::string.
7915
7916 2011-01-25  Ian Lance Taylor  <iant@google.com>
7917
7918         * script.cc (script_add_extern): Rewrite to use
7919         add_symbol_reference.
7920
7921 2011-01-25  Doug Kwan  <dougkwan@google.com>
7922
7923         * icf.cc (get_section_contents): Always lock section's object.
7924
7925 2011-01-24  Ian Lance Taylor  <iant@google.com>
7926
7927         * options.h (class General_options): Accept
7928         --no-detect-odr-violations.
7929
7930 2011-01-24  Ian Lance Taylor  <iant@google.com>
7931
7932         * version.cc (version_string): Bump to 1.11.
7933
7934 2011-01-24  Ian Lance Taylor  <iant@google.com>
7935
7936         * plugin.cc (class Plugin_rescan): Define new class.
7937         (Plugin_manager::claim_file): Set any_claimed_.
7938         (Plugin_manager::save_archive): New function.
7939         (Plugin_manager::save_input_group): New function.
7940         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
7941         necessary.
7942         (Plugin_manager::new_undefined_symbol): New function.
7943         (Plugin_manager::rescan): New function.
7944         (Plugin_manager::rescannable_defines): New function.
7945         (Plugin_manager::add_input_file): Set any_added_.
7946         * plugin.h (class Plugin_manager): define new fields rescannable_,
7947         undefined_symbols_, any_claimed_, and any_added_.  Declare
7948         Plugin_rescan as friend.  Declare new functions.
7949         (Plugin_manager::Rescannable): Define type.
7950         (Plugin_manager::Rescannable_list): Define type.
7951         (Plugin_manager::Undefined_symbol_list): Define type.
7952         (Plugin_manager::Plugin_manager): Initialize new fields.
7953         * archive.cc (Archive::defines_symbol): New function.
7954         (Add_archive_symbols::run): Pass archive to plugins if any.
7955         * archive.h (class Archive): Declare defines_symbol.
7956         * readsyms.cc (Input_group::~Input_group): New function.
7957         (Finish_group::run): Pass input_group to plugins if any.
7958         * readsyms.h (class Input_group): Declare destructor.
7959         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
7960         any.
7961
7962 2011-01-10  Ian Lance Taylor  <iant@google.com>
7963
7964         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
7965         section as relro.
7966         (Layout::set_segment_offsets): Reset increase_relro before calling
7967         set_section_addresses a second time.
7968
7969 2011-01-04  Cary Coutant  <ccoutant@google.com>
7970
7971         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
7972         sections before NOBITS sections.
7973
7974 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
7975
7976         * version.cc (print_version): Update copyright to 2011.
7977
7978 2010-12-23  Cary Coutant  <ccoutant@google.com>
7979
7980         * output.h (Output_data_reloc::add_output_section): Pass OD instead
7981         of OS to this->add.  Add OD parameter to second form of the function.
7982
7983 2010-12-20  Ian Lance Taylor  <iant@google.com>
7984
7985         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
7986         second of two consecutive entries with same offset.
7987
7988 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7989
7990         * testsuite/Makefile.am (ifuncmain2static_LDADD)
7991         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
7992         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
7993         to avoid unneeded links against $(LDADD).
7994         * testsuite/Makefile.in: Regenerate.
7995
7996 2010-12-15  Ian Lance Taylor  <iant@google.com>
7997
7998         PR gold/12324
7999         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
8000         for R_X86_64_32 and R_X86_64_PC32.
8001         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
8002         ver_matching_def_pic.o.
8003         (ver_matching_def_pic.o): New target.
8004
8005 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8006
8007         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
8008         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
8009         Move definition before File_read::View member definitions.
8010         (File_read::View::~View): Initialize and hold lock before
8011         updating current_mapped_bytes.
8012
8013 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8014
8015         * dwarf_reader.cc: Remove outdated comment.
8016         * gold-threads.cc: Fix typo in error message.
8017         * archive.cc: Fix typos in comments.
8018         * archive.h: Likewise.
8019         * arm-reloc-property.cc: Likewise.
8020         * arm-reloc-property.h: Likewise.
8021         * arm-reloc.def: Likewise.
8022         * arm.cc: Likewise.
8023         * attributes.h: Likewise.
8024         * cref.cc: Likewise.
8025         * ehframe.cc: Likewise.
8026         * fileread.h: Likewise.
8027         * gold.h: Likewise.
8028         * i386.cc: Likewise.
8029         * icf.cc: Likewise.
8030         * incremental.h: Likewise.
8031         * int_encoding.cc: Likewise.
8032         * layout.h: Likewise.
8033         * main.cc: Likewise.
8034         * merge.h: Likewise.
8035         * object.cc: Likewise.
8036         * object.h: Likewise.
8037         * options.cc: Likewise.
8038         * readsyms.cc: Likewise.
8039         * reduced_debug_output.cc: Likewise.
8040         * reloc.cc: Likewise.
8041         * script-sections.cc: Likewise.
8042         * sparc.cc: Likewise.
8043         * symtab.h: Likewise.
8044         * target-reloc.h: Likewise.
8045         * target.cc: Likewise.
8046         * target.h: Likewise.
8047         * timer.cc: Likewise.
8048         * timer.h: Likewise.
8049         * x86_64.cc: Likewise.
8050
8051 2010-12-09  Cary Coutant  <ccoutant@google.com>
8052
8053         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
8054         stack.
8055         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
8056         parameter; change all callers.
8057         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
8058         * options.h (warn_execstack): New option.
8059
8060 2010-12-07  Doug Kwan  <dougkwan@google.com>
8061
8062         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
8063         like function call relocations.
8064
8065 2010-12-07  Ian Lance Taylor  <iant@google.com>
8066
8067         * archive.cc (Archive::get_elf_object_for_member): Permit
8068         punconfigured to be NULL.
8069         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
8070         (Archive::include_member): Pass NULL to get_elf_object_for_member
8071         if we searched for the archive and this is the first included
8072         object.
8073
8074 2010-12-01  Ian Lance Taylor  <iant@google.com>
8075
8076         * dwarf_reader.h (class Sized_dwarf_line_info): Add
8077         track_relocs_type_ field.
8078         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8079         Set track_relocs_type_.
8080         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
8081         contents when using RELA relocs.
8082         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
8083         reloc_map_.
8084         * reloc.cc (Track_relocs::next_addend): New function.
8085         * reloc.h (class Track_relocs): Declare next_addend.
8086
8087 2010-12-01  Ian Lance Taylor  <iant@google.com>
8088
8089         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
8090         virtual destructor.
8091
8092 2010-12-01  Ian Lance Taylor  <iant@google.com>
8093
8094         * README: Update compilers known to work and fail.
8095
8096 2010-11-23  Matthias Klose  <doko@ubuntu.com>
8097
8098         * configure.in: For --enable-gold, handle value `default' instead of
8099         `both*'.  Always install ld as ld.bfd, install as ld if gold is
8100         not the default.
8101         * configure: Regenerate.
8102
8103 2010-11-18  Doug Kwan  <dougkwan@google.com>
8104
8105         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
8106         and right_alignment to be zero.  Store result alignment only if it is
8107         greater than existing alignment.
8108
8109 2010-11-16  Cary Coutant  <ccoutant@google.com>
8110
8111         PR gold/12220
8112         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
8113         Check for ".zdebug_line".
8114
8115 2010-11-16  Doug Kwan  <dougkwan@google.com>
8116             Cary Coutant  <ccoutant@google.com>
8117
8118         * output.h (Output_segment::set_section_addresses): Pass increase_relro
8119         by reference; adjust all callers.
8120         * output.cc (Output_segment::set_section_addresses): Adjust references
8121         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
8122         list is empty.
8123         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
8124         end at page boundary.
8125
8126 2010-11-16  Cary Coutant  <ccoutant@google.com>
8127
8128         PR gold/12220
8129         * layout.cc (Layout::choose_output_section): Transform names of
8130         compressed sections even when using a script with a SECTIONS clause.
8131         (Layout::output_section_name): Remove code to transform
8132         compressed debug section names.
8133         * output.cc (Output_section::add_input_section): Use uncompressed
8134         section size when tracking input sections.
8135
8136 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
8137
8138         * symtab.h (Symbol::NON_PIC_REF): Remove.
8139         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
8140         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
8141         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
8142         (Symbol::use_plt_offset): Take a flags argument and pass it
8143         directly to needs_dynamic_reloc.  Restrict check for undefined
8144         weak symbols to function calls.
8145         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
8146         (Target_arm::Scan::global): Use it.
8147         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
8148         (Target_arm::Relocate::relocate): Likewise.
8149         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
8150         parameter with an r_type parameter.  Use get_reference_flags
8151         to get the flags.
8152         (Target_arm::Relocate::relocate): Update accordingly.
8153         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
8154         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
8155         (Target_i386::Scan::global): Likewise.
8156         (Target_i386::Relocate::relocate): Likewise.
8157         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
8158         parameter with an r_type parameter.  Use get_reference_flags
8159         to get the flags.
8160         (Target_i386::Relocate::relocate): Update accordingly.
8161         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
8162         (Target_powerpc::Scan::global): Use it.
8163         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
8164         (Target_powerpc::Relocate::relocate): Likewise.
8165         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
8166         (Target_sparc::Scan::global): Use it.
8167         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
8168         (Target_sparc::Relocate::relocate): Likewise.
8169         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
8170         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
8171         (Target_x86_64::Scan::global): Likewise.
8172         (Target_x86_64::Relocate::relocate): Likewise.
8173
8174 2010-11-08  Doug Kwan  <dougkwan@google.com>
8175             Cary Coutant  <ccoutant@google.com>
8176
8177         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
8178         (Arm_exidx_merge_section::section_contents_): New data member.
8179         (Arm_input_section::Arm_input_section): Initialize original_contents_.
8180         (Arm_input_section::~Arm_input_section): De-allocate memory.
8181         (Arm_input_section::original_contents_): New data member.
8182         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
8183         in parameters instead of calling Object::section_contents without
8184         locking.
8185         (Arm_output_section::group_section): New parameter TASK.  Pass it
8186         to callees that need locking objects.
8187         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
8188         to lock EXIDX input sections.  Fix a formatting issue.  Call
8189         Arm_exidx_merged_section::build_contents to create merged section
8190         contents.
8191         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
8192         to lock object of stub table owner.
8193         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
8194         TEXT_SIZE to initialize data member TEXT_SIZE_.
8195         (Arm_exidx_input_section::addralign): Fix typo in comment.
8196         (Arm_exidx_input_section::text_size): New method.
8197         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
8198         that require locking objects.  Lock objects before scanning for stubs
8199         and updating local symbols.
8200         (Arm_input_section<big_endian>::init): Copy contents of original
8201         input section.
8202         (Arm_input_section<big_endian>::do_write): Use saved contents of
8203         original input section instead of calling Object::section_contents
8204         without locking.
8205         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
8206         size without calling Object::section_size().
8207         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
8208         for size.  Allocate a buffer for merged EXIDX entries.
8209         (Arm_exidx_merged_section::build_contents): New method.
8210         (Arm_exidx_merged_section::do_write): Move merge section contents
8211         building code to Arm_exidx_merged_section::build_contetns.  Write
8212         out contetns in buffer instead of building it on the fly.
8213         (Arm_relobj::make_exidx_input_section): Also pass text section size
8214         to Arm_exidx_input_section constructor.
8215         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
8216         (Arm_dynobj::do_read_symbols): Fix memory leak.
8217         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
8218         * target.h: (class Task): Add forward declaration.
8219         (Target::relax): Add new parameter TASK and pass it to
8220         Target::do_relax().
8221         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
8222
8223 2010-11-05  Cary Coutant  <ccoutant@google.com>
8224
8225         PR gold/10708
8226         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
8227         object when reading from the file.
8228         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
8229         second layout pass.
8230         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
8231         when reading section contents.
8232         (get_section_contents): Likewise.
8233         (icf::find_identical_sections): Likewise.
8234         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
8235         object when reading from the file.
8236         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
8237         the object when doing deferred section layout.
8238
8239 2010-11-03  Nick Clifton  <nickc@redhat.com>
8240
8241         PR gold/12001
8242         * script.h (class Symbol_assignment: name): New member.  Returns
8243         the name of the symbol.
8244         * scrfipt.cc (Script_options::is_pending_assignment): New member.
8245         Returns true if the given symbol name is on the list of
8246         assignments wating to be processed.
8247         * archive.cc (should_incldue_member): If the symbol is undefined,
8248         check to see if it is on the list of symbols pending assignment.
8249
8250 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
8251
8252         * script-sections.cc (Script_sections::find_memory_region): Check
8253         for a NULL output section pointer.
8254
8255 2010-10-29  Doug Kwan  <dougkwan@google.com>
8256
8257         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
8258         Output_section::add_relaxed_input_section.
8259         * output.cc (Output_section::add_relaxed_input_section): Add new
8260         arguments LAYOUT and NAME.  Set section order index.
8261         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8262         Copy section order index.
8263         * output.h (Output_section::add_relaxed_input_section): Add new
8264         arguments LAYOUT and NAME.
8265
8266 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8267
8268         * testsuite/Makefile.am: Move gcctestdir/ld rule to
8269         NATIVE_OR_CROSS_LINKER.
8270         * testsuite/Makefile.in: Regenerate.
8271
8272 2010-10-20  Doug Kwan  <dougkwan@google.com>
8273
8274         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
8275         without SHF_LINK_ORDER flags.
8276         * layout.cc (Layout::choose_output_section): Do not filter
8277         SHF_LINK_ORDER flag in a relocatable link.
8278
8279 2010-10-17  Cary Coutant  <ccoutant@google.com>
8280
8281         * output.h (Output_segment::set_section_addresses): Change function
8282         signature.  Update all callers.
8283         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
8284         sections.
8285         (Output_segment::set_section_addresses): Align after last TLS
8286         section.  Add padding before last relro section instead of after.
8287
8288 2010-10-17  Doug Kwan  <dougkwan@google.com>
8289
8290         * gold/arm.cc (Target_arm::got_section): Use correct order and set
8291         GOT output section to be writable.
8292
8293 2010-10-14  Cary Coutant  <ccoutant@google.com>
8294
8295         * debug.h (DEBUG_INCREMENTAL): New flag.
8296         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
8297         * gold.cc (queue_initial_tasks): Check parameters for incremental link
8298         mode.
8299         * incremental.cc (report_command_line): Ignore all forms of
8300         --incremental.
8301         * layout.cc (Layout::Layout): Check parameters for incremental link
8302         mode.
8303         * options.cc (General_options::parse_incremental): New function.
8304         (General_options::parse_no_incremental): New function.
8305         (General_options::parse_incremental_full): New function.
8306         (General_options::parse_incremental_update): New function.
8307         (General_options::incremental_mode_): New data member.
8308         (General_options::finalize): Check incremental_mode_.
8309         * options.h (General_options): Update help text for --incremental.
8310         Add --no-incremental, --incremental-full, --incremental-update.
8311         (General_options::Incremental_mode): New enum type.
8312         (General_options::incremental_mode): New function.
8313         (General_options::incremental_mode_): New data member.
8314         * parameters.cc (Parameters::incremental_mode_): New data member.
8315         (Parameters::set_options): Set incremental_mode_.
8316         (Parameters::set_incremental_full): New function.
8317         (Parameters::incremental): New function.
8318         (Parameters::incremental_update): New function.
8319         (set_parameters_incremental_full): New function.
8320         * parameters.h (Parameters::set_incremental_full): New function.
8321         (Parameters::incremental): New function.
8322         (Parameters::incremental_update): New function.
8323         (Parameters::incremental_mode_): New data member.
8324         (set_parameters_incremental_full): New function.
8325         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
8326         incremental link mode.
8327         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
8328         (Sized_relobj::do_relocate_sections): Likewise.
8329         * testsuite/Makefile.am (incremental_test): Use --incremental-full
8330         option.
8331         * testsuite/Makefile.in: Regenerate.
8332         * testsuite/incremental_test.sh: Filter all forms of --incremental.
8333
8334 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8335
8336         * script-sections.h (class Script_sections): Make
8337         Sections_elements typedef public.
8338         * script-sections.cc (class Sort_output_sections): Add elements_
8339         field.  Add constructor which sets it; change all callers.
8340         (Sort_output_sections::is_before): New function.
8341         (Sort_output_sections::operator()): Call is_before.
8342         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
8343         conditional.
8344         * testsuite/script_test_10.sh: New test. Test script section
8345         order.
8346         * testsuite/script_test_10.t: Likewise.
8347         * testsuite/script_test_10.s: Likewise.
8348         * testsuite/Makefile.am: Wrap the cross linker tests and the
8349         common tests into NATIVE_OR_CROSS_LINKER.
8350         (check_SCRIPTS): Add script_test_10.sh.
8351         (check_DATA): Add script_test_10.stdout.
8352         (script_test_10.o, script_test_10): New targets.
8353         (script_test_10.stdout): New target.
8354         * configure, testsuite/Makefile.in: Regenerate.
8355
8356 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8357
8358         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
8359         error for the deprecated relocations.
8360         (Target_arm::Scan::global): Likewise.
8361         (Target_arm::Relocate::relocate): Likewise.
8362
8363 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
8364
8365         * fileread.cc (Input_file::find_file): Initialize *found_name
8366         and *namep when using the fallback search for case 4.
8367
8368 2010-10-11  Cary Coutant  <ccoutant@google.com>
8369
8370         * options.h (class General_options): Redefine -z lazy as an alias for
8371         the negation of -z now.
8372
8373 2010-10-11  Ian Lance Taylor  <iant@google.com>
8374
8375         * resolve.cc (symbol_to_bits): Report the value of the unsupported
8376         binding.
8377
8378 2010-10-06  Nick Clifton  <nickc@redhat.com>
8379
8380         * script-sections.cc(class Memory_region): Remove
8381         current_lma_offset_ field.  Rename current_vma_offset_ to
8382         current_offset_.  Add last_section_ field.
8383         (Memory_region::get_current_vma_address): Rename to
8384         get_current_address.
8385         (Memory_region::get_current_lma_address): Delete.
8386         (Memory_region::increment_vma_offset): Rename to
8387         increment_offset.
8388         (Memory_region::increment_lma_offset): Delete.
8389         (Memory_region::attributes_compatible): New method.  Returns
8390         true if the provided section is compatible with the region.
8391         (Memory_region::get_last_section): New method.  Returns the last
8392         section to use the region.
8393         (Memory_region::set_last_section): New method.  Stores the last
8394         section to use the region.
8395         (Script_sections::block_in_region): New method.  Returns true if
8396         a block of memory is contained within a region.
8397         (Script_sections::find_memory_region): New method.  Locates a
8398         memory region to be used to set a VMA or LMA address.
8399         (Output_section_definition::set_section_addresses): Add code to
8400         check for addresses set by memory regions.
8401         (Output_segment::set_section_addresses): Remove memory region
8402         walking code.
8403         (Script_sections::create_segment): Add a warning if a header
8404         segment is created outside of any region.
8405         * script-sections.h (class Script_sections): Add prototypes for
8406         find_memory_region and block_in_region methods.
8407         * testsuite/memory_test.s: Use .long instead of .word.
8408         * testsuite/memory_test.t: Add some more output sections.
8409         * testsuite/memory_test.sh: Update expected output.
8410
8411 2010-10-02  Doug Kwan  <dougkwan@google.com>
8412
8413         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
8414         defintion to symtab.h
8415         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
8416         declaration to defintion.
8417
8418 2010-10-01  Nick Clifton  <nickc@redhat.com>
8419
8420         * expression.cc (eval): Replace dummy argument with NULL.
8421         (eval_maybe_dot): Check for a NULL result section pointer.
8422         (Symbol_expression::value): Likewise.
8423         (Dot_expression::value): Likewise.
8424         (BINARY_EXPRESSION): Likewise.
8425         (Max_expression::value): Likewise.
8426         (Min_expression::value): Likewise.
8427         (Absolute_expression::value): Likewise.
8428         (Addr_expression::value_from_output_section): Likewise.
8429         (Loaddddr_expression::value_from_output_section): Likewise.
8430         (Segment_start_expression::value): Likewise.
8431         * script-sections.cc
8432         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
8433         argument with NULL.
8434         (Sections_elememt_dot_assignment::set_section_addresses):
8435         Likewise.
8436         (Output_data_expression::do_write_to_buffer): Likewise.
8437         (Output_section_definition::finalize_symbols): Likewise.
8438         (Output_section_definition::set_section_addresses): Likewise.
8439
8440 2010-09-30  Doug Kwan  <dougkwan@google.com>
8441
8442         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
8443
8444 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
8445
8446         * target.h (Target::can_icf_inline_merge_sections): New virtual
8447         function.
8448         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
8449         virtual function.
8450         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
8451         virtual function.
8452         * icf.cc (get_section_contents): Inline merge sections only when
8453         target allows it.
8454
8455 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8456
8457         * configure: Regenerate.
8458
8459 2010-09-17  Ian Lance Taylor  <iant@google.com>
8460
8461         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
8462         * testsuite/Makefile.am (memory_test.o): New target.
8463         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
8464         memory_test.t.
8465         * testsuite/Makefile.in: Rebuild.
8466
8467 2010-09-17  Doug Kwan  <dougkwan@google.com>
8468
8469         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
8470         defintion if relocation uses GOT entries of the symbol.
8471         * testsuite/icf_safe_test.sh: Fix test.
8472         * testsuite/icf_safe_so_test.sh: Fix test.
8473
8474 2010-09-16  Cary Coutant  <ccoutant@google.com>
8475
8476         * script_sections.cc (class Memory_region): Remove "NULL" from
8477         vector initializations.
8478
8479 2010-09-15  Cary Coutant  <ccoutant@google.com>
8480
8481         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
8482         Resolve forwarding symbols.
8483
8484 2010-09-15  Doug Kwan  <dougkwan@google.com>
8485
8486         * gold/testsuite/script_test_3.t: Add ARM special sections.
8487         * gold/testsuite/script_test_4.t: Same.
8488         * gold/testsuite/script_test_5.t: Same.
8489         * gold/testsuite/script_test_6.t: Same.
8490         * gold/testsuite/script_test_7.t: Same.
8491         * gold/testsuite/script_test_7.t: Same.
8492         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
8493
8494 2010-09-14  Cary Coutant  <ccoutant@google.com>
8495
8496         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
8497         (Target_x86_64::Relocate::relocate_tls): Replace check for
8498         saw_tls_block_reloc_ with test for executable section.
8499
8500 2010-09-12  Cary Coutant  <ccoutant@google.com>
8501
8502         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
8503         position-independent executables to shared libraries need dynamic
8504         relocations.
8505         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
8506         position-independent executables.
8507         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
8508         * testsuite/Makefile.in: Regenerate.
8509
8510 2010-09-10  Nick Clifton  <nickc@redhat.com>
8511
8512         PR gold/11997
8513         * testsuite/memory_test.t: Discard any sections that are not
8514         needed.
8515
8516 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
8517
8518         PR gold/11996
8519         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
8520         "This::" to work around a bug in gcc 4.2.
8521
8522         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
8523
8524 2010-09-09  Rafael Espindola  <espindola@google.com>
8525
8526         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
8527         sections with different PF_X flags in the same segment.
8528         (Layout::find_first_load_seg): Search all segments to find the first
8529         one.
8530         * options.h (rosegment): New.
8531
8532 2010-09-08  Rafael Espindola  <espindola@google.com>
8533
8534         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
8535
8536 2010-09-08  Doug Kwan  <dougkwan@google.com>
8537
8538         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
8539         (Arm_relobj::do_relocate_sections): Add new parameter for output
8540         file to match the parent.
8541         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
8542         of local symbols instead of input values.  Update code to track
8543         changes in gold::relocate_section.
8544         * object.cc (Sized_relobj::compute_final_local_value): New methods.
8545         (Sized_relobj::compute_final_local_value_internal): New methods.
8546         (Sized_relobj::do_finalize_local_symbols): Move code from loop
8547         body into private version of Sized_relobj::compute_final_local_value.
8548         Call the inline method.
8549         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
8550         merged symbol value if there is one.
8551         (Symbol_value::has_output_value): New method defintiion.
8552         (Sized_relobj::Compute_final_local_value_status): New enum type.
8553         (Sized_relobj::compute_final_local_value): New methods.
8554         (Sized_relobj::compute_final_local_value_internal): New methods.
8555         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
8556         and arm_cortex_a8.sh.
8557         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
8558         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
8559         New tests.
8560         * Makefile.in: Regenerate.
8561         * testsuite/arm_bl_out_of_range.s: Update test.
8562         * testsuite/thumb_bl_out_of_range.s: Ditto.
8563         * testsuite/thumb_blx_out_of_range.s: Ditto.
8564         * testsuite/arm_branch_out_of_range.sh: New file.
8565         * testsuite/arm_cortex_a8.sh: Ditto.
8566         * testsuite/arm_cortex_a8_b.s: Ditto.
8567         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
8568         * testsuite/arm_cortex_a8_b_local.s: Ditto.
8569         * testsuite/arm_cortex_a8_bl.s: Ditto.
8570         * testsuite/arm_cortex_a8_blx.s: Ditto.
8571         * testsuite/arm_cortex_a8_local.s: Ditto.
8572         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
8573         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
8574
8575 2010-09-08  Rafael Espindola  <espindola@google.com>
8576
8577         * Makefile.am (memory_test.stdout): Run readelf with -W.
8578         * Makefile.in: Regenerate.
8579         * testsuite/memory_test.sh: Make the regexps accept both 32 and
8580         64 bit output.
8581
8582 2010-09-08  Rafael Espindola  <espindola@google.com>
8583
8584         * script-sections.cc (Script_sections::add_memory_region): Convert
8585         field precision to int.
8586         * script.cc (script_set_section_region, script_set_section_region):
8587         Convert field precision to int.
8588
8589 2010-09-08  Rafael Espindola  <espindola@google.com>
8590
8591         * arm.cc (do_finalize_sections): Create the __exidx_start and
8592         __exdix_end symbols even when the section is missing.
8593
8594 2010-09-08  Nick Clifton  <nickc@redhat.com>
8595
8596         * README: Remove claim that MEMORY is not supported.
8597         * expression.cc (script_exp_function_origin)
8598         (script_exp_function_length): Move from here to ...
8599         * script.cc: ... here.
8600         (script_set_section_region, script_add_memory)
8601         (script_parse_memory_attr, script_include_directive): New
8602         functions.
8603         * script-sections.cc
8604         (class Memory_region): New class.
8605         (class Output_section_definition): Add set_memory_region,
8606         set_section_vma, set_section_lma and get_section_name methods.
8607         (class Script_Sections): Add add_memory_region,
8608         find_memory_region, find_memory_region_origin,
8609         find_memory_region_length and set_memory_region methods.
8610         Have set_section_addresses method walk the list of set memory
8611         regions.
8612         Extend the print methos to display memory regions.
8613         * script-sections.h: Add prototypes for new methods.
8614         Add enum for MEMORY region attributes.
8615         * yyscript.y: Add support for parsing MEMORY regions.
8616         * script-c.h: Add prototypes for new functions.
8617         * testsuite/Makefile.am: Add test of MEMORY region functionality.
8618         * testsuite/Makefile.in: Regenerate.
8619         * testsuite/memory_test.sh: New script.
8620         * testsuite/memory_test.s: New assembler source file.
8621         * testsuite/memory_test.t: New linker script.
8622
8623 2010-08-27  Doug Kwan  <dougkwan@google.com>
8624
8625         * gold/resolve.cc (Symbol_table::should_override): Let a weak
8626         reference override an existing dynamic weak reference.
8627         * testsuite/Makefile.am: Add new test dyn_weak_ref.
8628         * testsuite/Makefile.in: Regenerate.
8629         * testsuite/dyn_weak_ref.sh: New file.
8630         * testsuite/dyn_weak_ref_1.c: Ditto.
8631         * testsuite/dyn_weak_ref_2.c: Ditto.
8632
8633 2010-08-27  Ian Lance Taylor  <iant@google.com>
8634
8635         * incremental.h (class Incremental_input_entry): Add virtual
8636         destructor.
8637
8638 2010-08-27  Ian Lance Taylor  <iant@google.com>
8639
8640         * testsuite/start_lib_test_3.c: Mark t3 as used.
8641
8642 2010-08-27  Nick Clifton  <nickc@redhat.com>
8643
8644         * options.cc (version_script): Fix small typo in previous
8645         whitespace tidyup.
8646
8647 2010-08-25  Nick Clifton  <nickc@redhat.com>
8648
8649         * archive.cc: Formatting fixes: Remove whitespace between
8650         typename and following asterisk.  Remove whitespace between
8651         function name and opening parenthesis.
8652         * archive.h: Likewise.
8653         * arm.cc: Likewise.
8654         * attributes.cc: Likewise.
8655         * attributes.h: Likewise.
8656         * common.cc: Likewise.
8657         * copy-relocs.cc: Likewise.
8658         * dirsearch.h: Likewise.
8659         * dynobj.cc: Likewise.
8660         * ehframe.cc: Likewise.
8661         * ehframe.h: Likewise.
8662         * expression.cc: Likewise.
8663         * fileread.cc: Likewise.
8664         * fileread.h: Likewise.
8665         * gc.h: Likewise.
8666         * gold-threads.cc: Likewise.
8667         * gold.cc: Likewise.
8668         * i386.cc: Likewise.
8669         * icf.h: Likewise.
8670         * incremental-dump.cc: Likewise.
8671         * incremental.cc: Likewise.
8672         * layout.cc: Likewise.
8673         * layout.h: Likewise.
8674         * main.cc: Likewise.
8675         * merge.cc: Likewise.
8676         * merge.h: Likewise.
8677         * object.cc: Likewise.
8678         * object.h: Likewise.
8679         * options.cc: Likewise.
8680         * options.h: Likewise.
8681         * output.cc: Likewise.
8682         * output.h: Likewise.
8683         * plugin.cc: Likewise.
8684         * plugin.h: Likewise.
8685         * powerpc.cc: Likewise.
8686         * reloc.cc: Likewise.
8687         * script-c.h: Likewise.
8688         * script-sections.cc: Likewise.
8689         * script.cc: Likewise.
8690         * stringpool.cc: Likewise.
8691         * symtab.cc: Likewise.
8692         * symtab.h: Likewise.
8693         * target.cc: Likewise.
8694         * timer.cc: Likewise.
8695         * timer.h: Likewise.
8696         * version.cc: Likewise.
8697         * x86_64.cc: Likewise.
8698
8699 2010-08-24  Nick Clifton  <nickc@redhat.com>
8700
8701         PR 11899
8702         * layout.cc (segment_precedes): Sort segments by their physical
8703         addresses, if they have been set.
8704
8705 2010-08-23  Cary Coutant  <ccoutant@google.com>
8706
8707         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
8708         symbols data.
8709         (Lib_group::include_member): Unlock object after deleting its
8710         symbols data.
8711         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
8712         the bug fixed here.
8713
8714 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
8715             Cary Coutant  <ccoutant@google.com>
8716
8717         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
8718         constructor, and set_blocker.
8719         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
8720         readsyms_blocker_.
8721         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
8722         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
8723         * testsuite/Makefile.am (start_lib_test): New test case.
8724         * testsuite/Makefile.in: Regenerate.
8725         * testsuite/start_lib_test_main.c: New file.
8726         * testsuite/start_lib_test_1.c: New file.
8727         * testsuite/start_lib_test_2.c: New file.
8728         * testsuite/start_lib_test_3.c: New file.
8729
8730 2010-08-19  Ian Lance Taylor  <iant@google.com>
8731
8732         * Makefile.in: Rebuild with automake 1.11.1.
8733         * aclocal.m4: Likewise.
8734         * testsuite/Makefile.in: Likewise.
8735
8736 2010-08-19  Ian Lance Taylor  <iant@google.com>
8737
8738         PR 10893
8739         * i386.cc (class Output_data_plt_i386): Update declarations.
8740         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
8741         local_ifuncs_ fields.
8742         (Target_i386::do_plt_section_for_global): New function.
8743         (Target_i386::do_plt_section_for_local): New function.
8744         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
8745         parameter; change all callers.  Initialize global_ifuncs_ and
8746         local_ifuncs_.  If doing a static link define __rel_iplt_start and
8747         __rel_iplt_end.
8748         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
8749         (Output_data_plt_i386::add_local_ifunc_entry): New function.
8750         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
8751         symbols.
8752         (Target_i386::make_plt_section): New function, broken out of
8753         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
8754         (Target_i386::make_plt_entry): Call make_plt_section.
8755         (Target_i386::make_local_ifunc_plt_entry): New function.
8756         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
8757         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
8758         R_386_IRELATIVE to switch.
8759         (Target_i386::Scan::global): Likewise.
8760         (Target_i386::Relocate::relocate): Likewise.
8761         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
8762         switch.
8763         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
8764         (Target_x86_64::do_plt_section_for_global): New function.
8765         (Target_x86_64::do_plt_section_for_local): New function.
8766         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
8767         parameter; change all callers.  If doing a static link define
8768         __rela_iplt_start and __rela_iplt_end.
8769         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
8770         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
8771         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
8772         to point to .plt.
8773         (Target_x86_64::make_local_ifunc_plt_entry): New function.
8774         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
8775         switch.
8776         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
8777         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
8778         R_X86_64_IRELATIVE to switch.
8779         (Target_x86_64::Scan::global): Likewise.
8780         (Target_x86_64::Relocate::relocate): Likewise.
8781         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
8782         switch.
8783         * target.h (class Target): Add plt_section_for_global and
8784         plt_section_for_local functions.  Add do_plt_section_for_global
8785         and do_plt_section_for_local virtual functions.
8786         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
8787         clarifying comments.
8788         (Symbol::use_plt_offset): Handle IFUNC symbol.
8789         * object.cc (Sized_relobj::Sized_relobj): Initialize
8790         local_plt_offsets_.
8791         (Sized_relobj::local_has_plt_offset): New function.
8792         (Sized_relobj::local_plt_offset): New function.
8793         (Sized_relobj::set_local_plt_offset): New function.
8794         (Sized_relobj::do_count): Handle IFUNC symbol.
8795         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
8796         a bit away from input_shndx_ field.  Add set_is_func_symbol and
8797         is_ifunc_symbol functions.
8798         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
8799         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
8800         local_plt_offsets_ field.
8801         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
8802         * output.h (class Output_section_data): Add non-const
8803         output_section function.
8804         (class Output_data_got): Update declarations.
8805         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
8806         Add use_plt_offset parameter to global and local constructors.
8807         Change all callers.  Change local_sym_index_ field to 31 bits.
8808         Change GSYM_CODE and CONSTANT_CODE accordingly.
8809         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
8810         doing a static link don't set sh_link field.
8811         (Output_data_got::Got_entry::write): Use PLT offset if
8812         appropriate.
8813         (Output_data_got::add_global_plt): New function.
8814         (Output_data_got::add_local_plt): New function.
8815         * target-reloc.h (relocate_section): Handle IFUNC symbol.
8816         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
8817         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
8818         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
8819         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
8820         IFUNC conditional.
8821         * testsuite/ifunc-sel.h: New file.
8822         * testsuite/ifuncmain1.c: New file.
8823         * testsuite/ifuncmain1vis.c: New file.
8824         * testsuite/ifuncmod1.c: New file.
8825         * testsuite/ifuncdep2.c: New file.
8826         * testsuite/ifuncmain2.c: New file.
8827         * testsuite/ifuncmain3.c: New file.
8828         * testsuite/ifuncmod3.c: New file.
8829         * testsuite/ifuncmain4.c: New file.
8830         * testsuite/ifuncmain5.c: New file.
8831         * testsuite/ifuncmod5.c: New file.
8832         * testsuite/ifuncmain6pie.c: New file.
8833         * testsuite/ifuncmod6.c: New file.
8834         * testsuite/ifuncmain7.c: New file.
8835         * configure, testsuite/Makefile.in: Rebuild.
8836
8837 2010-08-18  Ian Lance Taylor  <iant@google.com>
8838
8839         * incremental.cc
8840         (Output_section_incremental_inputs::write_input_files): Add cast
8841         to avoid signed/unsigned comparison warning.
8842         (Output_section_incremental_inputs::write_info_blocks): Likewise.
8843
8844 2010-08-12  Cary Coutant  <ccoutant@google.com>
8845
8846         * common.cc (Sort_commons::operator()): Remove unnecessary code.
8847
8848 2010-08-13  Ian Lance Taylor  <iant@google.com>
8849
8850         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
8851
8852 2010-08-12  Cary Coutant  <ccoutant@google.com>
8853             Doug Kwan  <dougkwan@google.com>
8854
8855         * resolve.cc (Symbol_table::should_override): When a weak dynamic
8856         defintion overrides non-weak undef, remember that the original undef
8857         is not weak.
8858         * symtab.cc (Symbol_table::sized_write_global): For undef without
8859         an original weak binding, set binding to global in output.
8860         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
8861         * testsuite/Makefile.in: Regenerate.
8862         * testsuite/strong_ref_weak_def.sh: New file.
8863         * testsuite/strong_ref_weak_def_1.c: Ditto.
8864         * testsuite/strong_ref_weak_def_2.c: Ditto.
8865
8866 2010-08-12  Cary Coutant  <ccoutant@google.com>
8867
8868         * testsuite/incremental_test.sh: Rewrite.
8869         * testsuite/incremental_test_1.c: Rewrite.
8870         * testsuite/incremental_test_2.c: Rewrite.
8871
8872 2010-08-12  Cary Coutant  <ccoutant@google.com>
8873
8874         * arm.cc (Target_arm::got_size): Add const.
8875         (Target_arm::got_entry_count): New function.
8876         (Target_arm::plt_entry_count): New function.
8877         (Target_arm::first_plt_entry_offset): New function.
8878         (Target_arm::plt_entry_size): New function.
8879         (Output_data_plt_arm::entry_count): New function.
8880         (Output_data_plt_arm::first_plt_entry_offset): New function.
8881         (Output_data_plt_arm::get_plt_entry_size): New function.
8882         * i386.cc (Target_i386::got_size): Add const.
8883         (Target_i386::got_entry_count): New function.
8884         (Target_i386::plt_entry_count): New function.
8885         (Target_i386::first_plt_entry_offset): New function.
8886         (Target_i386::plt_entry_size): New function.
8887         (Output_data_plt_i386::entry_count): New function.
8888         (Output_data_plt_i386::first_plt_entry_offset): New function.
8889         (Output_data_plt_i386::get_plt_entry_size): New function.
8890         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
8891         find_incremental_inputs_sections.  Dump incremental_got_plt section.
8892         * incremental.cc: Include target.h.
8893         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
8894         parameter.  Adjust all callers.  Find incremental_got_plt section.
8895         (Incremental_inputs::create_data_sections): Create incremental_got_plt
8896         section.
8897         (Output_section_incremental_inputs::set_final_data_size): Calculate
8898         size of incremental_got_plt section.
8899         (Output_section_incremental_inputs::do_write): Write the
8900         incremental_got_plt section.
8901         (Got_plt_view_info): New struct.
8902         (Local_got_offset_visitor): New class.
8903         (Global_got_offset_visitor): New class.
8904         (Global_symbol_visitor_got_plt): New class.
8905         (Output_section_incremental_inputs::write_got_plt): New function.
8906         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
8907         Add parameter.  Adjust all callers.
8908         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
8909         (Incremental_inputs::got_plt_section): New function.
8910         (Incremental_inputs::got_plt_section_): New data member.
8911         (Incremental_got_plt_reader): New class.
8912         * layout.cc (Layout::create_incremental_info_sections): Add the
8913         incremental_got_plt section.
8914         * object.h (Got_offset_list::get_list): New function.
8915         (Got offset_list::for_all_got_offsets): New function.
8916         (Sized_relobj::local_got_offset_list): New function.
8917         * powerpc.cc (Target_powerpc::got_size): Add const.
8918         (Target_powerpc::got_entry_count): New function.
8919         (Target_powerpc::plt_entry_count): New function.
8920         (Target_powerpc::first_plt_entry_offset): New function.
8921         (Target_powerpc::plt_entry_size): New function.
8922         (Output_data_plt_powerpc::entry_count): New function.
8923         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
8924         (Output_data_plt_powerpc::get_plt_entry_size): New function.
8925         * sparc.cc (Target_sparc::got_size): Add const.
8926         (Target_sparc::got_entry_count): New function.
8927         (Target_sparc::plt_entry_count): New function.
8928         (Target_sparc::first_plt_entry_offset): New function.
8929         (Target_sparc::plt_entry_size): New function.
8930         (Output_data_plt_sparc::entry_count): New function.
8931         (Output_data_plt_sparc::first_plt_entry_offset): New function.
8932         (Output_data_plt_sparc::get_plt_entry_size): New function.
8933         * symtab.h (Symbol::got_offset_list): New function.
8934         (Symbol_table::for_all_symbols): New function.
8935         * target.h (Sized_target::got_entry_count): New function.
8936         (Sized_target::plt_entry_count): New function.
8937         (Sized_target::plt_entry_size): New function.
8938         * x86_64.cc (Target_x86_64::got_size): Add const.
8939         (Target_x86_64::got_entry_count): New function.
8940         (Target_x86_64::plt_entry_count): New function.
8941         (Target_x86_64::first_plt_entry_offset): New function.
8942         (Target_x86_64::plt_entry_size): New function.
8943         (Output_data_plt_x86_64::entry_count): New function.
8944         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
8945         (Output_data_plt_x86_64::get_plt_entry_size): New function.
8946
8947 2010-08-12  Cary Coutant  <ccoutant@google.com>
8948
8949         * archive.cc: Include incremental.h.
8950         (Archive::Archive): Initialize incremental_info_.
8951         (Archive::include_member): Record archive members in incremental info.
8952         (Add_archive_symbols::run): Record begin and end of an archive in
8953         incremental info.
8954         (Lib_group::include_member): Record objects in incremental info.
8955         * archive.h (Incremental_archive_entry): Forward declaration.
8956         (Archive::set_incremental_info): New member function.
8957         (Archive::incremental_info): New member function.
8958         (Archive::Unused_symbol_iterator): New class.
8959         (Archive::unused_symbols_begin): New member function.
8960         (Archive::unused_symbols_end): New member function.
8961         (Archive::incremental_info_): New data member.
8962         * incremental-dump.cc (find_input_containing_global): New function.
8963         (dump_incremental_inputs): Dump new incremental info sections.
8964         * incremental.cc: Include symtab.h.
8965         (Output_section_incremental_inputs): New class.
8966         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
8967         new incremental info sections.
8968         (Sized_incremental_binary::do_check_inputs): Likewise.
8969         (Incremental_inputs::report_archive): Remove.
8970         (Incremental_inputs::report_archive_begin): New function.
8971         (Incremental_inputs::report_archive_end): New function.
8972         (Incremental_inputs::report_object): New function.
8973         (Incremental_inputs::finalize_inputs): Remove.
8974         (Incremental_inputs::report_input_section): New function.
8975         (Incremental_inputs::report_script): Rewrite.
8976         (Incremental_inputs::finalize): Do nothing but finalize string table.
8977         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
8978         (Incremental_inputs::sized_create_inputs_section_data): Remove.
8979         (Incremental_inputs::create_data_sections): New function.
8980         (Incremental_inputs::relocs_entsize): New function.
8981         (Output_section_incremental_inputs::set_final_data_size): New function.
8982         (Output_section_incremental_inputs::do_write): New function.
8983         (Output_section_incremental_inputs::write_header): New function.
8984         (Output_section_incremental_inputs::write_input_files): New function.
8985         (Output_section_incremental_inputs::write_info_blocks): New function.
8986         (Output_section_incremental_inputs::write_symtab): New function.
8987         * incremental.h (Incremental_script_entry): Forward declaration.
8988         (Incremental_object_entry): Forward declaration.
8989         (Incremental_archive_entry): Forward declaration.
8990         (Incremental_inputs): Forward declaration.
8991         (Incremental_inputs_header_data): Remove.
8992         (Incremental_inputs_header): Remove.
8993         (Incremental_inputs_header_write): Remove.
8994         (Incremental_inputs_entry_data): Remove.
8995         (Incremental_inputs_entry): Remove.
8996         (Incremental_inputs_entry_write): Remove.
8997         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
8998         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
8999         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
9000         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
9001         Likewise.
9002         (Incremental_input_entry): New class.
9003         (Incremental_script_entry): New class.
9004         (Incremental_object_entry): New class.
9005         (Incremental_archive_entry): New class.
9006         (Incremental_inputs::Incremental_inputs): Initialize new data members.
9007         (Incremental_inputs::report_inputs): Remove.
9008         (Incremental_inputs::report_archive): Remove.
9009         (Incremental_inputs::report_archive_begin): New function.
9010         (Incremental_inputs::report_archive_end): New function.
9011         (Incremental_inputs::report_object): Change prototype.
9012         (Incremental_inputs::report_input_section): New function.
9013         (Incremental_inputs::report_script): Change prototype.
9014         (Incremental_inputs::get_reloc_count): New function.
9015         (Incremental_inputs::set_reloc_count): New function.
9016         (Incremental_inputs::create_data_sections): New function.
9017         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
9018         (Incremental_inputs::inputs_section): New function.
9019         (Incremental_inputs::symtab_section): New function.
9020         (Incremental_inputs::relocs_section): New function.
9021         (Incremental_inputs::get_stringpool): Add const.
9022         (Incremental_inputs::command_line): Add const.
9023         (Incremental_inputs::inputs): Remove.
9024         (Incremental_inputs::command_line_key): New function.
9025         (Incremental_inputs::input_file_count): New function.
9026         (Incremental_inputs::input_files): New function.
9027         (Incremental_inputs::relocs_entsize): New function.
9028         (Incremental_inputs::sized_create_inputs_section_data): Remove.
9029         (Incremental_inputs::finalize_inputs): Remove.
9030         (Incremental_inputs::Input_info): Remove.
9031         (Incremental_inputs::lock_): Remove.
9032         (Incremental_inputs::inputs_): Change type.
9033         (Incremental_inputs::inputs_map_): Remove.
9034         (Incremental_inputs::current_object_entry_): New data member.
9035         (Incremental_inputs::inputs_section_): New data member.
9036         (Incremental_inputs::symtab_section_): New data member.
9037         (Incremental_inputs::relocs_section_): New data member.
9038         (Incremental_inputs::reloc_count_): New data member.
9039         (Incremental_inputs_reader): New class.
9040         (Incremental_symtab_reader): New class.
9041         (Incremental_relocs_reader): New class.
9042         * layout.cc (Layout::finalize): Move finalization of incremental info
9043         and creation of incremental info sections to follow finalization of
9044         symbol table.  Set offsets for postprocessing sections.
9045         (Layout::create_incremental_info_sections): Call
9046         Incremental_inputs::create_data_sections.  Add incremental symtab
9047         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
9048         sections to layout after input sections.
9049         * layout.h (struct Timespec): Forward declaration.
9050         (Layout::incremental_inputs): Add const.
9051         (Layout::create_incremental_info_sections): Add parameter.
9052         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
9053         * object.cc: Include incremental.h.
9054         (Relobj::finalize_incremental_relocs): New function.
9055         (Sized_relobj::do_layout): Record input sections in incremental info.
9056         * object.h (Object::output_section): New function.
9057         (Object::output_section_offset): Moved from Relobj.
9058         (Object::get_incremental_reloc_base): New function.
9059         (Object::get_incremental_reloc_count): New function.
9060         (Object::do_output_section): New function.
9061         (Object::do_output_section_offset): Moved from Relobj.
9062         (Object::do_get_incremental_reloc_base): New function.
9063         (Object::do_get_incremental_reloc_count): New function.
9064         (Object::Object): Initialize new data members.
9065         (Relobj::output_section): Renamed do_output_section and moved to
9066         protected.
9067         (Relobj::output_section_offset): Moved to Object.
9068         (Relobj::do_get_incremental_reloc_base): New function.
9069         (Relobj::do_get_incremental_reloc_count): New function.
9070         (Relobj::allocate_incremental_reloc_counts): New function.
9071         (Relobj::count_incremental_reloc): New function.
9072         (Relobj::finalize_incremental_relocs): New function.
9073         (Relobj::next_incremental_reloc_index): New function.
9074         (Relobj::reloc_counts_): New data member.
9075         (Relobj::reloc_bases_): New data member.
9076         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
9077         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
9078         (Sized_relobj::incremental_relocs_scan): New function.
9079         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9080         (Sized_relobj::incremental_relocs_write): New function.
9081         (Sized_relobj::incremental_relocs_write_reltype): New function.
9082         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
9083         incremental link.
9084         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
9085         archives and object files elsewhere.
9086         (Add_symbols::run): Report object files here.
9087         (Finish_group::run): Report end of archive at end of group.
9088         * reloc.cc: Include layout.h, incremental.h.
9089         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
9090         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
9091         (Sized_relobj::incremental_relocs_scan): New function.
9092         (Sized_relobj::incremental_relocs_scan_reltype): New function.
9093         (Sized_relobj::do_relocate_sections): Write incremental relocations.
9094         (Sized_relobj::incremental_relocs_write): New function.
9095         (Sized_relobj::incremental_relocs_write_reltype): New function.
9096         * script.cc (read_input_script): Rewrite test for incremental link.
9097         Change call to Incremental_inputs::report_script.
9098         * symtab.h (Symbol_table::first_global_index): New function.
9099         (Symbol_table::output_count): New function.
9100
9101 2010-08-12  Doug Kwan  <dougkwan@google.com>
9102
9103         * arm.cc (Target_arm::merge_object_attributes): Check command line
9104         options --no-wchar-size-warning and --no-enum-size-warning.
9105         * options.h (General_options): Add ld-compatible options
9106         --no-enum-size-warning and --no-wchar-size-warning.
9107
9108 2010-08-04  Ian Lance Taylor  <iant@google.com>
9109
9110         * x86_64.cc (Target_x86_64::Scan::local): Use
9111         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
9112         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
9113         (Target_x86_64::Scan::global): Likewise.
9114         (Target_x86_64::Relocate::relocate): Likewise.
9115         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
9116         Likewise.
9117
9118 2010-08-03  Cary Coutant  <ccoutant@google.com>
9119
9120         * merge.cc (Output_merge_string::do_add_input_section): Count strings
9121         to reserve space in merged_strings vector. Keep total input size
9122         for stats.
9123         (Output_merge_string::do_print_merge_stats): Print total input size.
9124         * merge.h (Output_merge_string): Add input_size_ field.
9125         * stringpool.cc (Stringpool_template::string_length): Move
9126         implementations out of Stringpool_template class and place in
9127         stringpool.h.
9128         * stringpool.h (string_length): Move out of Stringpool_template.
9129
9130 2010-08-03  Ian Lance Taylor  <iant@google.com>
9131
9132         PR 11712
9133         * layout.cc (relaxation_loop_body): If address of load segment is
9134         set, adjust address to include headers if possible.
9135
9136 2010-08-03  Ian Lance Taylor  <iant@google.com>
9137
9138         * version.cc (version_string): Bump to 1.10.
9139
9140 2010-08-03  Ian Lance Taylor  <iant@google.com>
9141
9142         PR 11805
9143         * layout.h (enum Output_section_order): Define.
9144         (class Layout): Update declarations.
9145         * layout.cc (Layout::get_output_section): Add order parameter.
9146         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
9147         is_first_non_relro parameters.  Change all callers.
9148         (Layout::choose_output_section): Likewise.
9149         (Layout::add_output_section_data): Likewise.
9150         (Layout::make_output_section): Likewise.  Set order.
9151         (Layout::default_section_order): New function.
9152         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
9153         * output.cc (Output_section::Output_section): Initialize order_.
9154         Don't initialize deleted fields.
9155         (Output_segment::Output_segment): Don't initialize deleted
9156         fields.
9157         (Output_segment::add_output_section_to_load): New function
9158         replacing add_output_section.  Change all callers to call this or
9159         add_output_section_to_nonload.
9160         (Output_segment::add_output_section_to_nonload): New function.
9161         (Output_segment::remove_output_section): Rewrite.
9162         (Output_segment::add_initial_output_data): Likewise.
9163         (Output_segment::has_any_data_sections): Likewise.
9164         (Output_segment::is_first_section_relro): Likewise.
9165         (Output_segment::maximum_alignment): Likewise.
9166         (Output_segment::has_dynamic_reloc): New function replacing
9167         dynamic_reloc_count.  Change all callers.
9168         (Output_segment::has_dynamic_reloc_list): New function replacing
9169         dynamic_reloc_count_list.  Change all callers.
9170         (Output_segment::set_section_addresses): Rewrite.
9171         (Output_segment::set_offset): Rewrite.
9172         (Output_segment::find_first_and_last_list): Remove.
9173         (Output_segment::set_tls_offsets): Rewrite.
9174         (Output_segment::first_section_load_address): Likewise.
9175         (Output_segment::output_section_count): Likewise.
9176         (Output_segment::section_with_lowest_load_address): Likewise.
9177         (Output_segment::write_section_headers): Likewise.
9178         (Output_segment::print_sections_to_map): Likewise.
9179         * output.h (class Output_data): Remove dynamic_reloc_count_
9180         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
9181         (Output_data::add_dynamic_reloc): Rewrite.
9182         (Output_data::has_dynamic_reloc): New function.
9183         (Output_data::dynamic_reloc_count): Remove.
9184         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
9185         is_last_relro_, is_first_non_relro_, is_interp_,
9186         is_dynamic_linker_section_ fields.  Add order and set_order
9187         functions.  Remove is_relro_local, set_is_relro_local,
9188         is_last_relro, set_is_last_relro, is_first_non_relro,
9189         set_is_first_non_relro functions, is_interp, set_is_interp,
9190         is_dynamic_linker_section, and set_is_dynamic_linker_section
9191         functions.
9192         (class Output_segment): Change Output_data_list from std::list to
9193         std:;vector.  Add output_lists_ field.  Remove output_data_ and
9194         output_bss_ fields.  Update declarations.
9195
9196 2010-08-02  Ian Lance Taylor  <iant@google.com>
9197
9198         * arm.cc (Target_arm::gc_process_relocs): Use typename.
9199         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
9200         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
9201
9202 2010-08-02  Ian Lance Taylor  <iant@google.com>
9203
9204         PR 11855
9205         * script.cc (Script_options::Script_options): Initialize
9206         symbol_definitions_ and symbol_references_.
9207         (Script_options::add_symbol_assignment): Update
9208         symbol_definitions_ and symbol_references_.
9209         (Script_options::add_symbol_reference): New function.
9210         (script_symbol): New function.
9211         * script.h (class Script_options): Add symbol_definitions_ and
9212         symbol_references_ fields.
9213         (Script_options::referenced_const_iterator): New type.
9214         (Script_options::referenced_begin): New function.
9215         (Script_options::referenced_end): New function.
9216         (Script_options::is_referenced): New function.
9217         (Script_options::any_unreferenced): New function.
9218         * script-c.h (script_symbol): Declare.
9219         * yyscript.y (exp): Call script_symbol.
9220         * symtab.cc: Include "script.h".
9221         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
9222         Change all callers.  Check symbols referenced by scripts.
9223         (Symbol_table::add_undefined_symbols_from_command_line): Add
9224         layout parameter.  Change all callers.
9225         (Symbol_table::do_add_undefined_symbols_from_command_line):
9226         Likewise.  Break out loop body.  Check symbols referenced by
9227         scripts.
9228         (Symbol_table::add_undefined_symbol_from_command_line): New
9229         function broken out of
9230         do_add_undefined_symbols_from_command_line.
9231         * symtab.h (class Symbol_table): Update declarations.
9232         * archive.cc: Include "layout.h".
9233         (Archive::should_include_member): Add layout parameter.  Change
9234         all callers.  Check for symbol mentioned in expression.
9235         * archive.h (class Archive): Update declaration.
9236         * object.cc (Sized_relobj::do_should_include_member): Add layout
9237         parameter.
9238         * object.h (Object::should_include_member): Add layout parameter.
9239         Change all callers.
9240         (Object::do_should_include_member): Add layout parameter.
9241         (class Sized_relobj): Update declaration.
9242         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
9243         parameter.
9244         * dynobj.h (class Sized_dynobj): Update declaration.
9245         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
9246         layout parameter.
9247         * plugin.h (class Sized_pluginobj): Update declaration.
9248
9249 2010-08-02  Ian Lance Taylor  <iant@google.com>
9250
9251         PR 11866
9252         * output.cc (Output_segment::set_offset): Search for the first and
9253         last sections rather than assuming that the list is in order.
9254         (Output_segment::find_first_and_last_list): New function.
9255         * output.h (class Output_segment): Update declarations.
9256         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
9257         (relro_strip_test_SOURCES): New variable.
9258         (relro_strip_test_DEPENDENCIES): New variable.
9259         (relro_strip_test_LDFLAGS): New variable.
9260         (relro_strip_test_LDADD): New variable.
9261         (relro_strip_test.so): New target.
9262
9263 2010-08-02  Ian Lance Taylor  <iant@google.com>
9264
9265         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
9266         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
9267         (Target_i386::got_tlsdesc_section): New function.
9268         (Target_i386::got_section): Create space for GOT entries for
9269         TLSDESC relocations.
9270         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
9271         R_386_TLS_GOTDESC.
9272         (Target_i386::Scan::global): Likewise.
9273         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
9274         using TLSDESC GOT.
9275         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
9276         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
9277         (Target_x86_64::got_tlsdesc_section): New function.
9278         (Target_x86_64::got_section): Create space for GOT entries for
9279         TLSDESC relocations.
9280         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
9281         R_386_TLS_GOTDESC.
9282         (Target_x86_64::Scan::global): Likewise.
9283         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
9284         using TLSDESC GOT.
9285
9286 2010-08-02  Ian Lance Taylor  <iant@google.com>
9287
9288         * testsuite/final_layout.sh: Use dc to convert from hex to
9289         decimal.
9290
9291 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
9292
9293         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
9294         paramter to the call to gold::gc_process_relocs.
9295         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
9296         paramter to the call to gold::gc_process_relocs.
9297         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
9298         parameter to the call to gold::gc_process_relocs.
9299         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
9300         template parameter to the call to gold::gc_process_relocs.
9301         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
9302         paramter to the call to gold::gc_process_relocs.
9303         * gc.h (get_embedded_addend_size): New function.
9304         (gc_process_relocs): Save the size of the reloc for use by ICF.
9305         * icf.cc (get_section_contents): Get the addend from the text section
9306         for SHT_REL relocation sections.
9307         * icf.h (Icf::Reloc_addend_size_info): New typedef.
9308         (Icf::Reloc_info): Add new member reloc_addend_size_info.
9309         * int_encoding.h (read_from_pointer): New overloaded function.
9310         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
9311         * testsuite/icf_sht_rel_addend_test.sh: New file.
9312         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
9313         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
9314
9315 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9316
9317         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
9318         * Makefile.in: Regenerate.
9319         * testsuite/Makefile.in: Regenerate.
9320
9321 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
9322
9323         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
9324         * gold/testsuite/debug_msg.cc: Likewise.
9325         * gold/testsuite/odr_violation1.cc
9326         * gold/testsuite/odr_violation2.cc
9327
9328 2010-07-21  Cary Coutant  <ccoutant@google.com>
9329
9330         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
9331         string, and length fields.
9332         (Output_merge_string::Merged_strings_list): New type.
9333         (Output_merge_string::Merged_strings_lists): New typedef.
9334         (Output_merge_string): Replace merged_strings_ with
9335         merged_strings_lists_.
9336         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
9337         Merged_strings_list per input object and section.  Don't store pointer
9338         to the string.  Don't store length with each merged string entry.
9339         (Output_merge_string::finalize_merged_data): Loop over list of merged
9340         strings lists.  Recompute length of each merged string.
9341
9342 2010-07-15  Cary Coutant  <ccoutant@google.com>
9343
9344         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
9345         here.
9346
9347 2010-07-14  Ian Lance Taylor  <iant@google.com>
9348
9349         * descriptors.cc (Descriptors::open): Report correct name in error
9350         message.
9351
9352 2010-07-13  Doug Kwan  <dougkwan@google.com>
9353
9354         * arm.cc (Arm_input_section::Arm_input_section): For a
9355         SHT_ARM_EXIDX section, always keeps the input sections.
9356         (Arm_input_section::set_exidx_section_link): New method.
9357         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
9358         has_errors_ to false.
9359         (Arm_exidx_input_section::has_errors,
9360         Arm_exidx_input_section::set_has_errors): New methods.
9361         (Arm_exidx_input_section::has_errors_): New data member.
9362         (Arm_relobj::get_exidx_shndx_list): New method.
9363         (Arm_output_section::append_text_sections_to_list): Do not skip
9364         section without SHF_EXECINSTR.
9365         (Arm_output_section::fix_exidx_coverage): Skip input sections with
9366         errors.
9367         (Arm_relobj::make_exidx_input_section): Add new parameter for text
9368         section header.  Make error messages more verbose.  Check for
9369         a non-executable section linked to an EXIDX section.
9370         (Arm_relobj::do_read_symbols): Remove error checking, which has been
9371         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
9372         check that there is no deferred EXIDX section if we exit early.
9373         Instead of not making an EXIDX section in case of an error, make one
9374         and set the has_errors flag of it.
9375         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
9376         in a relocatable link.
9377         (Target_arm::do_relax): Look for the EXIDX output section instead of
9378         assuming that it is called .ARM.exidx.
9379         (Target_arm::fix_exidx_coverage): Add a new parameter for input
9380         section list.  Do not check for SHF_EXECINSTR section flags but
9381         skip any input section with errors.
9382         * output.cc (Output_section::Output_section): Initialize
9383         always_keeps_input_sections_ to false.
9384         (Output_section::add_input_section): Check for
9385         always_keeps_input_sections_.
9386         *  output.h (Output_section::always_keeps_input_sections,
9387         Output_section::set_always_keeps_input_sections): New methods.
9388         (Output_section::always_keeps_input_sections): New data member.
9389
9390 2010-07-13  Rafael Espindola  <espindola@google.com>
9391
9392         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
9393         * fileread.h (Input_file): Add try_extra_search_path and find_file.
9394
9395 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
9396             Ian Lance Taylor  <iant@google.com>
9397
9398         * output.h (Output_section_lookup_maps::add_merge_section):
9399         Correct check of whether value was inserted.
9400         (Output_section_lookup_maps::add_merge_input_section): Likewise.
9401         (Output_section_lookup_maps::add_relaxed_input_section):
9402         Likewise.
9403         * arm.cc (Target_arm::got_section): Remove used local os.
9404         * i386.cc (Target_i386::got_section): Likewise.
9405         * x86_64.cc (Target_x86_64::got_section): Likewise.
9406         * sparc.cc (Target_sparc::got_section): Likewise.
9407         (Target_sparc::relocate): Remove unused local have_got_offset.
9408         * powerpc.cc (Target_powerpc::relocate): Likewise.
9409
9410 2010-07-13  Ian Lance Taylor  <iant@google.com>
9411
9412         * compressed_output.cc (zlib_decompress): Fix signature in
9413         !HAVE_ZLIB_H case.
9414
9415         * archive.cc (Archive::include_member): Unlock an external member
9416         of a thin archive.  Don't bother to delete an object we know is
9417         NULL.
9418
9419 2010-07-12  Cary Coutant  <ccoutant@google.com>
9420
9421         * compressed_output.cc (zlib_decompress): New function.
9422         (get_uncompressed_size): New function.
9423         (decompress_input_section): New function.
9424         * compressed_output.h (get_uncompressed_size): New function.
9425         (decompress_input_section): New function.
9426         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
9427         Handle compressed debug sections.
9428         * layout.cc (is_compressed_debug_section): New function.
9429         (Layout::output_section_name): Map compressed section names to
9430         canonical names.
9431         * layout.h (is_compressed_debug_section): New function.
9432         (is_debug_info_section): Recognize compressed debug sections.
9433         * merge.cc: Include compressed_output.h.
9434         (Output_merge_data::do_add_input_section): Handle compressed
9435         debug sections.
9436         (Output_merge_string::do_add_input_section): Handle compressed
9437         debug sections.
9438         * object.cc: Include compressed_output.h.
9439         (Sized_relobj::Sized_relobj): Initialize new data members.
9440         (build_compressed_section_map): New function.
9441         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
9442         * object.h (Object::section_is_compressed): New method.
9443         (Object::do_section_is_compressed): New method.
9444         (Sized_relobj::Compressed_section_map): New type.
9445         (Sized_relobj::do_section_is_compressed): New method.
9446         (Sized_relobj::compressed_sections_): New data member.
9447         * output.cc (Output_section::add_input_section): Handle compressed
9448         debug sections.
9449         * reloc.cc: Include compressed_output.h.
9450         (Sized_relobj::write_sections): Handle compressed debug sections.
9451
9452 2010-07-08  Cary Coutant  <ccoutant@google.com>
9453
9454         * resolve.cc (Symbol_table::resolve): Remember whether undef was
9455         weak when resolving to a dynamic def.
9456         (Symbol_table::should_override): Add adjust_dyndef flag; set it
9457         for weak undef/dynamic def cases. Adjust callers.
9458         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
9459         undef_binding_weak_.
9460         (Symbol_table::sized_write_globals): Adjust symbol binding.
9461         (Symbol_table::sized_write_symbol): Add binding parameter.
9462         * symtab.h (Symbol::set_undef_binding): New method.
9463         (Symbol::is_undef_binding_weak): New method.
9464         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
9465         (Symbol_table::should_override): Add new parameter.
9466         (Symbol_table::sized_write_symbol): Add new parameter.
9467
9468         * testsuite/weak_undef_file1.cc: Add new test case.
9469         * testsuite/weak_undef_file2.cc: Fix header comment.
9470         * testsuite/weak_undef_test.cc: Add new test case.
9471
9472 2010-06-29  Doug Kwan  <dougkwan@google.com>
9473
9474         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
9475         Initialize USE_SYMBOL_.
9476         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
9477         definition.
9478         (Arm_reloc_property::uses_symbol_): New data member declaration.
9479         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
9480         uses symbol value and symbol is undefined but not weakly undefined.
9481
9482 2010-06-28  Rafael Espindola  <espindola@google.com>
9483
9484         * plugin.cc (Plugin::load): Use dlerror.
9485
9486 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
9487
9488         * symtab.cc (detect_odr_violations): When reporting an ODR
9489         violation, report an object where the symbol is defined.
9490
9491 2010-06-25  Doug Kwan  <dougkwan@google.com>
9492
9493         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
9494         (Target_arm::section_may_have_icf_unsafe_pointers): New method
9495         definition.
9496         (Target_arm::Scan::local_reloc_may_be_function_pointer,
9497         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
9498         target hook to detect function points.
9499         (Target_arm::Scan::possible_function_pointer_reloc): New method.
9500         * icf.h (Icf::check_section_for_function_pointers): Change type of
9501         parameter SECTION_NAME to const reference to std::string.  Use
9502         target hook to determine if section may have unsafe pointers.
9503         * target.h (Target::section_may_have_icf_unsafe_pointers): New
9504         method definition.
9505
9506 2010-06-21  Rafael Espindola  <espindola@google.com>
9507
9508         * fileread.cc (Input_file::find_fie): New
9509         (Input_file::open): Use Input_file::find_fie.
9510         * fileread.h (Input_file::find_fie): New
9511         * plugin.cc (set_extra_library_path): New.
9512         (Plugin::load): Add set_extra_library_path to the transfer vector.
9513         (Plugin_manager::set_extra_library_path): New.
9514         (Plugin_manager::add_input_file): Use the extra search path if set.
9515         (set_extra_library_path(): New.
9516         * plugin.h (Plugin_manager): Add set_extra_library_path and
9517         extra_search_path_.
9518
9519 2010-06-19  Cary Coutant  <ccoutant@google.com>
9520
9521         * layout.cc (gdb_sections): Add .debug_types.
9522         (lines_only_debug_sections): Likewise.
9523
9524 2010-06-18  Rafael Espindola  <espindola@google.com>
9525
9526         * plugin.cc (add_input_file,add_input_library)
9527         (Plugin_manager::add_input_file): Make filename arguments const.
9528         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
9529         const.
9530
9531 2010-06-16  Doug Kwan  <dougkwan@google.com>
9532
9533         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
9534         .ARM.attributes section if we have not merged any input
9535         attributes sections.
9536
9537 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9538
9539         * arm.cc: Allow combining objects with no EABI version
9540         information.
9541
9542 2010-06-15  Rafael Espindola  <espindola@google.com>
9543
9544         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
9545
9546 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9547
9548         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
9549         (struct iovec): Correct !HAVE_READV definition.
9550
9551 2010-06-10  Cary Coutant  <ccoutant@google.com>
9552
9553         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
9554         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
9555         reloc sections.
9556         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
9557
9558         PR 11683
9559         * symtab.h (Symbol::is_placeholder): New member function.
9560         * target-reloc.h (relocate_section): Check for placeholder symbols.
9561
9562         * testsuite/Makefile.am (plugin_test_8): New test.
9563         (plugin_test_9): New test.
9564         * testsuite/Makefile.in: Regenerate.
9565
9566 2010-06-09  Nick Clifton  <nickc@redhat.com>
9567
9568         * yyscript.y (input_list_element): Allow strings prefixed with
9569         the '-' character.  Treat these as libraries.
9570         * script.cc (script_add_library): New function.  Adds a library
9571         specified by "-l<name>" found in an input script.
9572         * script-c.h: Add prototype for script_add_library.
9573
9574 2010-06-07  Doug Kwan  <dougkwan@google.com>
9575
9576         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
9577         Restrict stub-group size to be within long conditional branch
9578         range when working around cortex-A8 erratum.
9579
9580 2010-06-07  Damien Diederen  <dd@crosstwine.com>
9581
9582         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
9583         #ifdef typo.
9584
9585 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
9586
9587         PR gold/11658
9588         * output.cc
9589         (Output_section::Input_section_sort_entry::compare_section_ordering):
9590         Change to return non-zero correctly.
9591         (Output_section::Input_section_sort_section_order_index_compare
9592         ::operator()): Change to fix ambiguity in comparisons.
9593
9594 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
9595
9596         * gold.h (is_wildcard_string): New function.
9597         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
9598         (Layout::layout_eh_frame): Ditto.
9599         (Layout::find_section_order_index): New method.
9600         (Layout::read_layout_from_file): New method.
9601         * layout.h (Layout::find_section_order_index): New method.
9602         (Layout::read_layout_from_file): New method.
9603         (Layout::input_section_position_): New private member.
9604         (Layout::input_section_glob_): New private member.
9605         * main.cc (main): Call read_layout_from_file here.
9606         * options.h (--section-ordering-file): New option.
9607         * output.cc (Output_section::input_section_order_specified_): New
9608         member.
9609         (Output_section::Output_section): Initialize new member.
9610         (Output_section::add_input_section): Add new parameter.
9611         Keep input sections when --section-ordering-file is used.
9612         (Output_section::set_final_data_size): Sort input sections when
9613         section ordering file is specified.
9614         (Output_section::Input_section_sort_entry): Add new parameter.
9615         Check sorting type.
9616         (Output_section::Input_section_sort_entry::compare_section_ordering):
9617         New method.
9618         (Output_section::Input_section_sort_compare::operator()): Change to
9619         consider section_order_index.
9620         (Output_section::Input_section_sort_init_fini_compare::operator()):
9621         Change to consider section_order_index.
9622         (Output_section::Input_section_sort_section_order_index_compare
9623         ::operator()): New method.
9624         (Output_section::sort_attached_input_sections): Change to sort
9625         according to section order when specified.
9626         (Output_section::add_input_section<32, true>): Add new parameter.
9627         (Output_section::add_input_section<64, true>): Add new parameter.
9628         (Output_section::add_input_section<32, false>): Add new parameter.
9629         (Output_section::add_input_section<64, false>): Add new parameter.
9630         * output.h (Output_section::add_input_section): Add new parameter.
9631         (Output_section::input_section_order_specified): New
9632         method.
9633         (Output_section::set_input_section_order_specified): New method.
9634         (Input_section::Input_section): Initialize section_order_index_.
9635         (Input_section::section_order_index): New method.
9636         (Input_section::set_section_order_index): New method.
9637         (Input_section::section_order_index_): New member.
9638         (Input_section::Input_section_sort_section_order_index_compare): New
9639         struct.
9640         (Output_section::input_section_order_specified_): New member.
9641         * script-sections.cc (is_wildcard_string): Delete and move modified
9642         method to gold.h.
9643         (Output_section_element_input::Output_section_element_input): Modify
9644         call to is_wildcard_string.
9645         (Output_section_element_input::Input_section_pattern
9646         ::Input_section_pattern): Ditto.
9647         (Output_section_element_input::Output_section_element_input): Ditto.
9648         * testsuite/Makefile.am (final_layout): New test case.
9649         * testsuite/Makefile.in: Regenerate.
9650         * testsuite/final_layout.cc: New file.
9651         * testsuite/final_layout.sh: New file.
9652
9653 2010-06-01  Rafael Espindola  <espindola@google.com>
9654
9655         * plugin.cc (Plugin::load): Pass the output name to the plugin.
9656
9657 2010-06-01  Rafael Espindola  <espindola@google.com>
9658
9659         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
9660         visibility of symbols.
9661
9662 2010-05-27  Doug Kwan  <dougkwan@google.com>
9663
9664         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
9665         from start of output section instead of address for a local symbol
9666         in a merged or relaxed section when doing a relocatable link.
9667
9668 2010-05-26  Rafael Espindola  <espindola@google.com>
9669
9670         PR 11604
9671         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
9672         adding sections the garbage collector removed.
9673         * gold/testsuite/Makefile.am: Add test.
9674         * gold/testsuite/Makefile.in: Regenerate.
9675         * gold/testsuite/plugin_test_7.sh: New.
9676         * gold/testsuite/plugin_test_7_1.c: New.
9677         * gold/testsuite/plugin_test_7_2.c: New.
9678
9679 2010-05-26  Rafael Espindola  <espindola@google.com>
9680
9681         * script-sections.cc (Output_section_definition::set_section_addresses):
9682         Check for --section-start.
9683
9684 2010-05-26  Doug Kwan  <dougkwan@google.com>
9685
9686         * arm.cc (Arm_scan_relocatable_relocs): New class.
9687         (Target_arm::relocate_special_relocatable): New method.
9688         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
9689         (Arm_relocate_functions::thumb_branch_common): Same.
9690         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
9691         instead of Default_scan_relocatable_relocs.
9692         * target-reloc.h (relocate_for_relocatable): Let target handle
9693         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
9694         * target.h (Sized_target::relocate_special_relocatable): New method.
9695
9696 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9697
9698         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
9699
9700 2010-05-23  Doug Kwan  <dougkwan@google.com>
9701
9702         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
9703         instead of a cast.
9704         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
9705         with a direct branch, not a conditional branch, to a stub.
9706         * merge.cc (Output_merge_base::record_input_section): New method
9707         defintion.
9708         (Output_merge_data::do_add_input_section): Record input section if
9709         keeps-input-sections flag is set.
9710         (Output_merge_string::do_add_input_section): Ditto.
9711         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
9712         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
9713         INPUT_SECTIONS_.
9714         (Output_merge_base::keeps_input_sections,
9715         Output_merge_base::set_keeps_input_sections,
9716         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
9717         method definitions.
9718         (Output_merge_base::Input_sections): New type declaration.
9719         (Output_merge_base::input_sections_begin,
9720         Output_merge_base::input_sections_end,
9721         Output_merge_base::do_set_keeps_input_sections): New method definitions.
9722         (Output_merge_base::bool keeps_input_sections_,
9723         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
9724         Output_merge_base::input_sections_): New data members.
9725         (Output_merge_data::do_set_keeps_input_sections): New method
9726         defintion.
9727         (Output_merge_string::do_set_keeps_input_sections): Ditto.
9728         * output.cc (Output_section::Input_section::relobj): Move method
9729         defintion from class declaration to here and handle merge sections.
9730         (Output_section::Input_section::shndx): Ditto.
9731         (Output_section::Output_section): Remove initializations of removed
9732         data members and initialize new data member LOOKUP_MAPS_.
9733         (Output_section::add_input_section): Set keeps-input-sections flag
9734         for a newly created merge output section as appropriate.  Adjust code
9735         to use Output_section_lookup_maps class.
9736         (Output_section::add_relaxed_input_section): Adjst code for lookup
9737         maps code refactoring.
9738         (Output_section::add_merge_input_section): Add a new parameter
9739         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
9740         class.  If adding input section to a newly created merge output
9741         section fails, remove the new merge section.
9742         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
9743         Adjust code for use of the Output_section_lookup_maps class.
9744         (Output_section::find_merge_section): Ditto.
9745         (Output_section::build_lookup_maps): New method defintion.
9746         (Output_section::find_relaxed_input_section): Adjust code to use
9747         Output_section_lookup_maps class.
9748         (Output_section::get_input_sections): Export merge sections.  Adjust
9749         code to use Output_section_lookup_maps class.
9750         (Output_section:::add_script_input_section): Adjust code to use
9751         Output_section_lookup_maps class.  Update lookup maps for merge
9752         sections also.
9753         (Output_section::discard_states): Use Output_section_lookup_maps.
9754         (Output_section::restore_states): Same.
9755         * output.h (Merge_section_properties): Move class defintion out of
9756         Output_section.
9757         (Output_section_lookup_maps): New class.
9758         (Output_section::Input_section::is_merge_section): New method
9759         defintion.
9760         (Output_section::Input_section::relobj): Move defintion out of class
9761         defintion.  Declare method only.
9762         (Output_section::Input_section::shndx): Ditto.
9763         (Output_section::Input_section::output_merge_base): New method defintion.
9764         (Output_section::Input_section::u2_.pomb): New union field.
9765         (Output_section::Merge_section_by_properties_map,
9766         Output_section::Output_section_data_by_input_section_map,
9767         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
9768         Remove types.
9769         (Output_section::add_merge_input_section): Add new parameter
9770         KEEPS_INPUT_SECTIONS.
9771         (Output_section::build_lookup_maps): New method declaration.
9772         (Output_section::merge_section_map_,
9773         Output_section::merge_section_by_properties_map_,
9774         Output_section::relaxed_input_section_map_,
9775         Output_section::is_relaxed_input_section_map_valid_): Remove data
9776         members.
9777         (Output_section::lookup_maps_): New data member.
9778
9779 2010-05-21  Doug Kwan  <dougkwan@google.com>
9780
9781         PR gold/11619
9782         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
9783         avoid a compilation error.
9784
9785 2010-05-19  Rafael Espindola  <espindola@google.com>
9786
9787         * script-sections.cc (Output_section_definition::allocate_to_segment):
9788         Update the phdrs_list even when the output section is NULL.
9789         * testsuite/Makefile.am: Add test.
9790         * testsuite/Makefile.in: Regenerate.
9791         * testsuite/script_test_9.cc: New.
9792         * testsuite/script_test_9.sh: New.
9793         * testsuite/script_test_9.t: New.
9794
9795 2010-05-19  Doug Kwan  <dougkwan@google.com>
9796
9797         * arm.cc (Arm_input_section::original_size): New method.
9798         (Arm_input_section::do_addralign): Add a cast.
9799         (Arm_input_section::do_output_offset): Remove static cast.
9800         (Arm_input_section::original_addralign,
9801          Arm_input_section::original_size_): Change type to uint32_t.
9802         (Arm_input_section::init): Add safe casts for section alignment
9803         and size.
9804         (Arm_input_section::set_final_data_size): Do not set address and
9805         offset of stub table.
9806         (Arm_output_section::fix_exidx_coverage): Change use of of
9807         Output_section::Simple_input_section to that of
9808         Output_section::Input_section.
9809         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
9810         except for the first pass.
9811         * output.cc (Output_section::get_input_sections): Change type of
9812         input_sections to std::list<Input_section>.
9813         (Output_section::add_script_input_section): Rename from
9814         Output_section::add_simple_input_section.  Change type of SIS
9815         parameter from Simple_input_section to Input_section.
9816         * output.h (Output_section::Simple_input_section): Remove class.
9817         (Output_section::Input_section): Change class visibility to public.
9818         (Output_section::Input_section::addralign): Use stored alignments
9819         for special input sections if set.
9820         (Output_section::Input_section::set_addralign): New method.
9821         (Output_section::get_input_sections): Change parameter type from
9822         list of Simple_input_section to list of Input_section.
9823         (Output_section::add_script_input_section): Rename from
9824         Output_section::add_simple_input_section. Change first parameter's
9825         type from Simple_input_section to Input_section and remove the
9826         second and third parameters.
9827         * script-sections.cc (Input_section::Input_section_list): Change
9828         type to list of Output_section::Input_section/
9829         (Input_section_info::Input_section_info): Change parameter type of
9830         INPUT_SECTION to Output_section::Input_section.
9831         (Input_section_info::input_section): Change return type.
9832         (Input_section_info::input_section_): Change type to
9833         Output_section::Input_section.
9834         (Output_section_element_input::set_section_addresses): Adjust code
9835         to use Output_section::Input_section instead of
9836         Output_section::Simple_input_section.  Adjust code for renaming
9837         of Output_section::add_simple_input_section.
9838         (Orphan_output_section::set_section_addresses): Ditto.
9839
9840 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
9841
9842         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
9843         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
9844
9845 2010-05-18  Rafael Espindola  <espindola@google.com>
9846
9847         * options.cc (General_options::finalize): Handle -nostdlib.
9848         * options.h (nostdlib): New option.
9849         * script.cc (script_add_search_dir): Handle -nostdlib.
9850
9851 2010-05-12  Doug Kwan  <dougkwan@google.com>
9852
9853         * arm.cc (Target_arm::do_finalize_sections): Create an empty
9854         attributes section only if there no attributes section after merging.
9855         (Target_arm::merge_object_attributes): Move value of
9856         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
9857         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
9858         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
9859         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
9860         and arm_attr_merge_7.stdout.
9861         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
9862         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
9863         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
9864         arm_attr_merge_7b.o): New rules.
9865         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
9866         arm_attr_merge_7
9867         * testsuite/Makefile.in: Regenerate.
9868         * testsuite/arm_attr_merge.sh: New file.
9869         * testsuite/arm_attr_merge_[67][ab].s: Same.
9870
9871 2010-05-05  Nick Clifton  <nickc@redhat.com>
9872
9873         * po/es.po: Updated Spanish translation.
9874
9875 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9876
9877         * Makefile.am (install-exec-local): Properly install gold as
9878         default cross linker.
9879         * Makefile.in: Regenerated.
9880
9881 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
9882             Nick Clifton  <nickc@redhat.com>
9883
9884         * configure.ac (install_as_default): Define and set to false
9885         unless --enable-gold or --enable-gold=both/gold has been
9886         specified.
9887         * configure: Regenerate.
9888
9889         * Makefile.am (install-exec-local): Install the executable as
9890         'ld.gold'.  If install_as_default is true then also install it as
9891         'ld'.
9892         * Makefile.in: Regenerated.
9893
9894 2010-04-24  Ian Lance Taylor  <iant@google.com>
9895
9896         * layout.cc (Layout::layout_reloc): In relocatable link don't
9897         combine reloc sections for grouped sections.
9898
9899 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
9900
9901         * gc.h (gc_process_relocs): Pass information on relocs pointing to
9902         sections that are not ordinary to icf.
9903         * icf.cc (get_section_contents): Handle relocation pointing to section
9904         with no object or shndx information.
9905         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
9906         * testsuite/Makefile.in: Regenerate.
9907         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
9908         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
9909
9910 2010-04-22  Ian Lance Taylor  <iant@google.com>
9911
9912         * expression.cc (Expression::Expression_eval_info): Add
9913         result_alignment_pointer field.
9914         (Expression::eval_with_dot): Add result_alignment_pointer
9915         parameter.  Change all callers.
9916         (Expression::eval_maybe_dot): Likewise.
9917         (class Binary_expression): Add alignment_pointer parameter to
9918         left_value and right_value.  Change all callers.
9919         (BINARY_EXPRESSION): Set result alignment.
9920         (class Trinary_expression): Add alignment_pointer parameter to
9921         arg2_value and arg3_value.  Change all callers.
9922         (Trinary_cond::value): Set result alignment.
9923         (Max_expression::value, Min_expression::value): Likewise.
9924         (Align_expression::value): Likewise.
9925         * script-sections.cc (class Sections_element): Add dot_alignment
9926         parameter to set_section_addresses virtual function.  Update
9927         instantiations.
9928         (class Output_section_element): Likewise.
9929         (Script_sections::create_segments): Add dot_alignment parameter.
9930         Change all callers.
9931         (Script_sections::create_segments_from_phdrs_clause): Likewise.
9932         (Script_sections::set_phdrs_clause_addresses): Likewise.
9933         * script-sections.h: Update declarations.
9934         * script.h: Update declarations.
9935         * output.h (Output_segment::set_minimum_p_align): Don't decrease
9936         min_p_align.
9937         * testsuite/script_test_3.t: Set large alignment.
9938         * testsuite/script_test_3.sh: Make sure that at least one LOAD
9939         segment has expected alignment.
9940
9941 2010-04-22  Nick Clifton  <nickc@redhat.com>
9942
9943         * po/gold.pot: Updated by the Translation project.
9944         * po/vi.po: Updated Vietnamese translation.
9945
9946 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
9947
9948         * testsuite/Makefile.am (check_PROGRAMS): Add
9949         icf_virtual_function_folding_test.
9950         * testsuite/Makefile.in: Regenerated.
9951
9952 2010-04-15  Andrew Haley  <aph@redhat.com>
9953
9954         * options.h (merge_exidx_entries): New option.
9955         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
9956         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
9957         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
9958         (Target_arm::merge_exidx_entries): New function.
9959         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
9960         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
9961         to Arm_exidx_fixup constructor.
9962         Add new arg, merge_exidx_entries.
9963         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
9964         Arm_output_section::fix_exidx_coverage.
9965
9966 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
9967
9968         * icf.cc (get_section_contents): Check for preemptible functions.
9969         Ignore addend when appropriate.
9970         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
9971         section folded.
9972         (add_from_relobj): Check for section folded.
9973         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
9974         * symtab.h (should_add_dynsym_entry): Add new parameter.
9975         * target-reloc.h (scan_relocs): Check for section folded.
9976         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
9977         Check reloc types for function pointers in shared objects.
9978         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
9979         case.
9980         (icf_preemptible_functions_test): New test case.
9981         (icf_string_merge_test): New test case.
9982         * testsuite.Makefile.in: Regenerate.
9983         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
9984         bar_glob.  Refactor code.
9985         * testsuite/icf_preemptible_functions_test.cc: New file.
9986         * testsuite/icf_preemptible_functions_test.sh: New file.
9987         * testsuite/icf_string_merge_test.cc: New file.
9988         * testsuite/icf_string_merge_test.sh: New file.
9989         * testsuite/icf_virtual_function_folding_test.cc: New file.
9990         * testsuite/icf_virtual_function_folding_test.sh: New file.
9991
9992 2010-04-14  Doug Kwan  <dougkwan@google.com>
9993
9994         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
9995         for local symbol recounting if we remove a section due to ICF.
9996         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
9997         there are no regular objects in input.
9998
9999 2010-04-13  Doug Kwan  <dougkwan@google.com>
10000
10001         * arm.cc (Arm_input_section::set_final_data_size): Compute
10002         accurate final data size instead of using current data size.
10003
10004 2010-04-09  Doug Kwan  <dougkwan@google.com>
10005
10006         * layout.cc (Layout::choose_output_section): Handle script section
10007         types.
10008         (Layout::make_output_section_for_script): Add section type parameter.
10009         Handle script section types.
10010         * layout.h (Layout::make_output_section_for_script): Add section
10011         type parameter.
10012         * output.cc (Output_section::Output_section): Initialize data member
10013         is_noload_.
10014         (Output_section::do_reset_address_and_file_offset): Do not set address
10015         to 0 if section is a NOLOAD section.
10016         * output.h (Output_section::is_noload): New method.
10017         (Output_section::set_is_noload): Ditto.
10018         (Output_section::is_noload_): New data member.
10019         * script-c.h (Script_section_type): New enum type.
10020         (struct Parser_output_section_header): Add new file section_type.
10021         * script-sections.cc (Sections_element::output_section_name): Add
10022         parameter for returning script section type.
10023         (Output_section_definition::output_section_name): Ditto.
10024         (Output_section_definition::section_type)P; New method.
10025         (Output_section_definiton::script_section_type_name): Ditto.
10026         (Output_section_definition::script_section_type_): New data member.
10027         (Output_section_definition::Output_section_definition): Initialize
10028         data member Output_section_definition::script_section_type_.
10029         (Output_section_definition::create_sections): Pass script section type
10030         to Layout::make_output_section_for_script.
10031         (Output_section_definition::output_section_name): Return script
10032         section type to caller.
10033         (Output_section_definition::set_section_address): Do not advance
10034         dot value and load address if section type is NOLOAD.  Set address
10035         of NOLOAD sections regardless of section flags.
10036         (Output_section_definition::print): Print section type if it is
10037         not SCRIPT_SECTION_TYPE_NONE.
10038         (Output_section_definition::section_type): New method.
10039         (Output_section_definition::script_section_type_name): Ditto.
10040         (Script_sections::output_section_name): Add new parameter
10041         PSECTION_TYPE for returning script section type.  Pass it to
10042         section elements.  Handle discard sections.
10043         (Sort_output_sections::operator()): Handle NOLOAD sections.
10044         * script-sections.h (Script_sections::Section_type): New enum type.
10045         (Script_sections::output_section_name): Add a new parameter for
10046         returning script section type.
10047         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
10048         INFO and NOLOAD.
10049         * yyscript.y (union): Add new field SECTION_TYPE.
10050         (COPY, DSECT, INFO, NOLOAD): New tokens.
10051         (opt_address_and_section_type): Change type to output_section_header.
10052         (section_type): New non-terminal
10053         (section_header): Handle section type.
10054         (opt_address_and_section_type): Return section type value.
10055
10056 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
10057
10058         * testsuite/plugin_common_test_1.c (foo): Add prototype.
10059         * testsuite/plugin_common_test_2.c (foo): Likewise.
10060
10061 2010-04-08  Doug Kwan  <dougkwan@google.com>
10062
10063         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
10064         Output_merge_data.
10065         * output.cc (Output_section::add_merge_input_section): Simplify
10066         code and return status of Output_merge_base::add_input_section.
10067         Update merge section map only if Output_merge_base::add_input_section
10068         returns true.
10069
10070 2010-04-07  Doug Kwan  <dougkwan@google.com>
10071
10072         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
10073         if section is marked as containing instructions but has no mapping
10074         symbols.
10075         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
10076         correct section index.
10077         (Arm_relobj::find_linked_text_section): Ditto.
10078
10079 2010-04-07  Cary Coutant  <ccoutant@google.com>
10080
10081         * archive.cc (include_member): Destroy Read_symbols_data object before
10082         releasing file.
10083         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
10084         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
10085         (Read_symbols_data::~Read_symbols_data) New destructor.
10086         (Section_relocs::Section_relocs) New constructor.
10087         (Section_relocs::~Section_relocs) New destructor.
10088         (Read_relocs_data::Read_relocs_data) New constructor.
10089         (Read_relocs_data::~Read_relocs_data) New destructor.
10090         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
10091         pointers to NULL after deleting.
10092
10093 2010-04-07  Doug Kwan  <dougkwan@google.com>
10094
10095         * arm.cc: Replace "endianity" with "endianness" in comments.
10096         (Arm_exidx_cantunwind): Ditto.
10097         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
10098         (Arm_relobj::merge_flags_and_attributes): New method.
10099         (Arm_relobj::merge_flags_and_attributes_): New data member.
10100         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
10101         (Arm_relobj::scan_sections_for_stubs): Ditto.
10102         (Arm_relobj::do_read_symbols): Check to see if we really want to
10103         merge processor-specific flags and attributes.  Exit early if
10104         an object is empty except for section names and the undefined symbol.
10105         (Target_arm::do_finalize_sections): Move check for ELF format to
10106         Arm_relobj::do_read_symbols.  Merge processor specific flags and
10107         attributes from a regular object only when we have determined that
10108         it is aapropriate.  Do not create an .ARM.attributes section in
10109         output if there is no regular input object.
10110         (Target_arm::merge_processor_specific_flags): Check
10111         --warn-mismatch before printing any error.
10112         (Target_arm::merge_object_attributes): Ditto.
10113         * gold.cc (queue_middle_tasks): Handle the case in which there is
10114         no regular object in input.
10115         * options.cc (General_options::parse_EB): New method.
10116         (General_options::parse_EL): Same.
10117         (General_options::General_options): Initialize endianness_.
10118         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
10119         New options.
10120         (General_options::Endianness): New enum.
10121         (General_options::endianness): New method.
10122         (General_options::endianness_): New data member.
10123         * parameters.cc (Parameters::set_options): Check target endianness.
10124         (Parameters::set_target_once): Ditto.
10125         (Parameters::check_target_endianness): New method.
10126         (parameters_force_valid_target): If either -EL or -EB is specified,
10127         use it to define endianness of default target.
10128         * parameters.h (Parameters::check_target_endianness): New method
10129         declaration.
10130         * target.h (class Target): Change "endianity" to "endianness"
10131         in comments.
10132
10133 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
10134
10135         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
10136         * configure: Regenerate.
10137         * Makefile.in: Regenerate.
10138         * testsuite/Makefile.in: Regenerate.
10139
10140 2010-04-06  Cary Coutant  <ccoutant@google.com>
10141
10142         gcc PR lto/42757
10143         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
10144         prevailing definitions of common symbols.
10145         * testsuite/plugin_test_6.sh: New test case.
10146         * testsuite/plugin_common_test_1.c: New test case.
10147         * testsuite/plugin_common_test_2.c: New test case.
10148         * testsuite/Makefile.am (plugin_test_6): New test case.
10149         * testsuite/Makefile.in: Regenerate.
10150
10151 2010-04-06  Nick Clifton  <nickc@redhat.com>
10152
10153         * po/vi.po: New Vietnamese translation.
10154
10155 2010-03-30  Doug Kwan  <dougkwan@google.com>
10156
10157         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
10158
10159 2010-03-25  Doug Kwan  <dougkwan@google.com>
10160
10161         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
10162         to avoid a conversion warning on a 32-bit host.
10163
10164 2010-03-24  Ian Lance Taylor  <iant@google.com>
10165
10166         * testsuite/script_test_3.t: Add a TLS segment.
10167         * testsuite/Makefile.am (check_PROGRAMS): Add
10168         tls_phdrs_script_test.
10169         (tls_phdrs_script_test_SOURCES): Define.
10170         (tls_phdrs_script_test_DEPENDENCIES): Define.
10171         (tls_phdrs_script_test_LDFLAGS): Define.
10172         (tls_phdrs_script_test_LDADD): Define.
10173         * testsuite/Makefile.in: Rebuild.
10174
10175 2010-03-23  Cary Coutant  <ccoutant@google.com>
10176
10177         * fileread.cc (find_or_make_view): Fix comment.
10178
10179 2010-03-23  Ian Lance Taylor  <iant@google.com>
10180
10181         * script-sections.cc (class Orphan_section_placement): Define
10182         PLACE_TLS and PLACE_TLS_BSS.
10183         (Orphan_section_placement::Orphan_section_placement): Initialize
10184         new places.
10185         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
10186         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
10187         (tls_script_test_SOURCES): Define.
10188         (tls_script_test_DEPENDENCIES): Define.
10189         (tls_script_test_LDFLAGS): Define.
10190         (tls_script_test_LDADD): Define.
10191         * testsuite/Makefile.in: Rebuild.
10192
10193 2010-03-22  Doug Kwan  <dougkwan@google.com>
10194
10195         * arm.cc (Arm_relocate_functions::abs8,
10196         Arm_relocate_functions::abs16): Use correct check for overflow
10197         specified in the ARM ELF specs.
10198         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
10199         target of a BLX instruction specially.
10200         (Reloc_stub::stub_type_for_reloc): Ditto.
10201         (Relocate::relocate): Use symbolic names instead of numeric relocation
10202         codes to report error.
10203         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
10204         workaround.
10205         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
10206         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
10207         thumb2_blx_out_of_range.stdout
10208         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
10209         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
10210         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
10211         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
10212         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
10213         thumb2_blx_in_range, thumb2_blx_in_range.o,
10214         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
10215         thumb2_blx_out_of_range.o): New rules.
10216         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
10217         thumb2_blx_in_range and thumb2_blx_out_of_range.
10218         * testsuite/Makefile.in: Regenerate.
10219         * arm_branch_in_range.sh: Add tests for THUMB BLX.
10220         * testsuite/thumb_blx_in_range.s: New file.
10221         * testsuite/thumb_blx_out_of_range.s: New file.
10222
10223 2010-03-22  Rafael Espindola  <espindola@google.com>
10224
10225         * archive.cc (Should_include): Move to archive.h.
10226         (should_include_member): Make it a member of Archive.
10227         (Lib_group): New.
10228         (Add_lib_group_symbols): New.
10229         * archive.h: Include options.h.
10230         (Archive_member): Moved from Archive.
10231         (Should_include): Moved from archive.cc.
10232         (Lib_group): New.
10233         (Add_lib_group_symbols): New.
10234         * dynobj.cc (do_should_include_member): New.
10235         * dynobj.h (do_should_include_member): New.
10236         * gold.cc (queue_initial_tasks): Update call to queue.
10237         * main.cc (main): Print lib group stats.
10238         * object.cc (do_should_include_member): New.
10239         * object.h: Include archive.h.
10240         (Object::should_include_member): New.
10241         (Object::do_should_include_member): New.
10242         (Sized_relobj::do_should_include_member): New.
10243         * options.cc (General_options::parse_start_lib): New.
10244         (General_options::parse_end_lib): New.
10245         (Input_arguments::add_file): Handle lib groups.
10246         (Input_arguments::start_group): Check we are not in a lib.
10247         (Input_arguments::start_lib): New.
10248         (Input_arguments::end_lib): New.
10249         * options.h (General_options): Add start_lib and end_lib.
10250         (Input_argument::lib_): New.
10251         (Input_argument::lib): New.
10252         (Input_argument::is_lib): New.
10253         (Input_file_lib): New.
10254         (Input_arguments::in_lib_): New.
10255         (Input_arguments::in_lib): New.
10256         (Input_arguments::start_lib): New.
10257         (Input_arguments::end_lib_): New.
10258         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
10259         in unused members as preempted.
10260         (Sized_pluginobj::do_should_include_member): New.
10261         * plugin.h (Sized_pluginobj::do_should_include_member): New.
10262         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
10263         return the blocker.
10264         (Read_symbols::do_whole_lib_group): New.
10265         (Read_symbols::do_lib_group): New.
10266         (Read_symbols::do_read_symbols): Handle lib groups.
10267         (Read_symbols::get_name): Handle lib groups.
10268         * readsyms.h (Read_symbols): Add an archive member pointer.
10269         (Read_symbols::do_whole_lib_group): New.
10270         (Read_symbols::do_lib_group): New.
10271         (Read_symbols::member_): New.
10272         * script.cc (read_input_script): Update call to queue_soon.
10273
10274 2010-03-19  Doug Kwan  <dougkwan@google.com>
10275
10276         * arm.cc (Stub_table::Stub_table): Initialize new data members
10277         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10278         (Stub_table::add_reloc_stub): Assign stub offset and update
10279         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
10280         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
10281         New data members.
10282         (Stub_table::update_data_size_and_addralign): Use
10283         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
10284         instead of going over all reloc stubs.
10285         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
10286         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10287         Stringpool_template::offset_ to size of Stringpool_char.
10288         (Stringpool_template::new_key_offset): Remove code to initialize
10289         Stringpool_template::offset_.
10290         * stringpool.h (Stringpool_template::set_no_zero_null): Set
10291         Stringpool_template::offset_ to zero.
10292
10293 2010-03-15  Doug Kwan  <dougkwan@google.com>
10294
10295         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
10296         offset_.
10297         (Stringpool_template::new_key_offset): New method.
10298         (Stringpool_template::add_string): Assign offsets when adding new
10299         strings.
10300         (Stringpool_template::set_string_offsets): Do not set string offsets
10301         when not optimizing.
10302         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
10303         member size_.
10304         (Chunked_vector::clear): Clear size_.
10305         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
10306         (Chunked_vector::size): Return size_.
10307         (Chunked_vector::push_back): Use size_ to find insert position.
10308         (Chunked_vector::size_): New data member.
10309         (Stringpool_template::set_no_zero_null): Assert string set is empty.
10310         (Stringpool_template::new_key_offset): New method declaration.
10311         (Stringpool_template::offset_): New data member.
10312
10313 2010-03-15   Rafael Espindola  <espindola@google.com>
10314
10315         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
10316         Add_symbols' constructor.
10317         * readsyms.h (Add_symbols): Remove the input_group member.
10318
10319 2010-03-10  Ian Lance Taylor  <iant@google.com>
10320
10321         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
10322         target to ask whether a reference to a symbol requires a stack
10323         split.
10324         * target.h (Target::is_call_to_non_split): New function.
10325         (Target::do_is_call_to_non_split): Declare virtual function.
10326         * target.cc: Include "symtab.h".
10327         (Target::do_is_call_to_non_split): New function.
10328         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
10329
10330 2010-03-10  Cary Coutant  <ccoutant@google.com>
10331
10332         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
10333         (File_read::open[1]): Remove initial mapping of whole_file_view_.
10334         (File_read::open[2]): Add whole_file_view_ to list of views.
10335         (File_read::make_view): Remove test of whole_file_view_.
10336         (File_read::find_or_make_view): Create whole_file_view_ if
10337         necessary.
10338         (File_read::clear_views): Replace bool parameter with enum;
10339         adjust all callers.  Don't delete views with permanent data;
10340         do delete cached views and views from archives if
10341         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
10342         if clearing the corresponding view.
10343         * fileread.h (File_read::Clear_views_mode): New enum.
10344         (File_read::View::is_permanent_view): New method.
10345         (File_read::clear_views): Replace bool parameter
10346         with enum; adjust all callers.
10347         * options.h (General_options): Change keep_files_mapped option;
10348         add map_whole_files.
10349         * readsyms.cc (Add_symbols::run): Delete sd_ object before
10350         releasing the file.
10351         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
10352         the file.
10353
10354 2010-03-10  David S. Miller  <davem@davemloft.net>
10355
10356         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
10357
10358 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
10359
10360         * icf.cc (get_section_contents): Add '@' marker after processing the
10361         merge reloc.
10362
10363 2010-03-08  Doug Kwan  <dougkwan@google.com>
10364
10365         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
10366         due to a conversion warning.
10367         (Arm_relobj::update_output_local_symbol_count): Check for local
10368         symbol with unset output index.
10369
10370 2010-03-05  Ian Lance Taylor  <iant@google.com>
10371
10372         * options.h (class General_options): Add --spare-dynamic-tags.
10373         * output.cc (Output_data_dynamic::set_final_data_size): Implement
10374         --spare-dynamic-tags.
10375
10376 2010-03-05  Ian Lance Taylor  <iant@google.com>
10377
10378         * incremental.cc: Include "libiberty.h".
10379
10380 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
10381
10382         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
10383         function, is_info_ member.
10384         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
10385         (Versions::Versions): Update caller.
10386         (Versions::define_base_version): Likewise.
10387         (Versions::add_def): Likewise.
10388
10389 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
10390
10391         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
10392         (Scan::possible_function_pointer_reloc): New function.
10393         (Scan::local_reloc_may_be_function_pointer): Change to call
10394         possible_function_pointer_reloc.
10395         (Scan::global_reloc_may_be_function_pointer): Ditto.
10396         * icf.h (Icf::check_section_for_function_pointers): Change to reject
10397         relocations in ".data.rel.ro._ZTV" section.
10398         * testsuite/icf_safe_so_test.sh: Change to pass i386.
10399         * testsuite/icf_safe_so_test.cc: Ditto.
10400         * testsuite/icf_safe_test.cc: Ditto.
10401         * testsuite/icf_safe_test.sh: Ditto.
10402
10403 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10404             Ian Lance Taylor  <iant@google.com>
10405
10406         * target-reloc.h (relocate_section): Check the symbol table index
10407         for -1U before setting the local symbol index.
10408         (scan_relocatable_relocs): If copying the relocation, record that
10409         the local symbol is required.
10410         * object.h (Symbol_value::is_output_symtab_index_set): New
10411         function.
10412         (Symbol_value::may_be_discarded_from_output_symtab): New
10413         function.
10414         (Symbol_value::has_output_symtab_entry): New function.
10415         (Symbol_value::needs_output_symtab_entry): Remove.
10416         (Symbol_value::output_symtab_index): Make sure the symbol index is
10417         set.
10418         (Symbol_value::set_output_symtab_index): Make sure the symbol
10419         index is not set.  Make sure the new index is valid.
10420         (Symbol_value::set_must_have_output_symtab_entry): New function.
10421         (Symbol_value::has_output_dynsym_entry): New function.
10422         (Symbol_value::set_output_dynsym_index): Make sure the new index
10423         is valid.
10424         (Sized_relobj::set_must_have_output_symtab_entry): New function.
10425         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
10426         local symbol if permitted.
10427         (Sized_relobj::do_finalize_local_symbols): Call
10428         is_output_symtab_index_set rather than needs_output_symtab_entry.
10429         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
10430         rather than needs_output_symtab_entry.  Call
10431         has_output_dynsym_entry rather than needs_output_dynsym_entry.
10432         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
10433         is_output_symtab_index_set rather than needs_output_symtab_entry.
10434         * testsuite/discard_locals_relocatable_test.c: New file.
10435         * testsuite/discard_locals_test.sh: Test -r.
10436         * testsuite/Makefile.am (check_DATA): Add
10437         discard_locals_relocatable_test1.syms,
10438         discard_local_relocatable_test2.syms.
10439         (MOSTLYCLEANFILES): Likewise.  Also add
10440         discard_locals_relocatable_test1.lout and
10441         discard_locals_relocatable_test2.out.
10442         (discard_locals_relocatable_test1.syms): New target.
10443         (discard_locals_relocatable_test.o): New target.
10444         (discard_locals_relocatable_test1.out): New target.
10445         (discard_locals_relocatable_test2.syms): New target.
10446         (discard_locals_relocatable_test2.out): New target.
10447         (various): Add missing ../ld-new dependencies.
10448         * testsuite/Makefile.in: Rebuild.
10449
10450 2010-03-03  Nick Clifton  <nickc@redhat.com>
10451
10452         * po/fi.po: New Finnish translation.
10453
10454 2010-03-01  Doug Kwan  <dougkwan@google.com>
10455
10456         * layout.cc (Layout::Layout): Force section types of .init_array*,
10457         .preinit_array* and .fini_array* sections.
10458         * output.cc (Output_section::Input_section_sort_entry::has_priority):
10459         Fix check of return value of std::string::find.().
10460         (Output_section::Input_section_sort_compare::operator()): Remove
10461         comment about .init_array.
10462         (Output_section::Input_section_sort_init_fini_compare::operator()):
10463         New method.
10464         (Output_section::sort_attached_input_sections): Handle .init_array
10465         and .fini_array specially.
10466         * output.h (Output_section::Inut_section_sort_compare): Update
10467         comment.
10468         (Output_section::Input_section_sort_init_fini_compare): New struct.
10469
10470 2010-02-26  Doug Kwan  <dougkwan@google.com>
10471
10472         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
10473         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
10474         * testsuite/debug_msg.sh: Avoid matching source line number for
10475         use of global variable undef_int.
10476
10477 2010-02-26  Doug Kwan  <dougkwan@google.com>
10478
10479         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
10480         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
10481         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
10482         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
10483         * options.cc (General_options::General_options): Initialize member
10484         fix_v4bx_.
10485         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
10486         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
10487         and rm_no_fix_v4bx.stdout
10488         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
10489         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
10490         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
10491         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
10492         and arm_no_fix_v4bx.
10493         * Makefile.in: Regenerate.
10494         * testsuite/arm_fix_v4bx.s: New file.
10495         * testsuite/arm_fix_v4bx.sh: Ditto.
10496
10497 2010-02-24  Doug Kwan  <dougkwan@google.com>
10498
10499         * arm.cc (Target_arm::got_section): Make the .got section the first
10500         non RELRO section in the data segment.
10501         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
10502         suffixes of section names.
10503
10504 2010-02-24  Doug Kwan  <dougkwan@google.com>
10505
10506         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
10507         flags and attributes merging if an input file is a binary file.
10508         * fileread.cc (Input_file::open): Record format of original file.
10509         * fileread.h (Input_file::Format): New enum type.
10510         (Input_file::Input_file): Initialize data member format_.
10511         (Input_file::format): New method definition.
10512         (Input_file::format_):: New data member.
10513
10514 2010-02-24  Doug Kwan  <dougkwan@google.com>
10515
10516         * arm.cc (Arm_output_data_got): New class.
10517         (ARM_TCB_SIZE): New constant
10518         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
10519         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
10520         If user uses a script with a SECTIONS clause, issue only a warning
10521         for a misplaced EXIDX input section.  Otherwise, issue an error.
10522         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
10523         garbage collection.
10524         (Target_arm::got_mode_index_entry): Handle static linking.
10525         (Target_arm::Scan::local): Ditto.
10526         (Target_arm::Scan::global): Ditto.
10527         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
10528         all incorrectly implemented relocations.
10529         (Target_arm::fix_exidx_coverage): Pass layout to
10530         Arm_output_section::fix_exidx_coverage.
10531         * layout.cc (Layout::section_name_mapping): Remove trailing dots
10532         from ".ARM.exidx." and ".ARM.extab.".
10533
10534 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10535
10536         * arm.cc (Target_arm::do_finalize_sections): Create attribute
10537         section if it does not already exist.
10538         * attributes.cc (Attributes_section_data::Attributes_section_data):
10539         Don't crash if size is zero.
10540
10541 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10542             Ian Lance Taylor  <iant@google.com>
10543
10544         * gold.cc (queue_middle_tasks): If no input files were opened,
10545         exit.
10546         * workqueue.h (Task_function::Task_function): Assert that there is
10547         a blocker.
10548
10549 2010-02-22  Doug Kwan  <dougkwan@google.com>
10550
10551         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
10552         * icf.cc (get_section_contents): Cast snprintf arguments to long long
10553         types to avoid warnings due to different uint64_t implementations
10554         on different hosts.
10555
10556 2010-02-21  Doug Kwan  <dougkwan@google.com>
10557
10558         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
10559         handling of the maximum backward branch offset.
10560         (Arm_relocate_functions::thumb_branch_common): Ditto.
10561         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
10562         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
10563         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
10564         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
10565         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
10566         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
10567         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
10568         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
10569         thumb_bl_out_of_range thumb_bl_out_of_range.o,
10570         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
10571         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
10572         thumb2_bl_out_of_range.o): New rules.
10573         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
10574         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
10575         thumb2_bl_out_of_range
10576         * testsuite/Makefile.in: Regenerate.
10577         * testsuite/arm_bl_in_range.s: New file.
10578         * testsuite/arm_bl_out_of_range.s: Ditto.
10579         * testsuite/arm_branch_in_range.sh: Ditto.
10580         * testsuite/arm_branch_range.t: Ditto.
10581         * testsuite/thumb2_branch_range.t: Ditto.
10582         * testsuite/thumb_bl_in_range.s: Ditto.
10583         * testsuite/thumb_bl_out_of_range.s: Ditto.
10584         * testsuite/thumb_branch_range.t: Ditto.
10585
10586 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
10587
10588         * gc.h (gc_process_relocs): Change vectors to point to the new list.
10589         Add reloc offset information.
10590         * icf.cc (get_section_contents): Change iterators to point to the new
10591         vectors. Add reloc offset information to the contents.
10592         * icf.h (Icf::Sections_reachable_info): New typedef.
10593         (Icf::Sections_reachable_list): New typedef.
10594         (Icf::Offset_info): New typedef.
10595         (Icf::Reloc_info): New struct typedef.
10596         (Icf::Reloc_info_list): New typedef.
10597         (Icf::symbol_reloc_list): Delete method.
10598         (Icf::addend_reloc_list): Delete method.
10599         (Icf::section_reloc_list): Delete method.
10600         (Icf::reloc_info_list): New method.
10601         (Icf::reloc_info_list_): New member.
10602
10603 2010-02-19  Doug Kwan  <dougkwan@google.com>
10604
10605         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
10606         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
10607         * arm.cc (Arm_relocation_functions): New forward declaration.
10608         (Target_arm::Target_arm): Initialize new data members
10609         got_mod_index_offset_ and tls_base_symbol_defined_.
10610         (Target_arm::Relocate::relocate_tls): New method.
10611         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
10612          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
10613         New methods.
10614         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
10615         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
10616         (Target_arm::got_mod_index_offset_,
10617         Target_arm::tls_base_symbol_defined_): New data members.
10618         (Target_arm::Scan::local, Target::Scan::global,
10619         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
10620         relocations.
10621
10622 2010-02-18  Doug Kwan  <dougkwan@google.com>
10623
10624         * arm.cc (Arm_relobj::find_linked_text_section): New method.
10625         (Arm_relobj::make_exidx_input_section): Pass section index of linked
10626         text section as a parameter becuase some broken tools may not set
10627         the link in section header.
10628         (Target_arm::has_got_section): New method.
10629         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
10630         without any mapping symbol as data only.  Remove warning.
10631         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
10632         link in its section header, try to discover the link by inspecting the
10633         REL31 relocation at the beginning of the section.
10634         (Target_arm::Scan::check_non_pic): Report name of offending relocation
10635         in error message.
10636         (Target_arm::Scan::global): Treat any reference to the symbol
10637         _GLOBAL_OFFSET_TABLE_ as a GOT access.
10638
10639 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
10640
10641         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
10642         (Scan::global_reloc_may_be_function_pointer): New function.
10643         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10644         (Scan::global_reloc_may_be_function_pointer): New function.
10645         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
10646         (Scan::global_reloc_may_be_function_pointer): New function.
10647         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
10648         (Scan::global_reloc_may_be_function_pointer): New function.
10649         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
10650         (Scan::global_reloc_may_be_function_pointer): New function.
10651         (Scan::possible_function_pointer_reloc): New function.
10652         (Target_x86_64::can_check_for_function_pointers): New function.
10653         * gc.h (gc_process_relocs): Scan relocation types to determine if
10654         function pointers were taken for targets that support it.
10655         * icf.cc (Icf::find_identical_sections): Include functions for
10656         folding in safe ICF whose pointer is not taken.
10657         * icf.h (Secn_fptr_taken_set): New typedef.
10658         (fptr_section_id_): New member.
10659         (section_has_function_pointers): New function.
10660         (set_section_has_function_pointers): New function.
10661         (check_section_for_function_pointers): New function.
10662         * options.h: Fix comment for safe ICF option.
10663         * target.h (can_check_for_function_pointers): New function.
10664         * testsuite/Makefile.am: Add icf_safe_so_test test case.
10665         Modify icf_safe_test for X86-64.
10666         * testsuite/Makefile.in: Regenerate.
10667         * testsuite/icf_safe_so_test.cc: New file.
10668         * testsuite/icf_safe_so_test.sh: New file.
10669         * testsuite/icf_safe_test.cc (kept_func_3): New function.
10670         (main): Change to take pointer to function kept_func_3.
10671         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
10672         folding is done correctly for X86-64.
10673
10674 2010-02-12  David S. Miller  <davem@davemloft.net>
10675
10676         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
10677         is_symbolless parameter.
10678         (Output_reloc<SHT_REL>::is_symbolless): New.
10679         (Output_reloc<SHT_REL>::is_symbolless_): New.
10680         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
10681         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
10682         (Output_reloc<SHT_RELA>::is_symbolless): New.
10683         (Output_data_reloc::add_global): Handle is_symbolless.
10684         (Output_data_reloc::add_global_relative): Likewise.
10685         (Output_data_reloc::add_local): Likewise.
10686         (Output_data_reloc::add_local_relative): Likewise.
10687         (Output_data_reloc::add_symbolless_global_addend): New.
10688         (Output_data_reloc::add_symbolless_local_addend): New.
10689         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
10690         is_symbolless.
10691         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
10692         instead of ->is_relative_
10693         (Output_reloc::write): Likewise.
10694         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
10695         (Output_reloc::write_rel): Simplify.
10696
10697         * sparc.cc (Target_sparc::Scan::local): Use
10698         ->add_symbolless_local_addend as needed.
10699         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
10700         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
10701         based upon relocation offset.
10702
10703 2010-02-11  Doug Kwan  <dougkwan@google.com>
10704
10705         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
10706         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
10707         beginning of function.
10708         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
10709         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
10710         parameter is_32bit in calls to should_apply_static_reloc.
10711         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
10712         (check_DATA): Add arm_abs_global.stdout.
10713         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
10714         arm_abs_global.stdout): New rules.
10715         (MOSTLLYCLEANFILES): Add arm_abs_global
10716         * Makefile.in: Regenerate.
10717         * testsuite/arm_abs_global.s: New file.
10718         * testsuite/arm_abs_global.sh: Ditto.
10719         * testsuite/arm_abs_lib.s: Ditto.
10720
10721 2010-02-11  Ian Lance Taylor  <iant@google.com>
10722
10723         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
10724         Read_relocs task.
10725         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
10726         Allocate_commons_task first.
10727         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
10728         task, rather than symtab_lock_.
10729         (Gc_process_relocs::~Gc_process_relocs): New function.
10730         (Gc_process_relocs::is_runnable): Check this_blocker_.
10731         (Gc_process_relocs::locks): Use next_blocker_ rather than
10732         blocker_.
10733         (Scan_relocs::~Scan_relocs): New function.
10734         (Scan_relocs::is_runnable): Check this_blocker_ rather than
10735         symtab_lock_.
10736         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
10737         next_blocker_.
10738         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
10739         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
10740         constructor accordingly.
10741         (class Gc_process_relocs): Likewise.
10742         (class Scan_relocs): Likewise.
10743         * common.h (class Allocate_commons_task): Remove symtab_lock_
10744         field, and corresponding constructor parameter.
10745         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
10746         symtab_lock_.
10747         (Allocate_commons_task::locks): Likewise.
10748
10749 2010-02-11  Ian Lance Taylor  <iant@google.com>
10750
10751         * gold-threads.h (class Once): Define.
10752         (class Initialize_lock): Rewrite as child of Once.
10753         * gold-threads.cc (class Once_initialize): Define.
10754         (once_pointer_control): New static variable.
10755         (once_pointer, once_arg): New static variables.
10756         (c_run_once): New static function.
10757         (Once::Once, Once::run_once, Once::internal_run): New functions.
10758         (class Initialize_lock_once): Remove.
10759         (initialize_lock_control): Remove.
10760         (initialize_lock_pointer): Remove.
10761         (initialize_lock_once): Remove.
10762         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
10763         (Initialize_lock::initialize): Rewrite.
10764         (Initialize_lock::do_run_once): New function.
10765         * archive.cc (Archive::interpret_header): Only clear name if it is
10766         not already empty.
10767         * fileread.cc: Include "gold-threads.h"
10768         (file_counts_lock): New static variable.
10769         (file_counts_initialize_lock): Likewise.
10770         (File_read::release): Only increment counts when using --stats.
10771         Use a lock around the increment.
10772         * parameters.cc (class Set_parameters_target_once): Define.
10773         (set_parameters_target_once): New static variable.
10774         (Parameters::Parameters): Move here from parameters.h.
10775         (Parameters::set_target): Rewrite.
10776         (Parameters::set_target_once): New function.
10777         (Parameters::clear_target): Move here and rewrite.
10778         * parameters.h (class Parameters): Update declarations.  Add
10779         set_parameters_target_once_ field.
10780         (Parameters::Parameters): Move to parameters.cc.
10781         (Parameters::clear_target): Likewise.
10782         * readsyms.cc (Read_symbols::do_group): Create a Start_group
10783         task.
10784         (Start_group::~Start_group): New function.
10785         (Start_group::is_runnable): New function.
10786         (Start_group::locks, Start_group::run): New functions.
10787         (Finish_group::run): Change saw_undefined to size_t.
10788         * readsyms.h (class Start_group): Define.
10789         (class Finish_group): Change saw_undefined_ field to size_t.
10790         (Finish_group::Finish_group): Remove saw_undefined and
10791         this_blocker parameters.  Change all callers.
10792         (Finish_group::set_saw_undefined): New function.
10793         (Finish_group::set_blocker): New function.
10794         * symtab.h (class Symbol_table): Change saw_undefined to return
10795         size_t.  Change saw_undefined_ field to size_t.
10796         * target-select.cc (Set_target_once::do_run_once): New function.
10797         (Target_selector::Target_selector): Initialize set_target_once_
10798         field.  Don't initialize lock_ and initialize_lock_ fields.
10799         (Target_selector::instantiate_target): Rewrite.
10800         (Target_selector::set_target): New function.
10801         * target-select.h (class Set_target_once): Define.
10802         (class Target_selector): Update declarations.  Make
10803         Set_target_once a friend.  Remove lock_ and initialize_lock_
10804         fields.  Add set_target_once_ field.
10805
10806 2010-02-10  Ian Lance Taylor  <iant@google.com>
10807
10808         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
10809         queueing any tasks.
10810         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
10811         (queue_middle_tasks): Add all blockers before queueing any tasks.
10812         (queue_final_tasks): Likewise.
10813         * token.h (Task_token::add_blockers): New function.
10814         * object.h (Input_objects::number_of_relobjs): New function.
10815
10816 2010-02-10  Ian Lance Taylor  <iant@google.com>
10817
10818         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
10819         shared, not if not position independent.
10820         * x86_64.cc (Relocate::relocate_tls): Likewise.
10821         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
10822         (tls_pie_pic_test): New target.
10823         * testsuite/Makefile.in: Rebuild.
10824
10825         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
10826         (tls_test_main_pie.o, tls_test_pie.o): New targets.
10827         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
10828         * testsuite/Makefile.in: Rebuild.
10829
10830 2010-02-09  David S. Miller  <davem@davemloft.net>
10831
10832         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
10833         R_SPARC_RELATIVE using ->add_local_relative().
10834         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
10835
10836         * output.h (Output_data_dynamic::add_section_size): New method
10837         that takes two Output_data objects.
10838         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
10839         entry param.  Handle it in initializers.
10840         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
10841         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
10842         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
10843         arg.
10844         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
10845         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
10846         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
10847         for dynrel_includes_plt.
10848         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10849         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10850         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
10851         before .rela.plt
10852         (Target_sparc::do_finalize_sections): Update to pass true for
10853         dynrel_includes_plt.
10854         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
10855         output before .rela.plt
10856         (Target_powerpc::do_finalize_sections): Update to pass true for
10857         dynrel_includes_plt when 32-bit.
10858
10859 2010-02-08  Doug Kwan  <dougkwan@google.com>
10860
10861         * arm.cc (Arm_relobj::simple_input_section_output_address): New
10862         method.
10863         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
10864         Arm_relobj::scan_section_for_cortex_a8_stubs,
10865         Arm_relobj::do_relocation_section): Instead of calling
10866         Output_section::output_address, use faster
10867         Arm_relobj::simple_input_section_output_address.
10868
10869 2010-02-08  David S. Miller  <davem@davemloft.net>
10870
10871         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
10872         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
10873         relocation helper function.
10874
10875         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
10876         just like R_SPARC_GOT{10,13,22}.
10877         (Target_sparc::Scan::local): Likewise.
10878         (Target_sparc::Relocate:relocate): Likewise.
10879
10880 2010-02-06  Ian Lance Taylor  <iant@google.com>
10881
10882         * configure.ac: Rewrite targetobjs duplicate removal code to use
10883         only shell constructs.
10884         * configure: Rebuild.
10885
10886 2010-02-05  Doug Kwan  <dougkwan@google.com>
10887
10888         PR 11247
10889         * arm.cc (Arm_relobj::section_is_scannable): New method.
10890         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
10891         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
10892
10893 2010-02-04  Doug Kwan  <dougkwan@google.com>
10894
10895         PR 11247
10896         * arm-reloc-property.cc (cstdio): Include.
10897         * configure.ac (targetobjs): Remove duplicates.
10898         * configure: Regenerate.
10899         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
10900         big and little endian version for a given address size.
10901
10902 2010-02-03  Doug Kwan  <dougkwan@google.com>
10903
10904         * arm-reloc-property.cc
10905         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10906         definition.
10907         * arm-reloc-property.h
10908         (Arm_reloc_property_table::get_implemented_static_reloc_property):
10909         New method definition.
10910         (Arm_reloc_property_table::reloc_name_in_error_message): New method
10911         declaration.
10912         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
10913         overflow to N.
10914         (GOT_PREL): Change implemented to Y.
10915         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
10916         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
10917         (Arm_relocate_functions::movw_abs_nc): Remove method.
10918         (Arm_relocate_functions::movt_abs): Ditto.
10919         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
10920         (Arm_relocate_functions::thm_movt_abs): Ditto.
10921         (Arm_relocate_functions::movw_rel_nc): Ditto.
10922         (Arm_relocate_functions::movw_rel): Ditto.
10923         (Arm_relocate_functions::movt_rel): Ditto.
10924         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
10925         (Arm_relocate_functions:thm_movw_rel): Ditto.
10926         (Arm_relocate_functions:thm_movt_rel): Ditto.
10927         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
10928         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
10929         New method definitions.
10930         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
10931         (Arm_relocation_functions::arm_grp_ldr): Ditto.
10932         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
10933         (Arm_relocation_functions::arm_grp_ldc): Ditto.
10934         (Target_arm::Relocate::relocate): Check for non-static or
10935         unimplemented relocation code and exit early.  Change calls to
10936         Target_arm::reloc_uses_thumb_bit and
10937         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
10938         instead.  Refactor code to handle similar relocations to increase
10939         code sharing.  Remove check for unsupported relocation code in switch
10940         statement.
10941         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
10942         relocation property table to find out size.  Change error message to
10943         print out the name of a relocation code instead of the numeric value.
10944         (Target_arm::scan_reloc_for_stub): Use relocation property table
10945         instead of calling Target_arm::reloc_uses_thumb_bit().
10946
10947 2010-02-02  Doug Kwan  <dougkwan@google.com>
10948
10949         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
10950         types of relaxed input section.
10951
10952 2010-02-02  Doug Kwan  <dougkwan@google.com>
10953
10954         * Makefile.am (HFILES): Add arm-reloc-property.h.
10955         (DEFFILES): New.
10956         (TARGETSOURCES): Add arm-reloc-property.cc
10957         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
10958         (libgold_a_SOURCES): $(DEFFILES)
10959         * Makefile.in: Regenerate.
10960         * arm-reloc-property.cc: New file.
10961         * arm-reloc-property.h: New file.
10962         * arm-reloc.def: New file.
10963         * arm.cc: Update comments.
10964         (arm-reloc-property.h): New included header.
10965         (arm_reloc_property_table): New global variable.
10966         (Target_arm::do_select_as_default_target): New method definition.
10967         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
10968         arm-reloc-property to targ_extra_obj.
10969         * parameters.cc (set_parameters_target): Call
10970         Target::select_as_default_target().
10971         * target.h (Target::select_as_default_target): New method definition.
10972         (Target::do_select_as_default_target): Same.
10973
10974 2010-02-01  Doug Kwan  <dougkwan@google.com>
10975
10976         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
10977         first_output_text_section_.
10978         (Arm_exidx_fixup::first_output_text_section): New method definition.
10979         (Arm_exidx_fixup::first_output_text_section_): New data member.
10980         (Arm_exidx_fixup::process_exidx_section): Record the first text
10981         output section seen.
10982         (Arm_output_section::fix_exidx_coverage): Set correct linked section
10983         and entsize in output section header.
10984
10985 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10986
10987         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
10988         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
10989         (Arm_relocate_functions::thm_alu11): New Method.
10990         (Arm_relocate_functions::thm_pc8): New Method.
10991         (Arm_relocate_functions::thm_pc12): New Method.
10992         (Target_arm::Scan::local): Handle the relocations.
10993         (Target_arm::Scan::global): Likewise.
10994         (Target_arm::Relocate::relocate): Likewise.
10995         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10996
10997 2010-01-29  Doug Kwan  <dougkwan@google.com>
10998
10999         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
11000         of relocation types as ld.
11001
11002 2010-01-29  Doug Kwan  <dougkwan@google.com>
11003
11004         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
11005         to public.
11006         (Arm_relocate_functions::thumb_branch_common): Ditto.
11007         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
11008         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
11009         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
11010         Arm_relocate_functions::jump24): Remove.
11011         (Target_arm::Relocate::relocate): Adjust code to call
11012         Arm_relocation_functions::arm_branch_common and
11013         Arm_relocation_functions::thumb_branch_common instead of their removed
11014         wrappers.  Merge switch-cases together to reduce source code size.
11015
11016 2010-01-29  Doug Kwan  <dougkwan@google.com>
11017
11018         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
11019         output_local_symbol_count_needs_update_.
11020         (Arm_relobj::output_local_symbol_count_needs_update,
11021          Arm_relobj::set_output_local_symbol_count_needs_update,
11022          Arm_relobj::update_output_local_symbol_count): New methods.
11023         (Arm_relobj::output_local_symbol_count_needs_update_): New data
11024         member.
11025         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
11026         of pointed function as in a R_ARM_PREL31 relocation.
11027         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
11028         for output local symbol count updating.
11029         (Target_arm::do_relax): Update output local symbol counts in objects
11030         if necessary.
11031         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
11032
11033 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11034
11035         * arm.cc: Added support for the ARM relocations:
11036         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
11037         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
11038         (Arm_relocate_functions::movw_rel_nc): Renamed (was
11039         movw_prel_nc).
11040         (Arm_relocate_functions::movw_rel): New method.
11041         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
11042         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
11043         thm_movw_prel_nc).
11044         (Arm_relocate_functions::thm_movw_rel): New method.
11045         (Arm_relocate_functions::thm_movt_rel): Renamed (was
11046         thm_movt_prel).
11047         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
11048         relocations.
11049         (Target_arm::Scan::global): Likewise.
11050         (Target_arm::Relocate::relocate): Likewise.
11051         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11052         Likewise.
11053
11054 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11055
11056         * arm.cc: Added support for ARM group relocations.
11057         (Target_arm::reloc_needs_sym_origin): New method.
11058         (Arm_relocate_functions::calc_grp_kn): New method.
11059         (Arm_relocate_functions::calc_grp_residual): New method.
11060         (Arm_relocate_functions::calc_grp_gn): New method.
11061         (Arm_relocate_functions::arm_grp_alu): New Method.
11062         (Arm_relocate_functions::arm_grp_ldr): New Method.
11063         (Arm_relocate_functions::arm_grp_ldrs): New Method.
11064         (Arm_relocate_functions::arm_grp_ldc): New Method.
11065         (Target_arm::Scan::local): Handle the ARM group relocations.
11066         (Target_arm::Scan::global): Likewise.
11067         (Target_arm::Relocate::relocate): Likewise.
11068         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11069         Likewise.
11070
11071 2010-01-26  Doug Kwan  <dougkwan@google.com>
11072
11073         * arm.cc (set): Include.
11074         (class Arm_exidx_fixup): Change type of last_input_section_ to const
11075         pointer type.
11076         (Arm_output_section::Text_section_list): New type.
11077         (Arm_output_section::append_text_sections_to_list): New method.
11078         (Arm_output_section::fix_exidx_coverage): Ditto.
11079         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
11080         (Arm_relobj::convert_input_section_to_relaxed_section): Use
11081         Relobj::set_section_offset() instead of
11082         Sized_relobj::invalidate_section_offset().
11083         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
11084         parameter for section headers. Ignore relocation sections for
11085         unallocated sections and EXIDX sections.
11086         (Target_arm::fix_exidx_coverage): New method.
11087         (Target_arm::output_section_address_less_than): New type.
11088         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
11089         linked text section instead of the EXIDX section.
11090         (Arm_output_section::create_stub_group): Add an assertion to check
11091         that this is not an EXIDX output section.
11092         (Arm_output_section::append_text_sections_to_list): New method.
11093         (Arm_output_section::fix_exidx_coverage): Ditto.
11094         (Arm_relobj::scan_sections_for_stubs): Adjust call to
11095         Arm_relobj::section_needs_reloc_stub_scanning.
11096         (Target_arm::do_relax): Fix EXIDX output section coverage in the
11097         first pass.
11098         (Target_arm::fix_exidx_coverage): New method.
11099         * object.h (Relobj::set_output_section): New method.
11100         (Sized_relobj::invalidate_section_offset): Remove method.
11101         (Sized_relobj::do_invalidate_section_offset): Remove method.
11102         (Sized_relobj::do_set_section_offset): Handle offset value -1.
11103
11104 2010-01-25  Doug Kwan  <dougkwan@google.com>
11105
11106         * arm.cc (Arm_exidx_merged_section::do_output_offset):
11107         Fix warning due to signed and unsigned comparison on a 32-bit host.
11108
11109 2010-01-22  Doug Kwan  <dougkwan@google.com>
11110
11111         * arm.cc (Target_arm::do_relax): Record an output section for section
11112         offset adjustment it contains any stub table that has changed.
11113         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
11114         offsets in an output section if necessary.
11115         * output.cc (Output_section::Output_section): Initialize
11116         section_offsets_need_adjustments_.
11117         (Output_section::add_input_section_for_script): Renamed to
11118         Output_section::add_simple_input_section.
11119         (Output_section::save_states): Add a comment.
11120         (Output_section::discard_states): New method defintion.
11121         (Output_section::adjust_section_offsets): Same.
11122         * output.h (Output_section::add_input_section_for_script): Renamed to
11123         Output_section::add_simple_input_section.
11124         (Output_section::discard_states): New method declaration.
11125         (Output_section::adjust_section_offsets): Same.
11126         (Output_section::section_offsets_need_adjustment,
11127         Output_section::set_section_offsets_need_adjustment): New method
11128         definitions.
11129         (Output_section::section_offsets_need_adjustment_): New data member.
11130         * script-sections.cc
11131         (Output_section_element_input::set_section_address): Adjust code for
11132         renaming of Output_section::add_input_section_for_script.
11133         (Orphan_output_section::set_section_address): Same.
11134
11135 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11136
11137         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
11138         Fix_v4bx enum values .
11139         * gold/options.h (General_options): New option definitions.
11140         (General_options::fix_v4bx): New method.
11141         (General_options::Fix_v4bx): New enum.
11142         * gold/options.cc (General_options::parse_fix_v4bx): New method.
11143         (General_options::parse_fix_v4bx_interworking): New method.
11144
11145 2010-01-22  Doug Kwan  <dougkwan@google.com>
11146
11147         * arm.cc (Arm_exidx_fixup): New class.
11148
11149 2010-01-21  Doug Kwan  <dougkwan@google.com>
11150
11151         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
11152         classes.
11153         (Arm_exidx_section_offset_map): New type.
11154
11155 2010-01-21  Doug Kwan  <dougkwan@google.com>
11156
11157         * arm.cc (Arm_exidx_input_section): New class.
11158         (Arm_relobj::exidx_input_section_by_link,
11159         Arm_relobj::exidx_input_section_by_shndx,
11160         Arm_relobj::make_exidx_input_section): New methods.
11161         (read_arm_attributes_section): Remove.
11162         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
11163         information about them.
11164         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
11165         to here.
11166
11167 2010-01-20  Doug Kwan  <dougkwan@google.com>
11168
11169         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
11170         Input_section_specifier to Section_id.
11171         (Target_arm::new_arm_input_section: Adjust code for change of key
11172         type.
11173         (Target_arm::find_arm_input_section): Ditto.
11174         * gc.h (object.h): Include for Section_id nand Section_id_hash.
11175         (Section_id): Remove.
11176         (Garbage_collection::Section_id_hash): Remove.
11177         * icf.h (object.h): Include for Section_id nand Section_id_hash.
11178         (Section_id): Remove.
11179         (Icf::Section_id_hash): Remove.
11180         * object.h (Section_id, Const_section_id, Section_id_hash,
11181         Const_section_id_hash): New type definitions.
11182         * output.cc (Output_section::add_relaxed_input_section): Change to
11183         use Const_section_id instead of Input_section_specifier as key type.
11184         (Output_section::add_merge_input_section): Ditto.
11185         (Output_section::build_relaxation_map): Change to use Section_id
11186         instead of Input_section_specifier as key type.
11187         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11188         Ditto.
11189         (Output_section::convert_input_sections_to_relaxed_sections): Change
11190         to use Const_section_id instead of Input_section_specifier as key type.
11191         (Output_section::find_merge_section): Ditto.
11192         (Output_section::find_relaxed_input_section): Ditto.
11193         * output.h (Input_section_specifier): Remove class.
11194         (Output_section::Output_section_data_by_input_section_map): Change
11195         key type to Const_section_id.
11196         (Output_section::Output_relaxed_input_section_by_input_section_map):
11197         Ditto.
11198         (Output_section::Relaxation_map): Change key type to Section_id.
11199
11200 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11201
11202         * gold/arm.cc: Added support for R_ARM_V4BX relocation
11203         (class Arm_v4bx_stub): New class.
11204         (DEF_STUBS): Updated definition to support v4_veneer_bx.
11205         (Stub_factory::make_arm_v4bx_stub): New method.
11206         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
11207         (Stub_table::empty): Handle v4bx stubs.
11208         (Stub_table::add_arm_v4bx_stub): New method.
11209         (Stub_table::find_arm_v4bx_stub): New method.
11210         (Arm_relocate_functions::v4bx): New method.
11211         (Target_arm::fix_v4bx): New method.
11212         (Target_arm::Target_arm): Handle R_ARM_V4BX.
11213         (Stub_table::relocate_stubs): Likewise.
11214         (Stub_table::do_write): Likewise.
11215         (Stub_table::update_data_size_and_addralign): Likewise.
11216         (Stub_table::finalize_stubs):  Likewise.
11217         (Target_arm::Scan::local): Likewise.
11218         (Target_arm::Scan::global): Likewise.
11219         (Target_arm::do_finalize_sections): Likewise.
11220         (Target_arm::Relocate::relocate): Likewise.
11221         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11222         Likewise.
11223         (Target_arm::scan_reloc_for_stub): Likewise.
11224         (Target_arm::scan_reloc_section_for_stubs): Likewise.
11225
11226 2010-01-19  Ian Lance Taylor  <iant@google.com>
11227
11228         * output.cc (Output_section_headers::do_sized_write): Write large
11229         segment count to sh_info field.
11230         (Output_file_header::do_sized_write): For large segment count,
11231         write PN_XNUM to e_phnum field.
11232
11233 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11234
11235         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
11236         (Arm_relocate_functions::thm_jump8): New function.
11237         (Arm_relocate_functions::thm_jump11): New function.
11238         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
11239         R_ARM_THM_JUMP11.
11240         (Target_arm::Scan::global): Likewise.
11241         (Target_arm::Relocate::relocate): Likewise.
11242         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11243         Likewise.
11244
11245 2010-01-14  Doug Kwan  <dougkwan@google.com>
11246
11247         * arm.cc (map, utility): Include headers.
11248         (Target_arm::apply_cortex_a8_workaround): New method.
11249         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
11250         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
11251         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
11252         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
11253         the --[no-]fix-cortex-a8 command line options.
11254         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
11255         (Target_arm::relocate_stub): Use addend in instruction template.
11256         * options.h (DEFINE_bool): Set the user-set flag.
11257         (General_options): Add --[no-]-fix-cortex options.
11258         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
11259         : Update fast look-up map after conversion.
11260
11261 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
11262
11263         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
11264         in the first pass of do_layout.
11265
11266 2010-01-13  Doug Kwan  <dougkwan@google.com>
11267
11268         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11269         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
11270         apparent compiler problem of not folding static constant integral
11271         data members of elfcpp::Elf_sizes<32>.
11272
11273 2010-01-13  Doug Kwan  <dougkwan@google.com>
11274
11275         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
11276         Arm_relobj::section_needs_cortex_a8_stub_scanning,
11277         Arm_relobj::scan_section_for_cortex_a8_erratum,
11278         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
11279         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
11280         sections to scan for relocation stubs into a new method
11281         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
11282         relocation and Cortex-A8 stub scanning.
11283         (Target_arm::do_relax): Force stubs to be after stubbed sections
11284         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
11285         the beginning of a new relaxation pass.  Update a comment.
11286         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
11287
11288 2010-01-12  Ian Lance Taylor  <iant@google.com>
11289
11290         * target-reloc.h (visibility_error): New inline function.
11291         (relocate_section): Call visibility_error.
11292         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
11293         (MOSTLYCLEANFILES): Likewise.
11294         (protected_4_pic.o, protected_3.err): New targets.
11295         * testsuite/protected_4.cc: New file.
11296
11297 2010-01-12  Doug Kwan  <dougkwan@google.com>
11298
11299         * arm.cc (Cortex_a8_reloc): New class.
11300         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
11301         and cortex_a8_relocs_info_.
11302         (Target_arm::fix_cortex_a8): New method definition.
11303         (Target_arm::Cortex_a8_relocs_info): New type.
11304         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
11305         New data member declarations.
11306         (Target_arm::scan_reloc_for_stub): Record information about
11307         relocations for THUMB branches that might be exempted from the
11308         Cortex-A8 workaround.
11309         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
11310         at the beginning of a relaxation pass.
11311
11312 2010-01-12  Doug Kwan  <dougkwan@google.com>
11313
11314         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
11315         (Arm_relobj::Mapping_symbol_position,
11316          Arm_reloj::Mapping_symbol_position_less,
11317          Arm_relobj::Mapping_symbols_info): New types.
11318         (Target_arm::is_mapping_symbol_name): New method definition.
11319         (Arm_relobj::do_count_local_symbols): Save information about mapping
11320         symbols.
11321
11322 2010-01-11  Doug Kwan  <dougkwan@google.com>
11323
11324         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
11325         Arm_relocate_functions::thumb32_branch_upper,
11326         Arm_relocate_functions::thumb32_branch_lower,
11327         Arm_relocate_functions::thumb32_cond_branch_offset,
11328         Arm_relocate_functions::thumb32_cond_branch_upper,
11329         Arm_relocate_functions::thumb32_cond_branch_lower,
11330         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
11331         branch offset encoding.
11332         (Arm_relocate_functions::thumb_branch_common): Use new branch
11333         offset encoding methods to avoid code duplication.
11334         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
11335         (Stub_addend_reader::operator()): Use new branch encoding method
11336         to avoid code duplication.
11337
11338 2010-01-11  Doug Kwan  <dougkwan@google.com>
11339
11340         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
11341         (Target_arm::do_finalize_sections): Define special EXIDX section
11342         symbols only if referenced.
11343         * gc.h (Garbage_collection::add_reference): New method.
11344         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
11345         code duplication.
11346
11347 2010-01-11  Ian Lance Taylor  <iant@google.com>
11348
11349         * script.cc (Version_script_info::build_expression_list_lookup):
11350         Change complaing about duplicate wildcard match from error to
11351         warning.
11352
11353         * script.cc (class Lazy_demangler): Recreate--revert part of patch
11354         of 2009-12-30.
11355         (Version_script_info::Version_script_info): Initialize globs_,
11356         default_version_, default_is_global_, and exact_.  Don't
11357         initialize globals_ or locals_.
11358         (Version_script_info::build_lookup_tables): Build local symbols
11359         first.
11360         (Version_script_info::unquote): New function.
11361         (Version_script_info::add_exact_match): New function.
11362         (Version_script_info::build_expression_list_lookup): Remove lookup
11363         parameter.  Add is_global parameter.  Change all callers.  Handle
11364         wildcard pattern specially.  Unquote pattern.  Call
11365         add_exact_match.
11366         (Version_script_info::get_name_to_match): New function.
11367         (Version_script_info::get_symbol_version): New function.
11368         (Version_script_info::get_symbol_version_helper): Remove.
11369         (Version_script_info::check_unmatched_names): Call unquote.
11370         * script.h (class Version_script_info): Change get_symbol_version
11371         to be non-inline and add is_global parameter; change all callers.
11372         Rewrite symbol_is_local.  Update declarations.  Define struct
11373         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
11374         Remove globals_ and locals_ members.  Add exact_, globs_,
11375         default_version_, is_global_.
11376         (Version_script_info::Glob): Remove pattern, add expression and
11377         is_global.  Update constructor.  Change all callers.
11378         * dynobj.cc (Versions::finalize): Mark the version symbol as the
11379         default version.
11380         (Versions::symbol_section_contents): If a symbol is undefined, or
11381         defined in a dynamic object, set the version index to
11382         VER_NDX_LOCAL.
11383         * symtab.cc (Symbol_table::add_from_relobj): Don't call
11384         symbol_is_local.
11385         (Symbol_table::add_from_pluginobj): Likewise.
11386         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
11387
11388 2010-01-11  Doug Kwan  <dougkwan@google.com>
11389
11390         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
11391         (incremental_dump_LDADD): Add linking option for libintl.
11392         * Makefile.in: Regenerate.
11393
11394 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
11395
11396         PR gold/11144
11397         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
11398         instead of -Ds.
11399         * testsuite/Makefile.in: Regenerated.
11400
11401 2010-01-10  Doug Kwan  <dougkwan@google.com>
11402
11403         * options.h (DEFINE_var): Use parentheses around argument varname__
11404         in macro body to avoid any unintended subsequent substitutions.
11405
11406 2010-01-10  Ian Lance Taylor  <iant@google.com>
11407
11408         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
11409         candidates before doing symbol resolution.
11410
11411         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
11412         ODR candidates if only one is weak.
11413
11414 2010-01-08  Ian Lance Taylor  <iant@google.com>
11415
11416         * script.cc (Version_script_info::build_expression_list_lookup):
11417         Don't warn about ambiguous version, just record the ambiguity.
11418         (Version_script_info::get_symbol_version_helper): Give error if
11419         version is ambiguous.
11420
11421 2010-01-08  Doug Kwan  <dougkwan@google.com>
11422
11423         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
11424         prev_data_size_ and prev_addralign_.  Remove initializer for
11425         deleted data member has_been_changed_.
11426         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
11427         to determine if the table is empty.
11428         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
11429         Remove.
11430         (Stub_table::add_reloc_stub): Define method in class definition
11431         instead of just declaring it there.
11432         (Stub_table::add_cortex_a8_stub): New method definition.
11433         (Stub_table::update_data_size_and_addralign): Ditto.
11434         (Stub_table::finalize_stubs): Ditto.
11435         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
11436         (Stub_table::do_addralign_): Return address alignment in the
11437         (Stub_table::do_reset_address_and_file_offset): Define method in
11438         class definition instead of declaring it there.  Set current data
11439         size to be the data size of the previous pass.
11440         (Stub_table::set_final_data_size): Use current data size as the
11441         final data size.
11442         (Stub_table::relocate_stub): Change parameter type of stub from
11443         Reloc_stub pointer to Stub pointer.
11444         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
11445         (Stub_table::Cortex_a8_stub_list): New typedef.
11446         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
11447          Stub_table::prev_addralign_): New data member.
11448         (Arm_relobj::Arm_relobj): Initialize data member
11449         section_has_cortex_a8_workaround_.
11450         (Arm_relobj::section_has_cortex_a8_workaround,
11451          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
11452          definitions.
11453         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
11454         declarations.
11455         (Target_arm::relocate_stub): Change parameter type of stub from
11456         Reloc_stub pointer to Stub pointer.
11457         (Insn_template::size, Insn_template::alignment): Handle
11458         THUMB16_SPECIAL_TYPE.
11459         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
11460          Stub_table::update_data_size_and_addralign,
11461          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
11462         definitions.
11463         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
11464         (Stub_table::do_write): Ditto.
11465         (Target_arm::do_relax): Adjust code for changes in Stub_table.
11466
11467 2010-01-08  Ian Lance Taylor  <iant@google.com>
11468
11469         PR 11108
11470         * symtab.h (class Symbol): Remove fields is_target_special_ and
11471         has_plt_offset_.  Add field is_defined_in_discarded_section_.
11472         (Symbol::is_defined_in_discarded_section): New function.
11473         (Symbol::set_is_defined_in_discarded_section): New function.
11474         (Symbol::has_plt_offset): Rewrite.
11475         (Symbol::set_plt_offset): Verify that new offset is not -1U.
11476         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
11477         Don't initialize is_target_special_ or has_plt_offset_.
11478         Initialize is_defined_in_discarded_section_.
11479         (Symbol_table::add_from_relobj): If appropriate, set
11480         is_defined_in_discarded_section.
11481         * resolve.cc (Symbol::override_base_with_special): Don't test
11482         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
11483         * target-reloc.h (relocate_section): Do special handling for
11484         symbols defined in discarded sections for global symbols as well
11485         as local symbols.
11486
11487 2010-01-08  Ian Lance Taylor  <iant@google.com>
11488
11489         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
11490         the SHT_SYMTAB case.
11491
11492 2010-01-08  Ian Lance Taylor  <iant@google.com>
11493
11494         * object.cc (Sized_relobj::do_layout): Don't get confused if
11495         layout_eh_frame returns NULL.
11496
11497 2010-01-08  Ian Lance Taylor  <iant@google.com>
11498
11499         PR 11084
11500         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
11501         dynamic symbol table, use the normal symbol table.
11502         (Sized_dynobj::do_read_symbols): Remove assertion about type of
11503         symbol table.
11504
11505 2010-01-08  Ian Lance Taylor  <iant@google.com>
11506
11507         PR 11072
11508         * layout.cc (Layout::include_section): Remove .gnu_debuglink
11509         sections.
11510
11511 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
11512
11513         * version.cc (print_version): Change to "Copyright 2010".
11514
11515 2010-01-08  Ian Lance Taylor  <iant@google.com>
11516
11517         PR 10287
11518         PR 11063
11519         * i386.cc (class Target_i386): Change return type of plt_section
11520         to be non-const.
11521         (class Output_data_plt_i386): Add tls_desc_rel_ field.
11522         (Output_data_plt_i386::Output_data_plt_i386): Initialize
11523         tls_desc_rel_ field.
11524         (Output_data_plt_i386::rel_tls_desc): New function.
11525         (Target_i386::rel_tls_desc_section): New function.
11526         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
11527         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
11528         R_386_TLS_DESC reloc in rel_tls_desc_section.
11529         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
11530         Define struct Tlsdesc_info.
11531         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
11532         (Target_x86_64::do_reloc_symbol_index): New function.
11533         (Target_x86_64::add_tlsdesc_info): New function.
11534         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
11535         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
11536         tlsdesc_rel_ field.
11537         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
11538         all callers.
11539         (Output_data_plt_x86_64::rela_tlsdesc): New function.
11540         (Target_x86_64::rela_tlsdesc_section): New function.
11541         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
11542         handling.
11543         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
11544         (Target_x86_64::do_reloc_addend): New function.
11545         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
11546         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
11547         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
11548         (Output_reloc::type): New function.
11549         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
11550         (Output_reloc::is_target_specific): New function.
11551         (Output_reloc::target_arg): New function.
11552         (class Output_reloc) [SHT_RELA]: Add four new constructors for
11553         absolute relocs and target specific relocs.
11554         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
11555         add_target_specific.
11556         (class Output_data_reloc) [SHT_RELA]: Likewise.
11557         * output.cc (Output_reloc::Output_reloc): Add four new versions
11558         for absolute relocs and target specific relocs.
11559         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
11560         (Output_reloc::get_symbol_index): Likewise.
11561         (Output_reloc::local_section_offset): Check that local_sym_index_
11562         is not TARGET_CODE or 0.
11563         (Output_reloc::symbol_value): Likewise.
11564         (Output_reloc::write) [SHT_RELA]: Call target for target specific
11565         reloc.
11566         * target.h (class Target): Add reloc_symbol_index and reloc_addend
11567         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
11568         functions.
11569         * layout.cc (add_target_dynamic_tags): Use output section for
11570         DT_PLTRELSZ and DT_JMPREL.
11571
11572 2010-01-07  Ian Lance Taylor  <iant@google.com>
11573
11574         PR 11061
11575         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
11576         function.
11577         (class Output_data_reloc_generic): Define.
11578         (class Output_data_reloc_base): Change base class to
11579         Output_data_reloc_generic.  Change add() method to call
11580         bump_relative_reloc_count for a relative reloc.  Remove
11581         sort_relocs_ field.
11582         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
11583         to sort_relocs().
11584         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
11585         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
11586         appropriate.
11587         * layout.h (class Layout): Update declaration.
11588
11589 2010-01-07  Ian Lance Taylor  <iant@google.com>
11590
11591         * output.h (class Output_data): Add const version of
11592         output_section and do_output_section.
11593         (class Output_section_data): Add const version of
11594         do_output_section.
11595         (class Output_section): Likewise.
11596         * layout.cc (Layout::add_target_dynamic_tags): New function.
11597         * layout.h (class Layout): Update declarations.
11598         * arm.cc (Target_arm::do_finalize_sections): Use
11599         add_target_dynamic_tags.
11600         * i386.cc (Target_i386::do_finalize_sections): Likewise.
11601         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
11602         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
11603         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
11604
11605 2010-01-07  Ian Lance Taylor  <iant@google.com>
11606
11607         PR 11042
11608         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
11609         object as needed.
11610
11611 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
11612             Ian Lance Taylor  <iant@google.com>
11613
11614         PR 11019
11615         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
11616         Xindex::read_symtab_xindex.
11617
11618 2010-01-07  Doug Kwan  <dougkwan@google.com>
11619
11620         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
11621         (Insn_template::thumb16_bcond_insn): New method declaration.
11622         (Insn_template): Fix spelling.
11623         (Stub::thumb16_special): New method declaration.
11624         (Stub::do_write): Define virtual method which was previously pure
11625         virtual.
11626         (Stub::do_thumb16_special): New method declaration.
11627         (Stub::do_fixed_endian_write): New template member.
11628         (Reloc_stub::do_write): Remove.
11629         (Reloc_stub::do_fixed_endian_write): Remove.
11630         (Cortex_a8_stub): New class definition.
11631         (Stub_factory::make_cortex_a8_stub): New method definition.
11632         (Stub_factory::Stub_factory): Add missing static storage class
11633         qualifier for elf32_arm_stub_a8_veneer_blx.
11634
11635 2010-01-07  Ian Lance Taylor  <iant@google.com>
11636
11637         PR 10980
11638         * options.h (class General_options): Add --warn-unresolved-symbols
11639         and --error-unresolved-symbols.
11640         * errors.cc (Errors::undefined_symbol): Implement
11641         --warn-unresolved-symbols.
11642
11643         * options.h (class General_options): Add -z text and -z textoff.
11644         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
11645
11646 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
11647
11648         * gc.h (Garbage_collection::Cident_section_map): New typedef.
11649         (Garbage_collection::cident_sections): New function.
11650         (Garbage_collection::add_cident_section): New function.
11651         (Garbage_collection::cident_sections_): New member.
11652         (gc_process_relocs): Add references to sections whose names are C
11653         identifiers.
11654         * gold.h (cident_section_start_prefix): New constant.
11655         (cident_section_stop_prefix): New constant.
11656         (is_cident): New function.
11657         * layout.cc (Layout::define_section_symbols): Replace string constants
11658         with the newly defined constants.
11659         * object.cc (Sized_relobj::do_layout): Track sections whose names are
11660         C identifiers.
11661         * testsuite/Makefile.am: Add gc_orphan_section_test.
11662         * testsuite/Makefile.in: Regenerate.
11663         * testsuite/gc_orphan_section_test.cc: New file.
11664         * testsuite/gc_orphan_section_test.sh: New file.
11665
11666 2010-01-06  Ian Lance Taylor  <iant@google.com>
11667
11668         PR 10980
11669         * options.h (class General_options): Add --warn-shared-textrel.
11670         * layout.cc (Layout::finish_dynamic_section): Implement
11671         --warn-shared-textrel.
11672
11673         PR 10980
11674         * options.h (class General_options): Add --warn-multiple-gp.
11675
11676 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11677
11678         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
11679         $(THREADSLIB) and $(LIBDL).
11680         * Makefile.in: Rebuild.
11681
11682 2010-01-06  Ian Lance Taylor  <iant@google.com>
11683
11684         PR 10980
11685         * options.cc (General_options::parse_section_start): New function.
11686         (General_options::section_start): New function.
11687         (General_options::General_options): Initialize all members.
11688         * options.h: Include <map>
11689         (class General_options): Add --section-start.  Add section_starts_
11690         member.
11691         * layout.cc (Layout::attach_allocated_section_to_segment): If
11692         --section-start was used, set the address of the segment.  Remove
11693         local sort_sections.
11694         (Layout::relaxation_loop_body): If the address of the load segment
11695         has been set by --section-start, don't use it.
11696         * output.h (Output_segment::update_flags_for_output_section): New
11697         function.
11698         * output.cc (Output_segment::add_output_section): Call
11699         update_flags_for_output_section.
11700
11701 2010-01-05  Ian Lance Taylor  <iant@google.com>
11702
11703         PR 10980
11704         * options.h (class General_options): Add --undefined-version.
11705         * script.cc (struct Version_expression): Add was_matched_by_symbol
11706         field.
11707         (Version_script_info::matched_symbol): New function.
11708         (Version_script_info::get_symbol_version_helper): Call
11709         matched_symbol.
11710         (Version_script_info::check_unmatched_names): New function.
11711         * script.h (class Version_script_info): Update declarations.
11712         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
11713
11714         * options.h (class General_options): Use DEFINE_bool_alias for
11715         allow_multiple_definition.
11716         * resolve.cc (Symbol_table::should_override): Don't test
11717         allow_multiple_definition.
11718
11719         PR 10980
11720         * options.h (class General_options): Add --cref.
11721         * main.cc (main): Print cref table if --cref.  Don't close mapfile
11722         until after printing cref table.
11723         * cref.cc: Include "symtab.h".
11724         (class Cref_inputs): Define Cref_table_compare and Cref_table.
11725         (Cref_table_compare::operator()): New function.
11726         (Cref_inputs::gather_cref): New function.
11727         (filecol): New static const.
11728         (Cref_inputs::print_cref): New function.
11729         (Cref::print_cref): New function.
11730         * cref.h: Include <cstdio>.
11731         (class Cref): Update declarations.
11732         * mapfile.h (Mapfile::file): New function.
11733         * object.h (class Object): Define Symbols.  Declare virtual
11734         do_get_global_symbols.
11735         (Object::get_global_symbols): New function.
11736         * object.cc (Input_objects::add_object): Pass object to cref_ if
11737         --cref.
11738         (Input_objects::archive_start): Likewise.
11739         (Input_objects::archive_stop): Likewise.
11740         (Input_objects::print_cref): New function.
11741         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
11742         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
11743         --cref.
11744         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
11745         function.
11746         * plugin.h (class Sized_pluginobj): Update declarations.
11747
11748 2010-01-05  Ian Lance Taylor  <iant@google.com>
11749
11750         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
11751         to is_default_version.  Rename insdef to insdefault.
11752         (Symbol_table::add_from_relobj): Rename def to is_default_version
11753         and local to is_forced_local.
11754         (Symbol_table::add_from_pluginobj): Likewise.
11755         (Symbol_table::add_from_dynobj): Likewise.
11756         (Symbol_table::define_special_symbol): Rename insdef to
11757         insdefault.
11758
11759 2010-01-04  Ian Lance Taylor  <iant@google.com>
11760
11761         PR 10980
11762         * options.h (class General_options): Add
11763         --allow-multiple-definition and -z muldefs.
11764         * resolve.cc (Symbol_table::should_override): Don't warn about a
11765         multiple symbol definition if --allow-multiple-definition or -z
11766         muldefs.
11767
11768         PR 10980
11769         * options.h (class General_options): Add --add-needed and
11770         --copy-dt-needed-entries.  Tweak --as-needed help entry.
11771         * object.cc (Input_objects::check_dynamic_dependencies): Give an
11772         error if --copy-dt-needed-entries aka --add-needed is used and
11773         would cause a change in behaviour.
11774
11775         PR 10980
11776         * options.h (class General_options): Add -G as a short version of
11777         --shared.  Add no-op options -assert, -g, and -i.
11778
11779 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
11780
11781         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
11782         check for .text or .gnu.linkonce.t sections.
11783         * icf.cc (Icf::find_identical_sections): Ditto.
11784         Change the detection for mangled function name within the section
11785         name.
11786         * icf.h (is_section_foldable_candidate): New function.
11787
11788 2009-12-30  Ian Lance Taylor  <iant@google.com>
11789
11790         PR 10980
11791         * options.h (class General_options): Permit two dashes with
11792         --retain-symbols-file.
11793
11794 2009-12-30  Ian Lance Taylor  <iant@google.com>
11795
11796         PR 10979
11797         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
11798         don't put the file header and segment headers in the text
11799         segment.
11800
11801         PR 10979
11802         * common.cc (Sort_commons::operator()): Stabilize sort when both
11803         entries are NULL.
11804         (Symbol_table::do_allocate_commons_list): When allocating common
11805         symbols, skip a symbol which is no longer common.
11806         * symtab.h (Symbol::is_common): Test whether the symbol comes from
11807         an object before checking its type.
11808         * testsuite/common_test_2.c: New file.
11809         * testsuite/common_test_3.c: New file.
11810         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
11811         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
11812         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
11813         (common_test_2_pic.o, common_test_2.so): New targets.
11814         (common_test_3_pic.o, common_test_3.so): New targets.
11815         * testsuite/Makefile.in: Rebuild.
11816
11817         PR 10979
11818         * script.cc (read_input_script): If we see a new SECTIONS clause,
11819         and we have added an input section, give an error.
11820         * layout.h (class Layout): Add have_added_input_section function.
11821         Add have_added_input_section_ field.
11822         * layout.cc (Layout::Layout): Initialize
11823         have_added_input_section_.
11824         (Layout::layout): Set have_added_input_section_.
11825         (Layout::layout_eh_frame): Likewise.
11826
11827 2009-12-30  Ian Lance Taylor  <iant@google.com>
11828
11829         PR 10931
11830         * options.h (class General_options): Add --sort-common option.
11831         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
11832         * common.cc (Sort_common): Add sort_order parameter to
11833         constructor.  Add sort_order_ field.
11834         (Sort_commons::operator): Check sort_order_.
11835         (Symbol_table::allocate_commons): Determine the sort order.
11836         (Symbol_table::do_allocate_commons): Add sort_order parameter.
11837         Change all callers.
11838         (Symbol_table::do_allocate_commons_list): Likewise.
11839
11840 2009-12-30  Ian Lance Taylor  <iant@google.com>
11841
11842         PR 10916
11843         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
11844         symbols from this object, don't change the visibility of an
11845         undefined symbol.
11846         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
11847
11848 2009-12-30  Ian Lance Taylor  <iant@google.com>
11849
11850         PR 10861
11851         * script.h (class Version_script_info): Define Language enum.
11852         Update declarations.  Define Glob, Exact, and Lookup types.  Add
11853         new fields globals_, locals_, and is_finalized_.
11854         * script.cc: Various formatting fixes.
11855         (class Parser_closure): Change language_stack_ from a vector of
11856         std::string to one of Version_script_info::Language.  Adjust all
11857         uses accordingly.
11858         (class Lazy_demangler): Remove.
11859         (struct Version_expression): Change language from std::string to
11860         Version_script_info::Language.
11861         (Version_script_info::Version_script_info): New function.
11862         (Version_script_info::~Version_script_info): Don't call clear.
11863         (Version_script_info::finalize): New function.
11864         (Version_script_info::build_lookup_tables): New function.
11865         (Version_script_info::build_expression_list_lookup): New
11866         function.
11867         (Version_script_info::get_symbol_version_helper): Rewrite to use
11868         lookup tables.
11869         (Version_script_info::print_expression_list): Adjust to use
11870         Version_script_info::Language.
11871         (script_push_lex_into_version_mode): Check that the version script
11872         has not been finalized.
11873         (version_script_push_lang): Change language string to
11874         Version_script_info::Language.
11875         * options.cc (Command_line::version_script): New function.
11876         * options.h (class General_options): Add finalize_dynamic_list
11877         function.  Change version_script from declaration to definition.
11878         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
11879         * testsuite/version_script.map: Remove duplicate def of foo.
11880         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
11881         version_script.map.
11882         * testsuite/Makefile.in: Rebuild.
11883
11884 2009-12-30  Ian Lance Taylor  <iant@google.com>
11885
11886         PR 10843
11887         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
11888         if the input symbol index is 0, make the output symbol index 0.
11889
11890 2009-12-30  Ian Lance Taylor  <iant@google.com>
11891
11892         PR 10670
11893         * options.h (class General_options): Add -x/--discard-all.
11894         * object.cc (Sized_relobj::do_count_local_symbols): Handle
11895         --discard-all.  If the local symbol needs a dynamic entry, check
11896         that before handling --discard-locals.
11897
11898 2009-12-30  Ian Lance Taylor  <iant@google.com>
11899
11900         PR 10450
11901         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
11902         flags to PF_R.
11903         (Output_segment::add_output_section): Don't change the flags if
11904         the type is PT_TLS.
11905
11906         PR 10450
11907         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
11908         GNU hash table if they need a dynamic value.  Otherwise, don't add
11909         them if they are defined in a dynamic object or are forced local.
11910
11911 2009-12-29  Ian Lance Taylor  <iant@google.com>
11912
11913         PR 10450
11914         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
11915         .gnu.hash table for a 32-bit target.
11916
11917         PR 10450
11918         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
11919         regular and a dynamic object only needs a dynamic symbol table
11920         entry if it is externally visible.
11921
11922         PR 10450
11923         * i386.cc (class Target_i386): Initialize global_offset_table_ in
11924         constructor.  Add global_offset_table_ field.
11925         (Target_i386::got_section): Set global_offset_table_.
11926         (Target_i386::do_finalize_sections): Set global_offset_table_
11927         size.
11928         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
11929         in constructor.  Add global_offset_table_ field.
11930         (Target_x86_64::got_section): Set global_offset_table_.
11931         (Target_x86_64::do_finalize_sections): Set global_offset_table_
11932         size.
11933
11934         * layout.cc (Layout::Layout): Initialize increase_relro_.
11935         (Layout::get_output_section): Add is_relro, is_last_relro, and
11936         is_first_non_relro parameters.  Change all callers.
11937         (Layout::choose_output_section): Likewise.
11938         (Layout::add_output_section_data): Likewise.
11939         (Layout::make_output_section): Likewise.
11940         (Layout::set_segment_offsets): Clear increase_relro when using a
11941         linker script.
11942         * layout.h (class Layout): Add increase_relro method.  Add
11943         increase_relro_ field.  Update declarations.
11944         * output.cc (Output_section::Output_section): Initialize
11945         is_last_relro_ and is_first_non_relro_.
11946         (Output_segment::add_output_section): Group relro sections is
11947         do_sort is true.  Handle is_last_relro and is_first_non_relro.
11948         (Output_segment::maximum_alignment): Remove relro handling.
11949         (Output_segment::set_section_addresses): Add increase_relro
11950         parameter.  Change all callers.  Add initial alignment to align
11951         relro sections on separate page.  Remove old relro handling.
11952         (Output_segment::set_section_list_addresses): Remove in_relro
11953         parameter.  Change all callers.
11954         (Output_segment::set_offset): Add increase parameter.  Change all
11955         callers.  Remove old relro handling.
11956         * output.h (class Output_section): Add new methods: is_last_relro,
11957         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
11958         Add is_last_relro_ and is_first_non_relro_ fields.
11959         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
11960         Create separate .got.plt section.  Call increase_relro.
11961         * x86_64.cc (Target_x86_64::got_section): Likewise.
11962         * testsuite/relro_script_test.t: Add .got.plt.
11963
11964         PR 10450
11965         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
11966         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
11967         (Layout::finalize): Call set_dynamic_symbol_size.
11968         (Layout::set_dynamic_symbol_size): New function.
11969         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
11970         set_dynamic_symbol_size.
11971
11972         PR 10450
11973         * output.h (class Output_section): Add is_entsize_zero_ field.
11974         * output.cc (Output_section::Output_section): Initialize
11975         is_entsize_zero_.
11976         (Output_section::set_entsize): If two different entsizes are
11977         requested, force it to zero.
11978         (Output_section::add_input_section): Set flags for .debug_str
11979         before updating section flags.  Set entsize.
11980         (Output_section::update_flags_for_input_section): Set SHF_MERGE
11981         and SHF_STRING if all input sections have those flags.
11982
11983 2009-12-29   Rafael Espindola  <espindola@google.com>
11984
11985         * main.cc (main): Fix the sys time reporting.
11986         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
11987         reporting.
11988
11989 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
11990
11991         * options.cc (General_options::parse_version): Allow -v to exit
11992         without an error if there is nothing to link.
11993
11994 2009-12-29  Ian Lance Taylor  <iant@google.com>
11995
11996         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
11997         using a version of gcc before 4.1.
11998         * configure: Rebuild.
11999
12000 2009-12-28  Chris Demetriou  <cgd@google.com>
12001
12002         * attributes.cc (Output_attributes_section_data::do_write): Use
12003         std::vector::front rather than std::vector::data.
12004
12005 2009-12-28  Ian Lance Taylor  <iant@google.com>
12006
12007         * symtab.h (class Symbol_table): Add enum Defined.
12008         * resolve.cc (Symbol_table::should_override): Add defined
12009         parameter.  Change all callers.  Test whether object is NULL
12010         before calling a method on it.
12011         (Symbol_table::report_resolve_problem): Add defined parameter.
12012         Change all callers.
12013         (Symbol_table::should_override_with_special): Likewise.
12014         * symtab.cc (Symbol_table::define_in_output_data): Add defined
12015         parameter.  Change all callers.
12016         (Symbol_table::do_define_in_output_data): Likewise.
12017         (Symbol_table::define_in_output_segment): Likewise.
12018         (Symbol_table::do_define_in_output_segment): Likewise.
12019         (Symbol_table::define_as_constant): Likewise.
12020         (Symbol_table::do_define_as_constant): Likewise.
12021         * script.h (class Symbol_assignment): Add is_defsym parameter to
12022         constructor; change all callers.
12023         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
12024         parameter.  Change all callers.  Add is_defsym_ field.
12025         (class Parser_closure): Add parsing_defsym parameter to
12026         constructor; change all callers.  Add parsing_defsym accessor
12027         function.  Add parsing_defsym_ field.
12028
12029 2009-12-28  Ian Lance Taylor  <iant@google.com>
12030
12031         * gold.cc (queue_middle_tasks): Fix formatting.
12032         * object.cc (Relobj::is_section_name_included): Likewise.
12033
12034 2009-12-23  Ian Lance Taylor  <iant@google.com>
12035
12036         * i386.cc (Target_i386::do_calls_non_split): Recognize
12037         -fsplit-stack prologue for a function with a static chain.
12038         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
12039         -fsplit-stack prologue when using %r11.
12040
12041 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
12042
12043         * options.cc (General_options::parse_version): Make -v continue and do
12044         the link like GNU ld does.
12045
12046 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
12047
12048         * Makefile.am (CCFILES): Add timer.cc.
12049         (HFILES): Add timer.h.
12050         * configure.ac: Check for sysconf and times.
12051         * main.cc: include timer.h.
12052         (main): Use Timer instead of get_run_time.
12053         * timer.cc: New.
12054         * timer.h: New.
12055         * workqueue.cc: include timer.h.
12056         (Workqueue::find_and_run_task):
12057         Report user, sys and wall time.
12058         * Makefile.in: Regenerate.
12059         * config.in: Regenerate.
12060         * configure: Regenerate.
12061
12062 2009-12-16  Doug Kwan  <dougkwan@google.com>
12063
12064         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
12065         sections.
12066         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
12067         relaxed input sections.
12068         * output.cc (Output_section::find_relaxed_input_section): Change
12069         return type to Output_relaxed_input_section pointer.  Adjust code
12070         for new type of relaxed_input_section_map_.
12071         * output.h (Output_section::find_relaxed_input_section): Change
12072         return type to Output_relaxed_input_section pointer.
12073         (Output_section::Output_relaxed_input_section_by_input_section_map):
12074         New type.
12075         (Output_section::relaxed_input_section_map_): Change type to
12076         Output_section::Output_relaxed_input_section_by_input_section_map.
12077         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
12078         input section.
12079
12080 2009-12-15  Ian Lance Taylor  <iant@google.com>
12081
12082         * layout.cc (Layout::create_shstrtab): Only write out after input
12083         sections if we are compressing debug sections.
12084
12085 2009-12-15  Ian Lance Taylor  <iant@google.com>
12086
12087         * archive.cc (Archive::add_symbols): Only look up a symbol without
12088         a version if there is, in fact, a version.
12089
12090 2009-12-14  Ian Lance Taylor  <iant@google.com>
12091
12092         Revert -Wshadow changes, all changes from:
12093         2009-12-11  Doug Kwan  <dougkwan@google.com>
12094         2009-12-11  Nick Clifton  <nickc@redhat.com>
12095         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
12096
12097 2009-12-11  Doug Kwan  <dougkwan@google.com>
12098
12099         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
12100         due to -Wshadow.
12101         * attributes.cc (Object_attribute::size): Ditto.
12102         (Attributes_section_data::size): Ditto.
12103         (Attributes_section_data::Attributes_section_data): Ditto.
12104         (Output_attributes_section_data::do_write): Ditto.
12105         * attributes.h (Object_attribute::set_type): Ditto.
12106         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
12107
12108 2009-12-11  Nick Clifton  <nickc@redhat.com>
12109
12110         * archive.cc: Fix shadowed variable warnings.
12111         * arm.cc: Likewise.
12112         * compressed_output.cc: Likewise.
12113         * compressed_output.h: Likewise.
12114         * configure: Likewise.
12115         * dwarf_reader.cc: Likewise.
12116         * dynobj.cc: Likewise.
12117         * dynobj.h: Likewise.
12118         * ehframe.cc: Likewise.
12119         * ehframe.h: Likewise.
12120         * errors.cc: Likewise.
12121         * expression.cc: Likewise.
12122         * fileread.cc: Likewise.
12123         * fileread.h: Likewise.
12124         * freebsd.h: Likewise.
12125         * i386.cc: Likewise.
12126         * icf.cc: Likewise.
12127         * incremental.h: Likewise.
12128         * layout.cc: Likewise.
12129         * layout.h: Likewise.
12130         * mapfile.cc: Likewise.
12131         * merge.cc: Likewise.
12132         * merge.h: Likewise.
12133         * object.cc: Likewise.
12134         * object.h: Likewise.
12135         * options.h: Likewise.
12136         * output.cc: Likewise.
12137         * output.h: Likewise.
12138         * parameters.cc: Likewise.
12139         * plugin.cc: Likewise.
12140         * powerpc.cc: Likewise.
12141         * reduced_debug_output.cc: Likewise.
12142         * reduced_debug_output.h: Likewise.
12143         * reloc.cc: Likewise.
12144         * reloc.h: Likewise.
12145         * resolve.cc: Likewise.
12146         * script-sections.cc: Likewise.
12147         * script.cc: Likewise.
12148         * script.h: Likewise.
12149         * sparc.cc: Likewise.
12150         * symtab.cc: Likewise.
12151         * symtab.h: Likewise.
12152         * target-select.cc: Likewise.
12153         * target-select.h: Likewise.
12154         * token.h: Likewise.
12155         * workqueue.cc: Likewise.
12156         * workqueue.h: Likewise.
12157         * x86_64.cc: Likewise.
12158
12159 2009-12-10  Doug Kwan  <dougkwan@google.com>
12160
12161         * arm.cc (attributes.h): New include.
12162         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
12163         (Arm_relobj::~Arm_relobj): Delete object pointed by
12164         attributes_section_data_.
12165         (Arm_relobj::attributes_section_data): New method definition.
12166         (Arm_relobj::attributes_section_data_): New data member declaration.
12167         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
12168         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
12169         attributes_section_data_.
12170         (Arm_dynobj::attributes_section_data): New method definition.
12171         (Arm_dynobj::attributes_section_data_): New data member declaration.
12172         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
12173         initialization value of may_use_blx_ to false.
12174         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
12175         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
12176         object attributes to compute results instead of hard-coding.
12177         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
12178         Target_arm::get_secondary_compatible_arch,
12179         Target_arm::set_secondary_compatible_arch
12180         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12181         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
12182         New method declarations.
12183         (Target_arm::get_aeabi_object_attribute): New method definition.
12184         (Target_arm::attributes_section_data_): New data member declaration.
12185         (read_arm_attributes_section): New template definition.
12186         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
12187         (Arm_dynobj::do_read_symbols): Ditto.
12188         (Target_arm::do_finalize_sections): Merge attributes sections from
12189         input.  Check for BLX use after attributes section merging.
12190         Fix __exidx_start and __exidx_end visibility.  Create an
12191         .ARM.attributes section if necessary.
12192         (Target_arm::get_secondary_compatible_arch,
12193         Target_arm::set_secondary_compatible_arch,
12194         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
12195         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
12196         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
12197         New method definitions.
12198
12199 2009-12-09  Ian Lance Taylor  <iant@google.com>
12200
12201         * plugin.cc (Plugin::load): Don't cast from void* to a function
12202         pointer.
12203
12204 2009-12-09  Ian Lance Taylor  <iant@google.com>
12205
12206         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
12207         information fields.
12208
12209 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
12210
12211         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
12212         Replace two_file_shared_1.so with two_file_shared_2.so.
12213         * testsuite/Makefile.in: Regenerated.
12214
12215 2009-12-08  Doug Kwan  <dougkwan@google.com>
12216
12217         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
12218         (HFILES): Add attributes.h and int_encoding.h.
12219         * Makefile.in: Regenerate.
12220         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
12221         function definitions to int_encoding.cc
12222         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
12223         prototypes to int_encoding.h
12224         * reduced_debug_output.cc (int_encoding.h): New include.
12225         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
12226         function definitions to int_encoding.cc
12227         (insert_into_vector, read_from_pointer): Move template definitions to
12228         int_encoding.h
12229         * attributes.cc: New file.
12230         * attributes.h: New file.
12231         * int_encoding.cc: New file.
12232         * int_encoding.h: New file.
12233
12234 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
12235
12236         PR gold/11055
12237         * incremental-dump.cc (dump_incremental_inputs): New.
12238         (main): Use dump_incremental_inputs.
12239
12240 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
12241
12242         PR gold/10893
12243         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
12244         checking elfcpp::STT_FUNC.
12245         (Target_i386::Relocate::relocate): Likewise.
12246         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
12247
12248         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
12249         symbols from shared libraries into normal FUNC symbols.
12250
12251         * symtab.h (Symbol): Add is_func and use it.
12252
12253 2009-12-05  Doug Kwan  <dougkwan@google.com>
12254
12255         * arm.cc (Target_arm::arm_info): Initialize new fields
12256         attributes_section and attributes_vendor.
12257         * i386.cc (Target_i386::i386_info): Same.
12258         * object.cc (Sized_relobj::do_layout): Skip attribute section.
12259         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
12260         fields attributes_section and attributes_vendor.
12261         * sparc.cc (Target_sparc::sparc_info): Same.
12262         * target.h (Target::attributes_section, Target::attributes_vendor,
12263         Target::is_attributes_section, Target::attribute_arg_type,
12264         Target::attributes_order): New method definitions.
12265         (Target::Target_info::attributes_section,
12266         Target::Target_info::attributes_vendor): New fields.
12267         (Target::do_attribute_arg_type, Target::do_attributes_order): New
12268         virtual method definitions.
12269         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
12270         attributes_section and attributes_vendor.
12271         * testsuite/testfile.cc (Target_test::test_target_info): Same.
12272
12273 2009-12-05  Doug Kwan  <dougkwan@google.com>
12274
12275         * arm.cc: Update comments about interworking and stub generation.
12276         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
12277         considered as non-PIC.
12278         (Arm_relocate_functions::base_abs): Fix formatting.
12279         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
12280         of function to use GOT entry address instead of offset.
12281         (Target_arm::Scan::global): Issue an error if a symbol would need a
12282         PLT does not get one because it is untyped.  Remove code to create
12283         dynamic symbols for relative branches.
12284         (Target_arm::Relocate::relocate: Use 0 instead of false since function
12285         takes unsigned integer instead of boolean.
12286
12287 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
12288
12289         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
12290         (two_file_test_LDADD): Likewise.
12291         (common_test_1_LDADD): Likewise.
12292         (exception_test_LDADD) Likewise.
12293         (weak_test_LDADD): Likewise.
12294         (many_sections_test_LDADD): Likewise.
12295         (initpri1_LDADD): Likewise.
12296         (script_test_1_LDADD): Likewise.
12297         (script_test_2_LDADD): Likewise.
12298         (justsyms_LDADD): Likewise.
12299         (binary_test_LDADD): Likewise.
12300         (large_LDADD): Likewise.
12301         * testsuite/Makefile.in: Regenerated.
12302
12303 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
12304
12305         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
12306         (Symbol_table::override_with_special): Likewise.
12307         (Symbol_table::add_from_object): Likewise.
12308
12309 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12310
12311         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12312         Don't set the data_offset twice.
12313
12314 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
12315
12316         * testsuite/Makefile.in: Regenerate.
12317
12318 2009-12-03  Doug Kwan  <dougkwan@google.com>
12319
12320         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
12321         (Target_arm::do_finalize_sections): Add parameter for symbol table
12322         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
12323         * i386.cc (Target_i386::do_finalize_sections): Add an additional
12324         parameter for symbol table pointer.
12325         * layout.cc (Layout::finalize): Call Target::finalize_sections with
12326         an additional parameter for a pointer to symbol table.
12327         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
12328         parameter for a symbol table pointer.
12329         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
12330         * target.h (Target::finalize_sections, Target::do_finalize_sections):
12331         Ditto.
12332         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
12333         parameter for a symbol table pointer.
12334
12335 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
12336
12337         * incremental.cc (Incremental_inputs_header)
12338         (Incremental_inputs_header_write, Incremental_inputs_entry)
12339         (Incremental_inputs_entry_write): Move ...
12340         * incremental.h (Incremental_inputs_header)
12341         (Incremental_inputs_header_write, Incremental_inputs_entry)
12342         (Incremental_inputs_entry_write): here.
12343
12344 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12345
12346         * incremental.cc (make_sized_incremental_binary): Set the target.
12347         Error if it is incompatible.
12348         * output.h (Output_file): Add filename method.
12349
12350 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12351
12352         * incremental.cc (Incremental_inputs_entry): Remove unused argument
12353         from the get_* methods.
12354
12355 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12356
12357         * incremental-dump.cc (main): Check that the offeset of a script is 0.
12358         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
12359         Write 0 for the data_offset of scripts.
12360
12361 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
12362
12363         * testsuite/Makefile.am: Add the incremental_test.sh test.
12364         * testsuite/incremental_test.sh: New.
12365         * testsuite/incremental_test_1.c: New.
12366         * testsuite/incremental_test_2.c: New.
12367
12368 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
12369
12370         * incremental-dump.cc (main): Fix typos.
12371
12372 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
12373
12374         PR gold/11025
12375         * incremental-dump.cc (main): Use llu to print 64 bit values.
12376
12377 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
12378             H.J. Lu  <hongjiu.lu@intel.com>
12379
12380         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
12381         $(LIBDL).
12382         (incremental_dump_LDADD): Likewise.
12383         * Makefile.in: Regenerated.
12384
12385 2009-11-25  Doug Kwan  <dougkwan@google.com>
12386
12387         Revert:
12388
12389         2009-11-25  Doug Kwan  <dougkwan@google.com>
12390
12391                 * arm.cc (Target_arm::Target_arm): Move method definition
12392                 outside of class definition.  Add code to handle
12393                 --target1-rel, --target1-abs and --target2= options.
12394                 (Target_arm::get_reloc_reloc_type): Change method to be
12395                 non-static and const.
12396                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
12397                 New data member declaration.
12398                 (Target_arm::Scan::local, Target_arm::Scan::global,
12399                 Target_arm::Relocate::relocate,
12400                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
12401                 Adjust call to Target_arm::get_real_reloc_type.
12402                 (Target_arm::get_real_reloc_type): Use command line options
12403                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12404                 * options.h (--target1-rel, --target1-abs, --target2): New
12405                 ARM-only options.
12406
12407 2009-11-25  Doug Kwan  <dougkwan@google.com>
12408
12409         * arm.cc (Target_arm::Target_arm): Move method definition outside of
12410         class definition.  Add code to handle --target1-rel, --target1-abs
12411         and --target2= options.
12412         (Target_arm::get_reloc_reloc_type): Change method to be non-static
12413         and const.
12414         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
12415         member declaration.
12416         (Target_arm::Scan::local, Target_arm::Scan::global,
12417         Target_arm::Relocate::relocate,
12418         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
12419         call to Target_arm::get_real_reloc_type.
12420         (Target_arm::get_real_reloc_type): Use command line options to
12421         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
12422         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
12423         options.
12424
12425 2009-11-25  Doug Kwan  <dougkwan@google.com>
12426
12427         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
12428         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
12429         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
12430         formatting.
12431         (Arm_relocate_functions::thm_call): Replace body with a call to
12432         Arm_relocate_functions::thumb_branch_common.
12433         (Arm_relocate_functions::thm_jump24,
12434         Arm_relocate_functions::thm_xpc22): New method definitions.
12435         (Arm_relocate_functions::thumb_branch_common): New method definition.
12436         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
12437         operator.
12438         (Target_arm::Relocate::relocate): Adjust call to thm_call.
12439         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
12440
12441 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12442
12443         * Makefile.am: Build incremental-dump
12444         * Makefile.in: Regenerate.
12445         * incremental-dump.cc: New.
12446         * incremental.cc (Incremental_inputs_header_data,
12447         Incremental_inputs_entry_data): Move to incremental.h
12448         * incremental.h: (Incremental_inputs_header_data,
12449         Incremental_inputs_entry_data): Move from incremental.cc
12450
12451 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12452
12453         * incremental.cc (Incremental_inputs_header,
12454         Incremental_inputs_header_write, Incremental_inputs_entry,
12455         Incremental_inputs_entry_write): Add a typedef with the data type.
12456
12457 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
12458
12459         * incremental.cc (Incremental_inputs_header,
12460         Incremental_inputs_header_write, Incremental_inputs_entry,
12461         Incremental_inputs_entry_write): Update comment about which
12462         type has the filed descriptions.
12463
12464 2009-11-15  Doug Kwan  <dougkwan@google.com>
12465
12466         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
12467         (Arm_relocate_functions::arm_branch_common): Change method defintion
12468         in class definition to a method declaration and update list of formal
12469         parameters.
12470         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
12471         Arm_relocation_functions::jump24): Adjust call to
12472         Arm_relocate_functions::arm_branch_common.  Update list of formal
12473         parameters.
12474         (Arm_relocate_functions::xpc25): New method definition.
12475         (Arm_relocate_functions::arm_branch_common): Move method defintion
12476         out from class definition.  Use stubs for mode-switching and extending
12477         branch ranges.
12478         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
12479         specially.  Change code to enable use of stubs in ARM branches.
12480
12481 2009-11-10  Doug Kwan  <dougkwan@google.com>
12482
12483         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
12484         in method declaration.
12485         (Target_arm::relocate_stub): New method declaration.
12486         (Target_arm::default_target): Change to return a pointer instead of
12487         a const reference.
12488         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
12489         Target_arm::default_target.
12490         (Arm_Relobj::do_relocate_sections): Remove options paramater in
12491         method definition.
12492         (Target_arm::relocate_section): Adjust view.
12493         (Target_arm::relocate_stub): New method definition.
12494
12495 2009-11-10  Doug Kwan  <dougkwan@google.com>
12496
12497         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
12498         a format warning.
12499         * incremental.cc (open_incremental_binary): Initialized local
12500         variables to avoid warnings.
12501         * object.cc (make_elf_object): Ditto.
12502         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
12503         a format warning.
12504
12505 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
12506
12507         PR gold/10930
12508         * testsuite/plugin_test.c: Include "config.h".
12509
12510 2009-11-09  Doug Kwan  <dougkwan@google.com>
12511
12512         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
12513         (arm_symbol_value): Remove.
12514         (Arm_relocate_functions::arm_branch_common,
12515         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
12516         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
12517         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
12518         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
12519         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
12520         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
12521         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
12522         Arm_relocate_functions::thm_mobw_abs_nc,
12523         Arm_relocate_functions::thm_mov_abs,
12524         Arm_relocate_functions::movw_prel_nc,
12525         Arm_relocate_functions::thm_movt_abs,
12526         Arm_relocate_functions::movt_prel,
12527         Arm_relocate_functions::thm_movw_prel_nc,
12528         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
12529         (Target_arm::Relocate::relocate): Only decompose address into two
12530         parts if relocation type uses the thumb-bit and pass the actual
12531         bit instead of a flag indicating that the thumb-bit is used.  Adjust
12532         calls to methods in Arm_relocate_functions for this change.
12533
12534 2009-11-08  Ian Lance Taylor  <iant@google.com>
12535
12536         PR 10925
12537         * reloc.cc: Instantiate
12538         Sized_relobj::initialize_input_to_output_maps and
12539         Sized_relobj:free_input_to_output_maps.
12540
12541 2009-11-06  Ian Lance Taylor  <iant@google.com>
12542
12543         PR 10876
12544         * defstd.cc (in_segment): Set only_if_ref true for "end".
12545
12546 2009-11-06  Doug Kwan  <dougkwan@google.com>
12547
12548         * arm.cc (class Reloc_stub): Correct a comment.
12549         (Target_arm::Target_arm): Initialize arm_input_section_map_.
12550         (Target_arm::scan_section_for_stubs): New method declaration.
12551         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
12552         Change methods from private to protected.
12553         (Target_arm::do_may_relax): New method definition.
12554         (Target_arm::do_relax, Target_arm::group_sections,
12555         Target_arm::scan_reloc_for_stub,
12556         Target_arm::scan_reloc_section_for_stubs): New method declarations.
12557         (Target_arm::arm_input_section_map_): New data member declaration.
12558         (Target_arm::scan_reloc_for_stub,
12559         Target_arm::scan_reloc_section_for_stubs,
12560         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
12561         Target_arm::do_relax): New method definitions.
12562
12563 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
12564
12565         * configure.ac: Check for (struct stat)::st_mtim
12566         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
12567         * config.in: Regenerate.
12568         * configure: Regenerate.
12569
12570 2009-11-05  Ian Lance Taylor  <iant@google.com>
12571
12572         PR 10910
12573         * output.cc (Output_segment::add_output_section): Add missing
12574         return statement.
12575
12576 2009-11-04  Ian Lance Taylor  <iant@google.com>
12577
12578         PR 10880
12579         * object.h (class Object): Add is_needed and set_is_needed
12580         methods.  Add is_needed_ field.  Make bool fields into bitfields.
12581         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
12582         defined in a dynamic object and referenced by a regular object,
12583         set is_needed for the dynamic object.
12584         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
12585         if the file is marked with as_needed and it is not needed.
12586
12587 2009-11-04  Ian Lance Taylor  <iant@google.com>
12588
12589         PR 10887
12590         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
12591         tags if data is discarded by linker script.
12592         * i386.cc (Target_i386::do_finalize_sections): Likewise.
12593         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
12594         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
12595         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
12596
12597 2009-11-04  Ian Lance Taylor  <iant@google.com>
12598
12599         * layout.cc (Layout::get_output_section): Add is_interp and
12600         is_dynamic_linker_section parameters.  Change all callers.
12601         (Layout::choose_output_section): Likewise.
12602         (Layout::make_output_section): Likewise.
12603         (Layout::add_output_section_data): Add is_dynamic_linker_section
12604         parameter.  Change all callers.
12605         * layout.h (class Layout): Update declarations.
12606         * output.h (class Output_section): Add is_interp, set_is_interp,
12607         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
12608         Add is_interp_, is_dynamic_linker_section_ fields.  Change
12609         generate_code_fills_at_write_ to a bitfield.
12610         * output.cc (Output_section::Output_sections): Initialize new
12611         fields.
12612         (Output_segment::add_output_section): Add do_sort parameter.
12613         Change all callers.
12614
12615 2009-11-03  Ian Lance Taylor  <iant@google.com>
12616
12617         PR 10860
12618         * options.h (class General_options): Add --warn-common.
12619         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
12620         merging two common symbols.
12621         (Symbol_table::should_override): Handle --warn-common when merging
12622         a common symbol with a defined symbol.  Use report_resolve_problem
12623         for multiple definitions.
12624         (Symbol_table::report_resolve_problem): New function.
12625         * symtab.h (class Symbol_table): Declare report_resolve_problem.
12626
12627 2009-11-03  Doug Kwan  <dougkwan@google.com>
12628
12629         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
12630         stub_factory_.
12631         (Target_arm::stub_factory): New method definition.
12632         (Target_arm::new_arm_input_section,
12633         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
12634         Target_arm::reloc_uses_thumb_bit): New method declarations.
12635         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
12636         New type definitions.
12637         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
12638         member declarations.
12639         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
12640         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
12641         New method definitions.
12642
12643 2009-11-03  Ian Lance Taylor  <iant@google.com>
12644
12645         * options.h (class General_options): Add --warn_constructors.
12646
12647 2009-11-03  Ian Lance Taylor  <iant@google.com>
12648
12649         PR 10893
12650         * defstd.cc (in_section): Add entries for __rel_iplt_start,
12651         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
12652
12653 2009-11-03  Ian Lance Taylor  <iant@google.com>
12654
12655         PR 10895
12656         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
12657         --msgid-bugs-address.
12658         (install-pdf): New target.
12659         (install-data_yes): Look up one directory to find mkinstalldirs.
12660
12661 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
12662
12663         * po/Make-in (.po.gmo): Don't generate .gmo files in source
12664         tree.
12665
12666 2009-10-30  Doug Kwan  <dougkwan@google.com>
12667
12668         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
12669
12670 2009-10-30  Doug Kwan  <dougkwan@google.com>
12671
12672         * arm.cc (Stub_addend_reader): New struct template definition
12673         and partial specializations.
12674         (Stub_addend_reader::operator()): New method definition for a
12675         partially specialized template.
12676
12677 2009-10-30  Doug Kwan  <dougkwan@google.com>
12678
12679         * arm.cc (Arm_relobj::processor_specific_flags): New method
12680         definition.
12681         (Arm_relobj::do_read_symbols): New method declaration.
12682         (Arm_relobj::processor_specific_flags_): New data member declaration.
12683         (Arm_dynobj): New class definition.
12684         (Target_arm::do_finalize_sections): Add input_objects parameter.
12685         (Target_arm::do_adjust_elf_header): New method declaration.
12686         (Target_arm::are_eabi_versions_compatible,
12687         (Target_arm::merge_processor_specific_flags): New method declaration.
12688         (Target_arm::do_make_elf_object): New overloaded method definitions
12689         and declaration.
12690         (Arm_relobj::do_read_symbols): New method definition.
12691         (Arm_dynobj::do_read_symbols): Ditto.
12692         (Target_arm::do_finalize_sections): Add input_objects parameters.
12693         Merge processor-specific flags from all input objects.
12694         (Target_arm::are_eabi_versions_compatible,
12695         Target_arm::merge_processor_specific_flags,
12696         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
12697         New method definitions.
12698         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
12699         Input_objects pointer type parameter.
12700         * layout.cc (Layout::finalize): Pass input objects to target's.
12701         finalize_sections function.
12702         * output.cc (Output_file_header::do_sized_write): Set ELF file
12703         header's processor-specific flags.
12704         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
12705         Input_objects pointer type parameter.
12706         * sparc.cc (Target_sparc::do_finalize_sections): Same.
12707         * target.h (Input_objects): New forward class declaration.
12708         (Target::processor_specific_flags,
12709         Target::are_processor_specific_flags_sect): New method definitions.
12710         (Target::finalize_sections): Add input_objects parameter.
12711         (Target::Target): Initialize processor_specific_flags_ and
12712         are_processor_specific_flags_set_.
12713         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
12714         parameter.
12715         (Target::set_processor_specific_flags): New method definition.
12716         (Target::processor_specific_flags_,
12717         Target::are_processor_specific_flags_set_): New data member
12718         declarations.
12719         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
12720         Input_objects pointer type parameter.
12721
12722 2009-10-30  Doug Kwan  <dougkwan@google.com>
12723
12724         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
12725
12726 2009-10-28  Ian Lance Taylor  <iant@google.com>
12727
12728         * object.h (class Relobj): Drop options parameter from
12729         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
12730         do_scan_relocs, do_relocate.  Change all callers.
12731         (class Sized_relobj): Drop options parameters from
12732         do_gc_process_relocs, do_scan_relocs, do_relocate,
12733         do_relocate_sections, relocate_sections, emit_relocs_scan,
12734         emit_relocs_scan_reltype.  Change all callers.
12735         (struct Relocate_info): Remove options field and all references to
12736         it.
12737         * reloc.h (class Read_relocs): Remove options constructor
12738         parameter and options_ field.  Change all callers.
12739         (class Gc_process_relocs, class Scan_relocs): Likewise.
12740         (class Relocate_task): Likewise.
12741         * target-reloc.h (scan_relocs): Remove options parameter.  Change
12742         all callers.
12743         (scan_relocatable_relocs): Likewise.
12744         * target.h (class Sized_target): Remove options parameter from
12745         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
12746         all callers.
12747         * gc.h (gc_process_relocs): Remove options parameter.  Change all
12748         callers.
12749         * arm.cc: Update functions to remove options parameters.
12750         * i386.cc: Likewise.
12751         * powerpc.cc: Likewise.
12752         * sparc.cc: Likewise.
12753         * x86_64.cc: Likewise.
12754         * testsuite/testfile.cc: Likewise.
12755
12756 2009-10-28  Doug Kwan  <dougkwan@google.com>
12757
12758         * arm.cc (Arm_relobj): New class definition.
12759         (Arm_relobj::scan_sections_for_stubs,
12760         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
12761         New method definitions.
12762
12763 2009-10-28  Cary Coutant  <ccoutant@google.com>
12764
12765         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
12766         (Plugin::cleanup_done_): New member.
12767         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
12768         (Plugin_manager::cleanup_done_): Remove.
12769         (Plugin_manager::add_input_file): Edit error message.
12770         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
12771         (Plugin_manager::cleanup): Remove use of cleanup_done_.
12772
12773 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
12774
12775         * fileread.cc: (File_read::View::~View): Use the new
12776         data_ownership_ filed.
12777         (File_read::~File_read): Dispose the new whole_file_view_.
12778         (File_read::open): Mmap the whole file if needed.
12779         (File_read::open): Use whole_file_view_ instead of contents_.
12780         (File_read::find_view): Use whole_file_view_ if applicable.
12781         (File_read::do_read): Use whole_file_view_ instead of contents_.
12782         (File_read::make_view): Use whole_file_view_ instead of contents_,
12783         update File_read::View::View call.
12784         (File_read::find_or_make_view): Update File_read::View::View
12785         call.
12786         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
12787         remove contents_
12788         (File_read::View::Data_ownership): New enum.
12789         (File_read::View::View): Replace bool mapped_ with Data_ownership
12790         argument.
12791         (File_read::View::mapped_): Remove (replaced by data_ownership_).
12792         (File_read::View::data_ownership_): New field.
12793         (File_read::contents_): Remove (replaced by whole_file_view_).
12794         (File_read::whole_file_view_): New field.
12795         * options.h (class General_options): Add --keep-files-mapped.
12796
12797 2009-10-27  Cary Coutant  <ccoutant@google.com>
12798
12799         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
12800         * testsuite/Makefile.am (plugin_test_5): New test case.
12801         * testsuite/Makefile.in: Regenerate.
12802
12803 2009-10-25  Doug Kwan  <dougkwan@google.com>
12804
12805         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
12806         from private to protected to allow access by child class.
12807         (Sized_relobj::do_relocate_sections): New method declaration.
12808         (Sized_relobj::relocate_sections): Virtualize.
12809         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
12810         Sized_relobj::relocate_sections.  Instantiate template explicitly
12811         for different target sizes and endianity.
12812
12813 2009-10-24  Doug Kwan  <dougkwan@google.com>
12814
12815         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
12816         (Arm_input_section::as_arm_input_section): New method.
12817         (Arm_output_section): New class definition.
12818         (Arm_output_section::create_stub_group,
12819         Arm_output_section::group_sections): New method definitions.
12820
12821 2009-10-22  Doug Kwan  <dougkwan@google.com>
12822
12823         * arm.cc (Arm_input_section): New class definition.
12824         (Arm_input_section::init, Arm_input_section:do_write,
12825         Arm_input_section::set_final_data_size,
12826         Arm_input_section::do_reset_address_and_file_offset): New method
12827         definitions.
12828
12829 2009-10-21  Doug Kwan  <dougkwan@google.com>
12830
12831         * arm.cc (Stub_table, Arm_input_section): New forward class
12832         declarations.
12833         (Stub_table): New class defintion.
12834         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
12835         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
12836         New method definition.
12837
12838 2009-10-21  Doug Kwan  <dougkwan@google.com>
12839
12840         * arm.cc: Update copyright comments.
12841         (Target_arm): New forward class template declaration.
12842         (Arm_address): New type.
12843         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
12844         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
12845         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
12846         constants.
12847         (Insn_template): Same.
12848         (DEF_STUBS): New macro.
12849         (Stub_type): New enum type.
12850         (Stub_template): New class definition.
12851         (Stub): Same.
12852         (Reloc_stub): Same.
12853         (Stub_factory): Same.
12854         (Target_arm::Target_arm): Initialize may_use_blx_ and
12855         should_force_pic_veneer_.
12856         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
12857         Target_arm::should_force_pic_veneer,
12858         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
12859         Target_arm::using_thumb_only, Target_arm:;default_target): New
12860         method defintions.
12861         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
12862         New data member declarations.
12863         (Insn_template::size, Insn_template::alignment): New method defintions.
12864         (Stub_template::Stub_template): New method definition.
12865         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
12866         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
12867         (Stub_factory::Stub_factory): New method definition.
12868         * gold.h (string_hash): New template.
12869         * output.h (Input_section_specifier::hash_value): Use
12870         gold::string_hash.
12871         (Input_section_specifier::string_hash): Remove.
12872         * stringpool.cc (Stringpool_template::string_hash): Use
12873         gold::string_hash.
12874
12875 2009-10-20  Doug Kwan  <dougkwan@google.com>
12876
12877         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
12878         symbols of relaxed input sections.
12879         * output.h (Output_section::find_relaxed_input_section): Make
12880         method public.
12881
12882 2009-10-16  Doug Kwan  <dougkwan@google.com>
12883
12884         * dynobj.cc (Versions::Versions): Initialize version_script_.
12885         Only insert base version symbol definition for a shared object
12886         if version script defines any version versions.
12887         (Versions::define_base_version): New method definition.
12888         (Versions::add_def): Check that base version is not needed.
12889         (Versions::add_need): Define base version lazily.
12890         * dynobj.h (Versions::define_base_version): New method declaration.
12891         (Versions::needs_base_version_): New data member declaration.
12892         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
12893         (check_DATA): Add no_version_test.stdout.
12894         (libno_version_test.so, no_version_test.o no_version_test.stdout):
12895         New make rules.
12896         * testsuite/Makefile.in: Regenerate.
12897         * testsuite/no_version_test.c: New file.
12898         * testsuite/no_version_test.sh: Ditto.
12899
12900 2009-10-16  Doug Kwan  <dougkwan@google.com>
12901
12902         * expression.cc (class Segment_start_expression): New class definition.
12903         (Segment_start_expression::value): New method definition.
12904         (script_exp_function_segment_start): Return a new
12905         Segment_start_expression.
12906         * gold/script-c.h (script_saw_segment_start_expression): New function
12907         prototype.
12908         * script-sections.cc (Script_sections::Script_sections): Initialize
12909         SAW_SEGMENT_START_EXPRESSION_ to false.
12910         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
12911         and -Tbbs options to specify section addresses if given in
12912         command line and no SEGMENT_START expression is seen in a script.
12913         * script-sections.h (Script_sections::saw_segment_start_expression,
12914         Script_sections::set_saw_segment_start_expression): New method
12915         definition.
12916         (Script_sections::saw_segment_start_expression_): New data member
12917         declaration.
12918         * script.cc (script_saw_segment_start_expression): New function.
12919         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
12920         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
12921         script_test_7.sh and script_test_8.sh.
12922         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
12923         script_test_8.stdout.
12924         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
12925         (script_test_6, script_test_6.stdout, script_test_7,
12926         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
12927         * Makefile.in: Regenerate.
12928         * testsuite/script_test_6.sh: New file.
12929         * testsuite/script_test_6.t: Same.
12930         * testsuite/script_test_7.sh: Same.
12931         * testsuite/script_test_7.t: Same.
12932         * testsuite/script_test_8.sh: Same.
12933
12934 2009-10-16  Doug Kwan  <dougkwan@google.com>
12935
12936         * output.cc (Output_segment::set_section_list_address): Cast
12937         expressions to unsigned long long type to avoid format warnings.
12938
12939 2009-10-15  Ian Lance Taylor  <iant@google.com>
12940
12941         * script.cc (Script_options::add_symbol_assignment): Always add a
12942         dot assignment to script_sections_.
12943         * script-sections.cc (Script_sections::add_dot_assignment):
12944         Initialize if necessary.
12945
12946         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
12947         program headers with no load segment if there is a linker script.
12948
12949         * layout.cc (Layout::set_segment_offsets): Align the file offset
12950         to the segment aligment for -N or -n with no load segment.
12951         * output.cc (Output_segment::add_output_section): Don't crash if
12952         the first section is a TLS section.
12953         (Output_segment::set_section_list_addresses): Print an error
12954         message if the address moves backward in a linker script.
12955         * script-sections.cc
12956         (Output_section_element_input::set_section_addresses): Don't
12957         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
12958         (Orphan_output_section::set_section_addresses): Likewise.
12959
12960 2009-10-15  Doug Kwan  <dougkwan@google.com>
12961
12962         * layout.cc (Layout::finish_dynamic_section): Generate tags
12963         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
12964         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
12965         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
12966
12967 2009-10-14  Ian Lance Taylor  <iant@google.com>
12968
12969         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
12970         fields.
12971         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
12972         data_shdr fields of relinfo.
12973         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
12974         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
12975         R_386_TLS_LDO_32, adjust based on section flags.
12976         (Target_i386::Relocate::fix_up_ldo): Remove.
12977
12978 2009-10-13  Ian Lance Taylor  <iant@google.com>
12979
12980         Add support for -pie.
12981         * options.h (class General_options): Add -pie and
12982         --pic-executable.
12983         (General_options::output_is_position_independent): Test -pie.
12984         (General_options::output_is_executable): Return true if not shared
12985         and not relocatable.
12986         (General_options::output_is_pie): Remove.
12987         * options.cc (General_options::finalize): Reject incompatible uses
12988         of -pie.
12989         * gold.cc (queue_middle_tasks): A -pie link is not static.
12990         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
12991         * symtab.cc (Symbol::final_value_is_known): Return false if
12992         output_is_position_independent.
12993         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
12994         output_is_position_independent.
12995         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
12996         output_is_position_independent.
12997         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
12998         output_is_position_independent.
12999         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
13000         two_file_pie_test.
13001         (basic_pie_test.o, basic_pie_test): New targets.
13002         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
13003         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
13004         (two_file_pie_test): New target.
13005         * testsuite/Makefile.in: Rebuild.
13006         * README: Remove note saying that -pie is not supported.
13007
13008 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
13009
13010         * options.h (class General_options): Add -init and -fini.
13011         * layout.cc (Layout::finish_dynamic_section): Emit
13012         given init and fini functions.
13013
13014 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
13015
13016         * gc.h (gc_process_relocs): Check if icf is enabled using new
13017         function.
13018         * gold.cc (queue_initial_tasks): Likewise.
13019         (queue_middle_tasks): Likewise.
13020         * object.cc (do_layout): Likewise.
13021         * symtab.cc (is_section_folded): Likewise.
13022         * main.cc (main): Likewise.
13023         * reloc.cc (Read_relocs::run): Likewise.
13024         (Sized_relobj::do_scan_relocs): Likewise.
13025         * icf.cc (is_function_ctor_or_dtor): New function.
13026         (Icf::find_identical_sections): Check if function is ctor or dtor when
13027         safe icf is chosen.
13028         * options.h (General_options::icf): Change option to be an enum.
13029         (Icf_status): New enum.
13030         (icf_enabled): New method.
13031         (icf_safe_folding): New method.
13032         (set_icf_status): New method.
13033         (icf_status_): New variable.
13034         * (options.cc) (General_options::finalize): Set icf_status_.
13035         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
13036         icf_test and icf_keep_unique_test to use the --icf enum flag.
13037         * testsuite/icf_safe_test.sh: New file.
13038         * testsuite/icf_safe_test.cc: New file.
13039
13040 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
13041
13042         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
13043         includes to gc.h and icf.h.
13044         * arm.cc: Include gc.h.
13045         * gold.cc: Likewise.
13046         * i386.cc: Likewise.
13047         * powerpc.cc: Likewise.
13048         * sparc.cc: Likewise.
13049         * x86_64.cc: Likewise.
13050         * gc.h: Include icf.h.
13051
13052 2009-10-11  Ian Lance Taylor  <iant@google.com>
13053
13054         * plugin.cc: Include "gold.h" before other header files.
13055
13056 2009-10-10  Chris Demetriou  <cgd@google.com>
13057
13058         * options.h (Input_file_argument::Input_file_type): New enum.
13059         (Input_file_argument::is_lib_): Replace with...
13060         (Input_file_argument::type_): New member.
13061         (Input_file_argument::Input_file_argument): Take Input_file_type
13062         'type' rather than boolean 'is_lib' as second argument.
13063         (Input_file_argument::is_lib): Use type_.
13064         (Input_file_argument::is_searched_file): New function.
13065         (Input_file_argument::may_need_search): Handle is_searched_file.
13066         * options.cc (General_options::parse_library): Support -l:filename.
13067         (General_options::parse_just_symbols): Update for Input_file_argument
13068         changes.
13069         (Command_line::process): Likewise.
13070         * archive.cc (Archive::get_file_and_offset): Likewise.
13071         * plugin.cc (Plugin_manager::release_input_file): Likewise.
13072         * script.cc (read_script_file, script_add_file): Likewise.
13073         * fileread.cc (Input_file::Input_file): Likewise.
13074         (Input_file::will_search_for): Handle is_searched_file.
13075         (Input_file::open): Likewise.
13076         * readsyms.cc (Read_symbols::get_name): Likewise.
13077         * testsuite/Makefile.am (searched_file_test): New test.
13078         * testsuite/Makefile.in: Regenerate.
13079         * testsuite/searched_file_test.cc: New file.
13080         * testsuite/searched_file_test_lib.cc: New file.
13081
13082 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13083             Ian Lance Taylor  <iant@google.com>
13084
13085         * descriptor.cc: Include <cstdio> and "binary-io.h".
13086         (Descriptors::open): Open the files in binary mode always.
13087         * script.cc (Lex::get_token): Treat \r as whitespace.
13088
13089 2009-10-09  Ian Lance Taylor  <iant@google.com>
13090
13091         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
13092
13093 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13094             Ian Lance Taylor  <iant@google.com>
13095
13096         * configure.ac: Check for readv function also.
13097         * fileread.cc (readv): Define if not HAVE_READV.
13098         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
13099         does not exist.
13100         * config.in: Regenerate.
13101         * configure: Regenerate.
13102
13103 2009-10-09  Doug Kwan  <dougkwan@google.com>
13104
13105         * layout.cc (Layout::make_output_section): Call target hook to make
13106         ordinary output section.
13107         (Layout::finalize): Adjust parameter list of call the
13108         Target::may_relax().
13109         * layout.h (class Layout::section_list): New method.
13110         * merge.h (Output_merge_base::entsize): Change visibility to public.
13111         (Output_merge_base::is_string, Output_merge_base::do_is_string):
13112         New methods.
13113         (Output_merge_string::do_is_string): New method.
13114         * object.cc (Sized_relobj::do_setup): renamed from
13115         Sized_relobj::set_up.
13116         * object.h (Sized_relobj::adjust_shndx,
13117         Sized_relobj::initializ_input_to_output_maps,
13118         Sized_relobj::free_input_to_output_maps): Change visibilities to
13119         protected.
13120         (Sized_relobj::setup): Virtualize.
13121         (Sized_relobj::do_setup): New method declaration.
13122         (Sized_relobj::invalidate_section_offset,
13123         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
13124         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
13125         * options.cc (parse_int): New function.
13126         * options.h (parse_int): New declaration.
13127         (DEFINE_int): New macro.
13128         (stub_group_size): New option.
13129         * output.cc (Output_section::Output_section): Initialize memebers
13130         merge_section_map_, merge_section_by_properties_map_,
13131         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
13132         (Output_section::add_input_section): Handled deferred code-fill
13133         generation and remove an old comment.
13134         (Output_section::add_relaxed_input_section): New method definition.
13135         (Output_section::add_merge_input_section): Use merge section by
13136         properties map to speed to search.  Update merge section maps
13137         as appropriate.
13138         (Output_section::build_relaxation_map): New method definition.
13139         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
13140         Same.
13141         (Output_section::relax_input_section): Renamed to
13142         Output_section::convert_input_sections_to_relaxed_sections and change
13143         interface to take a vector of pointers to relaxed sections.
13144         (Output_section::find_merge_section,
13145         Output_section::find_relaxed_input_section): New method definitions.
13146         (Output_section::is_input_address_mapped,
13147         Output_section::output_offset, Output_section::output_address):
13148         Use output section data maps to speed up searching.
13149         (Output_section::find_starting_output_address): Add comments.
13150         (Output_section::do_write,
13151         Output_section::write_to_postprocessing_buffer): Do code-fill
13152         generation as appropriate.
13153         (Output_section::get_input_sections): Invalidate relaxed input section
13154         map.
13155         (Output_section::restore_states): Adjust type of checkpoint .
13156         Invalidate relaxed input section map.
13157         * output.h (Output_merge_base): New class declaration.
13158         (Input_section_specifier): New class defintion.
13159         (class Output_relaxed_input_section) Change base class to
13160         Output_section_data_build.
13161         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
13162         base class initializer.
13163         (Output_section::add_relaxed_input_section): New method declaration.
13164         (Output_section::Input_section): Change visibility to protected.
13165         (Output_section::Input_section::relobj,
13166         Output_section::Input_section::shndx): Handle relaxed input sections.
13167         Output_section::input_sections) Change visibility to protected.  Also
13168         define overload to return a non-const pointer.
13169         (Output_section::Merge_section_properties): New class defintion.
13170         (Output_section::Merge_section_by_properties_map,
13171         Output_section::Output_section_data_by_input_section_map,
13172         Output_section::Relaxation_map): New types.
13173         (Output_section::relax_input_section): Rename method to
13174         Output_section::convert_input_sections_to_relaxed_sections and change
13175         interface to take a vector of relaxed section pointers.
13176         (Output_section::find_merge_section,
13177         Output_section::find_relaxed_input_section,
13178         Output_section::build_relaxation_map,
13179         Output_section::convert_input_sections_in_list_to_relaxed_sections):
13180         New method declarations.
13181         (Output_section::merge_section_map_
13182         Output_section::merge_section_by_properties_map_,
13183         Output_section::relaxed_input_section_map_,
13184         Output_section::is_relaxed_input_section_map_valid_,
13185         Output_section::generate_code_fills_at_write_): New data members.
13186         * script-sections.cc
13187         (Output_section_element_input::set_section_addresses): Call
13188         current_data_size and addralign methods of relaxed input sections.
13189         (Orphan_output_section::set_section_addresses): Call current_data_size
13190         and addralign methods of relaxed input sections.
13191         * symtab.cc (Symbol_table::compute_final_value): Extract template
13192         from the body of Symbol_table::sized_finalize_symbol.
13193         (Symbol_table::sized_finalized_symbol): Call
13194         Symbol_table::compute_final_value.
13195         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
13196         (Symbol_table::compute_final_value): New templated method declaration.
13197         * target.cc (Target::do_make_output_section): New method defintion.
13198         * target.h (Target::make_output_section): New method declaration.
13199         (Target::relax): Add more parameters for input objects, symbol table
13200         and layout.  Adjust call to do_relax.
13201         (Target::do_make_output_section): New method declaration.
13202         (Target::do_relax): Add parameters for input objects, symbol table
13203         and layout.
13204
13205 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13206
13207         * pread.c: Include stdio.h.
13208
13209 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13210
13211         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
13212         defined.
13213
13214 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
13215
13216         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
13217         Change read_shndx type to unsigned int.
13218         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13219         int.
13220         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13221         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
13222         Change read_shndx type to unsigned int.
13223         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
13224         int.
13225         (Sized_dwarf_line_info::read_line_mappings): Likewise.
13226         * layout.cc (Layout::create_symtab_sections): Cast the result of
13227         local_symcount * symsize to off_t in the gold_assert.
13228
13229 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13230
13231         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
13232         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
13233         R_ARM_BASE_ABS.
13234         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
13235         (Arm_relocate_functions::thm_abs5): New function.
13236         (Arm_relocate_functions::abs12): New function.
13237         (Arm_relocate_functions::abs16): New function.
13238         (Arm_relocate_functions::base_abs): New function.
13239         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
13240         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
13241         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
13242         R_ARM_BASE_ABS.
13243         (Scan::global): Likewise.
13244         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
13245         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
13246         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
13247         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
13248         R_ARM_BASE_ABS.
13249
13250 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13251
13252         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
13253         (Arm_relocate_functions::movt_prel): New function.
13254         (Arm_relocate_functions::thm_movw_prel_nc): New function.
13255         (Arm_relocate_functions::thm_movt_prel): New function.
13256         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
13257         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
13258         (Scan::global, Relocate::relocate): Likewise.
13259         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13260
13261 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13262
13263         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
13264         Incremental_checker.
13265         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
13266         unsigned int.
13267         (class Incremental_inputs_header): New class.
13268         (Incremental_inputs_header_writer): Edit comment.
13269         (Incremental_inputs_entry): New class.
13270         (Incremental_inputs_entry_writer): Edit comment.
13271         (Sized_incremental_binary::do_find_incremental_inputs_section):
13272         Add *strtab_shndx parameter, fill it.
13273         (Sized_incremental_binary::do_check_inputs): New method.
13274         (Incremental_checker::can_incrementally_link_output_file): Use
13275         Sized_incremental_binary::check_inputs.
13276         (Incremental_inputs::report_command_line): Save command line in
13277         command_line_.
13278         * incremental.h:
13279         (Incremental_binary::find_incremental_inputs_section): New
13280         method.
13281         (Incremental_binary::do_find_incremental_inputs_section): Add
13282         strtab_shndx parameter.
13283         (Incremental_binary::do_check_inputs): New pure virtual method.
13284         (Sized_incremental_binary::do_check_inputs): Declare.
13285         (Incremental_checker::Incremental_checker): Add incremental_inputs
13286         parameter, use it to initialize incremental_inputs_.
13287         (Incremental_checker::incremental_inputs_): New field.
13288         (Incremental_checker::command_line): New method.
13289         (Incremental_checker::inputs): New method.
13290         (Incremental_checker::command_line_): New field.
13291
13292 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
13293
13294         * incremental.cc: Include <cstdarg> and "target-select.h".
13295         (vexplain_no_incremental): New function.
13296         (explain_no_incremental): New function.
13297         (Incremental_binary::error): New method.
13298         (Sized_incremental_binary::do_find_incremental_inputs_section): New
13299         method.
13300         (make_sized_incremental_binary): New function.
13301         (open_incremental_binary): New function.
13302         (can_incrementally_link_file): Add checks if output is ELF and has
13303         inputs section.
13304         * incremental.h: Include "elfcpp_file.h" and "output.h".
13305         (Incremental_binary): New class.
13306         (Sized_incremental_binary): New class.
13307         (open_incremental_binary): Declare.
13308         * object.cc (is_elf_object): Use
13309         elfcpp::Elf_recognizer::is_elf_file.
13310         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
13311         * output.h (Output_file::filesize): New method.
13312
13313 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13314
13315         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
13316         New function.
13317         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
13318         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
13319         function.
13320         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
13321         function.
13322         (Arm_relocate_functions::movw_abs_nc): New function.
13323         (Arm_relocate_functions::movt_abs): New function.
13324         (Arm_relocate_functions::thm_movw_abs_nc): New function.
13325         (Arm_relocate_functions::thm_movt_abs): New function.
13326         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
13327         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
13328         (Scan::global): Likewise.
13329         (Relocate::relocate): Likewise.
13330         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13331
13332 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13333
13334         * arm.cc (Arm_relocate_functions::got_prel) New function.
13335         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
13336         (Relocate::relocate): Likewise.
13337         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
13338
13339 2009-10-06  Ian Lance Taylor  <iant@google.com>
13340
13341         * options.h (class General_options): Define
13342         split_stack_adjust_size parameter.
13343         * object.h (class Object): Add uses_split_stack_ and
13344         has_no_split_stack_ fields.  Add uses_split_stack and
13345         has_no_split_stack accessor functions.  Declare
13346         handle_split_stack_section.
13347         (class Reloc_symbol_changes): Define.
13348         (class Sized_relobj): Define Function_offsets.  Declare
13349         split_stack_adjust, split_stack_adjust_reltype, and
13350         find_functions.
13351         * object.cc (Object::handle_split_stack_section): New function.
13352         (Sized_relobj::do_layout): Call handle_split_stack_section.
13353         * dynobj.cc (Sized_dynobj::do_layout): Call
13354         handle_split_stack_section.
13355         * reloc.cc (Sized_relobj::relocate_sections): Call
13356         split_stack_adjust for executable sections in split_stack
13357         objects.  Pass reloc_map to relocate_section.
13358         (Sized_relobj::split_stack_adjust): New function.
13359         (Sized_relobj::split_stack_adjust_reltype): New function.
13360         (Sized_relobj::find_functions): New function.
13361         * target-reloc.h: Include "object.h".
13362         (relocate_section): Add reloc_symbol_changes parameter.  Change
13363         all callers.
13364         * target.h (class Target): Add calls_non_split method.  Declare
13365         do_calls_non_split virtual method.  Declare match_view and
13366         set_view_to_nop.
13367         * target.cc: Include "elfcpp.h".
13368         (Target::do_calls_non_split): New function.
13369         (Target::match_view): New function.
13370         (Target::set_view_to_nop): New function.
13371         * gold.cc (queue_middle_tasks): Give an error if mixing
13372         split-stack and non-split-stack objects with -r.
13373         * i386.cc (Target_i386::relocate_section): Add
13374         reloc_symbol_changes parameter.
13375         (Target_i386::do_calls_non_split): New function.
13376         * x86_64.cc (Target_x86_64::relocate_section): Add
13377         reloc_symbol_changes parameter.
13378         (Target_x86_64::do_calls_non_split): New function.
13379         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
13380         parameter.
13381         * powerpc.cc (Target_powerpc::relocate_section): Add
13382         reloc_symbol_changes parameter.
13383         * sparc.cc (Target_sparc::relocate_section): Add
13384         reloc_symbol_changes parameter.
13385         * configure.ac: Call AM_CONDITIONAL for the default target.
13386         * configure: Rebuild.
13387         * testsuite/Makefile.am (TEST_AS): New variable.
13388         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
13389         (check_DATA): Add split_i386 and split_x86_64 files.
13390         (SPLIT_DEFSYMS): Define.
13391         (split_i386_[1234n].o): New targets.
13392         (split_i386_[124]): New targets.
13393         (split_i386_[1234r].stdout): New targets.
13394         (split_x86_64_[1234n].o): New targets.
13395         (split_x86_64_[124]): New targets.
13396         (split_x86_64_[1234r].stdout): New targets.
13397         (MOSTLYCLEANFILES): Add new executables.
13398         * testsuite/split_i386.sh: New file.
13399         * testsuite/split_x86_64.sh: New file.
13400         * testsuite/split_i386_1.s: New file.
13401         * testsuite/split_i386_2.s: New file.
13402         * testsuite/split_i386_3.s: New file.
13403         * testsuite/split_i386_4.s: New file.
13404         * testsuite/split_i386_n.s: New file.
13405         * testsuite/split_x86_64_1.s: New file.
13406         * testsuite/split_x86_64_2.s: New file.
13407         * testsuite/split_x86_64_3.s: New file.
13408         * testsuite/split_x86_64_4.s: New file.
13409         * testsuite/split_x86_64_n.s: New file.
13410         * testsuite/testfile.cc (Target_test): Update relocation_section
13411         function.
13412         * testsuite/Makefile.in: Rebuild.
13413
13414 2009-10-06  Ian Lance Taylor  <iant@google.com>
13415
13416         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
13417         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
13418         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
13419         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
13420         the address on ldo_addrs_.
13421         (Target_i386::Relocate::fix_up_ldo): New function.
13422
13423 2009-10-06   Rafael Espindola  <espindola@google.com>
13424
13425         * plugin.cc (add_input_library): New.
13426         (Plugin::load): Add add_input_library to tv.
13427         (Plugin_manager::add_input_file): Add the is_lib argument.
13428         (add_input_file): Update call to Plugin_manager::add_input_file.
13429         (add_input_library): New.
13430         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
13431
13432 2009-09-30  Doug Kwan  <dougkwan@google.com>
13433
13434         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
13435         symbol and call Symbol::may_need_copy_reloc to determine if
13436         a copy reloc is needed.
13437         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
13438         nocopyreloc is given in command line.
13439         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
13440         given in command line.
13441         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
13442         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
13443         of the removed Target_i386::may_need_copy_reloc.
13444         * options.h (copyreloc): New option with default value false.
13445         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13446         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
13447         instead of the removed Target_powerpc::may_need_copy_reloc.
13448         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
13449         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
13450         instead of the removed Target_sparc::may_need_copy_reloc.
13451         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
13452         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
13453         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
13454         instead of the removed Target_x86_64::may_need_copy_reloc.
13455
13456 2009-09-30  Ian Lance Taylor  <iant@google.com>
13457
13458         * object.h (class Object): Remove target_ field, and target,
13459         sized_target, and set_target methods.
13460         (Object::sized_target): Remove.
13461         (class Sized_relobj): Update declarations.  Remove sized_target.
13462         * object.cc (Sized_relobj::setup): Remove target parameter.
13463         Change all callers.
13464         (Input_objects::add_object): Don't do anything with the target.
13465         (make_elf_sized_object): Add punconfigured parameter.  Change all
13466         callers.  Set or test parameter target.
13467         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
13468         Change all callers.
13469         * parameters.cc (Parameters::set_target): Change parameter type to
13470         be non-const.
13471         (Parameters::default_target): Remove.
13472         (set_parameters_target): Change parameter type to be non-const.
13473         (parameters_force_valid_target): New function.
13474         (parameters_clear_target): New function.
13475         * parameters.h (class Parameters): Update declarations.  Remove
13476         default_target method.  Add sized_target and clear_target
13477         methods.  Change target_ to be non-const.
13478         (set_parameters_target): Update declaration.
13479         (parameters_force_valid_target): Declare.
13480         (parameters_clear_target): Declare.
13481         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
13482         as NULL if we aren't searching.
13483         (Add_symbols::run): Don't check for compatible target.
13484         * fileread.cc (Input_file::open_binary): Call
13485         parameters_force_valid_target.
13486         * gold.cc (queue_middle_tasks): Likewise.
13487         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
13488         set_target on object.
13489         * dynobj.h (class Sized_dynobj): Update declarations.
13490         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
13491         make_elf_object returns NULL.
13492         (Archive::include_member): Don't check whether object target is
13493         compatible.
13494         * output.cc (Output_section::add_input_section): Get target from
13495         parameters.
13496         (Output_section::relax_input_section): Likewise.
13497         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
13498         parameters.
13499         (Sized_relobj::do_scan_relocs): Likewise.
13500         (Sized_relobj::relocate_sections): Likewise.
13501         * resolve.cc (Symbol_table::resolve): Likewise.
13502         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
13503         parameter.  Change all callers.
13504         (Symbol_table::add_from_object): Get target from parameters.
13505         (Symbol_table::add_from_relobj): Don't check object target.
13506         (Symbol_table::add_from_dynobj): Likewise.
13507         (Symbol_table::define_special_symbol): Get target from
13508         parameters.
13509         * symtab.h (class Symbol_table): Update declaration.
13510         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
13511         parameter.  Change all callers.  Clear parameter target.
13512         (Binary_test): Test target here.
13513         * testsuite/object_unittest.cc (gold_testsuite): Remove
13514         target_test_pointer parameter.  Change all callers.
13515         (Object_test): Test target here.
13516
13517 2009-09-26  Ian Lance Taylor  <iant@google.com>
13518
13519         * testsuite/initpri1.c: Don't try to use constructor priorities if
13520         compiling with gcc before 4.3.
13521
13522 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
13523
13524         * testsuite/retain_symbols_file_test.sh (check_present): Change
13525         output file name to retain_symbols_file_test.stdout.
13526         (check_absent): Likewise.
13527
13528 2009-09-18  Craig Silverstein  <csilvers@google.com>
13529
13530         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
13531         * options.cc: Include <cerrno> and <fstream>.
13532         (General_options::finalize): Parse -retain-symbols-file tag.
13533         * options.h: New flag.
13534         (General_options): New method should_retain_symbol, new
13535         variable symbols_to_retain.
13536         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
13537         should_retain_symbol map.
13538         * testsuite/Makefile.am (retain_symbols_file_test): New test.
13539         * testsuite/Makefile.in: Regenerate.
13540         * testsuite/retain_symbols_file_test.sh: New file.
13541
13542 2009-09-18  Nick Clifton  <nickc@redhat.com>
13543
13544         * po/es.po: Updated Spanish translation.
13545
13546 2009-09-17  Doug Kwan  <dougkwan@google.com>
13547
13548         * debug.h (DEBUG_RELAXATION): New constant.
13549         (DEBUG_ALL): Add DEBUG_RELAXATION.
13550         (debug_string_to_enum): Add relaxation debug option.
13551         * layout.cc
13552         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
13553         Layout::Relaxation_debug_check::read_sections,
13554         Layout::Relaxation_debug_check::read_sections): New method definitions.
13555         (Layout::Layout): Initialize data members
13556         record_output_section_data_from_scrips_,
13557         script_output_section_data_list_ and relaxation_debug_check_.
13558         (Layout::save_segments, Layout::restore_segments,
13559         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13560         Layout::relaxation_loop_body): New method definitions.
13561         (Layout::finalize): Support relaxation.  Move section layout code to
13562         Layout::relaxation_loop_body.
13563         (Layout::set_asection_address_from_script): Move code for orphan
13564         section placement out.
13565         (Layout::place_orphan_sections_in_script): New method definition.
13566         * layout.h (Output_segment_headers, Output_file_header):
13567         New forward class declarations.
13568         (Layout::~Layout): Define.
13569         (Layout::new_output_section_data_from_script): New method definition.
13570         (Layout::place_orphan_sections_in_script): New method declaration.
13571         (Layout::Segment_states): New type declaration.
13572         (Layout::save_segments, Layout::restore_segments,
13573         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
13574         Layout::relaxation_loop_body): New method declarations.
13575         (Layout::Output_section_data_list): New type declaration.
13576         (Layout::Relaxation_debug_check): New class definition.
13577         (Layout::record_output_section_data_from_script_,
13578         Layout::script_output_section_data_list_, Layout::segment_states_,
13579         Layout::relaxation_debug_check_): New data members.
13580         * output.cc: (Output_section_headers::do_size): New method definition.
13581         (Output_section_headers::Output_section_headers): Move size
13582         computation to Output_section_headers::do_size.
13583         (Output_segment_headers::do_size): New method definition.
13584         (Output_file_header::Output_file_header): Move size computation to
13585         Output_file_header::do_size and call it.
13586         (Output_file_header::do_size): New method definition.
13587         (Output_data_group::Output_data_group): Adjust call to
13588         Output_section_data.
13589         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
13590         (Output_symtab_xindex::do_write): Add array bound check.
13591         (Output_section::Input_section::print_to_mapfile): Handle
13592         RELAXED_INPUT_SECTION_CODE.
13593         (Output_section::Output_section): Initialize data member checkpoint_.
13594         (Output_section::~Output_section): Delete checkpoint object pointed
13595         by checkpoint_.
13596         (Output_section::add_input_section): Always add an Input_section if
13597         relaxing.
13598         (Output_section::add_merge_input_section): Add assert.
13599         (Output_section::relax_input_section): New method definition.
13600         (Output_section::set_final_data_size): Set load address to zero for
13601         an unallocated section.
13602         (Output_section::do_address_and_file_offset_have_reset_values):
13603         New method definition.
13604         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
13605         Handle relaxed input section.
13606         (Output_section::sort_attached_input_sections): Checkpoint input
13607         section list lazily.
13608         (Output_section::get_input_sections): Change type of input_sections to
13609         list of Simple_input_section pointers.  Checkpoint input section list
13610         lazily.  Also handle relaxed input sections.
13611         (Output_section::add_input_section_for_script): Take a reference to
13612         a Simple_input_section object instead of Relobj pointer and section
13613         index as parameter.  Handle relaxed input sections.
13614         (Output_section::save_states, Output_section::restore_states): New
13615         method definitions.
13616         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
13617         (Output_data::is_data_size_fixed): New method definition.
13618         (Output_data::reset_addresss_and_file_offset): Do not reset data size
13619         if it is fixed.
13620         (Output_data::address_and_file_offset_have_reset_values): New method
13621         definition.
13622         (Output_data::do_address_and_file_offset_have_reset_values): New method
13623         definition.
13624         (Output_data::set_data_size): Check that data size is not fixed.
13625         (Output_data::fix_data_size): New method definition.
13626         (Output_data::is_data_size_fixed_): New data member.
13627         (Output_section_headers::set_final_data_size): New method definition.
13628         (Output_section_headers::do_size): New method declaration.
13629         (Output_segment_headers::set_final_data_size): New method definition.
13630         (Output_segment_headers::do_size): New method declaration.
13631         (Output_file_header::set_final_data_size)::New method definition.
13632         (Output_file_header::do_size)::New method declaration.
13633         (Output_section_data::Output_section_data): Add new parameter
13634         is_data_size_fixed and use it to fix data size.
13635         (Output_data_const::Output_data_const): Adjust call to base class
13636         constructor and fix data size.
13637         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
13638         base class constructor and fix data size.
13639         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
13640         base class constructor and fix data size.
13641         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
13642         class constructor and fix data size.
13643         (Output_data_group::set_final_data_size): New method definition.
13644         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
13645         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
13646         class constructor and fix data size.
13647         (Output_relaxed_input_section): New class definition.
13648         (Output_section::Simple_input_section): New class definition.
13649         (Output_section::get_input_sections): Adjust parameter list.
13650         (Output_section::add_input_section_for_script): Same.
13651         (Output_section::save_states, Output_section::restore_states,
13652         Output_section::do_address_and_file_offset_have_reset_values,
13653         (Output_section::Input_section::Input_section): Handle
13654         RELAXED_INPUT_SECTION_CODE.  Add new overload for
13655         Output_relaxed_input_section.
13656         (Output_section::Input_section::is_input_section,
13657         Output_section::Input_section::set_output_section): Handle relaxed
13658         input section.
13659         (Output_section::Input_section::is_relaxed_input_section,
13660         Output_section::Input_section::output_section_data,
13661         Output_section::Input_section::relaxed_input_section): New method
13662         definitions.
13663         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
13664         value.
13665         (Output_section::Input_section::u1_): Update comments.
13666         (Output_section::Input_section::u2_): Add new union member poris.
13667         (Output_section::Checkpoint_output_section): New classs definition.
13668         (Output_section::relax_input_section): New method declaration.
13669         (Output_section::checkpoint_): New data member.
13670         (Output_segment): Update comments.
13671         (Output_segment::Output_segment): Un-privatize copy constructor.
13672         (Output_segment::operator=): Un-privatize.
13673         * script-sections.cc (Output_section_element::Input_section_list):
13674         Change element type to Output_section::Simple_input_section.
13675         (Output_section_element_dot_assignment::set_section_addresses):
13676         Register output section data for relaxation clean up.
13677         (Output_data_exression::Output_data_expression): Adjust call to base
13678         constructor to fix data size.
13679         (Output_section_element_data::set_section_addresses): Register
13680         Output_data_expression object for relaxation clean up.
13681         (struct Input_section_info): Replace Relobj pointer and section index
13682         pair with Output_section::Simple_input_section and Convert struct to a
13683         class.
13684         (Input_section_sorter::operator()): Adjust access to
13685         Input_section_info data member to use accessors.
13686         (Output_section_element_input::set_section_addresses): Use layout
13687         parameter.  Adjust code to use Output_section::Simple_input_section
13688         and Input_secction_info classes.  Register filler for relaxation
13689         clean up.
13690         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
13691         and section index pair with Output_section::Simple_input_section
13692         class.  Adjust code accordingly.
13693         (Phdrs_element::release_segment): New method definition.
13694         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
13695         segment list.
13696         (Script_sections::release_segments): New method definition.
13697         * gold/script-sections.h (Script_sections::release_segments): New
13698         method declaration.
13699         * gold/target.h (Target::may_relax, Target::relax,
13700         Target::do_may_relax, Target::do_relax): New method definitions.
13701
13702 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
13703
13704         * arm.cc (has_signed_unsigned_overflow): New function.
13705         (Arm_relocate_functions::abs8): New function.
13706         (Target_arm::Scan::local): Handle R_ARM_ABS8.
13707         (Target_arm::Scan::global): Likewise.
13708         (Target_arm::relocate::relocate): Likewise.
13709         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
13710         Likewise.
13711
13712 2009-09-16  Cary Coutant  <ccoutant@google.com>
13713
13714         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
13715         * testsuite/Makefile.in: Regenerate.
13716
13717 2009-09-11  Nick Clifton  <nickc@redhat.com>
13718
13719         * po/gold.pot: Updated by the Translation project.
13720
13721 2009-09-08  Cary Coutant  <ccoutant@google.com>
13722
13723         * output.cc (Output_file::open): Add execute permission to empty file.
13724         * testsuite/Makefile.am (permission_test): New test.
13725         * testsuite/Makefile.in: Regenerate.
13726
13727 2009-09-02  Ian Lance Taylor  <iant@google.com>
13728
13729         * output.cc (Output_file::resize): Call map_no_anonymous rather
13730         than map.
13731
13732 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
13733
13734         * gold.cc: Include "incremental.h".
13735         (queue_initial_tasks): Call Incremental_checker methods.
13736         * incremental.cc: Include "output.h".
13737         (Incremental_checker::can_incrementally_link_output_file): New
13738         method.
13739         * incremental.h (Incremental_checker): New class.
13740
13741         * output.cc (Output_file::open_for_modification): New method.
13742         (Output_file::map_anonymous): Changed return type to bool.  Record
13743         map in base_ field.
13744         (Output_file::map_no_anonymous): New method, broken out of map.
13745         (Output_file::map): Use map_no_anonymous and map_anonymous.
13746         * output.h (class Output_file): Update declarations.
13747
13748 2009-08-24  Cary Coutant  <ccoutant@google.com>
13749
13750         * options.h (Command_line::Pre_options): New class.
13751         (Command_line::pre_options): New member.
13752         * options.cc (gold::options::ready_to_register): New variable.
13753         (One_option::register_option): Do nothing if not registering options.
13754         Assert if same short option registered twice.
13755         (General_options::General_options): Turn off option registration when
13756         done constructing.
13757         (Command_line::Pre_options::Pre_options): New constructor.
13758
13759 2009-08-24  Cary Coutant  <ccoutant@google.com>
13760
13761         * options.h (General_options::no_keep_memory): Remove incorrect
13762         short option.
13763
13764 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13765
13766         * Makefile.am (am__skiplex, am__skipyacc): New.
13767         * Makefile.in: Regenerate.
13768
13769 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
13770
13771         * Makefile.am (AM_CPPFLAGS): Renamed from ...
13772         (INCLUDES): ... this.
13773         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
13774         (AM_CPPFLAGS): Renamed from ...
13775         (INCLUDE): ... this.
13776         * Makefile.in, testsuite/Makefile.in: Regenerate.
13777
13778         * Makefile.in: Regenerate.
13779         * aclocal.m4: Likewise.
13780         * config.in: Likewise.
13781         * configure: Likewise.
13782         * testsuite/Makefile.in: Likewise.
13783
13784         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13785         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
13786         * Makefile.in: Regenerate.
13787         * testsuite/Makefile.in: Regenerate.
13788
13789 2009-08-19  Cary Coutant  <ccoutant@google.com>
13790
13791         * resolve.cc (Symbol_table::resolve): Don't complain about defined
13792         symbols in shared libraries overridden by hidden or internal symbols
13793         in the main program.
13794
13795 2009-08-19  Chris Demetriou  <cgd@google.com>
13796
13797         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
13798         checking source file names in error messages.
13799
13800 2009-08-18  Doug Kwan  <dougkwan@google.com>
13801
13802         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
13803         an elcpp::Ehdr as parameter.  Adjust call to set_target.
13804         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
13805         an elfcpp::Ehdr as parameter.
13806         * object.cc (Object::set_target): Remove the version that looks up
13807         a target and sets it.
13808         (Sized_relobj::setup): Take a Target object instead of
13809         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
13810         (make_elf_sized_object): Find target and ask target to
13811         make an ELF object.
13812         * object.h: (Object::set_target): Remove the version that looks up
13813         a target and sets it.
13814         (Sized_relobj::setup): Take a Target object instead of
13815         an elfcpp:Ehdr as parameter.
13816         * target.cc: Include dynobj.h.
13817         (Target::do_make_elf_object_implementation): New.
13818         (Target::do_make_elf_object): New.
13819         * target.h (Target::make_elf_object): New template declaration.
13820         (Target::do_make_elf_object): New method declarations.
13821         (Target::do_make_elf_object_implementation): New template declaration.
13822
13823 2009-08-14  Ian Lance Taylor  <iant@google.com>
13824
13825         * gold.h (FUNCTION_NAME): Define.
13826         (gold_unreachable): Use FUNCTION_NAME.
13827
13828 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13829
13830         * icf.cc (Icf::find_identical_sections): Issue a warning when a
13831         symbol in the --keep-unique list is not found.
13832
13833 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
13834
13835         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
13836         been maked as --keep-unique.
13837         (Icf::unfold_section): New function.
13838         * icf.h (Icf::unfold_section): New function.
13839         * options.h (General_options::keep_unique): New option.
13840         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
13841         * testsuite/Makefile.in: Regenerate.
13842         * testsuite/icf_keep_unique_test.sh: New file.
13843         * testsuite/icf_keep_unique_test.cc: New file.
13844
13845 2009-08-12  Cary Coutant  <ccoutant@google.com>
13846
13847         PR 10471
13848         * resolve.cc (Symbol_table::resolve): Check for references from
13849         dynamic objects to hidden and internal symbols.
13850         * testsuite/Makefile.am (hidden_test.sh): New test.
13851         * testsuite/Makefile.in: Regenerate.
13852         * testsuite/hidden_test.sh: New script.
13853         * testsuite/hidden_test_1.c: New test source.
13854         * testsuite/hidden_test_main.c: New test source.
13855
13856 2009-08-11  Doug Kwan  <dougkwan@google.com>
13857
13858         * arm.cc: Update comments.
13859         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
13860         segment to locate the .ARM.exidx section if present.
13861
13862 2009-08-09  Doug Kwan  <dougkwan@google.com>
13863
13864         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
13865         patch.
13866
13867 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
13868         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
13869         compiler warnings.
13870
13871 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
13872
13873         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
13874         valid tls_segment only for non-debug-section relocations.
13875         * testsuite/Makefile.am: Add gc_tls_test.
13876         * testsuite/Makefile.in: Regenerate.
13877         * testsuite/gc_tls_test.cc: New file.
13878         * testsuite/gc_tls_test.sh: New file.
13879
13880 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
13881
13882         * icf.cc: New file.
13883         * icf.h: New file.
13884         * Makefile.am (CCFILES): Add icf.cc.
13885         (HFILES): Add icf.h
13886         * Makefile.in: Regenerate.
13887         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
13888         * gc.h (gc_process_relocs): Populate lists used by icf to contain
13889         section, symbol and addend information for the relocs.
13890         * gold.cc (queue_middle_tasks): Call identical code folding.
13891         * gold.h: Add defines for multimap.
13892         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
13893         to the call of finalize_local_symbols.
13894         * main.cc (main): Create object of class Icf.
13895         * object.cc (Sized_relobj::do_layout): Allow this function to be
13896         called twice during icf.
13897         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
13898         to sections marked as identical by icf.
13899         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
13900         when available.
13901         (Sized_relobj::do_section_entsize): New function.
13902         * object.h (Object::section_entsize): New function.
13903         (Object::do_section_entsize): New pure virtual function.
13904         (Relobj::finalize_local_symbols): Add new parameter.
13905         (Relobj::do_section_entsize): New function.
13906         * options.h (General_options::icf): New option.
13907         (General_options::icf_iterations): New option.
13908         (General_options::print_icf_sections): New option.
13909         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
13910         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
13911         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
13912         icf.
13913         * symtab.cc (Symbol_table::is_section_folded): New function.
13914         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
13915         to sections marked as identical by icf.
13916         * symtab.h (Symbol_table::set_icf): New function.
13917         (Symbol_table::icf): New function.
13918         (Symbol_table::is_section_folded): New function.
13919         (Symbol_table::icf_): New data member.
13920         * target-reloc.h (relocate_section): Ignore sections folded by icf.
13921         * testsuite/Makefile.am: Add commands to build icf_test.
13922         * testsuite/Makefile.in: Regenerate.
13923         * testsuite/icf_test.sh: New file.
13924         * testsuite/icf_test.cc: New file.
13925
13926 2009-07-24  Chris Demetriou  <cgd@google.com>
13927
13928         * layout.cc (is_compressible_debug_section): Fix incorrect
13929         comment about compressed section names.
13930
13931 2009-07-20  Ian Lance Taylor  <ian@airs.com>
13932
13933         PR 10419
13934         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
13935
13936 2009-07-16  Ian Lance Taylor  <iant@google.com>
13937
13938         PR 10400
13939         * layout.h: #include <map>.
13940         (class Kept_section): Change from struct to class.  Add accessors
13941         and setters.  Add section size to Comdat_group mapping.  Change
13942         Comdat_group to std::map.  Add is_comdat_ field.  Add
13943         linkonce_size field in union.
13944         (class Layout): Update declaration of find_or_add_kept_section.
13945         Don't declare find_kept_object.
13946         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
13947         parameter.  Add object, shndx, is_comdat, and is_group_name
13948         parameters.  Change all callers.  Adjust for new Kept_section.
13949         (Layout::find_kept_object): Remove.
13950         * object.cc (Sized_relobj::include_section_group): Update use of
13951         Kept_section.  Rename secnum to shndx.  Only record
13952         Kept_comdat_section if sections are the same size.
13953         (Sized_relobj::include_linkonce_section): Update use of
13954         Kept_section.  Only record Kept_comdat_section if sections are the
13955         same size.  Set size of linkonce section.
13956         (Sized_relobj::map_to_kept_section): Update call to
13957         get_kept_comdat_section.
13958         * object.h (class Sized_relobj): Rename fields in
13959         Kept_comdat_section to drop trailing underscores; change object
13960         field to Relobj*.  Change Kept_comdat_section_table to store
13961         struct rather than pointer.
13962         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
13963         Add kept_object and kept_shndx parameters.  Change all callers.
13964         (Sized_relobj::get_kept_comdat_section): Change return type to
13965         bool.  Add kept_object and kept_shndx parameters.  Change all
13966         callers.
13967         * plugin.cc (Pluginobj::include_comdat_group): Update call to
13968         Layout::find_or_add_kept_section.
13969
13970 2009-07-09  Ian Lance Taylor  <iant@google.com>
13971
13972         * merge.cc (Object_merge_map::initialize_input_to_output_map):
13973         Reserve space in the hash table.
13974
13975 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
13976
13977         * fileread.cc (File_read::get_mtime): New method.
13978         * fileread.h (Timespec): New structure.
13979         (File_read::get_mtime): New method.
13980         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
13981         Renamed from timestamp_nsec.
13982         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
13983         Elf_Xword.
13984         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
13985         timestamp_nsec.
13986         (Incremental_inputs::report_archive): Save mtime; style fix.
13987         (Incremental_inputs::report_obejct): Save mtime; style fix.
13988         (Incremental_inputs::report_script): Save mtime; style fix.
13989         (Incremental_inputs::finalize_inputs): Style fix.
13990         (Incremental_inputs::finalize): Style fix.
13991         (Incremental_inputs::create_input_section_data): Store inputs
13992         mtime.
13993         * incremental.h (Incremental_inputs::report_script): Add mtime
13994         argument.
13995         (Incremental_inputs::Input_info::Input_info): Intialize only one
13996         union member.
13997         (Incremental_inputs::Input_info::archive): Move to nameless
13998         union.
13999         (Incremental_inputs::Input_info::obejct): Move to nameless union.
14000         (Incremental_inputs::Input_info::script): Move to nameless union.
14001         (Incremental_inputs::mtime): New field.
14002         * script.cc (read_input_script): Pass file mtime to
14003         Incremental_input.
14004         * script.h (Script_info::inputs): Style fix.
14005
14006 2009-07-01  Ian Lance Taylor  <ian@airs.com>
14007
14008         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
14009         instead of 32.
14010
14011 2009-06-24  Ian Lance Taylor  <iant@google.com>
14012
14013         PR 10156
14014         * layout.cc (Layout::choose_output_section): If we find an
14015         existing section, update the flags.
14016         (Layout::create_notes): New function, broken out of
14017         Layout::finalize.
14018         (Layout::finalize): Don't create note sections.
14019         (Layout::create_note): Don't crash if linker script discards
14020         section.
14021         (Layout::create_gold_note): Likewise.
14022         (Layout::create_build_id): Likewise.  Don't set
14023         after_input_sections on the section.
14024         (Layout::create_executable_stack_info): Remove target parameter.
14025         Change caller.
14026         * layout.h (class Layout): Declare create_notes.  Update
14027         declaration of create_executable_stack_info.
14028         * gold.cc (queue_middle_tasks): Call create_notes.
14029         * output.cc (Output_section::update_flags_for_input_section): Move
14030         here from output.h.  If SHF_ALLOC flag is newly set, mark address
14031         invalid.
14032         * output.h (Output_data::mark_address_invalid): New function.
14033         (class Output_section): Only declare, not define,
14034         update_flags_for_input_section.  Remove set_flags.
14035
14036 2009-06-24  Ian Lance Taylor  <iant@google.com>
14037
14038         * script-sections.cc (Output_section_definition::
14039         set_section_addresses): Rename shadowing local load_address to
14040         laddr.
14041
14042 2009-06-24  Ian Lance Taylor  <iant@google.com>
14043
14044         PR 10244
14045         * reloc.cc (relocate_sections): Skip empty relocation sections.
14046
14047 2009-06-23  Ian Lance Taylor  <iant@google.com>
14048
14049         PR 10156
14050         * layout.cc (Layout::create_note): Use choose_output_section
14051         rather than make_output_section.
14052
14053 2009-06-23  Ian Lance Taylor  <iant@google.com>
14054
14055         PR 10237
14056         * options.cc (General_options::parse_V): Set printed_version_.
14057         (General_options::General_options): Initialize printed_version_.
14058         * options.h (class General_options): Add printed_version_ field.
14059         * gold.cc (queue_initial_tasks): If there are no input files,
14060         don't give a fatal error if we printed the version information.
14061         (queue_middle_tasks): If using -r with a shared object, give a
14062         fatal error rather than an ordinary error.
14063
14064 2009-06-23  Ian Lance Taylor  <iant@google.com>
14065
14066         PR 10219
14067         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
14068         (Layout::make_output_section): Set have_stabstr_section_ if we see
14069         a .stab*str section.
14070         (Layout::finalize): Call link_stabs_sections.
14071         (Layout::link_stabs_sections): New file.
14072         * layout.h (class Layout): Add have_stabstr_section_ field.
14073         Declare link_stabs_sections.
14074
14075 2009-06-23  Doug Kwan  <dougkwan@google.com>
14076
14077         * Makefile.am (libgold_a_LIBADD): New.
14078         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
14079         * Makefile.in: Regenerate.
14080         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
14081         * configure: Regenerate.
14082         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
14083         * fileread.cc: Include sys/state.h
14084         * gold.h: Declare memmem and strndup if found missing.
14085         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
14086
14087 2009-06-23  Ian Lance Taylor  <iant@google.com>
14088
14089         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
14090         * configure: Rebuild.
14091
14092 2009-06-23  Ian Lance Taylor  <iant@google.com>
14093
14094         PR 10147
14095         * object.cc (Object::section_contents): Don't try to get a view if
14096         the section has length zero.
14097         (Object::handle_gnu_warning_section): If the section is empty, use
14098         the name of the section as the warning.
14099
14100 2009-06-23  Ian Lance Taylor  <iant@google.com>
14101
14102         PR 10133
14103         * stringpool.h (class Stringpool_template): Add optimize_ field.
14104         (Stringpool_template::set_optimize): New function.
14105         * stringpool.cc (Stringpool_template::Stringpool_template):
14106         Initialize optimize_ field.
14107         (Stringpool_template::set_string_offsets): Test local optimize
14108         fild rather than parameter.
14109         * layout.cc (Layout::Layout): Call set_optimize on the section
14110         name stringpool.
14111
14112 2009-06-22  Ian Lance Taylor  <iant@google.com>
14113
14114         PR 10030
14115         * yyscript.y: Parse TARGET.
14116         * script.cc (script_set_target): New function.
14117         * script-c.h (script_set_target): Declare.
14118         * options.cc (General_options::string_to_object_format): Rename
14119         from string_to_object_format in anonymous namespace.  Change
14120         callers.
14121         * options.h (class General_options): Declare
14122         string_to_object_format.
14123
14124 2009-06-22  Ian Lance Taylor  <iant@google.com>
14125
14126         * script-sections.cc (Script_sections::create_segments): Don't put
14127         program headers in a PT_LOAD segment if -n or -N.
14128
14129 2009-06-22  Ian Lance Taylor  <iant@google.com>
14130
14131         PR 10141
14132         * options.h (class General_options): Add -z lazy and -z now.  Sort
14133         -z options into alphabetical order.
14134         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
14135
14136 2009-06-21  Ian Lance Taylor  <iant@google.com>
14137
14138         * layout.cc (Layout::make_output_section): Call
14139         Target::new_output_section.
14140         (Layout::attach_allocated_section_to_segment): Put large section
14141         sections in a separate load segment with the large segment flag
14142         set.
14143         (Layout::segment_precedes): Sort large data segments after other
14144         load segments.
14145         (align_file_offset): New static function.
14146         (Layout::set_segment_offsets): Use align_file_offset.
14147         * output.h (class Output_section): Add is_small_section_ and
14148         is_large_section_ fields.
14149         (Output_section::is_small_section): New function.
14150         (Output_section::set_is_small_section):  New function.
14151         (Output_section::is_large_section): New function.
14152         (Output_section::set_is_large_section): New function.
14153         (Output_section::is_large_data_section): New function.
14154         (class Output_segment): Add is_large_data_segment_ field.
14155         (Output_segment::is_large_data_segment): New function.
14156         (Output_segment::set_is_large_data_segment): New function.
14157         * output.cc (Output_section::Output_section): Initialize new
14158         fields.
14159         (Output_segment::Output_segment): Likewise.
14160         (Output_segment::add_output_section): Add assertion that large
14161         data sections always go in large data segments.  Force small data
14162         sections to the end of the list of data sections.  Force small BSS
14163         sections to the start of the list of BSS sections.  For large BSS
14164         sections to the end of the list of BSS sections.
14165         * symtab.h (class Symbol): Declare is_common_shndx.
14166         (Symbol::is_defined): Check Symbol::is_common_shndx.
14167         (Symbol::is_common): Likewise.
14168         (class Symbol_table): Define enum Commons_section_type.  Update
14169         declarations.  Add small_commons_ and large_commons_ fields.
14170         * symtab.cc (Symbol::is_common_shndx): New function.
14171         (Symbol_table::Symbol_table): Initialize new fields.
14172         (Symbol_table::add_from_object): Put small and large common
14173         symbols in the right list.
14174         (Symbol_table::sized_finalized_symbol): Check
14175         Symbol::is_common_shndx.
14176         (Symbol_table::sized_write_globals): Likewise.
14177         * common.cc (Symbol_table::do_allocate_commons): Allocate new
14178         common symbol lists.  Don't call do_allocate_commons_list if the
14179         list is empty.
14180         (Symbol_table::do_allocate_commons_list): Remove is_tls
14181         parameter.  Add comons_section_type parameter.  Change all
14182         callers.  Handle small and large common symbols.
14183         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
14184         Symbol::is_common_shndx.
14185         * resolve.cc (symbol_to_bits): Likewise.
14186         * target.h (Target::small_common_shndx): New function.
14187         (Target::small_common_section_flags): New function.
14188         (Target::large_common_shndx): New function.
14189         (Target::large_common_section_flags): New function.
14190         (Target::new_output_section): New function.
14191         (Target::Target_info): Add small_common_shndx, large_common_shndx,
14192         small_common_section_flags, and large_common_section_flags
14193         fields.
14194         (Target::do_new_output_section): New virtual function.
14195         * arm.cc (Target_arm::arm_info): Initialize new fields.
14196         * i386.cc (Target_i386::i386_info): Likewise.
14197         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
14198         Likewise.
14199         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
14200         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14201         (Target_x86_64::do_new_output_section): New function.
14202         * configure.ac: Define conditional MCMODEL_MEDIUM.
14203         * testsuite/Makefile.am (check_PROGRAMS): Add large.
14204         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
14205         (large_LDFLAGS): Define.
14206         * testsuite/large.c: New file.
14207         * testsuite/testfile.cc (Target_test::test_target_info):
14208         Initialize new fields.
14209         * configure, testsuite/Makefile.in: Rebuild.
14210
14211 2009-06-05  Doug Kwan  <dougkwan@google.com>
14212
14213         * Makefile.am (CCFILES): Add target.cc.
14214         * Makefile.in: Regenerate.
14215         * i386.cc (class Target_i386): Define new virtual method to
14216         override do_is_local_label_name in parent.
14217         * object.cc (Sized_relobj::do_count_local_symbols): Discard
14218         local symbols if --discard-locals or -X is given.
14219         * options.h (class General_options): Declare new options
14220         '--discard-locals' and '-X' for discarding locals.
14221         * target.h (class Target): Define new methods is_local_label_name.
14222         Declare new virtual method do_is_local_label_name.
14223         * target.cc: New file.
14224         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
14225         (check_SCRIPTS): Add discard_locals_test.sh.
14226         (check_DATA): Add discard_local_tests.syms.
14227         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
14228         (discard_local_tests.syms, discard_locals_test.o): New make rules.
14229         * testsuite/Makefile.in: Regenerate.
14230         * testsuite/discard_locals_test.c: New file.
14231         * testsuite/discard_locals_test.sh: Same.
14232
14233 2009-06-05  Doug Kwan  <dougkwan@google.com>
14234
14235         * object.cc (Sized_relobj::Sized_relobj): Initialize
14236         discarded_eh_frame_shndx_ to -1U.
14237         (Sized_relobj::do_layout): Record index of a discard .eh_frame
14238         section.
14239         (Sized_relobj::do_count_local_symbols): Skip local symbols in
14240         a discarded .eh_frame section.
14241         (Sized_relobj::do_finalize_local_symbols): Ditto.
14242         * object.h (class Sized_relobj): Declare new member
14243         discarded_eh_frame_shndx_.
14244         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
14245         (local_labels_test.o, local_labels_test): New rules.
14246         * testsuite/Makefile.in: Regenerate.
14247
14248 2009-06-04  Doug Kwan  <dougkwan@google.com>
14249
14250         * layout.cc (Layout::section_name_mapping): Add mapping for
14251         special ARM sections.
14252
14253 2009-06-03  Doug Kwan  <dougkwan@google.com>
14254
14255         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
14256         (utils::has_overflow): Same.
14257
14258 2009-06-03  Ian Lance Taylor  <iant@google.com>
14259
14260         * layout.cc (Layout::section_name_mapping): New array, replacing
14261         Layout::linkonce_mapping.
14262         (Layout::section_name_mapping_count): New variable, replacing
14263         Layout::linkonce_mapping_count.
14264         (Layout::linkonce_output_name): Remove.
14265         (Layout::output_section_name): Rewrite.
14266         * layout.h (class Layout): Rename Linkonce_mapping to
14267         Section_name_mapping, linkonce_mapping to section_name_mapping,
14268         linkonce_mapping_count to section_name_mapping_count.  Don't
14269         declare linkonce_output_name.
14270
14271 2009-06-03  Doug Kwan  <dougkwan@google.com>
14272
14273         * gold/arm.cc (namespace utils): New.
14274         (Target_arm::reloc_is_non_pic): Define new method.
14275         (class Arm_relocate_functions): New.
14276         (Target_arm::Relocate::relocate): Handle relocation types used by
14277         Android.
14278
14279 2009-06-03  Ian Lance Taylor  <iant@google.com>
14280
14281         * arm.cc (Target_arm::scan::global): Use || instead of |.
14282
14283 2009-06-02  Doug Kwan  <dougkwan@google.com>
14284
14285         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
14286         issued_non_pic_error_.
14287         (class Target_arm::Scan): Declare new method check_non_pic.
14288         Define new method symbol_needs_plt_entry.
14289         Declare new data member issued_non_pic_error_.
14290         (class Target_arm::Relocate): Declare new method
14291         should_apply_static_reloc.
14292         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
14293         (Target_arm::Scan::check_non_pic): Define new method.
14294         (Target_arm::Scan::local): Handle a small subset of reloc types used
14295         by Android.
14296         (Target_arm::Scan::local): Same.
14297         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
14298
14299 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
14300
14301         * incremental.cc (Incremental_inputs::report_command_line): Filter
14302         out --incremental-* options.
14303
14304 2009-05-29  Doug Kwan  <dougkwan@google.com>
14305
14306         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
14307         template class.
14308         (class Target_arm): Update comment.
14309         (Target_arm::Target_arm): Initialize new data members GOT_,
14310         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
14311         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
14312         and Target_arm::rel_dyn_section.
14313         Declare new_enum Target_arm::Got_type.
14314         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
14315         and DYNBSS_.
14316         Update commments for member do_dynsym_value.
14317         (Target_arm::got_size, Target_arm::plt_section,
14318         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
14319         new methods inside class defintion.
14320         (Target_arm::got_section): Define new method.
14321         (Target_arm::rel_dyn_section): Same.
14322         (Output_data_plt_arm): New template class.
14323         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
14324         (Output_data_plt_arm:do_adjust_output_section): Define new method.
14325         (Output_data_plt_arm::add_entry): Same.
14326         (Output_data_plt_arm::first_plt_entry): Define new
14327         static data member for PLT instruction template.
14328         (Output_data_plt_arm::plt_entry): Same.
14329         (Output_data_plt_arm::do_write): Define new method.
14330         (Target_arm::make_plt_entry): Same.
14331         (Target_arm::do_finalize_sections): Same.
14332         (Target_arm::do_dynsym_value): Same.
14333
14334 2009-05-28  Doug Kwan  <dougkwan@google.com>
14335
14336         * Makefile.am (TARGETSOURCES): Add arm.cc.
14337         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
14338         * Makefile.in: Regenerate.
14339         * arm.cc: New file.
14340         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
14341
14342 2009-05-26  Doug Kwan  <dougkwan@google.com>
14343
14344         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
14345         (General_options::check_excluded_libs): Strip off directories in
14346         archive name before matching like GNU ld does.
14347         * testsuite/Makefile.am (MOSTLYCLEANFILES,
14348         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
14349         (exclude_libs_test_LDFLAGS): Add linker option
14350         -Wl,--exclude-libs,libexclude_libs_test_3
14351         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
14352         an explicit archive without using -l.
14353         (alt/libexclude_libs_test_3.a): New make rule.
14354         * testsuite/Makefile.in: Regenerate.
14355         * testsuite/exclude_libs_test.c : Declare lib3_default().
14356         (main): Call it.
14357         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
14358         * exclude_libs_test_3.c: New file.
14359
14360 2009-05-26  Nick Clifton  <nickc@redhat.com>
14361
14362         * po/id.po: New Indonesian translation.
14363         * po/gold.pot: Updated template file.
14364
14365 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
14366
14367         * testsuite/Makefile.am: Add -ffunction-sections to compile
14368         gc_comdat_test files.  Add -Wl,--gc-sections to build
14369         gc_comdat_test.
14370         * testsuite/Makefile.in: Regenerate.
14371         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
14372
14373 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
14374
14375         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
14376         kept comdat section was garbage collected.
14377         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
14378         * testsuite/Makefile.in: Regenerate.
14379         * testsuite/gc_comdat_test.sh: New file.
14380         * testsuite/gc_comdat_test_1.cc: New file.
14381         * testsuite/gc_comdat_test_2.cc: New file.
14382
14383 2009-05-19  Doug Kwan  <dougkwan@google.com>
14384
14385         * archive.cc (Archive::Archive): Move constructor from archive.h
14386         to here.  Initialize no_export_.
14387         (Archive::get_elf_object_for_member): Set no_export flag of object.
14388         * archive.h (Archive::Archive): Move constructor body to
14389         archive.cc.
14390         (Archive::no_export): New method.
14391         (Archive::no_export_): New field.
14392         * object.h (Object::Object): Initialize no_export_ to false.
14393         (Object::no_export, Object::set_no_export): New methods.
14394         (Object::no_export_): New field.
14395         * options.cc (General_options::parse_exclude_libs): New method.
14396         (General_options::check_excluded_libs) Same.
14397         * options.h (exclude_libs): New option.
14398         (General_options::check_excluded_libs): New method declaration.
14399         (General_options::excluded_libs_): New field.
14400         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
14401         default or protected visibility if an object has no-export flag set.
14402         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
14403         (check_SCRIPTS): Add exclude_libs_test.sh.
14404         (check_DATA): Add exclude_libs_test.syms.
14405         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
14406         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
14407         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
14408         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
14409         (exclude_libs_test.syms, libexclude_libs_test_1.a,
14410         libexclude_libs_test_2.a): New rules.
14411         * testsuite/Makefile.in: Regenerate.
14412         * testsuite/exclude_libs_test.c: New file.
14413         * testsuite/exclude_libs_test.sh: Ditto.
14414         * testsuite/exclude_libs_test_1.c: Ditto.
14415         * testsuite/exclude_libs_test_2.c: Ditto.
14416
14417 2009-05-15  Ian Lance Taylor  <iant@google.com>
14418
14419         * configure.ac: Check for declarations for cases where libiberty.h
14420         checks HAVE_DECL_xxx.
14421         * configure, config.in: Rebuild.
14422
14423 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
14424
14425         * gold.h (Incremental_argument_list): Remove (invalid) forward
14426         declaration.
14427         * incremental.cc (Incremental_inputs::report_achive): New method.
14428         (Incremental_inputs::report_object): New method.
14429         (Incremental_inputs::report_script): New method.
14430         (Incremental_inputs::finalize_inputs): New method.
14431         (Incremental_inputs::finalize): Call finalize_inputs().
14432         (Incremental_inputs::sized_create_incremental_inputs_section_data):
14433         Create inputs entries.
14434         * incremental.h (Incremental_input_type): New enum.
14435         (Incremental_inputs::Incremental_input): Initialize new fields.
14436         (Incremental_inputs::report_inputs): New method.
14437         (Incremental_inputs::report_achive): New method.
14438         (Incremental_inputs::report_object): New method.
14439         (Incremental_inputs::report_script): New method.
14440         (Incremental_inputs::finalize_inputs): New method.
14441         (Incremental_inputs::Input_info): New struct.
14442         (Incremental_inputs::Input_info_map): New typedef.
14443         (Incremental_inputs::lock_): New field.
14444         (Incremental_inputs::Inputs_): New field.
14445         (Incremental_inputs::Inputs_map): New field.
14446         * main.cc (main): Call Incremental_input::report_inputs.
14447         * options.h (Input_argument_list): Typedef moved from
14448         Input_arguments.
14449         (Input_file_group::Files): Remove, use ::Input_argument_list.
14450         (Input_file_group::Input_argument_list): Remove, use
14451         ::Input_argument_list.
14452         * plugin.cc (Plugin_manager::add_input_file): Add error in
14453         incremental build.
14454         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
14455         functions.
14456         * script.cc (read_input_script): Call
14457         Incremental_input::report_script.
14458         * script.h (Script_info): New class.
14459
14460 2009-04-27  Ian Lance Taylor  <iant@google.com>
14461
14462         * x86_64.cc (do_adjust_output_section): Set entsize to
14463         plt_entry_size.
14464
14465 2009-04-23  Elliott Hughes  <enh@google.com>
14466
14467         * output.cc (Output_file::close): After short writes, continue
14468         writing from the correct offset in the buffer being written.
14469
14470 2009-04-23  Chris Demetriou  <cgd@google.com>
14471
14472         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
14473         * configure: Regenerate.
14474         * config.in: Regenerate.
14475         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
14476         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
14477
14478 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
14479
14480         * incremental.cc (Incremental_inputs_header_data): Renamed from
14481         Incremental_input_header_data.
14482         (Incremental_inputs_header_data::data_size): New field.
14483         (Incremental_inputs_header_data::put_input_file_count): Renamed
14484         from input_file_count.
14485         (Incremental_inputs_header_data::put_command_line_offset): Renamed
14486         from command_line_offset.
14487         (Incremental_inputs_header_data::put_reserved): Renamed from
14488         put_reserved.
14489         (Incremental_inputs_entry_data): Renamed from
14490         Incremental_input_entry_data.
14491         (Incremental_inputs_entry_data::data_size): New field.
14492         (Incremental_inputs::report_command_line): New method.
14493         (Incremental_inputs::finalize): New method.
14494         (Incremental_inputs::create_incremental_inputs_data): New method.
14495         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
14496         * incremental.h: New file.
14497         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
14498         (Layout::finalize): Create incremental inputs section in
14499         incremental builds.
14500         (Layout::create_incremental_info_sections): New method.
14501         * layout.h (Layout::incremental_inputs): New method.
14502         (Layout::create_incremental_info_sections): New method.
14503         (Layout::incremental_inputs_): New field.
14504         * main.cc (main): Notify Incremental_input of the command line.
14505
14506 2009-04-01  Ian Lance Taylor  <iant@google.com>
14507             Mikolaj Zalewski  <mikolajz@google.com>
14508
14509         * gold.h (reserve_unordered_map): Define, three versions, one for
14510         each version of Unordered_map.
14511         * layout.cc (Layout::Layout): Remove options parameter.  Add
14512         number_of_input_files parameter.  Don't initialize options_.
14513         Initialize number_of_input_files_ and resized_signatures_.  Move
14514         sections_are_attached_.
14515         (Layout::layout_group): Reserve space for group_signatures_.
14516         (Layout::find_or_add_kept_section): Change name parameter to be a
14517         reference.  Resize signatures_ map when it gets large enough.
14518         (Layout::layout_eh_frame): Use parameters->options() instead of
14519         this->options_.
14520         (Layout::make_output_section): Likewise.
14521         (Layout::attach_allocated_section_to_segment): Likewise.
14522         (Layout::finalize, Layout::create_executable_stack): Likewise.
14523         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
14524         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
14525         * layout.h (class Layout): Update declarations.  Remove options_
14526         field.  Add number_of_input_files_ and resized_signatures_
14527         fields.  Move sections_are_attached_ field.
14528         * main.cc (main): Pass number of input files to Layout
14529         constructor.  Don't pass options.
14530
14531 2009-03-30  Ian Lance Taylor  <iant@google.com>
14532
14533         * ffsll.c (ffsll): Correct implementation.
14534
14535 2009-03-27  Ian Lance Taylor  <iant@google.com>
14536
14537         * ffsll.c: New file.
14538         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
14539         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
14540         * ftruncate.c (ftruncate): Declare before definition.
14541         * mremap.c (mremap): Likewise.
14542         * pread.c (pread): Likewise.
14543         * configure, Makefile.in, config.in: Rebuild.
14544
14545         * mremap.c: New file.
14546         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
14547         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
14548         (mremap): Declare if HAVE_MREMAP is not defined.
14549         * configure, Makefile.in, config.in: Rebuild.
14550
14551 2009-03-27  Cary Coutant  <ccoutant@google.com>
14552
14553         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
14554         position independent.
14555         * sparc.cc (Target_sparc::check_non_pic): Likewise.
14556         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
14557
14558 2009-03-24  Cary Coutant  <ccoutant@google.com>
14559
14560         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
14561         an executable.
14562         (needs_dynamic_reloc): Likewise.
14563
14564 2009-03-24  Ian Lance Taylor  <iant@google.com>
14565
14566         * yyscript.y (file_cmd): Recognize EXTERN.
14567         (extern_name_list, extern_name_list_body): New nonterminals.
14568         * script.cc (script_add_extern): Define.
14569         * script-c.h (script_add_extern): Declare.
14570
14571 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
14572
14573         * object.cc (is_elf_object): Define.
14574         * object.h (is_elf_object): Declare.
14575         * archive.cc (Archive::get_elf_object_for_member): Call
14576         is_elf_object.
14577         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
14578
14579 2009-03-24  Elliott Hughes  <enh@google.com>
14580
14581         * output.cc (Output_file::map_anonymous): Define.
14582         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
14583         try an anonymous one.  Report the size if the mmap fails.
14584         * output.h (class Output_file): Declare map_anonymous.
14585
14586 2009-03-24  Ian Lance Taylor  <iant@google.com>
14587
14588         * target-select.cc (instantiate_target): Don't acquire the lock if
14589         the instantiated_target_ field has already been set.
14590
14591 2009-03-23  Ian Lance Taylor  <iant@google.com>
14592
14593         * gold-threads.h (class Initialize_lock): Define.
14594         * gold-threads.cc (class Initialize_lock_once): Define.
14595         (initialize_lock_control): New static variable.
14596         (initialize_lock_pointer): New static variable.
14597         (initialize_lock_once): New static function.
14598         (Initialize_lock::Initialize_lock): Define.
14599         (Initialize_lock::initialize): Define.
14600         * target-select.h: Include "gold-threads.h".
14601         (class Target_selector): Add lock_ and initialize_lock_ fields.
14602         Don't define instantiate_target, just declare it.
14603         * target-select.cc (Target_selector::Target_selector): Initialize
14604         new fields.
14605         (Target_selector::instantiate_target): Define.
14606         * descriptors.h: Include "gold-threads.h".
14607         (class Descriptors): Add initialize_lock_ field.
14608         * descriptors.cc (Descriptors::Descriptors): Initialize new
14609         field.
14610         (Descriptors::open): Use initialize_lock_ field
14611         * errors.h (class Errors): Add initialize_lock_ field.
14612         * errors.cc (Errors::Errors): Initialize new field.
14613         (Errors::initialize_lock): Use initialize_lock_ field.
14614         * powerpc.cc (class Target_selector_powerpc): Remove
14615         instantiated_target_ field.  In do_recognize call
14616         instantiate_target rather than do_instantiate_target.  In
14617         do_instantiate_target just allocate a new target.
14618         * sparc.cc (class Target_selector_sparc): Likewise.
14619
14620         * freebsd.h: New file.
14621         * i386.cc: Include "freebsd.h".
14622         (Target_i386): Derive from Target_freebsd rather than
14623         Sized_target.
14624         (Target_selector_i386): Derive from Target_selector_freebsd rather
14625         than Target_selector.
14626         * x86_64.cc: Include "freebsd.h".
14627         (Target_x86_64): Derive from Target_freebsd rather than
14628         Sized_target.
14629         (Target_selector_x86_64): Derive from Target_selector_freebsd
14630         rather than Target_selector.
14631         * target.h (class Target): Add adjust_elf_header and
14632         do_adjust_elf_header.
14633         * output.cc (Output_file_header:: do_sized_write): Call target
14634         adjust_elf_header routine.
14635         * configure.tgt: Set targ_osabi.
14636         * configure.ac: Define GOLD_DEFAULT_OSABI.
14637         * parameters.cc (Parameters::default_target): Pass
14638         GOLD_DEFAULT_OSABI to select_target.
14639         * target-select.h (class Target_selector): Make instantiate_target
14640         protected rather than private.
14641         * Makefile.am (HFILES): Add freebsd.h.
14642         * configure, Makefile.in, config.in: Rebuild.
14643
14644         * merge.cc (do_add_input_section): Correct pend value.  Change
14645         message about last entry not being null terminated from error to
14646         warning.
14647
14648 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
14649
14650         * incremental.cc: New file.
14651         * Makefile.am (CCFILES): Add incremental.cc.
14652         * Makefile.in: Rebuild.
14653
14654 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
14655
14656         * layout.cc (Layout::output_section_name): Preserve names
14657         of '.note.' sections.
14658
14659 2009-03-19  Ian Lance Taylor  <iant@google.com>
14660
14661         * descriptors.cc (Descriptors::open): Check that the options are
14662         valid before using them.
14663
14664 2009-03-18  Ian Lance Taylor  <iant@google.com>
14665
14666         * script-sections.h: Include <list>.
14667         (class Script_sections): Change Sections_elements from std::vector
14668         to std::list.  Typedef public Elements_iterator.  Add
14669         orphan_section_placement_, data_segment_align_start_, and
14670         saw_data_segment_align_ fields.  Remove data_segment_align_index_
14671         field.
14672         * script-sections.cc (class Orphan_section_placement): New class.
14673         (class Sections_element): Add virtual functions is_relro and
14674         orphan_section_init.  Remove virtual function place_orphan_here.
14675         (class Output_section_definition): Add is_relro and
14676         orphan_section_init.  Remove place_orphan_here.
14677         (class Orphan_output_section): Likewise.
14678         (Script_sections::Script_sections): Update for field changes.
14679         (Script_sections::data_segment_align): Set saw_data_segment_align_
14680         and data_segment_align_start_, not data_segment_align_index.
14681         (Script_sections::data_segment_relro_end): Check
14682         saw_data_segment_align_.  Use data_segment_align_start_ rather
14683         than data_segment_align_index_.
14684         (Script_sections::place_orphan): Rewrite to use
14685         Orphan_section_placement.
14686
14687 2009-03-17  Ian Lance Taylor  <iant@google.com>
14688
14689         * archive.cc (Archive::add_symbols): Check for a version attached
14690         to the symbol name in the archive map.
14691         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
14692         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
14693         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
14694         (ver_test_11.a): New target.
14695         * testsuite/Makefile.in: Rebuild.
14696
14697         * configure.ac: Check for chsize and posix_fallocate.  Replace
14698         ftruncate.
14699         * ftruncate.c: New file, from gnulib.
14700         * output.cc (posix_fallocate): Define dummy version if not
14701         HAVE_POSIX_FALLOCATE.
14702         (Output_file::map): Call posix_fallocate rather than lseek and
14703         write.
14704         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
14705         * configure, Makefile.in, config.in: Rebuild.
14706
14707 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
14708
14709         * layout.h (Layout::create_note): Add section_name parameter.
14710         * layout.cc (Layout::create_note): Likewise.
14711         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
14712
14713 2009-03-17  Ian Lance Taylor  <iant@google.com>
14714
14715         * descriptors.cc: Include "options.h".
14716         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
14717         (Descriptors::open): Always use O_CLOEXEC when opening a new
14718         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
14719         then set FD_CLOEXEC.
14720
14721         * sparc.cc (class Target_sparc): Add has_got_section.
14722         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
14723         make sure we have a GOT section.
14724
14725         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
14726         (Target_sparc::Scan::local): Likewise.
14727         (Target_sparc::Scan::global): Likewise.
14728         (Target_sparc::Relocate::relocate): Likewise.
14729         (Target_sparc::Relocate::relocate_tls): Likewise.
14730
14731         * symtab.cc (Symbol_table::define_default_version): New function,
14732         broken out of add_from_object.
14733         (Symbol_table::add_from_object): Call define_default_version.
14734         (Symbol_table::define_special_symbol): Add resolve_oldsym
14735         parameter.  Change all callers.  If the version for a symbol comes
14736         from a version script, resolve it with the symbol with the same
14737         name with no version.  Also add the symbol without a version if
14738         appropriate.
14739         (do_define_in_output_data): If resolving with oldsym, don't delete
14740         sym.
14741         (do_define_in_output_segment): Likewise.
14742         (do_define_as_constant): Likewise.
14743         * symtab.h (class Symbol_table): Update declarations.
14744
14745 2009-03-13  Ian Lance Taylor  <iant@google.com>
14746
14747         * readsyms.cc (Read_symbols::incompatible_warning): New function.
14748         (Read_symbols::requeue): New function.
14749         (Read_symbols::do_read_symbols): If make_elf_object fails because
14750         the target type is not configured, and the file was searched for,
14751         issue a warning and retry with the next directory.
14752         (Add_symbols::run): If the file has an incompatible format, and
14753         it was searched for, requeue the Read_symbols task.  On error,
14754         release the object.
14755         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
14756         dirindex parameter to constructor.  Change all callers.  Declare
14757         incompatible_warning and requeue.
14758         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
14759         input_argument_ and input_group_ fields.  Add them to
14760         constructor.  Change all callers.
14761         (class Read_script): Add dirindex_ field.  Add it to constructor.
14762         Change all callers.
14763         * archive.cc (Archive::setup): Remove input_objects parameter.
14764         Change all callers.
14765         (Archive::get_file_and_offset): Likewise.
14766         (Archive::read_all_symbols): Likewise.
14767         (Archive::read_symbols): Likewise.
14768         (Archive::get_elf_object_for_member): Remove input_objects
14769         parameter.  Add punconfigured parameter.  Change all callers.
14770         (Archive::add_symbols): Change return type to bool.  Check return
14771         value of include_member.
14772         (Archive::include_all_members): Likewise.
14773         (Archive::include_member): Change return type to bool.  Return
14774         false if first included object has incompatible target.  Set
14775         included_member_ field.
14776         (Add_archive_symbols::run): If add_symbols returns false, requeue
14777         Read_symbols task.
14778         * archive.h (class Archive): Add included_member_ field.
14779         Initialize it in constructor.  Add input_file and searched_for
14780         methods.  Update declarations.
14781         (class Add_archive_symbols): Add dirpath_, dirindex_, and
14782         input_argument_ fields.  Add them to constructor.  Change all
14783         callers.
14784         * script.cc: Include "target-select.h".
14785         (class Parser_closure): Add skip_on_incompatible_target_ and
14786         found_incompatible_target_ fields.  Add
14787         skip_on_incompatible_target parameter to constructor.  Change all
14788         callers.  Add methods skip_on_incompatible_target,
14789         clear_skip_on_incompatible_target, found_incompatible_target, and
14790         set_found_incompatible_target.
14791         (read_input_script): Add dirindex parameter.  Change all callers.
14792         If parser finds an incompatible target, requeue Read_symbols
14793         task.
14794         (script_set_symbol): Clear skip_on_incompatible_target in
14795         closure.
14796         (script_add_assertion, script_parse_option): Likewise.
14797         (script_start_sections, script_add_phdr): Likewise.
14798         (script_check_output_format): New function.
14799         * script.h (read_input_script): Update declaration.
14800         * script-c.h (script_check_output_format): Declare.
14801         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
14802         (ignore_cmd): Remove OUTPUT_FORMAT.
14803         * fileread.cc (Input_file::Input_file): Add explicit this.
14804         (Input_file::will_search_for): New function.
14805         (Input_file::open): Add pindex parameter.  Change all callers.
14806         * fileread.h (class Input_file): Add input_file_argument method.
14807         Declare will_search_for.  Update declarations.
14808         * object.cc (make_elf_object): Add punconfigured parameter.
14809         Change all callers.
14810         * object.h (class Object): Make input_file public.  Add
14811         searched_for method.
14812         (make_elf_object): Update declaration.
14813         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
14814         restart search.
14815         * dirsearch.h (class Dirsearch): Update declaration.
14816         * options.h (class General_options): Add --warn-search-mismatch.
14817         * parameters.cc (Parameters::is_compatible_target): New function.
14818         * parameters.h (class Parameters): Declare is_compatible_target.
14819         * workqueue.cc (Workqueue::add_blocker): New function.
14820         * workqueue.h (class Workqueue): Declare add_blocker.
14821
14822         * fileread.cc (Input_file::open): Remove options parameter.
14823         Change all callers.
14824         (Input_file::open_binary): Likewise.
14825         * script.cc (read_input_script): Likewise.
14826         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
14827         options parameter from constructor.  Change all callers.
14828         (class Read_script): Likewise.
14829         * fileread.h (class Input_file): Update declarations.
14830         * script.h (read_input_script): Update declaration.
14831
14832 2009-03-10  Nick Clifton  <nickc@redhat.com>
14833
14834         * po/es.po: New Spanish translation.
14835
14836 2009-03-06  Cary Coutant  <ccoutant@google.com>
14837
14838         * options.cc (parse_short_option): Keep dash_z from registering itself.
14839
14840 2009-03-03  Ian Lance Taylor  <iant@google.com>
14841
14842         PR 9918
14843         * target-reloc.h (relocate_section): Pass output_section to
14844         relocate.
14845         * i386.cc (Target_i386::should_apply_static_reloc): Add
14846         output_section parameter.  Change all callers.
14847         (Target_i386::Relocate::relocate): Add output_section parameter.
14848         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
14849         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
14850         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
14851         * testsuite/two_file_shared.sh: New script.
14852         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
14853         (check_DATA): Add two_file_shared.dbg.
14854         (two_file_shared.dbg): New target.
14855         * testsuite/Makefile.in: Rebuild.
14856
14857 2009-03-01  Ian Lance Taylor  <iant@google.com>
14858
14859         * configure.ac: Check for byteswap.h.
14860         * configure: Rebuild.
14861         * config.in: Rebuild.
14862
14863 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
14864
14865         * layout.cc (Layout::find_or_add_kept_section): New function.
14866         (Layout::add_comdat): Removed.
14867         * layout.h (struct Kept_section): Move out of class Layout.
14868         Remove trailing underscores from field names.  Add group_sections
14869         field.  Rename group_ field to is_group.  Change all uses.
14870         (class Layout): Declare find_or_add_kept_section, not add_comdat.
14871         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
14872         comdat_groups_ field.
14873         (Sized_relobj::include_section_group): Use
14874         find_or_add_kept_section and Kept_section::group_sections.
14875         (Sized_relobj::include_linkonce_section): Likewise.
14876         * object.cc (class Sized_relobj): Don't define Comdat_group or
14877         Comdat_group_table.  Remove find_comdat_group and
14878         add_comdat_group.  Remove comdat_groups_ field.
14879         * plugin.cc (include_comdat_group): Use
14880         Layout::find_or_add_kept_section.
14881
14882 2009-02-28  Ian Lance Taylor  <iant@google.com>
14883
14884         * README: --gc-sections and map files are now supported.  Document
14885         some build requirements.
14886
14887         PR 6992
14888         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
14889         relocatable link set the value of the section symbol to zero.
14890         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
14891         relocatable link don't include the section address in the local
14892         symbol value.
14893
14894 2009-02-27  Ian Lance Taylor  <iant@google.com>
14895
14896         PR 6811
14897         * options.h (class Search_directory): Add is_system_directory.
14898         (class General_options): Declare is_in_system_directory.
14899         * options.cc (get_relative_sysroot): Make static.
14900         (get_default_sysroot): Make static.
14901         (General_optoins::is_in_system_directory): New function.
14902         * fileread.cc (Input_file::is_in_system_directory): New function.
14903         * fileread.h (class Input_file): Declare is_in_system_directory.
14904         * object.h (class Object): Add is_in_system_directory.
14905         (class Input_objects): Remove system_library_directory_ field.
14906         * object.cc (Input_objects::add_object): Don't set
14907         system_library_directory_.
14908         (input_objects::found_in_system_library_directory): Remove.
14909         * symtab.cc (Symbol_table::write_globals): Remove input_objects
14910         parameter.  Change all callers.
14911         (Symbol_table::sized_write_globals): Likewise.
14912         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
14913         Call Object::is_in_system_directory.
14914         * symtab.h (class Symbol_table): Update declarations.
14915
14916         PR 5990
14917         * descriptors.h (Open_descriptor): Add is_on_stack field.
14918         * descriptors.cc (Descriptors::open): If the descriptor is on the
14919         top of the stack, remove it.  Initialize is_on_stack field.
14920         (Descriptors::release): Only add pod to stack if it is not on the
14921         stack already.
14922         (Descriptors::close_some_descriptor): Clear stack_next and
14923         is_on_stack fields.
14924
14925         PR 7091
14926         * output.cc (Output_section::find_starting_output_address): Rename
14927         from starting_output_address; add PADDR parameter; change return
14928         type.
14929         * output.h (class Output_section): Declare
14930         find_starting_output_address instead of starting_output_address.
14931         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
14932         section symbol for which we can't find a merge section.
14933
14934         PR 9836
14935         * symtab.cc (Symbol_table::add_from_object): If the visibility is
14936         hidden or internal, force the symbol to be local.
14937         * resolve.cc (Symbol::override_visibility): Define.
14938         (Symbol::override_base): Use override_visibility.
14939         (Symbol_table::resolve): Likewise.
14940         (Symbol::override_base_with_special): Likewise.
14941         (Symbol_table::override_with_special): If the visibility is hidden
14942         or internal, force the symbol to be local.
14943         * symtab.h (class Symbol): Add set_visibility and
14944         override_visibility.
14945         * testsuite/ver_test_1.sh: New file.
14946         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
14947         (check_DATA): Add ver_test_1.syms.
14948         (ver_test_1.syms): New target.
14949         * testsuite/Makefile.in: Rebuild.
14950
14951 2009-02-25  Cary Coutant  <ccoutant@google.com>
14952
14953         * layout.cc (Layout::choose_output_section): Don't rename sections
14954         when using a linker script that has a SECTIONS clause.
14955         * Makefile.in: Regenerate.
14956
14957         * testsuite/Makefile.am (script_test_5.sh): New test case.
14958         * testsuite/Makefile.in: Regenerate.
14959         * testsuite/script_test_5.cc: New file.
14960         * testsuite/script_test_5.sh: New file.
14961         * testsuite/script_test_5.t: New file.
14962
14963 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
14964
14965         * archive.cc (Archive::include_member): Update calls to add_symbols.
14966         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
14967         the Layout argument.
14968         * dynobj.h (do_add_symbols): Add the Layout argument.
14969         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
14970         Layout argument.
14971         * object.h (Object::add_symbols): Add the Layout argument.
14972         (Object::do_add_symbols): Add the Layout argument.
14973         (Sized_relobj::do_add_symbols): Add the Layout argument.
14974         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
14975         Unify the two versions.
14976         (Add_plugin_symbols): Remove.
14977         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
14978         (Sized_pluginobj::do_add_symbols): Unify the two versions.
14979         (Add_plugin_symbols): Remove.
14980         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
14981         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
14982         (Add_symbols::run): Make it work with Pulginobj.
14983
14984 2009-02-06  Ian Lance Taylor  <iant@google.com>
14985
14986         * object.cc (Sized_relobj::do_layout): Make info message start
14987         with lower case letter.
14988
14989 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
14990
14991         * binary.cc: Fix file comment.
14992
14993         * options.h (enum Incremental_disposition): Define.
14994         (class General_options): Add new options: --incremental,
14995         --incremental_changed, --incremental_unchanged,
14996         --incremental_unknown.  Add incremental_disposition_ and
14997         implicit_incremental_ fields.
14998         (General_options::incremental_disposition): New function.
14999         (class Position_dependent_options): Add incremental_disposition
15000         option.
15001         (Position_dependent_options::copy_from_options): Set incremental
15002         dispositions.
15003         * options.cc (General_options::parse_incremental_changed): New
15004         function.
15005         (General_options::parse_incremental_unchanged): New function.
15006         (General_options::parse_incremental_unknown): New function.
15007         (General_options::General_options): Initialize new fields
15008         incremental_disposition_ and implicit_incremental_.
15009         (General_options::finalize): Check for uasge of --incremental-*
15010         without --incremental.
15011
15012 2009-02-06  Chris Demetriou  <cgd@google.com>
15013
15014         * gold.h (gold_undefined_symbol): Change to take only a Symbol
15015         pointer and to report location as the file name associated with
15016         the symbol.
15017         (gold_undefined_symbol_at_location): New function to replace the
15018         old gold_undefined_symbol functionality.
15019         * target-reloc.h (relocate_section): Update to use
15020         gold_undefined_symbol_at_location.
15021         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15022         Call gold_undefined_symbol function rather than gold_error.
15023         * errors.h (Errors::undefined_symbol): Take location as a
15024         string, rather than calculating it from a relocation.
15025         * errors.cc (Errors::fatal): Print "fatal error:" before the
15026         formatted message.
15027         (Errors::error, Errors::error_at_location): Print "error: "
15028         before the formatted message.
15029         (Errors::undefined_symbol): Take location as a string, rather
15030         than calculating it from a relocation.
15031         (gold_undefined_symbol_at_location): New function akin to
15032         old gold_undefined_symbol, calculates location from relocation.
15033         (gold_undefined_symbol): Change to take only a Symbol pointer
15034         and to report location as the file name associated with the symbol.
15035         * testsuite/debug_msg.sh: Update for changed error messages.
15036         * testsuite/undef_symbol.sh: Likewise.
15037
15038 2009-02-04  Duncan Sands  <baldrick@free.fr>
15039
15040         PR 9812
15041         * reduced_debug_output.h
15042         (Output_reduced_debug_abbrev_section::failed): Use format for
15043         gold_warning.
15044         (Output_reduced_debug_info_section::faild): Likewise.
15045
15046 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
15047
15048         * script.cc (Lazy_demangler): New class.
15049         (Version_script_info::get_symbol_version_helper): Demangle a
15050         symbol only once.
15051
15052 2009-01-29  Cary Coutant  <ccoutant@google.com>
15053
15054         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
15055         to __tls_get_addr.
15056         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
15057
15058 2009-01-28  Ian Lance Taylor  <iant@google.com>
15059
15060         * version.cc (version_string): Bump to 1.9.
15061
15062         * gold.h: Include <cstring> and <stdint.h>.
15063         * version.cc: Include <cstdio>.
15064         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
15065         warning.
15066         * reduced_debug_output.cc (insert_into_vector): Rename from
15067         Insert_into_vector; change all callers.  Use Swap_unaligned to
15068         avoid aliasing issue; remove union since it is unnecessary.
15069
15070 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
15071
15072         * Makefile.am (CCFILES): Add gc.cc.
15073         (HFILES): Add gc.h.
15074         * Makefile.in: Regenerate.
15075         * gold.cc (Gc_runner): New class.
15076         (queue_initial_tasks): Call garbage collection related tasks
15077         when corresponding options are invoked.
15078         (queue_middle_gc_tasks): New function.
15079         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
15080         processed early before laying out sections during garbage collection.
15081         * gold.h (queue_middle_gc_tasks): New function.
15082         (is_prefix_of): Move from "layout.cc".
15083         * i386.cc (Target_i386::gc_process_relocs): New function.
15084         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
15085         * main.cc (main): Create object of class "Garbage_collection".
15086         * object.cc (Relobj::copy_symbols_data): New function.
15087         (Relobj::is_section_name_included): New function.
15088         (Sized_relobj::do_layout): Allow this function to be called twice
15089         during garbage collection and defer layout of section during the
15090         first call.
15091         * object.h (Relobj::get_symbols_data): New function.
15092         (Relobj::is_section_name_included): New function.
15093         (Relobj::copy_symbols_data): New function.
15094         (Relobj::set_symbols_data): New function.
15095         (Relobj::get_relocs_data): New function.
15096         (Relobj::set_relocs_data): New function.
15097         (Relobj::is_output_section_offset_invalid): New pure virtual function.
15098         (Relobj::gc_process_relocs): New function.
15099         (Relobj::do_gc_process_relocs): New pure virtual function.
15100         (Relobj::sd_): New data member.
15101         (Sized_relobj::is_output_section_offset_invalid): New function.
15102         (Sized_relobj::do_gc_process_relocs): New function.
15103         * options.h (General_options::gc_sections): Modify to not be a no-op.
15104         (General_options::print_gc_sections): New option.
15105         * plugin.cc (Plugin_finish::run): Remove function call to
15106         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
15107         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
15108         * reloc.cc (Read_relocs::run): Add task to process relocs and
15109         determine unreferenced sections when doing garbage collection.
15110         (Gc_process_relocs): New class.
15111         (Sized_relobj::do_gc_process_relocs): New function.
15112         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
15113         sections that are garbage collected.
15114         * reloc.h (Gc_process_relocs): New class.
15115         * sparc.cc (Target_sparc::gc_process_relocs): New function.
15116         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
15117         symbols whose corresponding sections are garbage collected.
15118         (Symbol_table::Symbol_table): Add new parameter for the garbage
15119         collection object.
15120         (Symbol_table::gc_mark_undef_symbols): New function.
15121         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15122         (Symbol_table::gc_mark_dyn_syms): New function.
15123         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
15124         as garbage.
15125         (Symbol_table::add_from_object): Likewise.
15126         (Symbol_table::add_from_relobj): When building shared objects, do not
15127         treat externally visible symbols as garbage.
15128         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
15129         table information for static and relocatable links.
15130         * symtab.h (Symbol_table::set_gc): New function.
15131         (Symbol_table::gc): New function.
15132         (Symbol_table::gc_mark_undef_symbols): New function.
15133         (Symbol_table::gc_mark_symbol_for_shlib): New function.
15134         (Symbol_table::gc_mark_dyn_syms): New function.
15135         (Symbol_table::gc_): New data member.
15136         * target.h (Sized_target::gc_process_relocs): New pure virtual
15137         function.
15138         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
15139         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
15140
15141 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
15142
15143         * options.h (General_options::gc_sections): Define as a no-op for now.
15144         (General_options::no_keep_memory): Ditto.
15145         (General_options::Bshareable): Define.
15146         * options.cc (General_options::finalize): Honor -Bshareable.
15147
15148 2009-01-20  Andreas Schwab  <schwab@suse.de>
15149
15150         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
15151         read the value in the contents, since we don't use it.  Use the
15152         template endianness when writing.
15153         (Relocate::relocate): Use it for R_PPC_REL16_HA.
15154
15155 2009-01-19  Andreas Schwab  <schwab@suse.de>
15156
15157         * configure.tgt (powerpc64-*): Fix targ_obj.
15158
15159 2009-01-15  Ian Lance Taylor  <iant@google.com>
15160
15161         * object.cc (Sized_relobj::write_local_symbols): Don't write out
15162         local symbols when stripping all symbols.
15163
15164 2009-01-14  Cary Coutant  <ccoutant@google.com>
15165
15166         * output.cc (Output_reloc): Add explicit instantiations.
15167
15168 2009-01-14  Cary Coutant  <ccoutant@google.com>
15169
15170         * archive.cc (Archive::get_elf_object_for_member): Remove call
15171         to File_read::claim_for_plugin.
15172         * descriptors.cc (Descriptors::open): Remove reference to
15173         is_claimed.
15174         (Descriptors::claim_for_plugin): Remove.
15175         * descriptors.h (Descriptors::claim_for_plugin): Remove.
15176         (Descriptors::is_claimed): Remove.
15177         (claim_descriptor_for_plugin): Remove.
15178         * fileread.cc (File_read::claim_for_plugin): Remove.
15179         * fileread.h (File_read::claim_for_plugin): Remove.
15180         (File_read::descriptor): Reopen descriptor if necessary.
15181         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
15182         (Plugin_manager::all_symbols_read): Add task parameter. Change
15183         all callers.
15184         (Plugin_manager::get_input_file): New function.
15185         (Plugin_manager::release_input_file): New function.
15186         (Pluginobj::Pluginobj): Add filesize parameter and initialize
15187         corresponding data member.
15188         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
15189         and pass to base constructor. Change all callers.
15190         (get_input_file, release_input_file): New functions.
15191         (make_sized_plugin_object): Add filesize parameter. Change all callers.
15192         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
15193         (Plugin_manager::all_symbols_read): Add task parameter.
15194         (Plugin_manager::get_input_file): New function.
15195         (Plugin_manager::release_input_file): New function.
15196         (Plugin_manager::task_): New data member.
15197         (Pluginobj::Pluginobj): Add filesize parameter.
15198         (Pluginobj::filename): New function.
15199         (Pluginobj::descriptor): New function.
15200         (Pluginobj::filesize): New function.
15201         (Pluginobj::filesize_): New data member.
15202         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
15203         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
15204         File_read::claim_for_plugin; use Object::unlock to unlock the file.
15205
15206         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
15207         with archive libraries.
15208         * testsuite/Makefile.in: Regenerate.
15209         * testsuite/plugin_test.c (struct sym_info): New type.
15210         (get_input_file, release_input_file): New static variables.
15211         (onload): Capture new transfer vector entries.
15212         (claim_file_hook): Stop reading at end of file according to filesize.
15213         Factor out parsing of readelf output into separate function.
15214         (all_symbols_read_hook): Exercise get_input_file and release_input_file
15215         APIs and get the source file name from the symbol table.  Convert
15216         source file name to corresponding object file name.  Print info
15217         message when adding new input files.
15218         (parse_readelf_line): New function.
15219         * testsuite/plugin_test_1.sh: Add checks for new info messages.
15220         * testsuite/plugin_test_2.sh: Likewise.
15221         * testsuite/plugin_test_3.sh: Likewise.
15222         * testsuite/plugin_test_4.sh: New test case.
15223
15224 2009-01-07  Ian Lance Taylor  <iant@google.com>
15225
15226         * version.cc (version_string): Bump to 1.8.
15227
15228 2008-12-23  Cary Coutant  <ccoutant@google.com>
15229
15230         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
15231         * plugin.cc (Plugin_manager::finish): Rename as
15232         layout_deferred_objects.  Move cleanup to separate function.
15233         (Plugin_manager::cleanup): New function.
15234         (Plugin_finish::run): Call layout_deferred_objects and cleanup
15235         separately.
15236         * plugin.h (Plugin_manager::finish): Rename as
15237         layout_deferred_objects.
15238         (Plugin_manager::cleanup): New function.
15239         (Plugin_manager::cleanup_done): New field.
15240
15241 2008-12-23  Cary Coutant  <ccoutant@google.com>
15242
15243         * plugin.cc (is_visible_from_outside): New function.
15244         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
15245         so we don't return "IR only" status for exported symbols or -r links.
15246
15247         * testsuite/Makefile.am (plugin_test_3): New test case.
15248         * testsuite/Makefile.in: Regenerate.
15249         * testsuite/plugin_test_3.sh: New file.
15250
15251 2008-12-22  Cary Coutant  <ccoutant@google.com>
15252
15253         * object.cc (Sized_relobj::layout_section): New function.
15254         (Sized_relobj::do_layout): Defer layout of input sections until after
15255         plugin has provided replacement files.
15256         (Sized_relobj::do_layout_deferred_sections): New function.
15257         * object.h (Relobj::set_section_offset): Remove virtual keyword.
15258         (Relobj::layout_deferred_sections): New function.
15259         (Relobj::do_layout_deferred_sections): New function.
15260         (Sized_relobj::do_layout_deferred_sections): New function.
15261         (Sized_relobj::layout_section): New function.
15262         (Sized_relobj::Deferred_layout): New structure.
15263         (Sized_relobj::deferred_layout_): New field.
15264         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
15265         Change all callers.  Layout deferred sections.
15266         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
15267         references.
15268         (Plugin_hook::run): Move code from do_plugin_hook inline.
15269         (Plugin_hook::do_plugin_hook): Remove.
15270         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
15271         (Plugin_manager::finish): Renamed, was cleanup.
15272         (Plugin_manager::should_defer_layout): New function.
15273         (Plugin_manager::add_deferred_layout_object): New function.
15274         (Plugin_manager::Deferred_layout_list): New type.
15275         (Plugin_manager::deferred_layout_objects_): New field.
15276         (Plugin_hook::do_plugin_hook): Remove.
15277
15278 2008-12-17  Ian Lance Taylor  <iant@google.com>
15279
15280         * options.h (class General_options): Add --no case for
15281         --export-dynamic.
15282
15283 2008-12-16  Cary Coutant  <ccoutant@google.com>
15284
15285         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
15286         vector.
15287         (Plugin_manager::claim_file): Create plugin object even if
15288         plugin did not call the add_symbols callback.
15289         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
15290         asking for more symbols than were added.
15291         * testsuite/Makefile.am (plugin_test_1): Add test case with
15292         no global symbols.
15293         (empty.syms): New target.
15294         * testsuite/Makefile.in: Regenerate.
15295         * testsuite/plugin_test.c (claim_file_hook): Add new debug
15296         message. Don't call add_symbols if no globals.
15297         (all_symbols_read_hook): Don't provide replacement for empty
15298         claimed file.
15299
15300 2008-12-12  Ian Lance Taylor  <iant@google.com>
15301
15302         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
15303         r_type == 0 for a local symbol with r_sym == 0.
15304         (scan_relocatable_relocs): Pass r_sym to
15305         local_non_section_strategy.
15306         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
15307         r_sym parameter.
15308
15309         * configure.ac: Update test for TLS descriptors: they are
15310         supported as of glibc 2.9.
15311         * configure: Rebuild.
15312
15313 2008-12-11  Ian Lance Taylor  <iant@google.com>
15314
15315         PR 7091
15316         * target-reloc.h (Default_scan_relocatable_relocs): For each
15317         function, map r_type == 0 to RELOC_DISCARD.
15318
15319 2008-12-10  Cary Coutant  <ccoutant@google.com>
15320
15321         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
15322         object to override a kept COMDAT group from a plugin object.
15323
15324 2008-12-09  Ian Lance Taylor  <iant@google.com>
15325
15326         PR 7088
15327         * yyscript.y (file_cmd): Handle INPUT.
15328
15329         * testsuite/initpri1.c: Change all declarations to be full
15330         prototypes by adding void, to avoid compiler warnings.
15331
15332 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
15333
15334         * options.cc (General_options::parse_plugin_opt): New.
15335         (General_options::add_plugin): The argument now is just the filename.
15336         (General_options::add_plugin_option): New.
15337         * options.h (plugin_opt): New.
15338         (add_plugin): Change argument name.
15339         (add_plugin_option): New.
15340         * plugin.cc (Plugin::load): Don't parse the plugin option.
15341         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
15342         (Plugin::add_option): New.
15343         (Plugin::args_): Change type.
15344         (Plugin::filename_): New.
15345         (Plugin_manager::add_plugin_option): New.
15346         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
15347         * testsuite/Makefile.in: Regenerate.
15348
15349 2008-12-05  Cary Coutant  <ccoutant@google.com>
15350
15351         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
15352         Handle --strip-lto-sections option.
15353         * options.h (strip_lto_sections): New option.
15354
15355 2008-12-01  Cary Coutant  <ccoutant@google.com>
15356
15357         * plugin.cc (ld_plugin_message): Change format parameter to const.
15358         Fix mismatch between new[] and delete.
15359
15360 2008-11-14  Cary Coutant  <ccoutant@google.com>
15361
15362         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
15363         instead of -1U.
15364
15365 2008-11-05  Craig Silverstein  <csilvers@google.com>
15366
15367         * options.cc (General_options::parse_dynamic_list): New function.
15368         * options.h (General_options): New flags dynamic_list,
15369         dynamic_list_data, dynamic_list_cpp_new, and
15370         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
15371         (General_options::in_dynamic_list): New function.
15372         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
15373         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
15374         (Lex::can_continue_name): Likewise.
15375         (yylex): Likewise.
15376         (read_script_file): New parameter script_options.
15377         (read_dynamic_list): New function.
15378         (Script_options::define_dynamic_list): New function.
15379         (dynamic_list_keyword_parsecodes): New variable.
15380         (dynamic_list_keywords): New variable.
15381         * script.h (Script_options::define_dynamic_list): New function
15382         prototype.
15383         (read_dynamic_list): New function prototype.
15384         * symtab.cc (strprefix): New macro.
15385         (Symbol::should_add_dynsym_entry): Support dynamic_list,
15386         dynamic_list_data, dynamic_list_cpp_new, and
15387         dynamic_list_cpp_typeinfo.
15388         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
15389         (dynamic_list_expr): New rule.
15390         (dynamic_list_nodes): Likewise.
15391         (dynamic_list_node): Likewise.
15392         * testsuite/Makefile.am (dynamic_list): New test.
15393         * testsuite/Makefile.in: Regenerated.
15394         * testsuite/dynamic_list.t: New file.
15395         * testsuite/dynamic_list.sh: New file.
15396
15397 2008-11-05  Craig Silverstein  <csilvers@google.com>
15398
15399         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
15400         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
15401         (t11_last): Likewise.
15402         * testsuite/ver_test_6.c (main): Likewise.
15403
15404 2008-10-07  Cary Coutant  <ccoutant@google.com>
15405
15406         * options.c (General_options::finalize): Add check for -static and
15407         -shared.
15408         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
15409         is not empty.
15410
15411 2008-10-02  Cary Coutant  <ccoutant@google.com>
15412
15413         * plugin.cc (make_sized_plugin_object): Fix conditional
15414         compilation to work when not all targets are enabled.
15415
15416 2008-09-29  Cary Coutant  <ccoutant@google.com>
15417
15418         * archive.cc (Archive::get_file_and_offset): Use filename instead
15419         of name to get library path.
15420         (Archive::include_member): Unlock external member of a thin archive.
15421
15422         * testsuite/Makefile.am (TEST_AR): New variable.
15423         (thin_archive_test_1): New test.
15424         (thin_archive_test_2): New test.
15425         * testsuite/Makefile.in: Regenerate.
15426         * testsuite/thin_archive_main.cc: New file.
15427         * testsuite/thin_archive_test_1.cc: New file.
15428         * testsuite/thin_archive_test_2.cc: New file.
15429         * testsuite/thin_archive_test_3.cc: New file.
15430         * testsuite/thin_archive_test_4.cc: New file.
15431
15432 2008-09-29  Cary Coutant  <ccoutant@google.com>
15433
15434         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
15435         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
15436         instead of -1U.
15437         (Sized_relobj::do_finalize_local_symbols): Likewise.
15438         (Sized_relobj::map_to_kept_section): Likewise.
15439         * object.h (Sized_relobj::invalid_address): New constant.
15440         (Sized_relobj::do_output_section_offset): Check for invalid_address
15441         and return -1ULL.
15442         * output.cc (Output_reloc::local_section_offset): Use constant
15443         invalid_address instead of -1U.
15444         (Output_reloc::get_address): Likewise.
15445         (Output_section::output_address): Change -1U to -1ULL.
15446         * output.h (Output_reloc::invalid_address): New constant.
15447         * reloc.cc (Sized_relobj::write_sections): Use constant
15448         invalid_address instead of -1U.
15449         (Sized_relobj::relocate_sections): Likewise.
15450         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
15451         values for merge sections.
15452         * target-reloc.h (relocate_for_relocatable): Use constant
15453         invalid_address instead of -1U.
15454
15455 2008-09-19  Cary Coutant  <ccoutant@google.com>
15456
15457         Add plugin functionality for link-time optimization (LTO).
15458         * configure.ac (plugins): Add --enable-plugins option.
15459         * configure: Regenerate.
15460         * config.in: Regenerate.
15461         * Makefile.am (LIBDL): New variable.
15462         (CCFILES): Add plugin.cc.
15463         (HFILES): Add plugin.h.
15464         (ldadd_var): Add LIBDL.
15465         * Makefile.in: Regenerate.
15466
15467         * archive.cc: Include "plugin.h".
15468         (Archive::setup): Don't preread archive symbols when using a plugin.
15469         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
15470         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
15471         files.
15472         (Archive::include_member): Add symbols from plugin objects.
15473         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
15474         * descriptors.cc (Descriptors::open): Check for file descriptors
15475         abandoned by plugins.
15476         (Descriptors::claim_for_plugin): New function.
15477         * descriptors.h (Descriptors::claim_for_plugin): New function.
15478         (Open_descriptor::is_claimed): New field.
15479         (claim_descriptor_for_plugin): New function.
15480         * fileread.cc (File_read::claim_for_plugin): New function.
15481         * fileread.h (File_read::claim_for_plugin): New function.
15482         (File_read::descriptor): New function.
15483         * gold.cc: Include "plugin.h".
15484         (queue_initial_tasks): Add task to call plugin hooks for generating
15485         new object files.
15486         * main.cc: Include "plugin.h".
15487         (main): Load plugin libraries.
15488         * object.h (Pluginobj): Declare.
15489         (Object::pluginobj): New function.
15490         (Object::do_pluginobj): New function.
15491         (Object::set_target): New function.
15492         * options.cc: Include "plugin.h".
15493         (General_options::parse_plugin): New function.
15494         (General_options::General_options): Initialize plugins_ field.
15495         (General_options::add_plugin): New function.
15496         * options.h (Plugin_manager): Declare.
15497         (General_options): Add --plugin option.
15498         (General_options::has_plugins): New function.
15499         (General_options::plugins): New function.
15500         (General_options::add_plugin): New function.
15501         (General_options::plugins_): New field.
15502         * plugin.cc: New file.
15503         * plugin.h: New file.
15504         * readsyms.cc: Include "plugin.h".
15505         (Read_symbols::do_read_symbols): Check for archive before checking
15506         for ELF file.  Call plugin hooks to claim files.
15507         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
15508         from a real object file; force override when processing replacement
15509         files.
15510         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
15511         (Symbol::init_base_object): Likewise.
15512         (Symbol::init_base_output_data): Likewise.
15513         (Symbol::init_base_output_segment): Likewise.
15514         (Symbol::init_base_constant): Likewise.
15515         (Symbol::init_base_undefined): Likewise.
15516         (Symbol::output_section): Assert that object is not a plugin.
15517         (Symbol_table::add_from_pluginobj): New function.
15518         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
15519         undefined.
15520         (Symbol_table::sized_write_globals): Likewise.
15521         (Symbol_table::add_from_pluginobj): Instantiate template.
15522         * symtab.h (Sized_pluginobj): Declare.
15523         (Symbol::in_real_elf): New function.
15524         (Symbol::set_in_real_elf): New function.
15525         (Symbol::in_real_elf_): New field.
15526         (Symbol_table::add_from_pluginobj): New function.
15527
15528         * testsuite/Makefile.am (AM_CFLAGS): New variable.
15529         (LIBDL): New variable.
15530         (LDADD): Add LIBDL.
15531         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
15532         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
15533         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
15534         (MOSTLYCLEANFILES): Likewise.
15535         * testsuite/Makefile.in: Regenerate.
15536         * testsuite/plugin_test.c: New file.
15537         * testsuite/plugin_test_1.sh: New file.
15538         * testsuite/plugin_test_2.sh: New file.
15539
15540 2008-09-16  Ian Lance Taylor  <iant@google.com>
15541
15542         * target-reloc.h (relocate_section): Check whether a symbol is
15543         defined by the ABI before reporting an undefined symbol error.
15544         * target.h (Target::is_defined_by_abi): Make parameter const.
15545         (Target::do_is_defined_by_abi): Likewise.
15546         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
15547         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
15548         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
15549         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
15550         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
15551         * testsuite/Makefile.in: Rebuild.
15552
15553         * fileread.cc (make_view): Add casts to avoid warning.
15554
15555 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15556
15557         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
15558         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15559
15560 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
15561
15562         * options.h (General_options::output_is_executable): New.
15563         (General_options::output_is_pie): New.
15564         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
15565         for shared libraries.
15566         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
15567
15568 2008-09-11  Chris Demetriou  <cgd@google.com>
15569
15570         * options.h (origin): New -z option.
15571         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
15572         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
15573         in DT_FLAGS_1.
15574
15575 2008-09-05  Cary Coutant  <ccoutant@google.com>
15576
15577         * fileread.cc (File_read::make_view): Add check for attempt to map
15578         beyond end of file.
15579
15580 2008-09-05  Cary Coutant  <ccoutant@google.com>
15581
15582         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
15583         explicit instantiations.
15584
15585 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
15586
15587         PR gold/6858
15588         * options.cc (General_options::finalize): Allow undefined symbols
15589         in shlibs if linking -shared.
15590
15591         PR gold/6859
15592         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
15593         symbols as not needing a dynsym entry.
15594
15595 2008-08-20  Craig Silverstein  <csilvers@google.com>
15596
15597         * fileread.cc (File_read::open): Do not lock the file unless it
15598         was successfully opened.
15599
15600 2008-08-14  Cary Coutant  <ccoutant@google.com>
15601
15602         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
15603         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
15604         * testsuite/tls_test.cc (struct int128): 128-bit struct
15605         for testing TLS relocs with non-zero addend.
15606         (v12): New TLS variable.
15607         (t12): New test.
15608         (t_last): Add check for v12.
15609         * testsuite/tls_test.h (t12): New function.
15610         * testsuite/tls_test_main.cc (thread_routine): Call new test.
15611
15612 2008-08-13  Ian Lance Taylor  <iant@google.com>
15613
15614         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
15615         set tls_segment_ or relro_segment_.
15616         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
15617         when appropriate.
15618         * output.h (Output_section::clear_is_relro): New function.
15619         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
15620         sections specially even when output_data_ is empty.
15621         (Output_segment::maximum_alignment): When first section is relro,
15622         only force alignment for PT_LOAD segments.
15623         * script.cc (script_data_segment_align): New function.
15624         (script_data_segment_relro_end): New function.
15625         * script-c.h (script_data_segment_align): Declare.
15626         (script_data_segment_relro_end): Declare.
15627         * script-sections.h (class Script_sections): Declare
15628         data_segment_align and data_segment_relro_end.  Add fields
15629         segment_align_index_ and saw_relro_end_.
15630         * script-sections.cc (class Sections_element): Add set_is_relro
15631         virtual function.  Add new bool* parameter to place_orphan_here.
15632         Add get_output_section virtual function.
15633         (class Output_section_definition): Add set_is_relro.  Add new
15634         bool* parameter to place_orphan_here.  Add get_output_section.
15635         Add is_relro_ field.
15636         (Output_section_definition::Output_section_definition): Initialize
15637         evaluated_address_, evaluated_load_address, evaluated_addralign_,
15638         and is_relro_ fields.
15639         (Output_section_definition::place_orphan_here): Add is_relro
15640         parameter.
15641         (Output_section_definition::set_section_addresses): Set relro for
15642         output section.
15643         (Output_section_definition::alternate_constraint): Likewise.
15644         (class Orphan_output_section): Add new bool* parameter to
15645         place_orphan_here.  Add get_output_section.
15646         (Orphan_output_section::place_orphan_here): Add is_relro
15647         parameter.
15648         (Script_sections::Script_sections): Initialize
15649         data_segment_align_index_ and saw_relro_end_.
15650         (Script_sections::data_segment_align): New function.
15651         (Script_sections::data_segment_relro_end): New function.
15652         (Script_sections::place_orphan): Set or clear is_relro.
15653         (Script_sections::set_section_addresses): Force alignment of first
15654         TLS section.
15655         * yyscript.y (exp): Call script_data_segment_align and
15656         script_data_segment_relro_end.
15657         * testsuite/relro_script_test.t: New file.
15658         * testsuite/relro_test.cc (using_script): Declare.
15659         (t1, t2): Test using_script.
15660         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
15661         (relro_script_test_SOURCES): Define.
15662         (relro_script_test_DEPENDENCIES): Define.
15663         (relro_script_test_LDFLAGS): Define.
15664         (relro_script_test_LDADD): Define.
15665         (relro_script_test.so): New target.
15666         * testsuite/Makefile.in: Rebuild.
15667
15668 2008-08-06  Cary Coutant <ccoutant@google.com>
15669
15670         * archive.cc (Archive::total_archives, Archive::total_members)
15671         (Archive::total_members_loaded): New variables.
15672         (Archive::setup): Add parameter.  Add option to preread
15673         archive symbols.
15674         (Archive::read_armap): Add counter.
15675         (Archive::get_file_and_offset): New function.
15676         (Archive::get_elf_object_for_member): New function.
15677         (Archive::read_all_symbols): New function.
15678         (Archive::read_symbols): New function.
15679         (Archive::add_symbols): Add counters.
15680         (Archive::include_all_members): Use armap to find members if it's
15681         already built.
15682         (Archive::include_member): Skip reading symbols if already read.
15683         Factored code into Archive::get_file_and_offset and
15684         Archive::get_elf_object_for_member.  Changed call to
15685         Mapfile::report_include_archive_member.
15686         (Archive::print_stats): New function.
15687         * archive.h: Declare Object and Read_symbols_data classes.
15688         (Archive::Archive): Add initializers for new members.
15689         (Archive::setup): Add parameter.
15690         (Archive::print_stats): New function.
15691         (Archive::total_archives, Archive::total_members)
15692         (Archive::total_members_loaded): New variables.
15693         (Archive::get_file_and_offset): New function.
15694         (Archive::get_elf_object_for_member): New function.
15695         (Archive::read_all_symbols): New function.
15696         (Archive::read_symbols): New function.
15697         (Archive::Archive_member): New class.
15698         (Archive::members_): New member.
15699         (Archive::num_members_): New member.
15700         * main.cc: Include archive.h.
15701         (main): Call Archive::print_stats.
15702         * mapfile.cc (Mapfile::report_include_archive_member): Delete
15703         archive parameter; member_name is now the fully-decorated name.
15704         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
15705         * options.h: (General_options): Add --preread-archive-symbols option.
15706         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
15707         Archive::setup.
15708
15709 2008-08-04  Ian Lance Taylor  <iant@google.com>
15710
15711         * symtab.h (Symbol::use_plt_offset): New function.
15712         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
15713         * powerpc.cc (Relocate::relocate): Likewise.
15714         * sparc.cc (Relocate::relocate): Likewise.
15715         * x86_64.cc (Relocate::relocate): Likewise.
15716         * testsuite/weak_plt.sh: New test.
15717         * testsuite/weak_plt_main.cc: New test.
15718         * testsuite/weak_plt_shared.cc: New test.
15719         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
15720         (check_PROGRAMS): Add weak_plt.
15721         (check_DATA): Add weak_plt_shared.so.
15722         (weak_plt_main_pic.o, weak_plt): New targets.
15723         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
15724         * testsuite/Makefile.in: Rebuild.
15725
15726         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
15727         gcctestdir/ld.
15728         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
15729         * testsuite/Makefile.in: Rebuild.
15730
15731 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
15732
15733         * Makefile.am (POTFILES.in): Set LC_ALL=C.
15734         * Makefile.in: Regenerate.
15735         * po/POTFILES.in: Regenerate.
15736
15737 2008-07-29  Ian Lance Taylor  <iant@google.com>
15738
15739         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
15740         symbols before other symbols.
15741         * testsuite/script_test_2.cc (test_addr): Declare.
15742         (test_addr_alias): Declare.
15743         (main): Check that test_addr and test_addr_alias have the right
15744         values.
15745         * testsuite/script_test_2.t: Define test_addr_alias and
15746         test_addr.
15747
15748 2008-07-24  Ian Lance Taylor  <iant@google.com>
15749
15750         PR 5990
15751         * descriptors.cc: New file.
15752         * descriptors.h: New file.
15753         * gold-threads.h (class Hold_optional_lock): New class.
15754         * fileread.cc: Include "descriptors.h".
15755         (File_read::~File_read): Release descriptor rather than closing
15756         it.
15757         (File_read::open) [file]: Call open_descriptor rather than open.
15758         Set is_descriptor_opened_.
15759         (File_read::open) [memory]: Assert that descriptor is not open.
15760         (File_read::reopen_descriptor): New function.
15761         (File_read::release): Release descriptor.
15762         (File_read::do_read): Make non-const.  Reopen descriptor.
15763         (File_read::read): Make non-const.
15764         (File_read::make_view): Reopen descriptor.
15765         (File_read::do_readv): Likewise.
15766         * fileread.h (class File_read): Add is_descriptor_opened_ field.
15767         Update declarations.
15768         * layout.cc: Include "descriptors.h".
15769         (Layout::create_build_id): Use open_descriptor rather than open.
15770         * output.cc: Include "descriptors.h".
15771         (Output_file::open): Use open_descriptor rather than open.
15772         * archive.cc (Archive::const_iterator): Change Archive to be
15773         non-const.
15774         (Archive::begin, Archive::end): Make non-const.
15775         (Archive::count_members): Likewise.
15776         * archive.h (class Archive): Update declarations.
15777         * object.h (Object::read): Make non-const.
15778         * Makefile.am (CCFILES): Add descriptors.cc.
15779         (HFILES): Add descriptors.h.
15780         * Makefile.in: Rebuild.
15781
15782         PR 6716
15783         * gold.h: Always include <clocale>.  Add Solaris workarounds
15784         following code in binutils/sysdep.h.
15785
15786         PR 6048
15787         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
15788         this->eh_frame_hdr_ is NULL before using it.
15789
15790         * dynobj.cc (Versions::Versions): Update comment.
15791
15792         * dynobj.cc (Versions::Versions): If there is an soname, use it as
15793         the base version name.
15794
15795         * stringpool.cc (Stringpool_template::add_with_length): Set key to
15796         array size plus one.
15797         (Stringpool_template::set_string_offsets): Subtract one from key
15798         before using it as an array index.
15799         (Stringpool_template::get_offset_with_length): Likewise.
15800         (Stringpool_template::write_to_buffer): Likewise.
15801         * stringpool.h (Stringpool_template::get_offset_from_key):
15802         Likewise.
15803
15804 2008-07-23  Ian Lance Taylor  <iant@google.com>
15805
15806         PR 6658
15807         * object.h (Merged_symbol_value::value): Do our best to handle a
15808         negative addend.
15809
15810         PR 6647
15811         * script.cc (Version_script_info::get_versions): Don't add empty
15812         version tag to return value.
15813         (Version_script_info::get_symbol_version_helper): Change return
15814         type to bool.  Add pversion parameter.  Change all callers.
15815         (script_register_vers_node): Don't require a non-NULL tag.
15816         * script.h (class Version_script_info): Update declarations.
15817         (Version_script_info::get_symbol_version): Change return type to
15818         bool.  Add version parameter.  Change all callers.
15819         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
15820         handling.  Handle an empty version from a version script.
15821         (Symbol_table::define_special_symbol): Likewise.
15822         * testsuite/ver_test_10.script: New file.
15823         * testsuite/ver_test_10.sh: New file.
15824         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
15825         (check_DATA): Add ver_test_10.syms.
15826         (ver_test_10.syms, ver_test_10.so): New target.
15827         * testsuite/Makefile.in: Rebuild.
15828
15829 2008-07-23  Simon Baldwin  <simonb@google.com>
15830
15831         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
15832         to zero for undefined symbols from dynamic libraries.
15833
15834 2008-07-23  Ian Lance Taylor  <iant@google.com>
15835
15836         * symtab.cc (Symbol_table::resolve): Remove version parameter.
15837         Change all callers.
15838         * symtab.h (class Symbol_table): Update declaration.
15839         * testsuite/ver_test_9.cc: New file.
15840         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
15841         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
15842         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
15843         (ver_test_9.so, ver_test_9.o): New targets.
15844         * testsuite/Makefile.in: Rebuild.
15845
15846 2008-07-22  Ian Lance Taylor  <iant@google.com>
15847
15848         * options.h (class General_options): Define --check-sections.
15849         * layout.cc (Layout::set_segment_offsets): Handle
15850         --check-sections.
15851
15852         * options.h (class General_options): Define -n/--nmagic and
15853         -N/--omagic.
15854         * options.cc (General_options::finalize): For -n/--nmagic or
15855         -N/--omagic, set -static.
15856         * layout.cc (Layout::attach_allocated_section_to_segment): If
15857         -N/--omagic, don't put read-only and read-write sections in
15858         different segments.
15859         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
15860         finding a read-only segment.
15861         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
15862         don't set the minimum segment alignment to the common page size,
15863         and don't set the file offset to the address modulo the page size.
15864         * script-sections.cc (Script_sections::create_segments): If
15865         -n/--omagic, don't put read-only and read-write sections in
15866         different segments.
15867
15868         * cref.cc: New file.
15869         * cref.h: New file.
15870         * options.h (class General_options): Add --print-symbol-counts.
15871         * main.cc (main): Issue defined symbol report if requested.
15872         * archive.cc (Archive::interpret_header): Make into a const member
15873         function.
15874         (Archive::add_symbols): Call Input_objects::archive_start and
15875         archive_stop.
15876         (Archive::const_iterator): Define new class.
15877         (Archive::begin, Archive::end): New functions.
15878         (Archive::include_all_members): Rewrite to use iterator.
15879         (Archive::count_members): New function.
15880         * archive.h (class Archive): Update declarations.
15881         (Archive::filename): New function.
15882         * object.cc: Include "cref.h".
15883         (Sized_relobj::Sized_relobj): Initialize defined_count_.
15884         (Sized_relobj::do_get_global_symbol_counts): New function.
15885         (Input_objects::add_object): Add object to cross-referencer.
15886         (Input_objects::archive_start): New function.
15887         (Input_objects::archive_stop): New function.
15888         (Input_objects::print_symbol_counts): New function.
15889         * object.h: Declare Cref and Archive.
15890         (Object::get_global_symbol_counts): New function.
15891         (Object::do_get_global_symbol_counts): New pure virtual function.
15892         (class Sized_relobj): Add defined_count_ field.  Update
15893         declarations.
15894         (class Input_objects): Add cref_ field.  Update constructor.
15895         Update declarations.
15896         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
15897         defined_count_.
15898         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
15899         symbol counts.
15900         (Sized_dynobj::do_get_global_symbol_counts): New function.
15901         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
15902         defined_count_.  Update declarations.  Define Symbols typedef.
15903         * symtab.cc (Symbol_table::add_from_relobj): Add defined
15904         parameter.  Change all callers.
15905         (Symbol_table::add_from_dynobj): Add sympointers and defined
15906         parameters.  Change all callers.
15907         * symtab.h (class Symbol_table): Update declarations.
15908         * Makefile.am (CCFILES): Add cref.cc.
15909         (HFILES): Add cref.h.
15910         * Makefile.in: Rebuild.
15911
15912 2008-07-22  Simon Baldwin  <simonb@google.com>
15913
15914         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
15915         to zero when writing undefined symbols.
15916
15917 2008-07-22  Ian Lance Taylor  <iant@google.com>
15918
15919         * output.cc (Output_section::add_input_section): Don't try to
15920         merge empty merge sections.
15921
15922 2008-07-21  Craig Silverstein  <csilvers@google.com>
15923
15924         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
15925         Include symbol version in error message.
15926
15927 2008-07-20  Chris Demetriou  <cgd@google.com>
15928
15929         * configure.ac (gold_cv_c_random_seed): New configured variable.
15930         (RANDOM_SEED_CFLAGS): New substituted variable.
15931         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
15932         * configure: Rebuild.
15933         * Makefile.in: Likewise.
15934         * testsuite/Makefile.in: Likewise.
15935
15936 2008-07-18  Ian Lance Taylor  <iant@google.com>
15937
15938         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
15939         where we see NAME/NULL and NAME/VERSION  as separate symbols.
15940         * testsuite/ver_test_main.cc (main): Call t4.
15941         (t4, t4_2a): Define.
15942         * testsuite/ver_test_2.cc (t4_2): Define.
15943         * testsuite/ver_test_2.script: Put t4_2a in VER2.
15944         * testsuite/ver_test_4.cc (t4_2a): Define.
15945         * testsuite/ver_test_4.script: Put t4_2a in VER2.
15946         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
15947
15948 2008-07-17  Ian Lance Taylor  <iant@google.com>
15949
15950         * dynobj.cc (Versions::add_def): If we give an error about a
15951         missing version, go ahead and create the version anyhow.
15952
15953 2008-07-10  Ian Lance Taylor  <iant@google.com>
15954
15955         Handle output sections with more than 0x7fffffff bytes.
15956         * object.h (class Relobj): Change map_to_output_ to
15957         output_sections_, and just keep a section pointer.  Change all
15958         uses.  Move comdat group support to Sized_relobj.
15959         (Relobj::is_section_specially_mapped): Remove.
15960         (Relobj::output_section): Remove poff parameter.  Change all
15961         callers.
15962         (Relobj::output_section_offset): New function.
15963         (Relobj::set_section_offset): Rewrite.
15964         (Relobj::map_to_output): Remove.
15965         (Relobj::output_sections): New function.
15966         (Relobj::do_output_section_offset): New pure virtual function.
15967         (Relobj::do_set_section_offset): Likewise.
15968         (class Sized_relobj): Add section_offsets_ field.  Add comdat
15969         group support from Relobj.  Update declarations.
15970         (Sized_relobj::get_output_section_offset): New function.
15971         (Sized_relobj::do_output_section_offset): New function.
15972         (Sized_relobj::do_set_section_offset): New function.
15973         * object.cc (Relobj::output_section_address): Remove.
15974         (Sized_relobj::Sized_relobj): Initialize new fields.
15975         (Sized_relobj::include_section_group): Cast find_kept_object to
15976         Sized_relobj.
15977         (Sized_relobj::include_linkonce_section): Likewise.
15978         (Sized_relobj::do_layout): Use separate arrays for output section
15979         and output offset.
15980         (Sized_relobj::do_count_local_symbols): Change map_to_output to
15981         output_sections.
15982         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
15983         output_sections and section_offsets.
15984         (Sized_relobj::write_local_symbols): Likewise.
15985         (map_to_kept_section): Compute output address directly.
15986         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
15987         output_sections and section_offsets.
15988         (Sized_relobj::write_sections): Likewise.
15989         (Sized_relobj::relocate_sections): Likewise.
15990         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
15991         * output.h (class Output_reloc): Update declarations.  Change
15992         u2_.relobj to Sized_relobj*.
15993         (class Output_data_reloc): Change add functions to use
15994         Sized_relobj*.
15995         * output.cc (Output_reloc::Output_reloc): Change relobj to
15996         Sized_relobj*.
15997         (Output_reloc::local_section_offset): Change return type to
15998         Elf_Addr.  Use get_output_section_offset.
15999         (Output_reloc::get_address): Likewise.
16000         (Output_section::is_input_address_mapped): Don't call
16001         is_section_specially_mapped.
16002         (Output_section::output_offset): Likewise.
16003         (Output_section::output_address): Likewise.
16004         (Output_section::starting_output_address): Likewise.
16005         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
16006         parameter to Sized_relobj*.
16007         (Copy_relocs::need_copy_reloc): Likewise.
16008         (Copy_relocs::save): Likewise.
16009         * copy-relocs.h (class Copy_relocs): Update declarations.
16010         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
16011         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
16012         * target-reloc.h (relocate_for_relocatable): Change
16013         offset_in_output_section type to Elf_Addr.  Change code that uses
16014         it as well.
16015         * layout.cc (Layout::layout): Always set *off.
16016         * mapfile.cc (Mapfile::print_input_section): Use
16017         output_section_offset.
16018         * i386.cc (Target_i386::copy_reloc): Change object parameter to
16019         Sized_relobj*.
16020         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
16021         * sparc.cc (Target_sparc::copy_reloc): Likewise.
16022         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
16023
16024 2008-07-03  Ian Lance Taylor  <iant@google.com>
16025
16026         * layout.cc (Layout::include_section): Do not discard unrecognized
16027         SHT_STRTAB sections.
16028
16029 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
16030
16031         * script.cc (Lex::can_continue_name): Make '?' allowable in
16032         version-script names.
16033         * testsuite/version_script.map: Change glob pattern to use '?'
16034
16035 2008-06-30  Manish Singh  <yosh@gimp.org>
16036
16037         PR 6585
16038         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
16039         Correct typo.
16040
16041 2008-06-30  Ian Lance Taylor  <iant@google.com>
16042
16043         PR 6660
16044         PR 6682
16045         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
16046         versions]: Don't try to read the value in the contents, since we
16047         don't use it.  Use the template endianness when writing.
16048
16049 2008-06-25  Cary Coutant  <ccoutant@google.com>
16050
16051         * fileread.cc (File_read::make_view): Assert on zero-length view.
16052         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
16053         symbol table when there are no symbols to read.
16054
16055 2008-06-23  Craig Silverstein  <csilvers@google.com>
16056
16057         * version.cc (version_string): Bump to 1.7
16058
16059 2008-06-18  Craig Silverstein  <csilvers@google.com>
16060
16061         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
16062         constant 0xFFFF to type Valtype.
16063         (Powerpc_relocate_functions::rel16_ha): Likewise.
16064
16065 2008-06-17  Ian Lance Taylor  <iant@google.com>
16066
16067         * output.h (Output_section::Input_section): Initialize p2align_ to
16068         zero for Output_section_data constructors.
16069         (Output_section::Input_section::addralign): If not an input
16070         section, return the alignment of the Output_section_data.
16071         * testsuite/copy_test.cc: New file.
16072         * testsuite/copy_test_1.cc: New file.
16073         * testsuite/copy_test_2.cc: New file.
16074         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
16075         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
16076         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
16077         (copy_test_1_pic.o, copy_test_1.so): New targets.
16078         (copy_test_2_pic.o, copy_test_2.so): New targets.
16079         * testsuite/Makefile.in: Rebuild.
16080
16081         * script-sections.cc (Script_sections::place_orphan): Initialize
16082         local variable exact.
16083
16084 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
16085
16086         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
16087
16088 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
16089             David S. Miller  <davem@davemloft.net>
16090
16091         * powerpc.cc: New file.
16092         * Makefile.am (TARGETSOURCES): Add powerpc.cc
16093         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
16094         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
16095         * Makefile.in: Rebuild.
16096
16097 2008-06-09  Ian Lance Taylor  <iant@google.com>
16098
16099         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
16100         <exception>.
16101         (throwing, orig_terminate): New static variables.
16102         (terminate_handler): New static function.
16103         (t2): Set terminate handler.
16104
16105 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
16106
16107         PR 6584
16108         * binary.cc (Binary_to_elf::sized_convert): Fix .data
16109         alignment.
16110
16111 2008-05-30  Cary Coutant  <ccoutant@google.com>
16112
16113         * archive.cc (Archive::include_all_members) Correct to step
16114         over symbol table and extended name table in thin archives.
16115
16116 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
16117
16118         PR 6407
16119         * target-reloc.h (relocate_for_relocatable): Fix new_offset
16120         calculation.
16121
16122 2008-05-28  Caleb Howe  <cshowe@google.com>
16123
16124         * reduced_debug_output.cc: New file.
16125         * reduced_debug_output.h: New file.
16126         * options.h (class General_options): Add --strip-debug-non-line.
16127         * options.cc (General_options::finalize): Add strip_debug_non_line
16128         to the strip heirarchy.
16129         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
16130         fields.
16131         * layout.cc: Include "reduced_debug_output.h".
16132         (Layout::Layout): Initialize new fields.
16133         (line_only_debug_sections): New static array.
16134         (is_lines_only_debug_sections): New static inline function.
16135         (Layout::include_section): Handle --strip-debug-non-line.
16136         (Layout::make_output_section): If --strip-debug-non-line, build
16137         new output sections for .debug_abbrev and .debug_info.
16138         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
16139         gold.  Warn about possible overflow.
16140         (read_signed_LEB_128): Likewise.
16141         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
16142         (read_signed_LEB_128): Declare.
16143         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
16144         (HFILES): Add reduced_debug_output.h.
16145         * Makefile.in: Rebuild.
16146
16147 2008-05-21  Ian Lance Taylor  <iant@google.com>
16148
16149         * mapfile.cc: New file.
16150         * mapfile.h: New file.
16151         * options.h (class General_options): Add -M/--print-map and -Map.
16152         * options.cc (General_options::finalize): Make -M equivalent to
16153         -Map -.
16154         * main.cc: Include <cstdio> and "mapfile.h".
16155         (main): Open mapfile if requested.
16156         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
16157         constructor.  Change caller.
16158         (queue_initial_tasks): Add mapfile parameter.  Change caller.
16159         (queue_middle_tasks): Likewise.
16160         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
16161         declarations.
16162         * archive.cc: Include "mapfile.h".
16163         (Archive::add_symbols): Add mapfile parameter.  Change all
16164         callers.  Pass mapfile, symbol, and reason to include_member.
16165         (Archive::include_all_members): Add mapfile parameter.  Change all
16166         callers.
16167         (Archive::include_member): Add mapfile, sym, and why parameters.
16168         Change all callers.  Report inclusion to map file.
16169         * archive.h: Include "fileread.h".
16170         (class Archive): Update declarations.
16171         (Archive::file): New const method.
16172         (class Add_archive_symbols): Add mapfile_ field.  Update
16173         constructor.  Change all callers.
16174         * readsyms.h (class Read_symbols): Likewise.
16175         (class Finish_group): Likewise.
16176         (class Read_script): Likewise.
16177         * common.cc: Include "mapfile.h".
16178         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
16179         all callers.
16180         (Symbol_table::do_allocate_commons): Likewise.
16181         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
16182         symbol allocation to mapfile.
16183         * common.h (class Allocate_commons_task): Add mapfile_ field.
16184         Update constructor.  Change all callers.
16185         * symtab.h (class Symbol_table): Update declarations.
16186         * layout.cc: Include "mapfile.h".
16187         (Layout_task_runner::run): Print information to mapfile.
16188         (Layout::create_gold_note): Change Output_data_fixed_space to
16189         Output_data_zero_fill.
16190         (Layout::create_build_id): Likewise.
16191         (Layout::print_to_mapfile): New function.
16192         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
16193         constructor.  Change caller.
16194         (class Layout): Declare print_to_mapfile.
16195         * output.cc (Output_section::Input_section::print_to_mapfile): New
16196         function.
16197         (Output_section::add_input_section): If producing a map, always
16198         add to input_sections_ list.
16199         (Output_section::do_print_to_mapfile): New function.
16200         (Output_segment::print_sections_to_mapfile): New function.
16201         (Output_segment::print_section_list_to_mapfile): New function.
16202         * output.h: Include "mapfile.h".
16203         (Output_data::print_to_mapfile): New function.
16204         (Output_data::do_print_to_mapfile): New virtual function.
16205         (Output_segment_headers::do_print_to_mapfile): New function.
16206         (Output_file_header::do_print_to_mapfile): New function.
16207         (Output_data_const::do_print_to_mapfile): New function.
16208         (class Output_data_const_buffer): Add map_name_ field.  Update
16209         constructor.  Change all callers.  Add do_print_to_mapfile
16210         function.
16211         (class Output_data_fixed_space): Likewise.
16212         (class Output_data_space): Likewise.
16213         (class Output_data_zero_fill): New class.
16214         (Output_data_strtab::do_print_to_mapfile): New function.
16215         (Output_data_reloc_base::do_print_to_mapfile): New function.
16216         (Output_relocatable_relocs::do_print_to_mapfile): New function.
16217         (Output_data_group::do_print_to_mapfile): New function.
16218         (Output_data_got::do_print_to_mapfile): New function.
16219         (Output_data_dynamic::do_print_to_mapfile): New function.
16220         (Output_symtab_xindex::do_print_to_mapfile): New function.
16221         (class Output_section): Declare do_print_to_mapflie.  Declare
16222         print_to_mapfile in Input_section.
16223         (class Output_segment): Declare new functions.
16224         * object.h (Sized_relobj::symbol_count): New function.
16225         * script-sections.cc
16226         (Output_section_element_dot_assignment::set_section_addresses):
16227         Change Output_data_fixed_space to Output_data_zero_fill.
16228         (Output_data_expression::do_print_to_mapfile): New function.
16229         * script.cc (read_input_script): Add mapfile parameter.  Change
16230         all callers.
16231         * script.h (read_input_script): Update declaration.
16232         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
16233         (Eh_frame::do_print_to_mapfile): New function.
16234         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
16235         (Output_merge_string::do_print_to_mapfile): New function.
16236         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
16237         function.
16238         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
16239         function.
16240         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
16241         function.
16242         * Makefile.am (CCFILES): Add mapfile.cc.
16243         (HFILES): Add mapfile.h.
16244         * Makefile.in: Rebuild.
16245
16246 2008-05-19  Ian Lance Taylor  <iant@google.com>
16247
16248         * options.h (class General_options): Add -z relro.
16249         * layout.cc (Layout::Layout): Initialize relro_segment_.
16250         (Layout::add_output_section_data): Return the output section.
16251         (Layout::make_output_section): Rcognize relro sections and mark
16252         them appropriately.
16253         (Layout::attach_allocated_section_to_segment): Put relro sections
16254         in a PT_GNU_RELRO segment.
16255         (Layout::create_initial_dynamic_sections): Mark the .dynamic
16256         section as relro.
16257         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
16258         PT_TLS segments.
16259         (Layout::linkonce_mapping): Map d.rel.ro.local to
16260         .data.rel.ro.local.
16261         (Layout::output_section_name): Us .data.rel.ro.local for any
16262         section which begins with that.
16263         * layout.h (class Layout): Update add_output_section_data
16264         declaration.  Add relro_segment_ field.
16265         * output.cc (Output_section::Output_section): Initialize is_relro_
16266         and is_relro_local_ fields.
16267         (Output_segment::add_output_section): Group relro sections.
16268         (Output_segment::is_first_section_relro): New function.
16269         (Output_segment::maximum_alignment): If there is a relro section,
16270         align the segment to the common page size.
16271         (Output_segment::set_section_addresses): Track whether we are
16272         looking at relro sections.  If the last section is a relro
16273         section, align to the common page size.
16274         (Output_segment::set_section_list_addresses): Add in_relro
16275         parameter.  Change all callers.  Align to the page size when
16276         moving from relro to non-relro section.
16277         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
16278         segment.
16279         * output.h (class Output_section): Add is_relro_ and
16280         is_relro_local_ fields.
16281         (Output_section::is_relro): New function.
16282         (Output_section::set_is_relro): New function.
16283         (Output_section::is_relro_local): New function.
16284         (Output_section::set_is_relro_local): New function.
16285         (class Output_segment): Update declarations.
16286         * i386.cc (Target_i386::got_section): Mark .got section as relro.
16287         * sparc.cc (Target_sparc::got_section): Likewise.
16288         * x86_64.cc (Target_x86_64::got_section): Likewise.
16289         * testsuite/relro_test_main.cc: New file.
16290         * testsuite/relro_test.cc: New file.
16291         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
16292         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
16293         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
16294         (relro_test.so, relro_test_pic.o): New targets.
16295         * testsuite/Makefile.in: Rebuild.
16296
16297 2008-05-16  Ian Lance Taylor  <iant@google.com>
16298
16299         * output.cc (Output_segment::add_output_section): Remove front
16300         parameter.
16301         * output.h (class Output_segment): Remove
16302         add_initial_output_section and overloaded add_output_section.
16303         Update declaration of remaining add_output_section.
16304         * layout.cc (Layout::create_interp): Call add_output_section
16305         rather than add_initial_output_section.
16306         (Layout::finish_dynamic_section): Likewise.
16307
16308         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
16309         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
16310         know the dynamic type.
16311         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
16312         field.  Initialize it in constructor.
16313         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
16314         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
16315         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
16316         reloc.
16317
16318         * output.cc (Output_reloc::get_address): Change return type to
16319         Elf_Addr.
16320         * output.h (class Output_reloc): Update get_address declaration.
16321         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
16322         for section addresses.
16323
16324 2008-05-09  Ian Lance Taylor  <iant@google.com>
16325
16326         PR 6493
16327         * gold.cc (gold_nomem): Use return value of write.
16328
16329 2008-05-08  Ian Lance Taylor  <iant@google.com>
16330
16331         * symtab.c (Symbol::init_base_output_data): Add version
16332         parameter.  Change all callers.
16333         (Symbol::init_base_output_segment): Likewise.
16334         (Symbol::init_base_constant): Likewise.
16335         (Symbol::init_base_undefined): Likewise.
16336         (Sized_symbol::init_output_data): Likewise.
16337         (Sized_symbol::init_output_segment): Likewise.
16338         (Sized_symbol::init_constant): Likewise.
16339         (Sized_symbol::init_undefined): Likewise.
16340         (Symbol_table::do_define_in_output_data): If the new symbol has a
16341         version, mark it as the default.
16342         (Symbol_table::do_define_in_output_segment): Likewise.
16343         (Symbol_table::do_define_as_constant): Likewise.
16344         * symtab.h (class Symbol): Update declarations.
16345         (class Sized_symbol): Likewise.
16346         * resolve.cc (Symbol::override_version): New function.
16347         (Symbol::override_base): Call override_version.
16348         (Symbol::override_base_with_special): Likewise.
16349         * testsuite/ver_script_8.script: New file.
16350         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
16351         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
16352         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
16353         (ver_test_8_1.so, ver_test_8_2.so): New targets.
16354
16355 2008-05-06  Ian Lance Taylor  <iant@google.com>
16356
16357         PR 6049
16358         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
16359         functions.
16360         (class General_options): Remove existing --undefined, and add
16361         --no-undefined instead.  Add new --undefined as synonym for -u.
16362         * archive.cc (Archive::add_symbols): Check whether symbol was
16363         named with -u.
16364         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
16365         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
16366         all uses.  Add IS_UNDEFINED.  Update declarations to split
16367         different versions of init_base.  Declare init_base_undefined.
16368         (Symbol::is_defined): Handle IS_UNDEFINED.
16369         (Symbol::is_undefined): Likewise.
16370         (Symbol::is_weak_undefined): Call is_undefined.
16371         (Symbol::is_absolute): Handle IS_CONSTANT.
16372         (class Sized_symbol): Update declarations to split different
16373         versions of init.  Declare init_undefined.
16374         (class Symbol_table): Declare new functions.
16375         * symtab.cc (Symbol::init_base_object): Rename from init_base.
16376         Change all callers.
16377         (Symbol::init_base_output_data): Likewise.
16378         (Symbol::init_base_output_segment): Likewise.
16379         (Symbol::init_base_constant): Likewise.
16380         (Symbol::init_base_undefined): New function.
16381         (Sized_symbol::init_object): Rename from init.  Change all
16382         callers.
16383         (Sized_symbol::init_output_data): Likewise.
16384         (Sized_symbol::init_output_segment): Likewise.
16385         (Sized_symbol::init_constant): Likewise.
16386         (Sized_symbol::init_undefined): New function.
16387         (Symbol_table::add_undefined_symbols_from_command_line): New
16388         function.
16389         (Symbol_table::do_add_undefined_symbols_from_command_line): New
16390         function.
16391         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
16392         (Symbol::output_section): Likewise.
16393         (Symbol::set_output_section): Likewise.
16394         (Symbol_table::sized_finalize_symbol): Likewise.
16395         (Symbol_table::sized_write_globals): Likewise.
16396         * resolve.cc (Symbol_table::should_override): Likewise.
16397         (Symbol::override_base_with_special): Likewise.
16398
16399         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
16400         symbol, change it to have default visibility.
16401         * testsuite/protected_1.cc: New file.
16402         * testsuite/protected_2.cc: New file.
16403         * testsuite/protected_3.cc: New file.
16404         * testsuite/protected_main_1.cc: New file.
16405         * testsuite/protected_main_2.cc: New file.
16406         * testsuite/protected_main_3.cc: New file.
16407         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
16408         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
16409         (protected_1_LDFLAGS, protected_1_LDADD): Define.
16410         (protected_1.so): New target.
16411         (protected_1_pic.o, protected_2_pic.o): New targets.
16412         (protected_3_pic.o): New target.
16413         (check_PROGRAMS): Add protected_2.
16414         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
16415         (protected_2_LDFLAGS, protected_2_LDADD): Define.
16416         * testsuite/Makefile.in: Rebuild.
16417
16418         * options.h (DEFINE_var): Add set_user_set_##varname__.
16419         (DEFINE_bool_alias): New macro.
16420         (class General_options): Define -Bstatic using DEFINE_bool_alias
16421         rather than DEFINE_special.  Add --undefined as an alias for -z
16422         defs.
16423         * options.cc (General_options::parse_Bstatic): Remove.
16424
16425         * options.h (class General_options): Add --fatal-warnings.
16426         * main.cc (main): Implement --fatal-warnings.
16427         * errors.h (Errors::warning_count): New function.
16428
16429         * options.h (class General_options): Add -Bsymbolic-functions.
16430         * symtab.h (Symbol::is_preemptible): Check for
16431         -Bsymbolic-functions.
16432
16433 2008-05-05  Ian Lance Taylor  <iant@google.com>
16434
16435         * options.h (DEFINE_bool): For DASH_Z, create the negative option
16436         as noVARNAME rather than no-VARNAME.
16437         (class General_options): Add option -z combreloc.
16438         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
16439         get_address.
16440         (Output_reloc::sort_before) [SHT_REL]: New function.
16441         (Output_reloc::sort_before) [SHT_RELA]: New function.
16442         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
16443         Sort_relocs_comparison.
16444         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
16445         parameter.  Change all callers.
16446         (Output_data_reloc::Output_data_reloc) [both versions]: Add
16447         sort_relocs parameter.  Change all callers.
16448         * output.cc (Output_reloc::get_address): New function, broken out
16449         of write_rel.
16450         (Output_reloc::write_rel): Call it.
16451         (Output_reloc::compare): New function.
16452         (Output_data_reloc_base::do_write): Optionally sort relocs.
16453
16454         * configure.ac: If targ_extra_obj is set, link it in.
16455         * configure.tgt: Initialize all variables.
16456         (x86_64*): Set targ_extra_obj and targ_extra_size.
16457         * configure: Rebuild.
16458
16459         * object.cc (Sized_relobj::include_section_group): Adjust section
16460         indexes read from group data.  Build vector to pass to
16461         layout_group.
16462         * layout.cc (Layout::layout_group): Add flags and shndxes
16463         parameters.  Remove contents parameter.  Change caller.  Update
16464         explicit instantiations.
16465         * layout.h (class Layout): Update layout_group declaration.
16466         * output.cc (Output_data_group::Output_data_group): Add flags and
16467         input_shndxes parameters.  Remove contents parameter.  Change
16468         caller.
16469         (Output_data_group::do_write): Change input_sections_ to
16470         input_shndxes_.
16471         * output.h (class Output_data_group): Update constructor
16472         declaration.  Rename input_sections_ to input_shndxes_.
16473         * testsuite/many_sections_test.cc: Add template.
16474
16475 2008-04-30  Cary Coutant  <ccoutant@google.com>
16476
16477         * target-reloc.h (relocate_section): Fix dead-pointer bug.
16478
16479         * layout.cc (Layout::include_section): Refactored check for debug
16480         info section.
16481         (Layout::add_comdat): Add new parameters.  Change type
16482         of signature parameter.  Add object and shndx to signatures table.
16483         (Layout::find_kept_object): New function.
16484         * layout.h: Include <cstring>.
16485         (Layout::is_debug_info_section): New function.
16486         (Layout::add_comdat): Add new parameters.
16487         (Layout::find_kept_object): New function.
16488         (Layout::Kept_section): New struct.
16489         (Layout::Signatures): Change type of map range.
16490         * object.cc (Relobj::output_section_address): New function.
16491         (Sized_relobj::include_section_group): Add new parameters.  Change
16492         calls to Layout::add_comdat.  Change to build table of kept comdat
16493         groups and table mapping discarded sections to kept sections.
16494         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
16495         (Sized_relobj::do_layout): Change calls to include_section_group and
16496         include_linkonce_section.
16497         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
16498         value to zero when section is discarded.
16499         (Sized_relobj::map_to_kept_section): New function.
16500         * object.h (Relobj::output_section_address): New function.
16501         (Relobj::Comdat_group): New type.
16502         (Relobj::find_comdat_group): New function.
16503         (Relobj::Comdat_group_table): New type.
16504         (Relobj::Kept_comdat_section): New type.
16505         (Relobj::Kept_comdat_section_table): New type.
16506         (Relobj::add_comdat_group): New function.
16507         (Relobj::set_kept_comdat_section): New function.
16508         (Relobj::get_kept_comdat_section): New function.
16509         (Relobj::comdat_groups_): New field.
16510         (Relobj::kept_comdat_sections_): New field.
16511         (Symbol_value::input_value): Update comment.
16512         (Sized_relobj::map_to_kept_section) New function.
16513         (Sized_relobj::include_linkonce_section): Add new parameter.
16514         * target-reloc.h (Comdat_behavior): New type.
16515         (get_comdat_behavior): New function.
16516         (relocate_section): Add code to map a discarded section to the
16517         corresponding kept section when applying a relocation.
16518
16519 2008-04-30  Craig Silverstein  <csilvers@google.com>
16520
16521         * dwarf_reader.cc (next_generation_count): New static var.
16522         (Addr2line_cache_entry): New struct.
16523         (addr2line_cache): New static var.
16524         (Dwarf_line_info::one_addr2line): Added caching.
16525         (Dwarf_line_info::clear_addr2line_cache): New function.
16526         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
16527         cache-size parameter.
16528         (Dwarf_line_info::one_addr2line_cache): New function.
16529         * symtab.cc (Symbol_table::detect_odr_violations): Pass
16530         new cache-size argument to one_addr2line(), and clear cache.
16531
16532 2008-04-28  Cary Coutant  <ccoutant@google.com>
16533
16534         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
16535         R_386_PC8 relocations.
16536
16537 2008-04-23  Ian Lance Taylor  <iant@google.com>
16538
16539         * object.cc (Sized_relobj::include_section_group): Check for
16540         invalid section group.
16541
16542         * object.cc (make_elf_object): Correct test for 64-bit ELF file
16543         header size.
16544
16545         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
16546         than read for file header.
16547         * archive.cc (Archive::include_member): Likewise.
16548
16549 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
16550
16551         * aclocal.m4: Regenerate.
16552         * configure: Regenerate.
16553
16554 2008-04-19  Ian Lance Taylor  <iant@google.com>
16555
16556         * version.cc (version_string): Bump to 1.6.
16557
16558         * testsuite/Makefile.am (many_sections_r_test): New target.
16559         (many_sections_r_test_SOURCES): Remove.
16560         (many_sections_r_test_DEPENDENCIES): Remove.
16561         (many_sections_r_test_LDFLAGS): Remove.
16562         (many_sections_r_test_LDADD): Remove.
16563
16564         * object.cc (Sized_relobj::do_add_symbols): Always pass
16565         local_symbol_count_ to add_from_relobj.
16566
16567         * testsuite/Makefile.am (many_sections_check.h): Only check one in
16568         every thousand variables.
16569         * testsuite/Makefile.in: Rebuild.
16570
16571         * object.cc (Xindex::initialize_symtab_xindex): New function.
16572         (Xindex::read_symtab_xindex): New function.
16573         (Xindex::sym_xindex_to_shndx): New function.
16574         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
16575         available.
16576         (Sized_relobj::do_initialize_xindex): New function.
16577         (Sized_relobj::do_read_symbols): Adjust section links.
16578         (Sized_relobj::symbol_section_and_value): Add is_ordinary
16579         parameter.  Change all callers.
16580         (Sized_relobj::include_section_group): Adjust section links and
16581         symbol section indexes.
16582         (Sized_relobj::do_layout): Adjust section links.
16583         (Sized_relobj::do_count_local_symbols): Adjust section links and
16584         symbol section indexes.
16585         (Sized_relobj::do_finalize_local_symbols): Distinguish between
16586         ordinary and special symbols.
16587         (Sized_relobj::write_local_symbols): Add symtab_xindex and
16588         dynsym_xindex parameters.  Change all callers.  Adjust section
16589         links.  Use SHN_XINDEX when needed.
16590         (Sized_relobj::get_symbol_location_info): Adjust section links.
16591         Don't get fooled by special symbols.
16592         * object.h (class Xindex): Define.
16593         (class Object): Add xindex_ parameter.  Declare virtual functoin
16594         do_initialize_xindex.
16595         (Object::adjust_sym_shndx): New function.
16596         (Object::set_xindex): New protected function.
16597         (class Symbol_value): Add is_ordinary_shndx_ field.
16598         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
16599         (Symbol_value::value): Assert ordinary section.
16600         (Symbol_value::initialize_input_to_output_map): Likewise.
16601         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
16602         Change all callers.
16603         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
16604         all callers.
16605         (class Sized_relobj): Update declarations.
16606         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
16607         parameter.  Change all callers.
16608         (Sized_relobj::adjust_shndx): New function.
16609         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
16610         field.
16611         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
16612         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
16613         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
16614         (Sized_dynobj::read_dynsym_section): Adjust section links.
16615         (Sized_dynobj::read_dynamic): Likewise.
16616         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
16617         section links.
16618         (Sized_dynobj::do_initialize_xindex): New function.
16619         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
16620         do_initialize_xindex.
16621         (Sized_dynobj::adjust_shndx): New function.
16622         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
16623         dynsym_xindex_ fields.
16624         (Layout::finalize): Add a call to set_section_indexes before
16625         creating the symtab sections.
16626         (Layout::set_section_indexes): Don't do anything if the section
16627         already has a section index.
16628         (Layout::create_symtab_sections): Add shnum parameter.  Change
16629         caller.  Create .symtab_shndx section if needed.
16630         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
16631         caller.
16632         (Layout::allocated_output_section_count): New function.
16633         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
16634         needed.
16635         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
16636         fields.  Update declarations.
16637         (Layout::symtab_xindex): New function.
16638         (Layout::dynsym_xindex): New function.
16639         (class Write_symbols_task): Add layout_ field.
16640         (Write_symbols_task::Write_symbols_task): Add layout parameter.
16641         Change caller.
16642         * output.cc (Output_section_headers::Output_section_headers): Add
16643         shstrtab_section parameter.  Change all callers.
16644         (Output_section_headers::do_sized_write): Store overflow values
16645         for section count and section string table section index in
16646         section header zero.
16647         (Output_file_header::do_sized_write): Check for overflow of
16648         section count and section string table section index.
16649         (Output_symtab_xindex::do_write): New function.
16650         (Output_symtab_xindex::endian_do_write): New function.
16651         * output.h (class Output_section_headers): Add shstrtab_section_.
16652         Update declarations.
16653         (class Output_symtab_xindex): Define.
16654         (Output_section::has_out_shndx): New function.
16655         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
16656         field.
16657         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
16658         Change all callers.
16659         (Sized_symbol::init): Likewise.
16660         (Symbol::output_section): Check for ordinary symbol.
16661         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
16662         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
16663         callers.
16664         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
16665         Change all callers.  Simplify handling of symbols from sections
16666         not included in the link.
16667         (Symbol_table::add_from_dynobj): Handle ordinary symbol
16668         distinction.
16669         (Weak_alias_sorter::operator()): Assert that symbols are
16670         ordinary.
16671         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
16672         distinction.
16673         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
16674         parameters.  Change all callers.
16675         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
16676         symbol distinction.  Use SHN_XINDEX when needed.
16677         (Symbol_table::write_section_symbol): Add symtab_xindex
16678         parameter.  Change all callers.
16679         (Symbol_table::sized_write_section_symbol): Likewise.  Use
16680         SHN_XINDEX when needed.
16681         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
16682         declarations.
16683         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
16684         (Symbol::is_defined): Check is_ordinary.
16685         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
16686         (Symbol::is_absolute, Symbol::is_common): Likewise.
16687         (class Sized_symbol): Update declarations.
16688         (class Symbol_table): Update declarations.
16689         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
16690         parameters.  Change all callers.
16691         (Sized_symbol::override): Likewise.
16692         (Symbol_table::override): Likewise.
16693         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
16694         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
16695         is_ordinary, and orig_st_shndx parameters.  Change all callers.
16696         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
16697         to be in an ordinary section.
16698         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
16699         object and is_ordinary parameters.  Change all callers.
16700         (Sized_dwarf_line_info::read_relocs): Add object parameter.
16701         Change all callers.  Don't add undefined or non-ordinary symbols
16702         to reloc_map_.
16703         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
16704         Change all callers.
16705         * dwarf_reader.h (class Sized_dwarf_line_info): Update
16706         declarations.
16707         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
16708         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
16709         (Sized_relobj::relocate_sections): Likewise.
16710         * target-reloc.h (scan_relocs): Adjust section symbol index.
16711         (scan_relocatable_relocs): Likewise.
16712         * i386.cc (Scan::local): Check for ordinary symbols.
16713         * sparc.cc (Scan::local): Likewise.
16714         * x86_64.cc (Scan::local): Likewise.
16715         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
16716         to symbol_section_and_value.
16717         * testsuite/many_sections_test.cc: New file.
16718         * testsuite/Makefile.am (BUILT_SOURCES): Define.
16719         (check_PROGRAMS): Add many_sections_test.
16720         (many_sections_test_SOURCES): Define.
16721         (many_sections_test_DEPENDENCIES): Define.
16722         (many_sections_test_LDFLAGS): Define.
16723         (BUILT_SOURCES): Add many_sections_define.h.
16724         (many_sections_define.h): New target.
16725         (BUILT_SOURCES): Add many_sections_check.h.
16726         (many_sections_check.h): New target.
16727         (check_PROGRAMS): Add many_sections_r_test.
16728         (many_sections_r_test_SOURCES): Define.
16729         (many_sections_r_test_DEPENDENCIES): Define.
16730         (many_sections_r_test_LDFLAGS): Define.
16731         (many_sections_r_test_LDADD): Define.
16732         (many_sections_r_test.o): New target.
16733         * testsuite/Makefile.in: Rebuild.
16734
16735 2008-04-17  Cary Coutant  <ccoutant@google.com>
16736
16737         * errors.cc (Errors::info): New function.
16738         (gold_info): New function.
16739         * errors.h (Errors::info): New function.
16740         * gold.h (gold_info): New function.
16741         * object.cc (Input_objects::add_object): Print trace output.
16742         * options.cc (options::parse_set): New function.
16743         (General_options::parse_wrap): Deleted.
16744         (General_options::General_options): Deleted initializer.
16745         * options.h (options::String_set): New typedef.
16746         (options::parse_set): New function.
16747         (DEFINE_set): New macro.
16748         (General_options::wrap): Changed to use DEFINE_set. Changed
16749         callers of any_wrap_symbols and is_wrap_symbol.
16750         (General_options::trace, General_options::trace_symbol):
16751         New options.
16752         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
16753         (General_options::wrap_symbols_): Deleted.
16754         * symtab.cc (Symbol_table::add_from_object): Print trace output.
16755
16756 2008-04-17  David S. Miller  <davem@davemloft.net>
16757
16758         * options.cc (General_options::parse_V): New function.
16759         * options.h: Add entries for -V and -Qy.
16760
16761 2008-04-17  Ian Lance Taylor  <iant@google.com>
16762
16763         * common.cc (Symbol_table::allocate_commons): Remove options
16764         parameter.  Change caller.
16765         (Symbol_table::do_allocate_commons): Remove options parameter.
16766         Change caller.  Just call do_allocate_commons_list twice.
16767         (Symbol_table::do_allocate_commons_list): New function, broken out
16768         of do_allocate_commons.
16769         * common.h (class Allocate_commons_task): Remove options_ field.
16770         Update constructor.
16771         * symtab.cc (Symbol_table::Symbol_table): Initialize
16772         tls_commons_.
16773         (Symbol_table::add_from_object): Put TLS common symbols on
16774         tls_commons_ list.
16775         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
16776         which are IN_OUTPUT_DATA.
16777         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
16778         allocate_commons and do_allocate_commons declarations.  Declare
16779         do_allocate_commons_list.
16780         * gold.cc (queue_middle_tasks): Update creation of
16781         Allocate_commons_task to not pass options.
16782         * testsuite/Makefile.am (INCLUDES): Add -I.. .
16783         (TLS_TEST_C_FLAGS): New variable.
16784         (tls_test_c_pic.o): New target.
16785         (tls_test_shared.so): Link in tls_test_c_pic.o.
16786         (tls_test_c_pic_ie.o): New target.
16787         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
16788         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
16789         (tls_test_c.o): New target.
16790         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
16791         (tls_pic_test_LDADD): Likewise.
16792         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
16793         (tls_shared_gd_to_ie_test_LDADD): Likewise.
16794         (tls_test_c_gnu2.o): New target.
16795         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
16796         tls_test_c_gnu2.o.
16797         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
16798         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
16799         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
16800         * testsuite/tls_test.cc: Include "config.h".
16801         (t_last): Call t11_last.
16802         * testsuite/tls_test.h (t11, t11_last): Declare.
16803         * testsuite/tls_test_c.c: New file.
16804         * testsuite/tls_test_main.cc (thread_routine): Call t11.
16805         * configure.ac: Check for OpenMP support.
16806         * configure, config.in, Makefile.in: Rebuild.
16807         * testsuite/Makefile.in: Rebuild.
16808
16809 2008-04-16  Cary Coutant  <ccoutant@google.com>
16810
16811         * i386.cc (Target_i386::define_tls_base_symbol): New function.
16812         (Target_i386::tls_base_symbol_defined_): New field.
16813         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16814         (Target_i386::Scan::global): Likewise.
16815         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
16816         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
16817         (Target_x86_64::tls_base_symbol_defined_): New field.
16818         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
16819         (Target_x86_64::Scan::global): Likewise.
16820
16821 2008-04-16  Cary Coutant  <ccoutant@google.com>
16822
16823         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
16824         (Symbol::needs_plt_entry): Allow weak undefined symbols.
16825         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
16826         building shared libraries.
16827         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
16828         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
16829         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
16830         * testsuite/Makefile.in: Rebuild.
16831         * testsuite/weak_undef.h: New file.
16832         * testsuite/weak_undef_file1.cc: Add extra test cases.
16833         * testsuite/weak_undef_file2.cc: Likewise.
16834         * testsuite/weak_undef_test.cc: Likewise.
16835
16836 2008-04-16  David S. Miller  <davem@davemloft.net>
16837
16838         * sparc.cc (Target_sparc::Scan): Change from struct to class.
16839         Add issued_non_pic_error_ field.  Declare check_non_pic.
16840         (Target_sparc::Scan::check_non_pic): New function.
16841         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
16842         (Target_sparc::Scan::global): Likewise.
16843
16844         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
16845         * configure: Rebuild.
16846
16847         * options.h (DEFINE_enable): New macro.
16848         (new_dtags): New enable option.
16849         (initfirst, interpose, loadfltr, nodefaultlib,
16850         nodelete, nodlopen, nodump): New -z options.
16851         * layout.cc (Layout:finish_dynamic_section): If new
16852         dtags enabled, emit DT_RUNPATH.  Also, emit a
16853         DT_FLAGS_1 containing any specified -z flags.
16854
16855 2008-04-16  Ian Lance Taylor  <iant@google.com>
16856
16857         * copy-relocs.cc: New file.
16858         * copy-relocs.h: New file.
16859         * reloc.cc: Remove Copy_relocs code.
16860         * reloc.h: Likewise.
16861         * reloc-types.h (struct Reloc_types) [both versions]: Add
16862         get_reloc_addend_noerror.
16863         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
16864         variants of add_global which take an addend which must be zero.
16865         * i386.cc: Include "copy-relocs.h".
16866         (class Target_i386): Change type of copy_relocs_ to variable,
16867         update initializer.
16868         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
16869         Change all callers.
16870         (Target_i386::do_finalize_sections): Change handling of
16871         copy_relocs_.
16872         * sparc.cc: Include "copy-relocs.h".
16873         (class Target_sparc): Change type of copy_relocs_ to variable,
16874         update initializer.
16875         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
16876         Change all callers.
16877         (Target_sparc::do_finalize_sections): Change handling of
16878         copy_relocs_.
16879         * x86_64.cc: Include "copy-relocs.h".
16880         (class Target_x86_64): Change type of copy_relocs_ to variable,
16881         update initializer.
16882         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
16883         class.  Change all callers.
16884         (Target_x86_64::do_finalize_sections): Change handling of
16885         copy_relocs_.
16886         * Makefile.am (CCFILES): Add copy-relocs.cc.
16887         (HFILES): Add copy-relocs.h.
16888
16889         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
16890
16891         * testsuite/script_test_4.sh: Permit leading zeroes.
16892
16893 2008-04-15  Ian Lance Taylor  <iant@google.com>
16894
16895         * script-sections.cc (Script_sections::create_segments): Use
16896         header_size_adjustment even when there is enough room for the
16897         headers.
16898         * testsuite/script_test_4.sh: New file.
16899         * testsuite/script_test_4.t: New file.
16900         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
16901         (check_DATA): Add script_test_4.stdout.
16902         (MOSTLYCLEANFILES): Likewise.
16903         (script_test_4): New target.
16904         (script_test_4.stdout): New target.
16905         * testsuite/Makefile.in: Rebuild.
16906
16907         * sparc.cc: Add definitions for Output_data_plt_sparc class
16908         constants.
16909
16910 2008-04-14  David S. Miller  <davem@davemloft.net>
16911
16912         * sparc.cc: New file.
16913         * Makefile.am (TARGETSOURCES): Add sparc.cc
16914         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
16915         * configure.tgt: Document targ_extra_size and
16916         targ_extra_big_endian.  Add entries for sparc-* and
16917         sparc64-*.
16918         * configure.ac: Handle targ_extra_size and
16919         targ_extra_big_endian.
16920         * Makefile.in: Rebuild.
16921         * configure: Likewise.
16922         * po/POTFILES.in: Likewise.
16923         * po/gold.pot: Likewise.
16924
16925 2008-04-14  Ian Lance Taylor  <iant@google.com>
16926
16927         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
16928         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
16929         in the name/type/flags to section mapping.  Don't call
16930         allocate_output_section.
16931         (Layout::choose_output_section): Change parameter from adjust_name
16932         to is_input_section.  Don't permit input sections after sections
16933         are attached to segments.  Don't call allocate_output_section.
16934         (Layout::layout_eh_frame): Call update_flags_for_input_section,
16935         not write_enable_output_section.
16936         (Layout::make_output_section): Don't push to
16937         unattached_section_list_ nor call attach_to_segment.  Call
16938         attach_section_to_segment if sections are attached.
16939         (Layout::attach_sections_to_segments): New function.
16940         (Layout::attach_section_to_segment): New function.
16941         (Layout::attach_allocated_section_to_segment): Rename from
16942         attach_to_segment.  Remove flags parameter.
16943         (Layout::allocate_output_section): Remove function.
16944         (Layout::write_enable_output_section): Remove function.
16945         * layout.h (class Layout): Update for above changes.  Add new
16946         field sections_are_attached_.
16947         * output.h (Output_section::update_flags_for_input_section): New
16948         function.
16949         * output.cc (Output_section::add_input_section): Call
16950         update_flags_for_input_section.
16951         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
16952
16953 2008-04-11  Cary Coutant  <ccoutant@google.com>
16954
16955         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
16956         thought unnecessary.
16957         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
16958
16959 2008-04-11  Ian Lance Taylor  <iant@google.com>
16960
16961         * output.h (class Output_section_data): Remove inline definition
16962         of set_addralign.
16963         * output.cc (Output_section_data::set_addralign): New function.
16964
16965 2008-04-11  Cary Coutant  <ccoutant@google.com>
16966
16967         Add support for TLS descriptors for i386 and x86_64.
16968         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
16969         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
16970         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
16971         GOT_TYPE_TLS_DESC.
16972         (Target_i386::got_mod_index_entry): Remove unnecessary code.
16973         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
16974         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
16975         relocations.
16976         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
16977         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
16978         Fix problem with initial-exec relocations.
16979         (Target_i386::Relocate::relocate_tls): Likewise.
16980         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
16981         relaxation.
16982         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
16983         support for section-plus-offset dynamic table entries.
16984         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
16985         (Output_data_dynamic::Dynamic_entry): Add support for
16986         section-plus-offset dynamic table entries.
16987         (Output_data_dynamic::Classification): Likewise.
16988         (Output_data_dynamic::classification_): Renamed offset_.
16989         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
16990         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
16991         (Target_x86_64::make_plt_section): New function.
16992         (Target_x86_64::reserve_tlsdesc_entries): New function.
16993         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
16994         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
16995         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
16996         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
16997         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
16998         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
16999         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
17000         add extra PLT entry for TLS descriptors.
17001         (Output_data_plt_x86_64::got_): New field.
17002         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
17003         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
17004         fields.
17005         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
17006         descriptors.
17007         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
17008         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
17009         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
17010         R_386_TLS_DESC_CALL relocations.
17011         (Target_x86_64::Scan::global): Likewise.
17012         (Target_x86_64::do_finalize_sections): Add dynamic table entries
17013         for TLS descriptors.
17014         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
17015         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
17016         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
17017         GD-to-IE relaxation.
17018         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
17019         and TLS_DESCRIPTORS.
17020         * Makefile.in: Rebuild.
17021         * configure: Rebuild.
17022         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
17023         (tls_test_shared2.so): New target.
17024         (tls_shared_gd_to_ie_test_SOURCES): New variable.
17025         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
17026         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
17027         (tls_shared_gd_to_ie_test_LDADD): New variable.
17028         (tls_shared_gnu2_gd_to_ie_test): New target.
17029         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
17030         New targets.
17031         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
17032         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
17033         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
17034         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
17035         (tls_shared_gnu2_test): New target.
17036         (tls_test_gnu2_shared.so): New target.
17037         (tls_shared_gnu2_test_SOURCES): New variable.
17038         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
17039         (tls_shared_gnu2_test_LDFLAGS): New variable.
17040         (tls_shared_gnu2_test_LDADD): New variable.
17041         * testsuite/Makefile.in: Rebuild.
17042         * testsuite/Makefile.
17043
17044 2008-04-11  Ian Lance Taylor  <iant@google.com>
17045
17046         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
17047         justsyms.t.
17048         * testsuite/Makefile.in: Rebuild.
17049
17050         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
17051         long.
17052         * testsuite/script_test_2.cc (main): Adjust test.
17053
17054 2008-04-11  David S. Miller  <davem@davemloft.net>
17055             Ian Lance Taylor  <iant@google.com>
17056
17057         * options.h (General_options): Add entries for '-Y' and
17058         '-relax'.
17059         * options.cc (General_options:finalize): If -Y was used, add those
17060         entries to the library path instead of the default "/lib" and
17061         "/usr/lib".
17062
17063 2008-04-11  David S. Miller  <davem@davemloft.net>
17064
17065         * testsuite/justsyms.t: Start at 0x100.
17066         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
17067         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
17068         long.
17069         * testsuite/script_test_2.cc: Adjust string and section length
17070         checks.
17071
17072 2008-04-09  Ian Lance Taylor  <iant@google.com>
17073
17074         PR gold/5996
17075         * script-sections.cc (Sections_element::allocate_to_segment): Add
17076         orphan parameter.
17077         (Output_section_definition::allocate_to_segment): Likewise.
17078         (Orphan_output_section::allocate_to_segment): Likewise.
17079         (Script_sections::attach_sections_using_phdrs_clause): Don't
17080         propagate non-PT_LOAD segments to orphan sections.
17081         * testsuite/Makefile.am (script_test_3.stdout): Generate using
17082         readelf rather than objdump.
17083         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
17084         .interp section and PT_INTERP segment are the same size.
17085         * testsuite/Makefile.in: Rebuild.
17086
17087         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
17088         aliases for symbols defined in the same object.
17089         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
17090         (weak_alias_test_SOURCES): New variable.
17091         (weak_alias_test_DEPENDENCIES): New variable.
17092         (weak_alias_test_LDFLAGS): New variable.
17093         (weak_alias_test_LDADD): New variable.
17094         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
17095         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
17096         (weak_alias_test_3.o): New target.
17097         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
17098         * testsuite/weak_alias_test_main.cc: New file.
17099         * testsuite/weak_alias_test_1.cc: New file.
17100         * testsuite/weak_alias_test_2.cc: New file.
17101         * testsuite/weak_alias_test_3.cc: New file.
17102
17103 2008-04-08  Ian Lance Taylor  <iant@google.com>
17104
17105         * options.h (class General_options): Add --noinhibit-exec option.
17106         * main.cc (main): Check --noinhibit-exec.
17107
17108         * options.h (class General_options): Define --wrap as a special
17109         option.  Add wrap_symbols_ field.
17110         (General_options::any_wrap_symbols): New function.
17111         (General_options::is_wrap_symbol): New function.
17112         * options.cc (General_options::parse_wrap): New function.
17113         (General_options::General_options): Initialize wrap_symbols_.
17114         * symtab.cc (Symbol_table::wrap_symbol): New function.
17115         (Symbol_table::add_from_object): Handle --wrap.
17116         * symtab.h (class Symbol_table): Declare wrap_symbol.
17117         * target.h (Target::wrap_char): New function.
17118         (Target::Target_info): Add wrap_char field.
17119         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
17120         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
17121         * testsuite/testfile.cc (Target_test::test_target_info):
17122         Likewise.
17123
17124         * errors.cc (Errors::undefined_symbol): Mention symbol version if
17125         there is one.
17126
17127         * layout.h (class Layout): Add added_eh_frame_data_ field.
17128         * layout.cc (Layout::Layout): Initialize new field.
17129         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
17130         output section until we find a section we merged successfully.
17131         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
17132         that the size be non-zero.
17133
17134         * merge.cc (Object_merge_map::get_output_offset): Remove inline
17135         qualifier.
17136
17137 2008-04-08  Craig Silverstein  <csilvers@google.com>
17138
17139         * configure.ac: Export new conditional variable HAVE_ZLIB.
17140         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
17141         on HAVE_ZLIB.
17142         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
17143         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17144
17145 2008-04-07  Ian Lance Taylor  <iant@google.com>
17146
17147         * version.cc (version_string): Set to "1.5".
17148
17149         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
17150         Add issued_non_pic_error_ field.  Declare check_non_pic.
17151         (Target_x86_64::Scan::check_non_pic): New function.
17152         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
17153         (Target_x86_64::Scan::global): Likewise.
17154
17155         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
17156         addend parameter.  Change caller.  Handle merge sections.
17157         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
17158         Address to Addend.  Don't add in the result of
17159         local_section_offset, pass down the addend and use the returned
17160         value.
17161         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
17162         Update declarations of local_section_offset and symbol_value.
17163         * testsuite/two_file_test_1.cc (t18): New function.
17164         * testsuite/two_file_test_2.cc (f18): New function.
17165         * testsuite/two_file_test_main.cc (main): Call t18.
17166         * testsuite/two_file_test.h (t18, f18): Declare.
17167
17168         * configure.ac: Don't test for objdump, c++filt, or readelf.
17169         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
17170         conditionals.
17171         (TEST_READELF): New variable.
17172         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
17173         (check_PROGRAMS): Add two_file_strip_test.
17174         (two_file_strip_test): New target.
17175         (check_PROGRAMS): Add two_file_same_shared_strip_test.
17176         (two_file_same_shared_strip_test_SOURCES): New variable.
17177         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
17178         (two_file_same_shared_strip_test_LDFLAGS): New variable.
17179         (two_file_same_shared_strip_test_LDADD): New variable.
17180         (two_file_shared_strip.so): New target.
17181         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
17182         (ver_test_5.syms, ver_test_7.syms): Likewise.
17183         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
17184         (strip_test_3.stdout): Use TEST_OBJDUMP.
17185         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17186
17187 2008-04-04  Cary Coutant  <ccoutant@google.com>
17188
17189         * symtab.h (Symbol::is_weak_undefined): New function.
17190         (Symbol::is_strong_undefined): New function.
17191         (Symbol::is_absolute): New function.
17192         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
17193         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
17194         absolute symbols.
17195         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
17196         (weak_undef_test): New target.
17197         * testsuite/Makefile.in: Rebuild.
17198         * testsuite/weak_undef_file1.cc: New file.
17199         * testsuite/weak_undef_file2.cc: New file.
17200         * testsuite/weak_undef_test.cc: New file.
17201
17202 2008-04-03  Craig Silverstein  <csilvers@google.com>
17203
17204         * compressed_output.h (class Output_compressed_section): Use
17205         unsigned buffer.
17206         * compressed_output.cc (zlib_compress): Use unsigned buffers,
17207         add zlib header.
17208         (zlib_compressed_suffix): Removed.
17209         (Output_compressed_section::set_final_data_size): Use unsigned
17210         buffers.
17211         * testsuite/Makefile.am (flagstest_compress_debug_sections):
17212         Fix linker invocation.
17213         (flagstest_o_specialfile_and_compress_debug_sections):
17214         Likewise.
17215         * testsuite/Makefile.in: Regenerated.
17216
17217 2008-04-02  David S. Miller  <davem@davemloft.net>
17218
17219         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
17220         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
17221
17222 2008-04-02  Craig Silverstein  <csilvers@google.com>
17223
17224         * TODO: New file.
17225
17226 2008-04-02  Ian Lance Taylor  <iant@google.com>
17227
17228         * fileread.cc (File_read::find_view): Add byteshift and vshifted
17229         parameters.  Update for new key type to views_.  Change all
17230         callers.
17231         (File_read::read): Adjust for byteshift in returned view.
17232         (File_read::add_view): New function, broken out of
17233         find_and_make_view.
17234         (File_read::make_view): New function, broken out of
17235         find_and_make_view.
17236         (File_read::find_or_make_view): Add offset and aligned
17237         parameters.  Rewrite accordingly.  Change all callers.
17238         (File_read::get_view): Add offset and aligned parameters.  Adjust
17239         for byteshift in return value.
17240         (File_read::get_lasting_view): Likewise.
17241         * fileread.h (class File_read): Update declarations.
17242         (class File_read::View): Add byteshift_ field.  Add byteshift to
17243         constructor.  Add byteshift method.
17244         * archive.h (Archive::clear_uncached_views): New function.
17245         (Archive::get_view): Add aligned parameter.  Change all callers.
17246         * object.h (Object::get_view): Add aligned parameter.  Change all
17247         callers.
17248         (Object::get_lasting_view): Likewise.
17249
17250         * fileread.cc (File_read::release): Don't call clear_views if
17251         there are multiple objects.
17252         * fileread.h (File_read::clear_uncached_views): New function.
17253         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
17254         on the archive.
17255
17256 2008-03-31  Cary Coutant  <ccoutant@google.com>
17257
17258         Add thin archive support.
17259         * archive.cc (Archive::armagt): New const.
17260         (Archive::setup): Remove task parameter and calls to unlock.
17261         (Archive::unlock_nested_archives): New function.
17262         (Archive::read_header): Add nested_off parameter. Change
17263         all callers.
17264         (Archive::interpret_header): Likewise.
17265         (Archive::include_all_members): Change to handle thin
17266         archives.
17267         (Archive::include_member): Likewise.
17268         * archive.h (Archive::Archive): Add new parameters and
17269         initializers.
17270         (Archive::armagt): New const.
17271         (Archive::setup): Remove task parameter.
17272         (Archive::unlock_nested_archives): New function.
17273         (Archive::read_header): Add nested_off parameter.
17274         (Archive::interpret_header): Likewise.
17275         (Archive::Nested_archive_table): New typedef.
17276         (Archive::is_thin_archive_): New field.
17277         (Archive::nested_archives_): New field.
17278         (Archive::options_): New field.
17279         (Archive::dirpath_): New field.
17280         (Archive::task_): New field.
17281         * readsyms.cc (Read_symbols::do_read_symbols): Add check
17282         for thin archives.  Pass additional parameters to
17283         Archive::Archive.  Unlock the archive file after calling
17284         Archive::setup.
17285
17286 2008-03-29  Ian Lance Taylor  <iant@google.com>
17287
17288         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
17289         version symbol to be local.
17290         * testsuite/ver_test_4.sh: New file.
17291         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
17292         (check_DATA): Add ver_test_4.syms.
17293         (ver_test_4.syms): New target.
17294         * testsuite/Makefile.in: Rebuild.
17295
17296         * output.cc
17297         (Output_section::Input_section_sort_entry::has_priority): New
17298         function.
17299         (Output_section::Input_section_sort_entry::match_file_name): New
17300         function.
17301         (Output_section::Input_section_sort_entry::match_section_name):
17302         Remove.
17303         (Output_section::Input_section_sort_entry::match_section_name_prefix):
17304         Remove.
17305         (Output_section::Input_section_sort_entry::match_section_file):
17306         Remove.
17307         (Output_section::Input_section_sort_compare::operator()): Rewrite
17308         using new Input_section_sort_entry functions.  Sort crtbegin and
17309         crtend first.  Sort sections with no priority before sections with
17310         a priority.
17311         * testsuite/initpri1.c (d3): Check j != 4.
17312         (cd5): New constructor/destructor function.
17313         (main): Check j != 2.
17314
17315         * symtab.cc (Symbol_table::add_from_object): If we don't use the
17316         new symbol when resolving, don't call set_is_default.
17317         * testsuite/ver_test_7.cc: New file.
17318         * testsuite/ver_test_7.sh: New file.
17319         * testsuite/Makefile.am (ver_test_7.so): New target.
17320         (ver_test_7.o): New target.
17321         (check_SCRIPTS): Add ver_test_7.sh.
17322         (check_DATA): Add ver_test_7.syms.
17323         (ver_test_7.syms): New target.
17324
17325 2008-03-28  Ian Lance Taylor  <iant@google.com>
17326
17327         * layout.cc (Layout::layout): If we see an input section with a
17328         name that needs sorting, set the must_sort flag for the output
17329         section.
17330         (Layout::make_output_section): If the name of the output section
17331         indicates that it might require sorting, set the may_sort flag.
17332         * output.h (Output_section::may_sort_attached_input_sections): New
17333         function.
17334         (Output_section::set_may_sort_attached_input_sections): New
17335         function.
17336         (Output_section::must_sort_attached_input_sections): New
17337         function.
17338         (Output_section::set_must_sort_attached_input_sections): New
17339         function.
17340         (class Output_section): Declare Input_section_sort_entry.  Define
17341         Input_section_sort_compare.  Declare
17342         sort_attached_input_sections.  Add new fields:
17343         may_sort_attached_input_sections_,
17344         must_sort_attached_input_sections_,
17345         attached_input_sections_are_sorted_.
17346         * output.cc (Output_section::Output_section): Initialize new
17347         fields.
17348         (Output_section::add_input_section): Add an entry to
17349         input_sections_ if may_sort or must_sort are true.
17350         (Output_section::set_final_data_size): Call
17351         sort_attached_input_sections if necessary.
17352         (Output_section::Input_section_sort_entry): Define new class.
17353         (Output_section::Input_section_sort_compare::operator()): New
17354         function.
17355         (Output_section::sort_attached_input_sections): New function.
17356         * configure.ac: Check whether the compiler supports constructor
17357         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
17358         * testsuite/initpri1.c: New file.
17359         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
17360         CONSTRUCTOR_PRIORITY.
17361         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
17362         (initpri1_LDFLAGS): New variable.
17363         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
17364
17365 2008-03-27  Ian Lance Taylor  <iant@google.com>
17366
17367         * common.cc (Sort_commons::operator): Correct sorting algorithm.
17368         * testsuite/common_test_1.c: New file.
17369         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
17370         (common_test_1_SOURCES): New variable.
17371         (common_test_1_DEPENDENCIES): New variable.
17372         (common_test_1_LDFLAGS): New variable.
17373
17374         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
17375         and commons_ correctly when NAME/VERSION does not override
17376         NAME/NULL.
17377         * testsuite/ver_test_6.c: New file.
17378         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
17379         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
17380         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
17381
17382 2008-03-26  Ian Lance Taylor  <iant@google.com>
17383
17384         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
17385         of an undefined symbol from a version script.
17386         * testsuite/Makefile.am (ver_test_5.so): New target.
17387         (ver_test_5.o): New target.
17388         (check_SCRIPTS): Add ver_test_5.sh.
17389         (check_DATA): Add ver_test_5.syms.
17390         (ver_test_5.syms): New target.
17391         * testsuite/ver_test_5.cc: New file.
17392         * testsuite/ver_test_5.script: New file.
17393         * testsuite/ver_test_5.sh: New file.
17394         * Makefile.in, testsuite/Makefile.in: Rebuild.
17395
17396         PR gold/5986
17397         Fix problems building gold with gcc 4.3.0.
17398         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
17399         (gold_error_at_location, gold_warning_at_location): Use it.
17400         * configure.ac: Check whether we can compile and use a template
17401         function with a printf attribute.
17402         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
17403         when jumping over bytes.
17404         * object.cc: Instantiate Object::read_section_data.
17405         * debug.h: Include <cstring>
17406         * dwarf_reader.cc: Include <algorithm>
17407         * main.cc: Include <cstring>.
17408         * options.cc: Include <cstring>.
17409         * output.cc: Include <cstring>.
17410         * script.cc: Include <cstring>.
17411         * script.h: Include <string>.
17412         * symtab.cc: Include <cstring> and <algorithm>.
17413         * target-select.cc: Include <cstring>.
17414         * version.cc: Include <string>.
17415         * testsuite/testmain.cc: Include <cstdlib>.
17416         * configure, config.in: Rebuild.
17417
17418 2008-03-25  Ian Lance Taylor  <iant@google.com>
17419
17420         * options.cc: Include "../bfd/bfdver.h".
17421         (options::help): Print bug reporting address.
17422
17423         * version.cc (print_version): Adjust output for current value of
17424         BFD_VERSION_STRING.
17425
17426         * NEWS: New file.
17427
17428         * options.cc (options::help): Print list of supported targets.
17429         * target-select.h: Include <vector>.
17430         (class Target_selector): Make machine_, size_, and is_big_endian_
17431         fields const.  Add bfd_name_ and instantiated_target_ fields.
17432         (Target_selector::Target_selector): Add bfd_name parameter.
17433         (Target_selector::recognize): Make non-virtual, call
17434         do_recognize.
17435         (Target_selector::recognize_by_name): Make non-virtual, call
17436         do_recognize_by_name.
17437         (Target_selector::supported_names): New function.
17438         (Target_selector::bfd_name): New function.
17439         (Target_selector::do_instantiate_target): New pure virtual
17440         function.
17441         (Target_selector::do_recognize): New virtual function.
17442         (Target_selector::do_recognize_by_name): New virtual function.
17443         (Target_selector::instantiate_target): New private function.
17444         (supported_target_names): Declare.
17445         * target-select.cc (Target_selector::Target_selector): Update for
17446         new parameter and fields.
17447         (select_target_by_name): Check that the name matches before
17448         calling recognize_by_name.
17449         (supported_target_names): New function.
17450         * i386.cc (class Target_selector_i386): Update Target_selector
17451         constructor call.  Remove recognize and recognize_by_name.  Add
17452         do_instantiate_target.
17453         * x86_64.cc (class Target_selector_x86_64): Likewise.
17454         * testsuite/testfile.cc (class Target_selector_test): Update for
17455         changes to Target_selector.
17456
17457         * README: Rewrite, with some notes on unsupported features.
17458
17459 2008-03-24  Cary Coutant  <ccoutant@google.com>
17460
17461         * i386.cc (Target_i386::Got_type): New enum declaration.
17462         (Target_i386::Scan::local): Updated callers of Output_data_got
17463         member functions.
17464         (Target_i386::Scan::global): Likewise.
17465         (Target_i386::Relocate::relocate): Likewise.
17466         (Target_i386::Relocate::relocate_tls): Likewise.
17467         * object.h (Got_offset_list): New class.
17468         (Sized_relobj::local_has_got_offset): Added got_type parameter.
17469         (Sized_relobj::local_got_offset): Likewise.
17470         (Sized_relobj::set_local_got_offset): Likewise.
17471         (Sized_relobj::local_has_tls_got_offset): Removed.
17472         (Sized_relobj::local_tls_got_offset): Removed.
17473         (Sized_relobj::set_local_tls_got_offset): Removed.
17474         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
17475         * output.cc (Output_data_got::add_global): Added got_type parameter.
17476         (Output_data_got::add_global_with_rel): Likewise.
17477         (Output_data_got::add_global_with_rela): Likewise.
17478         (Output_data_got::add_global_pair_with_rel): New function.
17479         (Output_data_got::add_global_pair_with_rela): New function.
17480         (Output_data_got::add_local): Added got_type parameter.
17481         (Output_data_got::add_local_with_rel): Likewise.
17482         (Output_data_got::add_local_with_rela): Likewise.
17483         (Output_data_got::add_local_pair_with_rel): New function.
17484         (Output_data_got::add_local_pair_with_rela): New function.
17485         (Output_data_got::add_global_tls): Removed.
17486         (Output_data_got::add_global_tls_with_rel): Removed.
17487         (Output_data_got::add_global_tls_with_rela): Removed.
17488         (Output_data_got::add_local_tls): Removed.
17489         (Output_data_got::add_local_tls_with_rel): Removed.
17490         (Output_data_got::add_local_tls_with_rela): Removed.
17491         * output.h (Output_data_got::add_global): Added got_type parameter.
17492         (Output_data_got::add_global_with_rel): Likewise.
17493         (Output_data_got::add_global_with_rela): Likewise.
17494         (Output_data_got::add_global_pair_with_rel): New function.
17495         (Output_data_got::add_global_pair_with_rela): New function.
17496         (Output_data_got::add_local): Added got_type parameter.
17497         (Output_data_got::add_local_with_rel): Likewise.
17498         (Output_data_got::add_local_with_rela): Likewise.
17499         (Output_data_got::add_local_pair_with_rel): New function.
17500         (Output_data_got::add_local_pair_with_rela): New function.
17501         (Output_data_got::add_global_tls): Removed.
17502         (Output_data_got::add_global_tls_with_rel): Removed.
17503         (Output_data_got::add_global_tls_with_rela): Removed.
17504         (Output_data_got::add_local_tls): Removed.
17505         (Output_data_got::add_local_tls_with_rel): Removed.
17506         (Output_data_got::add_local_tls_with_rela): Removed.
17507         * resolve.cc (Symbol::override_base_with_special): Removed
17508         reference to has_got_offset_ field.
17509         * symtab.cc (Symbol::init_fields): Replaced initialization
17510         of got_offset_ with got_offsets_.  Removed initialization
17511         of has_got_offset_
17512         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
17513         (Symbol::got_offset): Likewise.
17514         (Symbol::set_got_offset): Likewise.
17515         (Symbol::has_tls_got_offset): Removed.
17516         (Symbol::tls_got_offset): Removed.
17517         (Symbol::set_tls_got_offset): Removed.
17518         (Symbol::got_offset_): Removed.
17519         (Symbol::tls_mod_got_offset_): Removed.
17520         (Symbol::tls_pair_got_offset_): Removed.
17521         (Symbol::got_offsets_): New field.
17522         (Symbol::has_got_offset): Removed.
17523         (Symbol::has_tls_mod_got_offset): Removed.
17524         (Symbol::has_tls_pair_got_offset): Removed.
17525         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
17526         (Target_x86_64::Scan::local): Updated callers of Output_data_got
17527         member functions.
17528         (Target_x86_64::Scan::global): Likewise.
17529         (Target_x86_64::Relocate::relocate): Likewise.
17530         (Target_x86_64::Relocate::relocate_tls): Likewise.
17531
17532 2008-03-25  Ben Elliston  <bje@au.ibm.com>
17533
17534         * yyscript.y: Fix spelling error in comment.
17535
17536 2008-03-24  Ian Lance Taylor  <iant@google.com>
17537
17538         * options.h (class General_options): Define build_id option.
17539         * layout.h (class Layout): Declare write_build_id, create_note,
17540         create_build_id.  Add build_id_note_ member.
17541         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
17542         "libiberty.h", "md5.h", "sha1.h".
17543         (Layout::Layout): Initialize eh_frame_data_,
17544         eh_frame_hdr_section_, and build_id_note_.
17545         (Layout::finalize): Call create_build_id.
17546         (Layout::create_note): New function, broken out of
17547         Layout::create_gold_note.
17548         (Layout::create_gold_note): Call create_note.
17549         (Layout::create_build_id): New function.
17550         (Layout::write_build_id): New function.
17551         (Close_task_runner::run): Call write_build_id.
17552
17553         * x86_64.cc: Correct license to GPLv3.
17554
17555 2008-03-23  Ian Lance Taylor  <iant@google.com>
17556
17557         * options.cc: Include "demangle.h".
17558         (parse_optional_string): New function.
17559         (parse_long_option): Handle takes_optional_argument.
17560         (parse_short_option): Update dash_z initializer.  Handle
17561         takes_optional_argument.
17562         (General_options::General_options): Initialize do_demangle_.
17563         (General_options::finalize): Set do_demangle_.  Handle demangling
17564         style.
17565         * options.h (parse_optional_string): Declare.
17566         (struct One_option): Add optional_arg field.  Update constructor.
17567         Update call constructor calls.  Add takes_optional_argument
17568         function.
17569         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
17570         (DEFINE_optional_string): Define.
17571         (General_options::demangle): Change from DEFINE_bool to
17572         DEFINE_optional_string.
17573         (General_options::no_demangle): New function.
17574         (General_options::do_demangle): New function.
17575         (General_options::set_do_demangle): New function.
17576         (General_options::execstack_status_): Move definition to end of
17577         class definition.
17578         (General_options::static_): Likewise.
17579         (General_options::do_demangle_): New field.
17580         * object.cc (big_endian>::get_symbol_location_info): Call
17581         Options::do_demangle, not Options::demangle.
17582         * symtab.cc (demangle): Likewise.
17583
17584 2008-03-22  Ian Lance Taylor  <iant@google.com>
17585
17586         * gold.h: Include <cstddef> and <sys/types.h>
17587         * options.h: Include <cstring>.
17588
17589 2008-03-21  Ian Lance Taylor  <iant@google.com>
17590
17591         * Added source code to GNU binutils.
17592 \f
17593 Copyright (C) 2008-2015 Free Software Foundation, Inc.
17594
17595 Copying and distribution of this file, with or without modification,
17596 are permitted in any medium without royalty provided the copyright
17597 notice and this notice are preserved.
17598
17599 Local Variables:
17600 mode: change-log
17601 left-margin: 8
17602 fill-column: 74
17603 version-control: never
17604 End: